Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to sync data from to different embedded Device?
QtWS25 Last Chance

How to sync data from to different embedded Device?

Scheduled Pinned Locked Moved Unsolved General and Desktop
syncsensorsembedded qt
4 Posts 2 Posters 684 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yash001
    wrote on last edited by
    #1

    Hello,

    I do have two device, Device_A and Device_B. They are emitting signals, ExperimentDCdataArraived
    and Experiment NodeBeagging Signals.

    ExperimentDCdataArraived is emit on arrival of DC data.
    Sample rate is set same in both device, I would like to place both devices data in single csv file.

    On emit of ExperimentNodeBeagging signal, new csv file are created. It is mostly emit from Device_A. It is also emit from Device_B but slot are just return without creating new csv file.

    I would like to executable slot of ExperimentNodeBeaggingif both device sent same number of data to software. Otherwise wait for Device_B sent the data point.

    if (oldData.container.contains(DCDATA_RING_CURRENT)) {
       			auto len1 = oldData.container[DCDATA_RING_CURRENT].numberOfDataPoints();
       			auto len2 = oldData.container[DCDATA_ELAPSED_TIME_S].numberOfDataPoints();
    
       			while (len1 != len2) {
       				QEventLoop loop;
       				QEventLoop* loopPtr = &loop;
    
       				QTimer::singleShot(20, loopPtr, SLOT(quit()));
       				loopPtr->exec();
       				len1 = oldData.container[DCDATA_RING_CURRENT].numberOfDataPoints();
       				len2 = oldData.container[DCDATA_ELAPSED_TIME_S].numberOfDataPoints();
       			}
       		}
    

    I place this code in slot of ExperimentNodeBeagging but it is crashing for some sampling rate because loopPtr->exec();

    As If I am not wrong then its look like doing something like below

    1. emit the ExperimentNodeBeagging.
    2. wait for exit code at lootpPtr->exec().
    3. emit the ExperimentNodeBeagging.
    4. wait for exit code at lootpPtr->exec().
    5. get the exit code from step 2
    6. execute the remaining Slot of ExperimentNodeBeagging
    7. get the exit code from step 4
    8. execute the remaining Slot of ExperimentNodeBeagging (Here my Software is crash)

    In Normal execution ExperimentNodeBeagging is not emit the second time (step 7 and 8 ). Here Device_A is not getting the response ExperimentNodeBeagging within certain amount of time that's why Device_A again sent signal ExperimentNodeBeagging.

    I am calling loopPtr->exec(); because before creating the CSV file I need wait data from Device_B.

    Is there any good way to sync both Device?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      If you want to have both data before going further, why not store them rather than artificially wait ? Then once you have both write them to the file you want.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Y 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        If you want to have both data before going further, why not store them rather than artificially wait ? Then once you have both write them to the file you want.

        Y Offline
        Y Offline
        Yash001
        wrote on last edited by Yash001
        #3

        @SGaist I am doing the that thing but the issue is created at last point.

        So, Whenever the Device_A send the last data point, and immediately send the ExperimentNodeBeagging, So new csv file created.

        Whenever the Device_B send the data point at that time it will place in new csv file instead of old csv file because of ExperimentNodeBeagging.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Do you really need two different objects to communicate with these devices ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved