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

How to disconnect the device?

I'm using nRF52DK with ble_app_hids_mouse to pair with the smartphone.

From the smartphone we can disconnect the device at will. But I have problem when I want the device to disconnect from the smartphone. At some point I want the device to disconnect and go to sleep with the following statements:

sd_ble_gap_adv_stop(m_advertising.adv_handle);
sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
m_conn_handle = BLE_CONN_HANDLE_INVALID;
sd_power_system_off();

When the above statements are executed, on the smartphone I can see it momentarily disconnected but then it reconnected again right after that. I wonder what am I missing here in order to have the device disconnect totally then go to sleep.

Related