This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

about delete binding information

I am currently developing with nrf52832 sdk14.2. When nrf52832 is bound to a different iphone connection, if the stored binding record of nrf52832 is already full, will the system automatically delete the saved binding information? If so, will it delete all or the earliest one?

Parents
  • Hi,

    Typically it is up to the application to delete peers. There is support for a rank system in the peer manager module, such that each time you re-connect with previous bonded peer you may set it as the highest rank (call pm_peer_rank_highest()), thereby the oldest used peer will have the lowest rank (call pm_peer_ranks_get()). You can count number of available peers between connections by calling pm_peer_count(), for instance when you are disconnected, thereby if you want to support 5 peers, then set the max to 6, and delete the oldest peer when pm_peer_count() return 6. A peer is deleted by calling pm_peer_delete() and you may run fds garbage collection afterwards.

    In later SDK's it seems however that the deleting of the oldest is also somewhat done automatically when storage is full. You can typically find that in main.c in pm_evt_handler() that there is a call to pm_handler_flash_clean(). This function will on PM_EVT_STORAGE_FULL event execute the following code:

    The above code delete the oldest bond, then next run garbage collection to free up storage.

    So I assume you may choose whether you want to delete peers before PM_EVT_STORAGE_FULL occurs (based on the number of peers you want to have bonded at any time) and/or rely on pm_handler_flash_clean() to delete oldest peer when storage is actually full.

    Best regards,
    Kenneth

Reply
  • Hi,

    Typically it is up to the application to delete peers. There is support for a rank system in the peer manager module, such that each time you re-connect with previous bonded peer you may set it as the highest rank (call pm_peer_rank_highest()), thereby the oldest used peer will have the lowest rank (call pm_peer_ranks_get()). You can count number of available peers between connections by calling pm_peer_count(), for instance when you are disconnected, thereby if you want to support 5 peers, then set the max to 6, and delete the oldest peer when pm_peer_count() return 6. A peer is deleted by calling pm_peer_delete() and you may run fds garbage collection afterwards.

    In later SDK's it seems however that the deleting of the oldest is also somewhat done automatically when storage is full. You can typically find that in main.c in pm_evt_handler() that there is a call to pm_handler_flash_clean(). This function will on PM_EVT_STORAGE_FULL event execute the following code:

    The above code delete the oldest bond, then next run garbage collection to free up storage.

    So I assume you may choose whether you want to delete peers before PM_EVT_STORAGE_FULL occurs (based on the number of peers you want to have bonded at any time) and/or rely on pm_handler_flash_clean() to delete oldest peer when storage is actually full.

    Best regards,
    Kenneth

Children
No Data
Related