Detect BLE connection interval in sketch? #781
-
Is there a way to detect the current BLE connection interval in a sketch? This would be useful for optimizing the data that is sent over BLE. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
check the code and/or example, there is plenty reference there |
Beta Was this translation helpful? Give feedback.
-
I've noticed that this sometimes returns a different connection interval than is reported by the "Full debug" output in the IDE. In the example below, the debug output reports a 7.5 ms connection interval (which I believe is correct) while connection->getConnectionInterval() returns an interval of 6 (which is 3.75 ms). This is shown in the last line below (sent from the connect callback). Any idea why this happens? 09:51:40.126 -> [BLE ] BLE_GAP_EVT_CONNECTED : Conn Handle = 0 |
Beta Was this translation helpful? Give feedback.
I couldn't find it in any of the examples, but there is a 'getConnectionInterval' function that will give you the result you're looking for.
Here's the peripheral 'bleuart' example's connect_callback modified with the connection interval function: