Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Events, EventHanders and GenericAttributeProfile notifications (BLE)

$
0
0

Hello all, 

 I am using the GenericAttributeProfile to communicate with a Bluetooth (Low Energy) radio. A problem I'm seeing is that when the data is received, it is not necessarily in the order sent. I believe the data is arriving at the receiver in order, but due to the the speed the data comes in, and how events are implemented, the data is evaluated out of order. Is my thinking correct? 

The mechanism is to subscribe to a GattCharateristic object's ValueChanged event. Every time data is received (a notification) the EventHandler will be invoked. Unfortunately, when I log my data to console, it seems to be produced out of order. 

private GattCharacteristic characteristic;

...

characteristic.ValueChanged += Characteristic_ValueChanged


So if I send 10 packets of data across. This will cause 10 events, and hence 10 eventHandlers to be invoked. Can these events/eventHandlers be invoked in any order? Do not conflate what I just said with what was ask here: this http://stackoverflow.com/questions/1645478/order-of-event-handler-execution

I only  have 1 eventHandler per event. The problem is that when events occur, my eventHandler logs the data to console, and I see that it is out of order sometimes. 

So to consolidate, my questions are

1. Are events handled in the order received?

2. Is there another mechanism for receiving notifications for Bluetooth Low Energy? 

Please let me know if you do not understand my question. 

Many Thanks

Thomas


2010: Q6700 3GHz; 6GB DDRII; ~ 2.7TB internal; ATI RAEDON 5770 1GB @ Stock; Elixir Keyboard; Gigabyte GM-M6800; 2 x E173FPf 2005: 2GIG RAM, 3.6Ghz P4, 2 x 200gb SATA HD 8mb cache, 256mb 9950 ATI RADEON,19" LCD Core i7 3.2GHz, 6GB DDRIII, ASUS 512MB EN8800GT


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>