How can I prevent notify sending stale sensor data to the client? #28707
Unanswered
justinleavesley
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my application, sensor data is available at a much higher rate than can be sent via BLE. I want to ensure that when a connection event occurs, the data sent is the very latest sensor data actually available. I don't care about the older sensor readings.
Calling bt_gatt_notify every time new data is available will result in a buffer full of stale data by the time the connection event occurs.
For example: the connection interval maybe 15ms. Sensor data is available every 1ms. When the connection event happens I want the data sent to be the lastest possible sensor data. This is a real-time event so throttling the sensor reads would just make the data staler than it need be i.e. I want the actual time of the connection event and the actual time of the sensor data to be as close as possible.
Is it possible to overwrite the notify buffer rather than adding to the queue?
Or is it possible to reset the buffer before calling bt_gatt_notify?
Or some other way?
Or is a requirement of BLE that data in a notify event, must be the immutable data at the moment of setting the flag?
I don't really want to have to drive the reads from the client for a number of reasons.
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions