This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[NRF51822] Function to check if BLE is connected or not

Is there a function within the nRF51822 SDK to check if BLE is connected or not (or to check general BLE connection state)?

Thanks.

Parents
  • Hi, Nick,

    Not necessary to set a flag for this purpose. You should have a connection handle for the BLE operation (e.g. m_conn_handle), which is used in sd_ble_gap_disconnect(m_conn_handle, ...)

    if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
    {
    	/* BLE is connected. Do something. */
    } else
    {
    	/* BLE is not connected. Do something. */
    }
    
Reply
  • Hi, Nick,

    Not necessary to set a flag for this purpose. You should have a connection handle for the BLE operation (e.g. m_conn_handle), which is used in sd_ble_gap_disconnect(m_conn_handle, ...)

    if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
    {
    	/* BLE is connected. Do something. */
    } else
    {
    	/* BLE is not connected. Do something. */
    }
    
Children
No Data
Related