This is my environment:
IDE: VSC
SDK: NCS v2.2.0
Central - iOS or Android phone running custom App, or an nRF52832 on custom hardware
Peripheral - nRF52832 on custom hardware
In our application, we have a Peripheral that can, at various times during its operation, be paired and bonded to any number of Centrals (at the moment, I've set this limit to 10). Connections to the Peripheral require pairing/bonding with the Central. If I get more than 10 different Centrals attempting to connect over the lifetime of the device, I need to start removing old pairing/bonding information. Alternatively, if a Central has deleted its pairing/bonding info for whatever reason, and then subsequently wants to connect to the Peripheral, I need to first remove the old pairing/bonding info on the Peripheral associated with that Central, and then re-establish new pairing/bonding info.
The catch is, I don't want to ever remove the pairing/bonding info that has been established and stored after a connection to my Peripheral from the Central that is running on my other set of custom hardware. This device has no way of agreeing to a new pair/bond request out in the field (its set up in the factory to only talk with specific Peripherals), so I don't want to ever remove that.
In my firmware to date, if I get a situation where a Central that has forgotten its pairing/bonding info tries to connect to the Peripheral, I make this call:
The bt_unpair(BT_ID_DEFAULT, BT_ADDR_LE_ANY) removes EVERYTHING. Which is not what I want to do.
So, I have two questions:
- In the situation where the Central has forgotten the pairing/bonding info, and I only want to delete the info associated with that Central from my Peripheral, how do I establish what the correct id and addr are to include in my call to bt_unpair(id, addr)?
- When I get to 10 Centrals with pairing/bonding info, how do I start writing over the top of old ones, but avoid writing over the info associated with my Client that uses the nRF52832 on my custom hardware? i.e. how do I find out what its id and addr are so that I can somehow prevent this being written over or removed?
Regards,
Mike