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

How to advertise to unpaired peers

Hey, I'm running the ble_app_hids_keyboard example. I would like to modify it so that once I have a connection to a device I can press a button and go into advertising mode again to give a chance for a different device to pair.

Now the problem is that if I call:

sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);

to terminate the connection and then go into advertising mode again, both iOS and Android will immediatly connect again, so there's no chance for anyone else to pair.

My next idea was to delete bonds (pm_peers_delete()) that works in Android, but really creates a mess on iOS and I have to go to and delete the pair from the iOS bluetooth settings before it will talk to my nrf51 keyboard again.

So, my question is: What would be the proper way to implement this feature? I have a few ideas that I could try to implement:

  1. Somehow block the current peer device from connecting again for a period of time to give others a chance to connect.

  2. Advertise without disconnect the current peer (is that even possible?) and drop the current peer when I get a new connection.

Hopefully the solution would also prevent other already paired peers in range to connect. Sort of like a blacklist of paired peers.

Anyone know what's the proper way to implement this feature?

Related