Currently, I am using the ble_app_cts_c example and I want to disconnect the connected device.
I want to know how can I check the condition for any connected device?
and how can I disconnect it manually using the button interupt?
Thanks
Currently, I am using the ble_app_cts_c example and I want to disconnect the connected device.
I want to know how can I check the condition for any connected device?
and how can I disconnect it manually using the button interupt?
Thanks
Hello,
I want to know how can I check the condition for any connected device?
The SoftDevice will pass the BLE_GAP_EVT_CONNECTED and BLE_GAP_EVT_DISCONNECTED events to the ble_evt_handler function when the device is connected or disconnected. The default behavior of the ble_evt_handler is then to update the m_cur_conn_handle with the connection handle, or to reset it to BLE_CONN_HANDLE_INVALID if the event is disconnection.
So, your application logic can use this variable to determine whether it is currently in a connection or not.
and how can I disconnect it manually using the button interupt?
You may manually force a disconnect by calling the sd_ble_gap_disconnect function. Disconnection by button press is already implemented in the ble_app_cts_c example. You can see how this is implemented in the bsp_event_handler's BSP_EVENT_DISCONNECT event handling.
Best regards,
Karl
Hello,
I want to know how can I check the condition for any connected device?
The SoftDevice will pass the BLE_GAP_EVT_CONNECTED and BLE_GAP_EVT_DISCONNECTED events to the ble_evt_handler function when the device is connected or disconnected. The default behavior of the ble_evt_handler is then to update the m_cur_conn_handle with the connection handle, or to reset it to BLE_CONN_HANDLE_INVALID if the event is disconnection.
So, your application logic can use this variable to determine whether it is currently in a connection or not.
and how can I disconnect it manually using the button interupt?
You may manually force a disconnect by calling the sd_ble_gap_disconnect function. Disconnection by button press is already implemented in the ble_app_cts_c example. You can see how this is implemented in the bsp_event_handler's BSP_EVENT_DISCONNECT event handling.
Best regards,
Karl