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

How to tell the host to clear and do all the bonding setup again?

Hi

I am writing an application that requires bonding/paring stuffs and face a problem as below

The maximum bonds that my device can manage is 2. When these 2 slots are fully used and another host tries to connect with my device, the least frequent used bond will be deleted to free up a slot for the new coming.

The problem comes when the deleted one comes back and requests to reconnect with my device. In this case, the connection is still re-established but the two devices can't talk to each other since I lost all the bond data for this connection. My question is, is there anyway that I can tell the host (phone) to forget my device and do all the bonding/paring setups again?

I'm using Nordic nrf51822 chip with soft device s110 v7.0.0

Thank you for any help!

  • I don't think there is a built in procedure in the Bluetooth Core specification to do this, and because of this our SoftDevices don't have an API for it.

    You may be able to implement it in the application on the nRF51 and in the app on the phone. You can have a characteristic that notifies the app when it should delete the bond information. This is assuming that the app actually is able to delete the bond information.

    It seems to be possible on Android, see this, but I haven't tested this myself.

    I couldn't find a way to do it on iOS, the only way to delete the bond information is by forgetting the device in settings.

  • Hi Petter, thank you for the swift response. So sad that BLE doesn't introduce any way to implement such kind of thing. By the way, is there any workaround for my problem? I just don't want the link to be re-established (and get stuck in it). My current solution is when the event BLE_GAP_EVT_SEC_INFO_REQUEST comes and if I don't have the info, I will do nothing (instead of using sd_ble_gap_sec_info_reply(m_conn_handle, NULL, NULL) as the example code). In this case the iPhone will try to reconnect a couple of times and I just go ahead and ignore them. Eventually the phone stops request reconnecting and my device can get out of the stuck situation. Do you have any better idea? Thank you!

  • I believe I suggested a possible workaround for Android, other than that I can't think of anything. Regarding your current solution. What do you achieve by doing nothing? If you do sd_ble_gap_sec_info_reply(m_conn_handle, NULL, NULL) iOS will keep the connection, it will just not be encrypted. iOS will be able to access characteristic values and descriptors that don't require encryption. I'm thinking maybe you should add this as a separate question? You could link to this question if it is relevant.

  • Since my application uses HID services that require encryption, doing sd_ble_gap_sec_info_reply(m_conn_handle, NULL, NULL) seems to be a bad idea since my device will get stuck with this iPhone as it keep the connection unencrypted. If I do nothing, the connection is dropped, iOS will try to reconnect a couple times (about 3 or 4 times as I experienced) then give up eventually. After that, my device can connect with other devices.

Related