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

Connect without advertising to a previously paired device

Hi,

We'd like to implement a feature that allows changing a BLE connection from [central device #1 -> peripheral] to [central device #2 -> same peripheral] (similar to Apple's Airpods).

Currently, trying to reconnect to a peripheral that is already connected to another central device simply fails.

Is there a way to force a connection to a peripheral that doesn't advertise? from previous topics it seems this wasn't possible in Softdevice 4.0, but we're using 5.0 and wondered if anything changed.

Thanks

  • FormerMember
    0 FormerMember

    The BLE Multiperipheral example in the SDK shows how to connect on peripheral to several centrals (SKD 14.2.0). I would recommend you to take a look at that example. 

    Connecting without advertising is not possible. However, for bonded devices, it is possible to use directed advertising. 

  • Thanks. We reactivate advertising manually, similar the example. But we'd also like to disconnect (without unpairing) the previous central device from the peripheral.

    After the 2nd central connects, we use sd_ble_gap_disconnect() to disconnect the 1st central device, but the 2nd central device also stops communicating even though it displays as "Connected" on the Bluetooth menu.

    It's probably because a BLE_GAP_EVT_DISCONNECTED is sent after the disconnection. Is there a way to disconnect a device without harming the connection with the new device?

  • We managed to disconnect 1 device while still being connected to the 2nd using directed advertising. We now face another issue - the disconnected device reconnects automatically.

    Is there a way to only allow "manual" connection from a central device? meaning, only a manual press on "connect" will attempt to reconnect. It's not clear if there's a difference from the peripheral's side between automatic and manual connection.

    Thanks

  • FormerMember
    0 FormerMember in reply to ohtap

    If the central automatically re-connects, it means that the central is scanning and that the peripheral is advertising. If you want the central to scan, but not connect, you can for example use a flag to tell the application if it is allowed to send connect request or not, upon a advertising report  (BLE_GAP_EVT_ADV_REPORT). The flag can be controlled manually.

    if(allowed_to_connect == true)
    { 
         err_code = sd_ble_gap_connect(..);
    }

  • Unfortunately we have no control over the central (phone/desktop computer/tablet), only the peripheral.

    Is there a way to send a disconnection signal from the peripheral to the central to stop it from reconnecting automatically? meaning still in the "paired" devices list, but not "connected", so the user has to manually press "connect" on the central's Bluetooth menu, as if he disconnected manually.

    Right now we send sd_ble_gap_disconnect(conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);  but the central just reconnects when we start advertising.

Related