nRF Connect SDK API 0.1.0
|
int bt_radio_notification_conn_cb_register | ( | const struct bt_radio_notification_conn_cb * | cb, |
uint32_t | prepare_distance_us | ||
) |
#include <include/bluetooth/radio_notification_cb.h>
Register a radio notification callback struct for connections.
When the prepare callback is used to provide data to the Bluetooth stack, the application needs to reserve enough time to allow the data to be forwarded to the link layer.
When used with a peripheral connection, the prepare distance also needs to take clock drift into account to avoid that the callback triggers too late. The clock drift is determined by the distance between packets and the clock accuracy of both the central and the peripheral. The Bluetooth specification allows a worst case clock accurary of 500 ppm. That gives a worst case combined clock accurary of 1000 ppm. This results in 1 ms drift per second.
See Bluetooth Core Specification, Vol 6, Part B, Section 4.2.4 for more details on clock drift.
[in] | cb | The callback structure to be used. The memory pointed to needs to be kept alive by the user. |
[in] | prepare_distance_us | The distance in time from the start of the prepare callback to the start of the connection event. See also BT_RADIO_NOTIFICATION_CONN_CB_PREPARE_DISTANCE_US_RECOMMENDED. |
0 | The callback structure has been successfully registered. |
-EALREADY | A callback has already been registered. |
-ENOMEM | There are not enough PPI channels available to use this feature. |