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

How to disconnect and enter to advertising without reconnecting to latest device

Hi,

On a button press I need to enter to disconnect from the currently connected device and then start advertising in order to allow a new device to connect.

I manage to disconnect and put the device in FAST_ADV but when the master device detects it, it sends a connection request, so I need to prevent the nrf from accepting connection queries from the latest master. 

How to do that ?

Thanks a lot for your help.

  • Hi

    You can't stop a peripheral from connecting to a master in BLE. If the slave receives a connection request it will automatically connect, so you'll have to find a way to stop the advertising device from getting that connection request in the first place if you want it to connect to another master. 

    This issue has come up before and is discussed in this thread. Additional things you can do to discover the other device is to lower the TX power of the advertising device so that it will only discover devices in close proximity of itself.

    Best regards,

    Simon

  • This means, I have to turn off the bluetooth on the master device if I want to be able to connect to a new master. there is no black list nor filters on the softdevice nor SDK,
    is there in theory at least a way to implement such a black list or filter ?

  • Unfortunately, we don't have a blacklist feature, only the whitelist. If you need to blacklist a device the only option I see is to check the address on the connected event, and disconnect if it is the blacklisted device. After x amount of tries, the peripheral should inevitably connect to the second master instead of the initial master device. What kind of filter did you have in mind?

    If you are developing the master side of this application as well, you can, for example, set a delay after a disconnect before it starts scanning again. This should give your advertising device a few seconds to advertise to any other scanners before it is connected to the initial master again.

    Best regards,

    Simon

Related