5 Replies Latest reply on Oct 23, 2017 7:42 AM by epr_1639216

    Handling Unilateral Bond Removal

      I have two devices that I'm setting up to be bonded to each other upon user-input. It is working well to bond the two devices, but if I try to clear bond information from one of the devices, the other device still retains the bond information and attempts to use it upon reconnection to the other device.

         

      Is there a way to catch when the device I'm connecting to is no longer bonded to the central, but the central still has the bonding information stored for the peripheral device? Or, at least to "update" the bonding information stored on the central device?

        • 1. Re: Handling Unilateral Bond Removal

          Hi,

             

          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.

             

          Regards,

             

          - Madhu Sudhan

          • 2. Re: Handling Unilateral Bond Removal

            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?

            • 3. Re: Handling Unilateral Bond Removal

              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?

              • 4. Re: Handling Unilateral Bond Removal
                DeTo_1826166

                Hello,

                 

                Did you find a solution i would like to do a similar thing

                • 5. Re: Handling Unilateral Bond Removal

                  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)