Hello,
I am building an application based on nRF Desktop in NCS 2.5.2 for nrf52840dk in the peripheral role. We are using multiple identities, each with capacity for a single bond.
In ble_bond.c, it is possible to trigger erase advertising by sending the appropriate click events, which is great.
For the sake of UI consistency in our app, it makes more sense for a delete operation to be permanent, rather than erase advertise with a 2 minute timeout. I cannot figure out which .c file does the actual erase advertising, ble_bond.c just does an APP_EVENT_SUBMIT into the ether.
1. How do I find which .c file does the erase advertising? Figuring out where messages like this go is a problem I have faced before in NCS, so it would be great to know if there is a technique to finding this out.
2. How could I bypass the timeout and instantly accept the delete/identity swap?
3. (Alternative solutions) I have tried an implementation using bt_unpair(). This works okay, but upon unpairing the previously paired device instantly receives a pairing request, which is undesirable. Is this because some bond information remains on the nrf? If this pairing request could be avoided by taking some extra step before unpairing, this would be an acceptable solution. Here is what I have tried.
void delete_identity_bonds(uint8_t delete_id)
{
uint8_t start_id = get_app_id();
if(start_id != delete_id)
{
LOG_INF("go from id%d to delete id = %d", start_id, delete_id);
change_identity(delete_id);
}
//remove peer
int err = bt_unpair(get_bt_stack_peer_id(delete_id), BT_ADDR_LE_ANY);
if (err) {
LOG_ERR("Failed to remove");
}
LOG_INF("return to start id = %d", start_id);
if(change_identity(start_id) == CONFIG_BT_ID_MAX)
{
LOG_ERR("Failed to find id");
}
}
Thank you.