<?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>CAF BLE state bond limit</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78815/caf-ble-state-bond-limit</link><description>Hi, I am trying to use the CAF BLE state module to manage my bluetooth connection. 
 To understand how it works I have been testing the nRF desktop application, which makes extensive use of the CAF BLE state module. The documentation of nRF desktop states</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Aug 2021 08:19:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78815/caf-ble-state-bond-limit" /><item><title>RE: CAF BLE state bond limit</title><link>https://devzone.nordicsemi.com/thread/326916?ContentTypeID=1</link><pubDate>Fri, 27 Aug 2021 08:19:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35817b2a-7113-44a9-80ad-4b9a85b7a8d3</guid><dc:creator>langestefann</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;Thanks a lot for your very detailed answer. This cleared up many doubts I had.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Stefan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CAF BLE state bond limit</title><link>https://devzone.nordicsemi.com/thread/326230?ContentTypeID=1</link><pubDate>Mon, 23 Aug 2021 15:13:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85c09714-e4d9-4a6d-85c0-5ff0591aa9d0</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Some background information:&lt;/p&gt;
&lt;p&gt;BLE state module was previously part of nRF Desktop application, then it was separated to CAF. It follows nRF Desktop&amp;#39;s assumptions related to Bluetooth operations. E.g. it assumes that peripheral has one bond per Bluetooth&amp;nbsp;local identity, but the peripheral could use multiple Bluetooth local identities. When peripheral device uses given local identity, only the Bluetooth central that is bonded with that local identity can connect with the peripheral (if peripheral device has no bonded central for given local identity, any central may connect and bond to it).&lt;/p&gt;
&lt;p&gt;Because of this&amp;nbsp;assumption, the module disallows for peripheral to have more than one bond per local identity.&lt;/p&gt;
&lt;p&gt;To answer your questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;How should I use the CAF BLE state module regarding bonds? I would like to be able to store multiple bonds.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Bluetooth bonds management is not actually performed by CAF BLE state. Still, you could use multiple Bluetooth local identities and switch between them using ble_peer_operation_event. In nRF Desktop this task is implemented in ble_bond. The ble_bond module has many application-specific features (e.g. in nRF Desktop Bluetooth bonds are controlled using click_event&amp;nbsp;related to predefined button), so the module is not part of CAF. You could implement needed functionalities in similar way for your application using Zephyr&amp;#39;s Bluetooth API. See the following documentation pages for details:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/doc/ble_bond.html#nrf-desktop-ble-bond"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/doc/ble_bond.html#nrf-desktop-ble-bond&lt;/a&gt;&amp;nbsp;- BLE bond module from nRF Desktop (source code available in src/applications/nrf_desktop/modules/ble_bond.c)&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/caf/caf_overview.html#c.ble_peer_operation_event"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/libraries/caf/caf_overview.html#c.ble_peer_operation_event&lt;/a&gt;&amp;nbsp;- BLE peer operation event&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/README.html#bluetooth-in-nrf-desktop"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/README.html#bluetooth-in-nrf-desktop&lt;/a&gt;&amp;nbsp;- Bluetooth guide related to nRF Destkop and Bluetooth Kconfig options that could be relevant for your application.​&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;How can I delete bond information on the peripheral device (nRF52840)? &lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use bt_unpair&amp;nbsp;function. &lt;a href="https://docs.zephyrproject.org/latest/reference/bluetooth/gap.html#c.bt_unpair"&gt;https://docs.zephyrproject.org/latest/reference/bluetooth/gap.html#c.bt_unpair&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;See &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/doc/ble_bond.html#peer-erasing"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/nrf_desktop/doc/ble_bond.html#peer-erasing&lt;/a&gt;&amp;nbsp;for details regarding bond erase in nRF Desktop. Keep in mind that peer erase functionality on nRF52840DK is by default enabled only in configuration that works as a dongle. You must enable it in configuration in order to use it for other configurations.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;I have noticed that if I delete bond information from my phone and try to reconnect to my peripheral device&amp;nbsp;it will refuse the connection. Is there any way to handle this behaviour so that I can allow the device to reconnect again?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If your phone (central) has deleted bond information it is expected to be unable to reconnect with peripheral device. In that case you should remove bond information from peripheral and bond with the phone again. If you really want to let your phone to connect with the peripheral overwriting bond on peripheral device you should enable CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE. Keep in mind that it&amp;#39;s not a good practice, since this would enable cases where an attacker could copy the peer device&amp;nbsp;address to connect and start an unauthenticated pairing procedure to replace the existing bond.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>