Reconnect to a bonded Peripheral after toggling iOS Bluetooth off/on

462 Views Asked by At

I am not new to iOS, but am relatively new to CoreBluetooth and BTLE in general. Using devices running iOS 10 or later ( currently 11.2 ), I have found that if bluetooth is toggled off and on, the bonded peripheral can no longer be accessed.

After doing a bit of debugging, it seems that once bonded, the security information saved on both ends includes the address of each peer. The iOS side remembers the peripheral just fine, but after turning Bluetooth off and on again, the address of the iOS device changes itself, so to the peripheral its currently registered bonded peer (address) no longer exists. For this reason, connection between the two is no longer possible until the bonding information on the peripheral side is cleared ( Peripheral device performs direct advertisement once bonded so that only its bonded peer can see it ).

I would like to know A) is there anyway to retain the same address on the iOS side after toggling Bluetooth off/on B) If the address cannot be retained/recalled, what is the usual method for dealing with this sort of situation?

I have searched through the Core Bluetooth Programming reference and have googled this problem to the best of my ability, but to no avail.


Peripheral output via serial connection while bonded with the iOS central:

BTA=001EC0461948 Name=The_Lock1948 Connected=7DD350CC912D,1 Bonded=7DD350CC912D,1 Server Service=00000001 Features=20000000 TxPower=4

iOS Bluetooth off/on, then reconnect with the exact same iOS device:

BTA=001EC0461948 Name=The_Lock1948 Connected=5DDC08C0B0A3,1 Bonded=7DD350CC912D,1 Server Service=00000001 Features=24000000 TxPower=4

As you can see, the "Connected" address has changed while the peripheral remains bonded to the previous address. The only difference between the two is a toggle of the BT setting. When I say BT power off/on, I mean really turn the power off and on, not the "Allow New Connections" setting in iOS 11+.

By the way, just to add to this, I have seen 2 other BTLE peripheral devices ( keyboards ) that cannot reconnect after a iOS BT power toggle until they are reset in some fashion.

0

There are 0 best solutions below