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

how to check if BLE is connected

Hello,

Is there any way to check if the bluetooth is connected after NVIC Reset?In our project when we get a specific command from the UART, NVIC reset is done.After the reset i want to check if our device (peripheral) is connected and if it is to disconnect it.I'm setting a flag on BLE_GAP_EVT_CONNECTED event, but after the reset the flag is 0.Also after NVIC reset i am getting error 2 when i call err_code = sd_ble_gap_disconnect(conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); APP_ERROR_CHECK(err_code);

Parents
  • After a reset you will not be connected to anything.

    If you have a peripheral device you will have to start to advertise and wait for the central device to send a connection request to you before you can be connected again.

  • Hi @Petter. I have a similar question, when the central stops receiving the data or if the peripheral goes out of range and comes in again. How to get reconnected successfully without any delay? i.e peripheral should start adversitising immediately and the central should be able to pick it up. I am working on a medical application where the peripheral is in a patients body who is expected to move in and out. Hence, there will be a loss in the connection and once they are within range, how to enable the connection and data transmission automatically? The connection interval I'm using is 10 ms, nrf52840 DK on peripheral and nrf52840 DK as a central device. Your help is much appreciated. Thanks!

Reply
  • Hi @Petter. I have a similar question, when the central stops receiving the data or if the peripheral goes out of range and comes in again. How to get reconnected successfully without any delay? i.e peripheral should start adversitising immediately and the central should be able to pick it up. I am working on a medical application where the peripheral is in a patients body who is expected to move in and out. Hence, there will be a loss in the connection and once they are within range, how to enable the connection and data transmission automatically? The connection interval I'm using is 10 ms, nrf52840 DK on peripheral and nrf52840 DK as a central device. Your help is much appreciated. Thanks!

Children
No Data
Related