Central: Establishing multiple connections simulataneously

When calling sd_ble_gap_connect(), and providing a whitelist, what is the expected process for establishing a connection, as far as timing is concerned?  Will the device scan until it hears an advertising packet from anything on the whitelist, then send out a connection request, and complete the process very quickly, or are multiple advertising packets, and therefore multiple advertising intervals required in order to establish a connection?

If multple advertising packets are required, will the device only attempt to connect to the device it first recieves an advertising packet from, or will it try to connect to any device on the whitelist, and only complete the connection with one device?

Is it possible to simultaneously initiate connections with many devices at once, without repeated calls to sd_ble_gap_connect()?

  • Hello,

    I did answer a similar case earlier, I think the same answer apply here:

    So you simply call sd_ble_gap_scan_start() to start receiving advertisement reports. Once you want to connect to a specific peer based on the received advertisment report you call sd_ble_gap_connect(). For both api calls you define a set of parameters, one is the timeout:

    uint16_t              timeout;                    /**< Scan timeout in 10 ms units. @sa BLE_GAP_SCAN_TIMEOUT. */

    On BLE_GAP_EVT_TIMEOUT or BLE_GAP_EVT_CONNECTED, you need to call sd_ble_gap_scan_start() again. It's only possible to connect one at a time.

    If you know the advertisement interval, then you can time the call to the sd_ble_gap_connect(), such that if the advertisment interval is 100ms, then possible wait 95ms before calling sd_ble_gap_connect() with a 20ms timeout. It's not possible with accurate timing, since the BLE spec mandate a 10ms random delay on the advertisment intervals.

    Hope that helps,
    Kenneth

Related