Removing bonded devices

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
HeGi_2497906
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

Removing bonded devices: Here is my attempt to clear all bonded devices, will this work?

           CyBle_GapRemoveBondedDevice(cyBle_sflashDeviceAddress);

           CyBle_GapRemoveBondedDevice(cyBle_sflashDeviceAddress-1);

           CyBle_GapRemoveBondedDevice(cyBle_sflashDeviceAddress-2);

           CyBle_GapRemoveBondedDevice(cyBle_sflashDeviceAddress-3);

Determining if a device needs to be stored: there is no clear dialog if the BLE handler determines that for you or not, it seems like it does, but there is no documentation I can find that proves that, how do I determine if a device is already paired.  So how do you know if you need to store the device or not?

Executing the  CyBle_GapGetBondedDevicesByRank(); I just cannot seem to figure out how to point at the list and how to create the right buffer, I have tried many ideas, none seem to work.

0 Likes
1 Solution

Hello,

    The bonding information stores in FLASH memory and not in the SFLASH. The maximum number of Bonded devices ( #4) are limited by the BLE stack internal memory.

The API CyBle_GapRemoveDeviceFromWhiteList() can be used to remove the devices from whitelist as well as the bonding info. ( Right Click on the API-> Go to Declaration for details on this API).

However, You could also use CyBle_GapRemoveBondedDevice() API ( Recommended) for removing the Bonding info.

-Gyan

View solution in original post

0 Likes
5 Replies
SayaniS_66
Moderator
Moderator
Moderator
10 likes received First like received

Hello,

The API  CyBle_GapRemoveBondedDevice() allows removing the bonding information of the device including CCCD values. So, you can use this API to clear all the bonded devices. The implementation is :

CYBLE_API_RESULT_T CyBle_GapRemoveBondedDevice (CYBLE_GAP_BD_ADDR_T *bdAddr) where *bdAdder is the pointer to peer device address, of type CYBLE_GAP_BD_ADDR_T.

The API CyBle_GapGetBondedDevicesList () will return the count and the bluetooth device address of the devices added to the bonded list.

The implementation is :

CYBLE_API_RESULT_T CyBle_GapGetBondedDevicesList (CYBLE_GAP_BONDED_DEV_ADDR_LIST_T *bondedDevList) where bondedDevList is the buffer to which list of bonded device list will be stored of type CYBLE_GAP_BONDED_DEV_ADDR_LIST_T.

The event CYBLE_EVT_GAP_AUTH_COMPLETE indicates that the authentication/pairing procedure has been completed.

CyBle_GapGetBondedDevicesByRank() function returns the count and Bluetooth device address along with bd handles of the devices in the bonded device list in the order of rank (i.e. Newest device bonded will be at 0 index).

The implementation is :

CYBLE_API_RESULT_T CyBle_GapGetBondedDevicesByRank (CYBLE_GAP_DEVICE_ADDR_LIST_T *bondedDevList) where bondedDevList is the buffer to which list of bonded device list will be stored of type CYBLE_GAP_DEVICE_ADDR_LIST_T.

Please refer to the code example from the below link for more details on API implementation.

PSoC-4-BLE/100_Projects_in_100_Days/Day015_Bonding at master · cypresssemiconductorco/PSoC-4-BLE · G...

-Sayani

0 Likes

Sayani, the example executes a remove from whitelist, not bonded in sflash.  Please show an example of the correct function.

0 Likes

Hello,

The example uses the API CyBle_GapRemoveDeviceFromWhiteList() which removes the bonding information of the device as well as removes it from the whitelist. So this API can also be used to remove bonding information. Additionally, CyBle_GapRemoveBondedDevice() API can also be used. Moreover, the bonding information is stored in flash and not in sflash.

-Sayani.

0 Likes

Sayani, are you sure about the data storage location?  BLE Bonding and SFLASH on PROC PSoC4

The question would then become, why is bonding limited to 4 items?

On the whitelist example this code is executed, why if the function does it for you?

  apiResult = CyBle_GapRemoveDeviceFromWhiteList(&clearAllDevices);
/* CyBle_StoreBondingData should be called to clear the Bonding info from flash */
while(CYBLE_ERROR_OK != CyBle_StoreBondingData(1));
 
0 Likes

Hello,

    The bonding information stores in FLASH memory and not in the SFLASH. The maximum number of Bonded devices ( #4) are limited by the BLE stack internal memory.

The API CyBle_GapRemoveDeviceFromWhiteList() can be used to remove the devices from whitelist as well as the bonding info. ( Right Click on the API-> Go to Declaration for details on this API).

However, You could also use CyBle_GapRemoveBondedDevice() API ( Recommended) for removing the Bonding info.

-Gyan

0 Likes