Hi, we have the requirement for our peripheral to be able to disable Bluetooth functionality, i.e. disconnect any connected central device and not accept any new connections. We are running nRF52832 with SDK 15.3. We have functionality in place to bond with a central device.
At this stage in the development I am using the nRF Connect app from Google play. I can bond the peripheral with my phone and I have the "Use autoconnect" checkbox ticked.
Now when disabling the Bluetooth functionality I try the following:
(void)ble_advertising_start(&m_advertising, BLE_ADV_MODE_IDLE);
(void)sd_ble_gap_adv_stop(m_advertising.adv_handle);
if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
{
ret_code_t result = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
}
With this I expect advertising to be disabled and if any device is connected it should be disconnected. What happens is that the connected central device is disconnected briefly but immediately reconnects. How can I prevent this from happening?
Kind regards
ozh