The BLE stack will update the bonding data in RAM while the devices are connected. If the bonding data is to be retained during shutdown, the application can use CyBle_StoreBondingData() API to write the bonding data from RAM to the dedicated flash location, as defined by the Component.
After bonding, the connected device will be automatically added to whitelist. Please see a related thread at following link, Whitelist is just RAM ? . You can refer the following code example for a better understanding, PSoC-4-BLE/100_Projects_in_100_Days/Day015_Bonding at master · cypresssemiconductorco/PSoC-4-BLE · GitHub .
Please feel free to ask if you have any related queries.
Thanks and Regards,
Your answer says that after bonding, the connected device will be automatically added to the whitelist. The following code, from the example, perhiperal_Resolving_List, contains lines to fill a tempory structure and add the device to the whitelist. Why is this necessary if the device is automatically added to the whitelist?
/* Place your application code here. */
if((cyBle_pendingFlashWrite != 0u))
apiResult = CyBle_StoreBondingData(0u);
if(apiResult == CYBLE_ERROR_OK)
printf("Bonding Data stored.\r\n");
/* Add to resolving list only if random address */
if((cyBle_discoveryModeInfo.advParam->advFilterPolicy == 0x00) && (peerBdAddr.type == 1))
CyBle_GapGetPeerDevSecurityKeyInfo(cyBle_connHandle.bdHandle , &localKeyFlag , &peerKeys );
CyBle_GapGetDevSecurityKeyInfo( &localKeyFlag, &localKeys);
memcpy( &deviceToResolve.localIrk , &localKeys.irkInfo , sizeof(localKeys.irkInfo));
memcpy( &deviceToResolve.peerIrk , &peerKeys.irkInfo , sizeof(peerKeys.irkInfo));
memcpy(&deviceToResolve.bdAddr, &peerKeys.idAddrInfo, CYBLE_GAP_BD_ADDR_SIZE);
apiResult = CyBle_GapAddDeviceToResolvingList(&deviceToResolve);
printf("Device addition to resolving list result = %x\r\n",apiResult);
// fill temporary struct to add device to whitelist
memcpy(&temporaryBDAddress.bdAddr, &peerKeys.idAddrInfo, CYBLE_GAP_BD_ADDR_SIZE);
temporaryBDAddress.type = peerKeys.idAddrInfo;
// add device to whitelist
apiResult = CyBle_GapAddDeviceToWhiteList(&temporaryBDAddress);
printf("Device id address added to whitelist = %x\r\n",apiResult);
apiResult = CyBle_GapReadResolvingList(&resolvingDeviceList);
printf("\r\nCyBle_GapReadResolvingList api result is %x",apiResult);
printf("\r\n Resolving list data is %x \r\n",resolvingDeviceList.noOfDevice);
As I mentioned in my previous response, after bonding the connected device automatically get added to white list. It is not required to update whitelist separately. Are you observing any related issues in your application?
Thanks and Regards,