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

Enforce order of connection to centrals

I have peripheral BLE device which can have several centrals in its whitelist. It should be able to connect to central with higher priority first, for example: device have 3 centrals in whitelist with A having highest priority, B second highest and C lowest, when device is powered up and all centrals available it should always connect to A, if A is not available - to B and so on.

So my questions is:

  1. Can it be implemented on nrf52?
  2. If 1 is doable: Can it be done not to slow(compared to normal connection time)? Thanks!
  • It is not possible to block B and C if A is available. Either the devices are in the whitelist or not.

    The only way I can think of is using a timer. When the device is powered up you whitelist with A for x ms, then after x ms you put in B and then after x ms you put in C.

    Yes, this would make the connection to C slower if only C is available, but what is too slow I can't say for your application. You can tune it by selecting how long you want to wait before you put more devices into the whitelist.

    Will this work for you?

  • trying to whitelist all single hosts will be too slow for me. But now I know that it can't be done in "normal" way. Thanks!

  • Another option could be to advertise with A, B and C in the whitelist.

    If A connects first, you stop advertising.

    If B connects first you continue to advertise with A in whitelist, and then if A connects you disconnect B and stop advertising.

    If C connects first you continue to advertise, if B then connects you disconnect C and continue to advertise with A in the whitelist and so on..., and if A connects you disconnect C and stop advertising.

Related