<?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>pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/125970/pc-ble-driver-py-how-to-use-numerical-comparison</link><description>Hi, 
 
 I know that pc-ble-driver-py is archived but as there is no real alternative to it, I&amp;#39;m still using this package... 
 
 I&amp;#39;m using BLE nRF52840 dongle to connect to a BLE target. 
 When using exemple &amp;quot;test_lesc_security.py&amp;quot;, I&amp;#39;m able to connect</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 Dec 2025 14:28:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/125970/pc-ble-driver-py-how-to-use-numerical-comparison" /><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/557777?ContentTypeID=1</link><pubDate>Wed, 31 Dec 2025 14:28:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb0035c3-e4fc-4e56-94e8-b4ea4910e147</guid><dc:creator>Antoine.B</dc:creator><description>&lt;p&gt;Last update:&lt;/p&gt;
&lt;p&gt;Following this spec :&amp;nbsp;&lt;a title="S145 SoftDevice API documentation: sd_ble_gap_auth_key_reply" href="https://docs.nordicsemi.com/bundle/s145-latest/page/group_BLE_GAP_FUNCTIONS_ga01e04f368c8e7b3aaa31740dbd53bd12.html#ga01e04f368c8e7b3aaa31740dbd53bd12" rel="noopener noreferrer" target="_blank"&gt;https://docs.nordicsemi.com/bundle/s145-latest/page/group_BLE_GAP_FUNCTIONS_ga01e04f368c8e7b3aaa31740dbd53bd12.html#ga01e04f368c8e7b3aaa31740dbd53bd12&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;NULL must be used instead of passkey when confirming LE Secure Connections Numeric Comparison.&lt;/p&gt;
&lt;p&gt;Code must be adapted as below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;    def on_gap_evt_passkey_display(self, ble_driver, conn_handle, match_request, passkey): # Reached with IOCaps = keyboard_display/none/yesno
        self.logger.info(&amp;quot;Central on_gap_evt_passkey_display: {}&amp;quot;.format(passkey))
        ascii_passkey = &amp;#39;&amp;#39;.join(map(chr, passkey))
        self.logger.info(f&amp;quot;Central on_gap_evt_passekey_display (ASCII): {ascii_passkey}&amp;quot;)

        if match_request:
            resp = driver.sd_ble_gap_auth_key_reply(self.adapter.driver.rpc_adapter, conn_handle, driver.BLE_GAP_AUTH_KEY_TYPE_PASSKEY, None)
            self.logger.info(f&amp;quot;auth_key_reply return value: {resp}&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I tried with b&amp;#39;\0&amp;#39; for NULL character but only work with &amp;quot;None&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Anyway, numerical comparison is available following the details posted by &lt;a href="https://devzone.nordicsemi.com/members/aryan"&gt;Susheel Nuguru&lt;/a&gt;&amp;nbsp; (thanks again !) and using &amp;#39;None&amp;#39; instead of &amp;#39;pk.cast()&amp;#39;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/557755?ContentTypeID=1</link><pubDate>Tue, 30 Dec 2025 16:34:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c52ad6a-75fb-4e8a-9f2b-8b30ba8c1b04</guid><dc:creator>Antoine.B</dc:creator><description>&lt;p&gt;Quick update on the topic:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The function&amp;nbsp;&amp;quot;sd_ble_gap_auth_key_reply&amp;quot; return the value: 7&lt;pre class="ui-code" data-mode="python"&gt;resp = driver.sd_ble_gap_auth_key_reply(self.adapter.driver.rpc_adapter, conn_handle, driver.BLE_GAP_AUTH_KEY_TYPE_NONE, pk.cast())&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/s145-latest/page/group_nrf_error_ga0a5831cf5092e0dd43a01869676ee076.html#ga0a5831cf5092e0dd43a01869676ee076,"&gt;https://docs.nordicsemi.com/bundle/s145-latest/page/group_nrf_error_ga0a5831cf5092e0dd43a01869676ee076.html#ga0a5831cf5092e0dd43a01869676ee076,&lt;/a&gt;&amp;nbsp;it&amp;#39;s look like 7 means NRF_ERROR_INVALID_PARAM.&lt;/p&gt;
&lt;p&gt;Still with the documentation (&lt;a href="https://docs.nordicsemi.com/bundle/s145-latest/page/group_BLE_GAP_FUNCTIONS_ga01e04f368c8e7b3aaa31740dbd53bd12.html#ga01e04f368c8e7b3aaa31740dbd53bd12"&gt;https://docs.nordicsemi.com/bundle/s145-latest/page/group_BLE_GAP_FUNCTIONS_ga01e04f368c8e7b3aaa31740dbd53bd12.html#ga01e04f368c8e7b3aaa31740dbd53bd12&lt;/a&gt;), function &amp;quot;sd_ble_gap_auth_key_reply&amp;quot; only have 3 parameters (conn_handle, key_type, p_key). But in the pc-ble-driver-py, this function have 4 parameters (&amp;quot;adapter&amp;quot; added). Why there is this difference ?&lt;/p&gt;
&lt;p&gt;Does somone know what could cause NRF_ERROR_INVALID_PARAM ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Antoine&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/557459?ContentTypeID=1</link><pubDate>Fri, 19 Dec 2025 15:44:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7500f942-98ad-44a4-b98a-7b504b8785a2</guid><dc:creator>Antoine.B</dc:creator><description>&lt;p&gt;Hi Shusheel,&lt;/p&gt;
&lt;p&gt;Thank you for the reply !&lt;/p&gt;
&lt;p&gt;I just update pc-ble-driver-py following your response to have the code below:&lt;/p&gt;
&lt;p&gt;- ble_driver:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;elif evt_id == BLEEvtID.gap_evt_passkey_display:
    for obs in self.observers:
        passkey = BLEGapPasskeyDisplay.from_c(ble_event.evt.gap_evt.params.passkey_display)

        obs.on_gap_evt_passkey_display(
            ble_driver=self,
            conn_handle=ble_event.evt.gap_evt.conn_handle,
            passkey=passkey.passkey,
            match_request=ble_event.evt.gap_evt.params.passkey_display.match_request
        )&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;- observers:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;def on_gap_evt_passkey_display(
    self, ble_driver, conn_handle, passkey, match_request):
    logger.debug(
        &amp;quot;evt&amp;gt; passkey_display conn({}) passkey({}), match_request({})\n&amp;quot;.format(
            conn_handle, passkey, match_request
        )
    )&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;- On my test script:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;def on_gap_evt_passkey_display(self, ble_driver, conn_handle, passkey, match_request): # Reached with IOCaps = keyboard_display/none/yesno
    self.logger.info(&amp;quot;Central on_gap_evt_passkey_display: {}&amp;quot;.format(passkey))
    ascii_passkey = &amp;#39;&amp;#39;.join(map(chr, passkey))
    self.logger.info(f&amp;quot;Central on_gap_evt_passekey_display (ASCII): {ascii_passkey}&amp;quot;)
    passkeyQueue.put(passkey)
    
    if match_request:
        # Send passkey as it has been printed on display
        pk = util.list_to_uint8_array(passkey) #b&amp;quot;\0&amp;quot;)#
        driver.sd_ble_gap_auth_key_reply(self.adapter.driver.rpc_adapter,conn_handle,driver.BLE_GAP_AUTH_KEY_TYPE_PASSKEY, pk.cast())
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;match_request&amp;quot; parameter is correctly set to 1 so the &amp;quot;if match_request&amp;quot; condition is True and sd_ble_gap_auth_key_reply is reached as expected.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But I still got issue with bonding as status returned is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;result = self.adapter.evt_sync[self.conn_handle].wait(BLEEvtID.gap_evt_auth_status)

#=&amp;gt; result = {&amp;#39;error_src&amp;#39;: 0, &amp;#39;bonded&amp;#39;: 0, &amp;#39;sm1_levels&amp;#39;: &amp;lt;pc_ble_driver_py.lib.nrf_ble_driver_sd_api_v5.ble_gap_sec_levels_t; proxy of &amp;lt;Swig Object of type &amp;#39;ble_gap_sec_levels_t *&amp;#39; at 0x000002CBAD782370&amp;gt; &amp;gt;, &amp;#39;sm2_levels&amp;#39;: &amp;lt;pc_ble_driver_py.lib.nrf_ble_driver_sd_api_v5.ble_gap_sec_levels_t; proxy of &amp;lt;Swig Object of type &amp;#39;ble_gap_sec_levels_t *&amp;#39; at 0x000002CBAE474FF0&amp;gt; &amp;gt;, &amp;#39;kdist_own&amp;#39;: &amp;lt;pc_ble_driver_py.ble_driver.BLEGapSecKDist object at 0x000002CBAE474C40&amp;gt;, &amp;#39;kdist_peer&amp;#39;: &amp;lt;pc_ble_driver_py.ble_driver.BLEGapSecKDist object at 0x000002CBAE474C70&amp;gt;, &amp;#39;auth_status&amp;#39;: &amp;lt;BLEGapSecStatus.timeout: 1&amp;gt;}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is there something else to perform numerical comparison ? Like sending something else than just the passkey ? Or waiting for an event that I could miss and not set the hanlder ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Antoine&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/557398?ContentTypeID=1</link><pubDate>Fri, 19 Dec 2025 07:13:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e9404e4-ebf3-4a3c-ba49-0cb29ea66166</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Antoine,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am no expert in the pc-ble-driver, just reading and reviewing the code along with you for the first time, but I have good experience with BLE.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;SoftDevice sends&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;ble_gap_evt_passkey_display_t&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;with both the six-digit passkey and a&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;match_request&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;bit; when&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;match_request=1&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;you must reply with&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;sd_ble_gap_auth_key_reply&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;to accept/reject the comparison. pc-ble-driver-py seems to be dropping that flag, do not know why. So your script never knows to confirm and the pairing stalls. To fix this you must extend the feature by carrying the match_request through&amp;nbsp;&lt;span&gt;BLEGapPasskeyDisplay, forward it in the ble_driver and observers and update your handler to call&amp;nbsp;sd_ble_gap_auth_key_reply with the proper key when match_request is true.&amp;nbsp; I do not have any sample or code snippets to show you but I think this most likely seems to be the reason.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/557304?ContentTypeID=1</link><pubDate>Thu, 18 Dec 2025 10:58:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6680f30c-b67b-472f-9a19-9c2aee953d9e</guid><dc:creator>Antoine.B</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for the details response.&lt;/p&gt;
&lt;p&gt;As I don&amp;#39;t program that much on microcontrollers, it can take some times to perform the test with Bluetoth shell.&lt;/p&gt;
&lt;p&gt;From what I understand, at the event &amp;quot;on_gap_evt_passkey_display&amp;quot; I need to send back the passkey with &amp;quot;sd_ble_gap_auth_key_reply&amp;quot; as below ?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;    def on_gap_evt_passkey_display(self, ble_driver, conn_handle, passkey): # Reached with IOCaps = keyboard_display/none/yesno
        self.logger.info(&amp;quot;Central on_gap_evt_passkey_display: {}&amp;quot;.format(passkey))
        ascii_passkey = &amp;#39;&amp;#39;.join(map(chr, passkey))
        self.logger.info(f&amp;quot;Central on_gap_evt_passekey_display (ASCII): {ascii_passkey}&amp;quot;)
        passkeyQueue.put(passkey)

        # Send passkey as it has been printed on display
        pk = util.list_to_uint8_array(passkey)
        driver.sd_ble_gap_auth_key_reply(self.adapter.driver.rpc_adapter,conn_handle,driver.BLE_GAP_AUTH_KEY_TYPE_PASSKEY, pk.cast())&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Or should I add a parameter &amp;quot;match_request&amp;quot; in ble_driver.py (and observers.py) for on_gap_evt_passkey_display ?&lt;/p&gt;
&lt;p&gt;By any chance, do you have any exemple on that ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As nRF Connect is based on &amp;quot;pc-ble-driver-js&amp;quot;, the &amp;quot;numerical comparison&amp;quot; method is a difference between pc-ble-driver-py and pc-ble-driver-js ? Both shouldn&amp;#39;t have the same functionalities ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Antoine&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/557206?ContentTypeID=1</link><pubDate>Wed, 17 Dec 2025 12:33:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3ea9407-7db6-479b-be28-2ab85d406106</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Bluetooth Shell sample should work on ESP32 if you chose the right board files as this is a Zephyr sample.n the current&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;pc_ble_driver_py&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;sources the GAP passkey event is only half-exposed. When the SoftDevice raises&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;BLE_GAP_EVT_PASSKEY_DISPLAY&lt;/span&gt;, the C struct includes a&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;match_request&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;flag that signals “this is numeric comparison; please tell me if the numbers match.” The Python glue strips that bit:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span title="pc_ble_driver_py/ble_driver.py (line 919)"&gt;pc_ble_driver_py/ble_driver.py (line 919)&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;only copies the six-byte passkey, and when the event is dispatched &lt;span title="pc_ble_driver_py/ble_driver.py (line 2718)"&gt;pc_ble_driver_py/ble_driver.py L2718&lt;/span&gt;&amp;nbsp;observers receive just&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;passkey=…&lt;/span&gt;.&amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Because&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;match_request&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;never reaches Python, the app can’t know it should call&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;sd_ble_gap_auth_key_reply&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;with&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;BLE_GAP_AUTH_KEY_TYPE_PASSKEY&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(accept) or&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;_NONE&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(reject), so bonding fails even though the digits match.&lt;/p&gt;
&lt;p&gt;That is why nRF Connect Desktop works (its stack seems to be handling the confirm), while&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;pc-ble-driver-py&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;doesn’t. To support numeric comparison you will have to extend the driver to forward&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;match_request&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;through the observer chain and update your script to send the confirmation key reply. In short, the pc-ble-driver do not seem to support what you want unless you add&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/556963?ContentTypeID=1</link><pubDate>Mon, 15 Dec 2025 12:51:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f0239c7-702c-4fd4-b481-6b8b59403c8d</guid><dc:creator>Antoine.B</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. But do you want me to flash the nRF52840 dongle with Bluetooth Shell ? Or the target board ?&lt;/p&gt;
&lt;p&gt;The target board running with ESP32, the Bluetooth Shell cannot be used right ?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Antoine&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/556801?ContentTypeID=1</link><pubDate>Thu, 11 Dec 2025 18:12:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9257ab8-cff4-4a28-9673-38d322db85f5</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;Antoine&lt;/span&gt;,&lt;/p&gt;
&lt;p&gt;Before we proceed further, I would like to point out that there is an alternative in the nRF Connect SDK. It is the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-3.1.1/page/zephyr/connectivity/bluetooth/bluetooth-shell.html"&gt;Bluetooth Shell&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Could you please try that first?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/556422?ContentTypeID=1</link><pubDate>Mon, 08 Dec 2025 08:58:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:decc2415-31b3-4377-9e90-8cdb0ffbadc1</guid><dc:creator>Antoine.B</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your replay.&lt;br /&gt;The BLE target is a custom board (ESP32). This board display the passkey (screen connected) and automatically approved the numerical comparison (no action required from human on the target board).&lt;/p&gt;
&lt;p&gt;And with nRF Connect Desktop (so on the PC side), the numerical comparison work properly (passkey display and button &amp;quot;match&amp;quot;/&amp;quot;no match&amp;quot;).&lt;/p&gt;
&lt;p&gt;But to use numerical comparison with pc-ble-driver-py (and not nRF Connect anymore in order to perform production test and automatized the BLE connexion) there is not example.&lt;br /&gt;I tried the following:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt; def on_gap_evt_passkey_display(self, ble_driver, conn_handle, passkey): # Reached with IOCaps = keyboard_display/none/yesno
        self.logger.info(&amp;quot;Central on_gap_evt_passkey_display: {}&amp;quot;.format(passkey))
        ascii_passkey = &amp;#39;&amp;#39;.join(map(chr, passkey))
        self.logger.info(f&amp;quot;Central on_gap_evt_passekey_display (ASCII): {ascii_passkey}&amp;quot;)
        passkeyQueue.put(passkey)

        # Send passkey as it has been printed on display
        pk = util.list_to_uint8_array(b&amp;#39;\0&amp;#39;)
        driver.sd_ble_gap_auth_key_reply(self.adapter.driver.rpc_adapter,conn_handle,driver.BLE_GAP_AUTH_KEY_TYPE_PASSKEY, pk.cast())&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the event trigger with the correct passkey displayed but the auth_status is not successful :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;def check_bond(self):
    result = self.adapter.evt_sync[self.conn_handle].wait(BLEEvtID.gap_evt_auth_status)
    self.logger.info(&amp;quot;Check bond result: {}&amp;quot;.format(result))
    if result != BLEGapSecStatus.success:
        raise NordicSemiException(&amp;quot;Auth Status returned error code: {}&amp;quot;.format(result))&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here &amp;quot;result&amp;quot; is a dict with &amp;quot;bond&amp;quot;:0.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;With below the sec_params for adapter.driver.ble_gap_authenticate:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="python"&gt;self.sec_params = BLEGapSecParams(bond=True,
                                          mitm=True,
                                          lesc=True,
                                          keypress=True,
                                          io_caps=BLEGapIOCaps.yesno,
                                          oob=False,
                                          min_key_size=7,
                                          max_key_size=16,
                                          kdist_own=self.kdist_own,
                                          kdist_peer=self.kdist_peer)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Antoine&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pc-ble-driver-py How to use numerical comparison ?</title><link>https://devzone.nordicsemi.com/thread/556312?ContentTypeID=1</link><pubDate>Fri, 05 Dec 2025 10:05:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec48c3f2-5d22-4552-8653-465a53c0f1ef</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Can you share some more details on what this BLE target device is exactly? If you&amp;#39;re using the passkey display event and want to confirm it using an nRF52840 Dongle, the most common way to do so is to have the Dongle connected to a serial terminal that writes out the passkey as well and you can confirm it&amp;#39;s the same like that. Then a button press or similar usually will allow the devices to connect, or if the target expects some sort of confirmation, you need to confirm the passkey on the target side. Most likely via a button.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>