Tool/software:
Dear team
I'm working with the CC2340R5 using SDK 8.40 and IDE 12.8.
I want to delete the specified bonded device by using mac address, and i want to list all bonded devices
kindly help us on this query.
Thanks and regards
Abinesh. R
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Dear team
I'm working with the CC2340R5 using SDK 8.40 and IDE 12.8.
I want to delete the specified bonded device by using mac address, and i want to list all bonded devices
kindly help us on this query.
Thanks and regards
Abinesh. R
Hi Abinesh,
I want to delete the specified bonded device by using mac address
You will need to use this API with the GAPBOND_ERASE_SINGLEBOND as the parameter. Take note that if you want to erase bond records while in active connections, you will also need to enable GAPBOND_ERASE_BOND_IN_CONN by using the gapBondMgr API and setting this to true.
i want to list all bonded devices
In order to do this, you will have to create a list of connected devices addresses. You can then use GAPBondMgr_FindAddr to see if a record exists. So the complete sequence would be iterating through the addresses stored when connected, and calling GAPBondMgr_FindAddr and if there is a record, to output the address.
Best,
Nima Behmanesh
Hi Nima,
I tried using the APIs below, but I'm still getting a bond count of one. If the bond is removed in our module ,on the mobile side the device connects without showing the pairing popup.
if(Bonded_1==1){
GAPBondMgr_SetParameter(GAPBOND_ERASE_BOND_IN_CONN, sizeof(uint8_t), (uint8_t[]){TRUE});
GAPBondMgr_SetParameter(GAPBOND_ERASE_SINGLEBOND, B_ADDR_LEN + 1, mac_addr); // mac addr has connected device address
GAPBondMgr_GetParameter(GAPBOND_BOND_COUNT, &count);
uart_app_write(&count,1); //printing the count
Bonded_1=0;
}
Hi Abinesh,
The code you provided above, where is this being called in the application? Is it in a separate thread?
I will try to reproduce this on my side and see if I see anything similar occurring.
Best,
Nima Behmanesh
Hi Nima,
I'm calling in separate thread.
After connection and paired ,I'm sending an uart command to remove bonded device by using above shared code.
Thanks and Regards
Abinesh
Hi Abinesh,
If you're calling those APIs from a separate thread, then you will need to wrap those calls in BLEAppUtil_invokeFunction. Any calls to BLE APIs from outside the BLE stack thread must use the BLEAppUtil_invokeFunction call.
Do you mind trying that? I recommend creating a wrapper:
void my_wrapper()
{
// BLE APIs with parameters
}
BLEAppUtil_invokeFunctionNoData(my_wrapper);
Best,
Nima Behmanesh