nRF51822 as peripheral: how to delete pairing/bonding data of all previously paired centrals but current one

Hello,

I have a peripheral (nRF51822, S130, using the peer manager) that should be paired/bonded with at most one central. This means that if I want to pair the terminal with central#2, I should somehow delete central#1 to not allow to connect. So, I think I cannot use whitelisting. I tried to use pm_peers_delete on the event PM_EVT_CONN_SEC_START to delete all previously bonded data, but obviously it failed!

Could you please help me to know how to use pm_peer_delete in order to delete all already paired/bonded centrals when I want to pair with a new central?

1. Where do I need to call pm_peer_delete(pm_peer_id_t peer_id);

2. How can I get all peer_id that have already been saved not the new one? 

Thanks.

Related