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
  • No, it's not automatically restart advertising. It's the application code does that, somewhere in the code does, you need to find that. Search for advertising_start() or ble_advertising_start or something similar. Which firmware you are testing with ? Which SDK version ?

    If you try any example in the example\ble_peripheral folder, you can find that the device doesn't advertise after you get connected.

Reply
  • No, it's not automatically restart advertising. It's the application code does that, somewhere in the code does, you need to find that. Search for advertising_start() or ble_advertising_start or something similar. Which firmware you are testing with ? Which SDK version ?

    If you try any example in the example\ble_peripheral folder, you can find that the device doesn't advertise after you get connected.

Children
No Data
Related