<?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>BLE sequence of characteristic discovery and read with and without pairing/bonding</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91176/ble-sequence-of-characteristic-discovery-and-read-with-and-without-pairing-bonding</link><description>I&amp;#39;m trying to read the CTS characteristic from a BLE server (an iOS device) and part of the requirement from Apple is that the server and client be paired and bonded before the CTS information is available. 
 What I&amp;#39;m trying to establish is the chain</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 30 Sep 2022 07:44:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91176/ble-sequence-of-characteristic-discovery-and-read-with-and-without-pairing-bonding" /><item><title>RE: BLE sequence of characteristic discovery and read with and without pairing/bonding</title><link>https://devzone.nordicsemi.com/thread/388675?ContentTypeID=1</link><pubDate>Fri, 30 Sep 2022 07:44:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09901c5e-24a6-42f0-a1f7-3e0a6c1b6751</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the late response. I haven&amp;#39;t fully tested&amp;nbsp;&lt;span&gt;CONFIG_BT_KEYS_OVERWRITE_OLDEST but from what I can see in the code it seems that the oldest bond (most aged) will get removed automatically by&amp;nbsp;&lt;/span&gt;bt_unpair() in keys.c :&amp;nbsp;&lt;br /&gt;&amp;nbsp;&lt;img style="max-height:589px;max-width:572px;" height="589" src="https://devzone.nordicsemi.com/resized-image/__size/1144x1178/__key/communityserver-discussions-components-files/4/pastedimage1664523495045v1.png" width="572" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Have you tried to test by just enabling&amp;nbsp;&lt;span&gt;CONFIG_BT_KEYS_OVERWRITE_OLDEST&amp;nbsp; ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regarding your question about having the central remove bond but the bond remains on the peripheral, it&amp;#39;s about security requirement. There is a risk that an attacker can spoof that it&amp;#39;s the central and request a new bond. So usually it&amp;#39;s not allowed to request a new bond from a bonded central.&amp;nbsp;&lt;br /&gt;You will need to handle it with some extra security requirement, for example a physical button to erase all bonds (or single bond) , and you can call bt_unpair() in the code. In nRF5 SDK we have the allow_repair option, but I haven&amp;#39;t seen the same option in Zephyr.&amp;nbsp;&lt;br /&gt;But it&amp;#39;s possible to allow repair if it&amp;#39;s JustWork pairing, you can use this config:&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/3.0.0/reference/kconfig/CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE.html"&gt;CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE sequence of characteristic discovery and read with and without pairing/bonding</title><link>https://devzone.nordicsemi.com/thread/388442?ContentTypeID=1</link><pubDate>Thu, 29 Sep 2022 01:09:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8454d5f2-2a05-463a-ad75-d34ed14a1873</guid><dc:creator>Mike Austin (LPI)</dc:creator><description>&lt;p&gt;OK, sorted it.&amp;nbsp; &lt;span&gt;CONFIG_BT_MAX_PAIRED was set to 1.&amp;nbsp; Just increased that to 5 (I have 8192 bytes of flash storage for bonding/pairing info, so could potentially increase that a fair bit more) and I can get my peripheral to correctly grab the CTS from multiple clients now.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I now want to ensure I don&amp;#39;t end up hitting the limit of CONFIG_BT_MAX_PAIRED, so want to check the actual number of centrals paired at any given moment, and start removing earlier ones (or just wiping the whole lot clean) to keep below the limit.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;There appears to be a config setting&amp;nbsp;&lt;span&gt;CONFIG_BT_KEYS_OVERWRITE_OLDEST that if enabled, should allow the system to overwrite the oldest bonding/pairing info when it hits the&amp;nbsp;CONFIG_BT_MAX_PAIRED limit. I can see a bunch of API&amp;#39;s in keys.c that manage the overwriting, but its not clear how I get these to be implemented.&amp;nbsp; Is this something the code takes care of by simply setting&amp;nbsp;CONFIG_BT_KEYS_OVERWRITE_OLDEST=y?&amp;nbsp; Or do I actually need to be calling those API&amp;#39;s within my own code to manage the BT keys?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m also trying to deal with the scenario where a central deletes the bonding information but this still remains within the peripheral.&amp;nbsp; At the moment, my code fails to work correctly if this happens, so I need someway of detecting this (I think its when I get a Reason 4 return from my pairing_failed() function.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Cheers,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Mike&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE sequence of characteristic discovery and read with and without pairing/bonding</title><link>https://devzone.nordicsemi.com/thread/388438?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2022 23:46:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:732bb98d-faf3-4ad2-9165-8a0c04d56411</guid><dc:creator>Mike Austin (LPI)</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve been doing a bit more development work on the CTS functionality.&amp;nbsp; Your suggestion above seems to work, but only if I am accessing my peripheral with the same client.&lt;/p&gt;
&lt;p&gt;If I introduce a new client, then the whole bonding/pairing scenario for the new client doesn&amp;#39;t appear to be functioning as I would expect, and my code jumps into attempting to grab the CTS info without bonding/pairing to the new client.&amp;nbsp; And this ultimately fails.&lt;/p&gt;
&lt;p&gt;Any ideas how I can check within my code whether my peripheral has paired/bonded with a specific client, and if not, set up a new pairing/bonding with that client?&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE sequence of characteristic discovery and read with and without pairing/bonding</title><link>https://devzone.nordicsemi.com/thread/386473?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 23:15:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73305a0e-f393-40a3-a2a3-e844a13100a9</guid><dc:creator>Mike Austin (LPI)</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;Yep - using NCS V2.0.0, so your suggestion worked.&amp;nbsp; Thanks for your help&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE sequence of characteristic discovery and read with and without pairing/bonding</title><link>https://devzone.nordicsemi.com/thread/382690?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2022 12:57:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:767f0751-989f-48f5-8630-6ae614becb86</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you let me know which SDK version you are using ?&amp;nbsp;&lt;br /&gt;If you are using NCS v2.0.x you can have a look at the periphera_uart example.&amp;nbsp;&lt;br /&gt;In the example, if you enable&amp;nbsp;CONFIG_BT_NUS_SECURITY_ENABLED, you can find that:&lt;/p&gt;
&lt;p&gt;- On the first bond, after the&amp;nbsp;bonding is finished, you will receive&amp;nbsp;pairing_complete() call back.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;- On reconnection to a bonded device, you will not receive&amp;nbsp;pairing_complete() but instead receive&amp;nbsp;security_changed() call back. Note that &lt;span&gt;security_changed belong to&amp;nbsp;&lt;/span&gt;conn_callbacks when the&amp;nbsp;&lt;span&gt;pairing_complete() belongs to&amp;nbsp;conn_auth_info_callbacks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>