This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Mismatch between connection handles in ble_nus?

I'm using the nus_c service with multiple central connections. Obviously, I need the connection handle in my event handler - ble_nus_c_evt_handler(ble_nus_c_t* p_ble_nus_c, const ble_nus_c_evt_t* p_ble_nus_evt).

I've noticed that when BLE_NUS_C_EVT_NUS_RX_EVT is raised, the connection handle in the NUS context object and the event object are different: p_ble_nus_c->conn_handle == 1, as expected, while p_ble_nus_evt->conn_handle == 0.

I've traced it down to on_hvx() in ble_nus_c.c, not setting the connection handle from the GATTC event to the ble_nus_c_evt_t structure it dispatches.

Is this by design or a bug?