5 Replies Latest reply on Oct 30, 2018 8:03 AM by PY_21

    How to check bonding data of newly paired device on PSOC4

    EyGe_3183606

      Hi,

       

      I have a PSOC4 device with BLE and I want to work in a mode of unauthenticated pairing with encryption and with bonding.

       

      I want to be able to save the bonding key to the flash and I saw in the documentation that only 4 keys could be saved in the flash.

      It is also a function to erase the oldest bonded device from the list if its full.

       

      So I want to implement a code that the BLEapplication triggers the code due to a bonding event and I then save that bonded device. If the list is full I should check if that device is already listed in the list and if not then erase the oldest device from the list.

       

      How do I verify that the external device ID that was just paired isn't already stored so that I don't save it twice?

       

      Thanks,
      David

        • 1. Re: How to check bonding data of newly paired device on PSOC4
          PY_21

          Hello,

           

          Bonding is the process in which the keys and identity information exchanged during the pairing process are saved. After devices are bonded, they do not have to go through the pairing process again when reconnected. So the same device won't be saved twice.

          To remove the bonding information the API CyBle_GapRemoveBondedDevice (CYBLE_GAP_BD_ADDR_T *bdAddr) is used. You can also use the API CyBle_GapRemoveOldestDeviceFromBondedList ( ) which removes the oldest device from the bonded and white lists.

          In order to know the bonded devices list we can use the API CyBle_GapGetBondedDevicesList(CYBLE_GAP_BONDED_DEV_ADDR_LIST_T *bondedDevList) which returns the count and Bluetooth device address of the devices in the bonded device list.

           

           

          Thanks,

          P Yugandhar.

          1 of 1 people found this helpful
          • 2. Re: How to check bonding data of newly paired device on PSOC4
            EyGe_3183606

            Thanks Yugandhar for your reply.

             

            So if I use CyBle_GapRemoveBondedDevice (CYBLE_GAP_BD_ADDR_T *bdAddr) what is the bdAddr of the device I have just bonded with?

            How do I get that information?


            Thanks

            David

            • 3. Re: How to check bonding data of newly paired device on PSOC4
              PY_21

              Hello,

               

              We can use the API CyBle_GapGetBondedDevicesList(CYBLE_GAP_BONDED_DEV_ADDR_LIST_T *bondedDevList) which returns the count and Bluetooth device address of the devices in the bonded device list. We can select appropriate bdAddr from bonded list and then remove from bonded list using CyBle_GapRemoveBondedDevice (CYBLE_GAP_BD_ADDR_T *bdAddr).

              Please refer the Day015_Bonding example in the link for more information on bonding.

               

              Thanks,

              P Yugandhar.

              1 of 1 people found this helpful
              • 4. Re: How to check bonding data of newly paired device on PSOC4
                EyGe_3183606

                Dear Yugandhar,

                 

                Thanks for your reply again.

                I reviewed the Bonding example that you referred me to. In that example they remove ALL the bonded devices. There is no case where they remove a specific bonding.

                When you wrote

                We can select appropriate bdAddr from bonded list and then remove from bonded list using CyBle_GapRemoveBondedDevice (CYBLE_GAP_BD_ADDR_T *bdAddr)

                then the problem is that I can get the bonded list but how on earth do I know which device is the one I am now bonded with? What should I search for?

                I mean, is there any way to distinguish and know what is the bonding ID of the device I am now connected with? so that I can erase it later...

                 

                Thanks,
                David

                • 5. Re: How to check bonding data of newly paired device on PSOC4
                  PY_21

                  Hello,

                   

                  Bonding device list will give the details of previously bonded devices data and present connected device bonded data.

                  In the API CyBle_GapGetBondedDevicesList(CYBLE_GAP_BONDED_DEV_ADDR_LIST_T *bondedDevList), bondedDevList.bdAddrList[0].bdAddr will contains the bonded information of the present connected device and remaining three bdAddrLists will contain the previously bonded devices information(if they are already paired).

                   

                  Thanks,

                  P Yugandhar.

                  1 of 1 people found this helpful