<?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>How to only allow a maximum of one bonded connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94490/how-to-only-allow-a-maximum-of-one-bonded-connection</link><description>If I only wanted to allow one bond at a time, how could I do this? 
 For example when someone connects for the first time they would pair and bond, by entering the passkey. If someone else wanted to pair and bond, the previous person who bonded should</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 05 Dec 2022 09:32:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94490/how-to-only-allow-a-maximum-of-one-bonded-connection" /><item><title>RE: How to only allow a maximum of one bonded connection</title><link>https://devzone.nordicsemi.com/thread/398932?ContentTypeID=1</link><pubDate>Mon, 05 Dec 2022 09:32:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baec97d7-c464-4705-a4bc-e3b00579d9a6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The peer manager itself does not support a hard limit of the number of connections, so you need to do what you describe. After the second peer is bonded, delete the bond for the first (oldest) peer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In practice, this involves using&amp;nbsp;pm_peer_delete() as you write, and calling it with the ID of that peer. There are several way you could do this. Either obtain the peer ID that you do not want to delete. The most robust would probably be to use&amp;nbsp;pm_peer_ranks_get(), to get the ID of the&amp;nbsp;peer that has not been seen for the longest and delete it.&amp;nbsp;Or in case you&amp;nbsp;risk ending&amp;nbsp;up in a state with more bonds and want to avoid it, use the same function to get the ID of the most recently seen peer, and keep that, but delete all others (which you get a list of with&amp;nbsp;pm_peer_id_list()). There are also other possible approaches, as you can get a lot of information from the peer manager (take a look at peer_manager.h).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>