<?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 do I find out if devices already bonded after building up a connection?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19597/how-do-i-find-out-if-devices-already-bonded-after-building-up-a-connection</link><description>Hello, 
 I have an BLE application were I want, for security reasons, to allow a connection only if a button is pushed or if the devices already have bonded before. The Button is no problem I just wait for the BLE_GAP_EVT_CONNECTED event. Then I ask</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 10 Feb 2017 11:29:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19597/how-do-i-find-out-if-devices-already-bonded-after-building-up-a-connection" /><item><title>RE: How do I find out if devices already bonded after building up a connection?</title><link>https://devzone.nordicsemi.com/thread/76255?ContentTypeID=1</link><pubDate>Fri, 10 Feb 2017 11:29:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39d85149-e547-4a54-82bb-a0a7597a1da6</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;If you wait for the BLE_GAP_EVT_CONNECTED event you have already allowed connection, if you want to disallow connections you should advertise with a whitelist containing the addresses of the bonded devices, and advertise without whitelist when the button is pushed.&lt;/p&gt;
&lt;p&gt;If you want to allow connections but only let devices pair when the button is pushed I think you can use pm_sec_params_set().&lt;/p&gt;
&lt;p&gt;When the button is pushed call pm_sec_params_set() with the security parameters you want to use when pairing/bonding, when button is released call pm_sec_params_set(NULL) to disallow pairing.&lt;/p&gt;
&lt;p&gt;I guess you could alternatively call pm_sec_params_set() with or without NULL depending on button state every time you get an event from the SoftDevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>