none
GattCharacteristic.ValueChanged Event Ordering with Bluetooth LE 8.1 RRS feed

  • Question

  • I'm developing an application using C# with the BluetoothLE GattCharacteristic class.  My device is using a notification characteristic and sending pieces of data that are reassembled into a large frame on the PC side.  I do this using the valueChanged event for the GattCharacteristic.  I'm noticing that sometimes the data I send from the device is not always the same data that gets received by the PC and fed to the value changed event.  Sometimes the data has a few extra bytes and sometimes it is just completely different.  This is infrequent, but when it happens, it causes major problems for me.

    I'm assuming that notifications and characteristic values are queued up in a FIFO as they are received by Windows.  That way, I can process the value changed events in order to create a larger message.  However, if they are not necessarily in the order the were received, that would explain some of the issues I'm having.

    I did a quick check using the GattValueChangedEventArgs::Timestamp and found that sometimes the args I'm processing in the value changed event  have a timestamp that is older than the args I processed the prior time in the value changed event.  This would suggest that the order is not necessarily maintained.

    Can anyone confirm how the ordering works?  Or is it possible that I'm missing something?

    Tuesday, May 27, 2014 11:49 PM

All replies