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

how to Stop advertise when ble are connected

hello.

I want to toggle ble functions when received message from UART.

so when start message come, I start advertising and start services and stop message come, disconnect(if it connected) and stop advertising.

       if(stop)
{
    if(m_conn_handle != BLE_CONN_HANDLE_INVALID) // ble connected
    {
      sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    }
    advertising_stop();
}

but when ble is connected, the advertising_stop() function is not working. because ble going to advertising state when device is connected.

How I Can handle this situation?

I want to disable BLE directly.

Parents Reply Children
No Data
Related