You can get the GetBondedDeviceList API to retrieve the list of the device you have bonded and check if the peripheral is in the list or not.
- Madhu Sudhan
If I connect to a peripheral with bonded information stored, but the peripheral no longer has the bond information stored, what will happen? Is there a way to tell if the remote device no longer has the "matching" bond information? Or do I need to just catch an event for invalid bond information, and rebond?
Specifically, I'm looking for a way to re-write bond information stored in the RAM/flash data if the remote side refuses the current bond credentials.
Do I just re-attempy the CyBle_GapAuthReq() with authInfo set to CYBLE_GAP_BONDING_NONE to rerequest the bonding information?
Did you find a solution i would like to do a similar thing
When the CYBLE_EVT_GAP_AUTH_FAILED occurs, it signifies that the remote device refused the authentication (most likely due to the bond being invalid).
When this occurs, I disconnect from the remote device; (wait until disconnect complete), then remove the bonded device. Once the flash finishes removing the old bond, I then reconnect with the BLE device and bond with it.
The order of events/function calls is as follows:
CYBLE_EVT_GAP_AUTH_FAILED event occurs
CyBle_GapDisconnect(cyBle_connHandle.bdHandle) function called
(wait until disconnect complete)
CyBle_GapRemoveBondedDevice(&pMainData.bondedDevice) function called
(wait until flash write/delete complete)
CyBle_GapcConnectDevice(&pMainData.bondedDevice) function called
(Then just re-bond with the device on reconnect)