<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Peer manager bonds handling</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/34150/peer-manager-bonds-handling</link><description>Hello, 
 If I understand well, when the part of the flash reserved for the PM is full, new bonds cannot be saved until the application deletes older bonding data. 
 I would like my app to automaticaly delete the oldest bonds so that the flash never gets</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 11 May 2018 12:02:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/34150/peer-manager-bonds-handling" /><item><title>RE: Peer manager bonds handling</title><link>https://devzone.nordicsemi.com/thread/131700?ContentTypeID=1</link><pubDate>Fri, 11 May 2018 12:02:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2108c7eb-4882-4e42-8e3e-c6438f8b5731</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am not sure if this is already available. I don&amp;#39;t think it is in any of the examples in the SDK (I might be wrong), but I assume that there exists some github repository doing this.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, these are likely SDK - dependent (since some function names, and especially softdevice calls, are changed between the major SDK versions).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I assume you have seen the function &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.0.0%2Fgroup__peer__manager.html&amp;amp;anchor=gad20bb7430862e537e4219cf9fd8c5f98"&gt;pm_peer_delete()&lt;/a&gt;. The only thing you need to do is to make sure that you use the correct peer ID, to remove e.g. the peer that has not been connected for the longest.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To handle these, you will find the functions&amp;nbsp;pm_peer_rank_highest() and&amp;nbsp;pm_peer_ranks_get() (you will find their descriptions in the same link above).&lt;/p&gt;
&lt;p&gt;You typically call pm_peer_rank_highest() whenever you store a new bond, and whenever you need to delete a bond, call pm_peer_ranks_get(), which will return the ID of the highest ranked and the lowest ranked. Then you would want to delete the peer with the lowest rank.&lt;/p&gt;
&lt;p&gt;Take a look at it, and let me know if something isn&amp;#39;t clear.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>