The BLE_NUS_C_EVT_DISCONNECTED
of the ble_nus_c_evt_handler()
give a conn_handle = BLE_CONN_HANDLE_INVALID
. So it's not possible to know which peripheral got disconnected when multiple connections are allowed.
The BLE_NUS_C_EVT_DISCONNECTED
of the ble_nus_c_evt_handler()
give a conn_handle = BLE_CONN_HANDLE_INVALID
. So it's not possible to know which peripheral got disconnected when multiple connections are allowed.
I'm sorry, I don't understand what your question is.
Why BLE_NUS_C_EVT_DISCONNECTED doesn't give which peripheral got disconnected ?
Because when the BLE_GAP_EVT_DISCONNECTED event is received by ble_nus_c_on_ble_evt() the connection handle is set to BLE_CONN_HANDLE_INVALID.
p_ble_nus_c->conn_handle = BLE_CONN_HANDLE_INVALID;
I believe the Nordic UART Service Client is implemented to only be used with one server.
I was able to connect to 2 servers with ble_nus_c but i used BLE_GAP_EVT_DISCONNECTED
in on_ble_evt()
instead of BLE_NUS_C_EVT_DISCONNECTED
. But i think it would be better that SDK give a valid conn_handle in BLE_GAP_EVT_DISCONNECTED
so i would be able to use this event.
Great that you found a workaround. I'll bring your feedback to the developers. Thank you.