<?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 bonding/pairing with pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39468/ble-bonding-pairing-with-pc-ble-driver-py</link><description>Hi, 
 Does the pc_ble_driver_py contain any API for paring or bonding bluetooth devices? And if so, do you have any examples or documentation which explain how to use them? 
 I see that the ble_adaptor class has authenticate() and encrypt() functions</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Oct 2018 14:55:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39468/ble-bonding-pairing-with-pc-ble-driver-py" /><item><title>RE: BLE bonding/pairing with pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/153298?ContentTypeID=1</link><pubDate>Wed, 17 Oct 2018 14:55:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d724c4c2-bc20-4ac9-9192-4e8e31615bfe</guid><dc:creator>james s</dc:creator><description>&lt;p&gt;I&amp;#39;ve solved it now, I needed to delete the bond information from the&amp;nbsp;peripheral device which I was connecting to between tests.&amp;nbsp;This is&amp;nbsp;why it wasn&amp;#39;t sending a ble_gap_evt_sec_params_request.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE bonding/pairing with pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/153178?ContentTypeID=1</link><pubDate>Wed, 17 Oct 2018 09:38:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1ae5b2c-0bcd-4eb9-a7e9-640d0e47c7df</guid><dc:creator>james s</dc:creator><description>&lt;p&gt;I&amp;#39;m calling it from the main function of the program, after a connection has been established. I&amp;#39;m developing a central application using the heart_rate_collector example as a starting point, and I&amp;#39;m trying to extend its functionality to include pairing / bonding.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE bonding/pairing with pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/153165?ContentTypeID=1</link><pubDate>Wed, 17 Oct 2018 09:10:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4855a9ab-25d3-462e-a2c0-32f1f33d4744</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;This error code is described in the API documentation:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;This function is only used to reply to a&amp;nbsp;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___b_l_e___g_a_p___e_n_u_m_e_r_a_t_i_o_n_s.html#ggada486dd3c0cce897b23a887bed284fefa6c5eefbcfabbc1ce4a8bcbf550c285ae"&gt;BLE_GAP_EVT_SEC_PARAMS_REQUEST&lt;/a&gt;, calling it at other times will result in an&amp;nbsp;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group__nrf__error.html#gaf0aff2ba7864b34a36b4a96986e1851e"&gt;NRF_ERROR_INVALID_STATE&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Where did you call it from? Are you developing a central or peripheral application using pc-ble-driver-py?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE bonding/pairing with pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/153139?ContentTypeID=1</link><pubDate>Wed, 17 Oct 2018 07:54:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27b706de-d3a7-42a7-b70d-6cf3398b942f</guid><dc:creator>james s</dc:creator><description>&lt;p&gt;Hi J&amp;oslash;rgen, thanks for getting back to me.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve had a look at the documentation you linked to and I&amp;#39;m still having issues with my program. To setup bonding my code is currently:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;self.sec_params = BLEGapSecParams(bond=True,
                                  mitm=False,
                                  lesc=False,
                                  keypress=False,
                                  io_caps=BLEGapIOCaps.none,
                                  oob=False,
                                  min_key_size=7,
                                  max_key_size=16,
                                  kdist_own=self.kdist_own,
                                  kdist_peer=self.kdist_peer)

self.adapter.driver.ble_gap_authenticate(self.conn_handle, self.sec_params)
self.evt_sync.wait(evt=&amp;quot;sec_params&amp;quot;)
self.adapter.driver.ble_gap_sec_params_reply(self.conn_handle,
                                             BLEGapSecStatus.success,
                                             None)

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But this fails with the message &amp;quot;pc_ble_driver_py.exceptions.NordicSemiException: Failed to ble_gap_sec_params_reply. Error code: 8&amp;quot;&lt;/p&gt;
&lt;p&gt;I have also tried running:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;collector.adapter.authenticate(conn_handle, bond=True)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But this failed with the same error. Is there something I&amp;#39;m missing that&amp;#39;s causing this?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;James&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE bonding/pairing with pc-ble-driver-py</title><link>https://devzone.nordicsemi.com/thread/153065?ContentTypeID=1</link><pubDate>Tue, 16 Oct 2018 12:56:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3cf4643-fa67-402d-95d6-fcc281c37232</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You should have a look at the API documentation of the softdevice functions mentioned in the implementation of &lt;a href="https://github.com/NordicSemiconductor/pc-ble-driver-py/blob/master/python/pc_ble_driver_py/ble_adapter.py#L417"&gt;Authenticate&lt;/a&gt; and &lt;a href="https://github.com/NordicSemiconductor/pc-ble-driver-py/blob/master/python/pc_ble_driver_py/ble_adapter.py#L431"&gt;Encrypt&lt;/a&gt; methods, and check how they are used in the SDK examples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#ga7b23027c97b3df21f6cbc23170e55663"&gt;&lt;span&gt;sd_ble_gap_sec_params_reply&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#ga5b10ba191122c7cf7cfccbdf76b3c657"&gt;sd_ble_gap_encrypt&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>