empatica / ble-client-windows

This repo contains a simple client for sending commands and receive data from an Empatica E4 using Empatica BLE Server
23 stars 16 forks source link

Out-of-order message delivery #7

Open felixk101 opened 7 years ago

felixk101 commented 7 years ago

Hi, I'm just taking a look at what the console prints out when I subscribe to certain stream, and occasionally some messages appear later than they should be.

E4_Gsr 1506597489,962 0,4562284
E4_Gsr 1506597490,212 0,4536668
E4_Gsr 1506597490,462 0,4523861
E4_Gsr 1506597490,712 0,4511053
E4_Gsr 1506597491,212 0,4472629
E4_Gsr 1506597490,962 0,4511053 <--- the timestamp ending in 490 is between two 491s
E4_Gsr 1506597491,462 0,4485437
E4_Gsr 1506597491,712 0,4459821
E4_Gsr 1506597491,962 0,4447013
E4_Gsr 1506597492,212 0,4447013
E4_Gsr 1506597492,462 0,4408589

Does this have anything to do with the fact that HandleResponseFromEmpaticaBLEServer(_response); is being called before "All the data has arrived"?

felixk101 commented 7 years ago

I've discovered a cheap but ugly workaround for this issue. If I only have one connection to the Empatica wristband, almost half of my data had timestamps that were out of order, which would be really frustrating to simply discard. But, by opening 4-6 more connections, the "invalidity" drops from 47% to 2%.