This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Maximizing bond count stored in FDS

Hi,

I use nrf52832, SDK 16 and SD s132. I use FDS to store application data (fixed size), and I use bonding too. So the peer manager also store the peer related data in FDS (about 27 words / peer).
I saw here in several answers that the peer manager does not limit the bond count by default. The only limit is the free space in FDS. So the peer manager can fill up all of the FDS_VIRTUAL_PAGES.
The problem is that my app data don't fit in the FDS after an amount of bonding.

So how can I maximize the stored bond count?

  • Hi,

    The peer manager does not have any built in features to limit the number of bonds, but it provides you with the APIs you need to easily do this. I suggest you do something like this at sensible times (for instance every time after adding a new bond):

    1. Check the number of existing bonds using pm_peer_count(). If this is same or lower than a maximum number of your choice, so nothing. If it is higher, continue.
    2. Use pm_peer_ranks_get() to get the peer ID of the lowest ranked peer, which is the peer that has not been seen for the longest time.
    3. Then delete that bond using pm_peer_delete(). 
  • Thank you. It sounds good.
    Can you suggest an event that indicates a new bond?
    I found PM_EVT_PEER_DATA_UPDATE_SUCCEEDED, but it's not quite good.

  • I suggest you use BLE_GAP_EVT_AUTH_STATUS.

Related