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

sd_ble_gap_connect() timeout in S120 central

Do I need to implement my own timer to wrap this function? I appears that I might receive a BLE_GAP_EVT_TIMEOUT timeout event but testing has yet to reveal one.

My test case is to verify that I can connect to a peer by address, reboot the central and that peer, wait for an advertisement, unplug the peer and then issue the connect command to the central.

  • In order to get a timeout event from sd_ble_gap_connect, you need to have a non-zero timeout value in the scan parameters provided as a parameter for sd_ble_gap_connect. This parameter represents the timeout in seconds.

    Once you have set the timeout parameter, you will either receive an BLE_GAP_EVT_CONNECTED event, or BLE_GAP_EVT_TIMEOUT event with the source set to 'connection'.

Related