<?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>Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116903/need-to-disable-pairing-with-windows-10</link><description>Greetings, 
 
 I&amp;#39;ve searched the forum, but haven&amp;#39;t found a particular answer. I need to configure the project to not pair with Windows 10 PC because it blocks other software that needs to send commands to the device. This is critical. Tried to pair it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Dec 2024 13:37:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116903/need-to-disable-pairing-with-windows-10" /><item><title>RE: Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/thread/515751?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2024 13:37:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9532cd69-c645-4fee-be0e-d9e43e3c7165</guid><dc:creator>Corapche</dc:creator><description>&lt;p&gt;&lt;span&gt;Ok, so it seems I fixed it somehow. I had issues with importing files in the SEGGER Embedded Studio with dependencies. It seems that if you don&amp;#39;t include the headers that are connected to peer_manager.c (or other files that you might use) in the main.c file, it won&amp;#39;t show the dependencies as imported. Also clean &amp;amp; build seems to fix it. Had to manually adjust some things in the component folder due to issues with the sdk_config file, mainly in the IF part because the sdk_config didn&amp;#39;t have those definitions to enable/disable them. I imported the peer manager and added the following code, which blocks peering with PC Windows 10 devices.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// PASSKEY
#define PASSKEY_TXT                     &amp;quot;Passkey:&amp;quot;                                  /**&amp;lt; Message to be displayed together with the pass-key. */
#define PASSKEY_TXT_LENGTH              8                                           /**&amp;lt; Length of message to be displayed together with the pass-key. */
#define PASSKEY_LENGTH                  6                                           /**&amp;lt; Length of pass-key received by the stack for display. */

#define SEC_PARAM_BOND                  1                                           /**&amp;lt; Perform bonding. */
#define SEC_PARAM_MITM                  1                                           /**&amp;lt; Man In The Middle protection required (applicable when display module is detected). */
#define SEC_PARAM_LESC                  1                                           /**&amp;lt; LE Secure Connections enabled. */
#define SEC_PARAM_KEYPRESS              0                                           /**&amp;lt; Keypress notifications not enabled. */
#define SEC_PARAM_IO_CAPABILITIES       BLE_GAP_IO_CAPS_DISPLAY_ONLY                /**&amp;lt; Display I/O capabilities. */
#define SEC_PARAM_OOB                   0                                           /**&amp;lt; Out Of Band data not available. */
#define SEC_PARAM_MIN_KEY_SIZE          7                                           /**&amp;lt; Minimum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE          16                                          /**&amp;lt; Maximum encryption key size. */&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for the Peer Manager initialization.
 */
static void peer_manager_init(void)
{
    ble_gap_sec_params_t sec_param;
    ret_code_t           err_code;

    err_code = pm_init();
    APP_ERROR_CHECK(err_code);

    memset(&amp;amp;sec_param, 0, sizeof(ble_gap_sec_params_t));

    // Security parameters to be used for all security procedures.
    sec_param.bond           = SEC_PARAM_BOND;
    sec_param.mitm           = SEC_PARAM_MITM;
    sec_param.lesc           = SEC_PARAM_LESC;
    sec_param.keypress       = SEC_PARAM_KEYPRESS;
    sec_param.io_caps        = SEC_PARAM_IO_CAPABILITIES;
    sec_param.oob            = SEC_PARAM_OOB;
    sec_param.min_key_size   = SEC_PARAM_MIN_KEY_SIZE;
    sec_param.max_key_size   = SEC_PARAM_MAX_KEY_SIZE;
    sec_param.kdist_own.enc  = 1;
    sec_param.kdist_own.id   = 1;
    sec_param.kdist_peer.enc = 1;
    sec_param.kdist_peer.id  = 1;

    err_code = pm_sec_params_set(&amp;amp;sec_param);
    APP_ERROR_CHECK(err_code);

    err_code = pm_register(pm_evt_handler);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/thread/513655?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2024 14:20:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9e7dadb-d64c-416d-996f-cb20fb3c9bf4</guid><dc:creator>Corapche</dc:creator><description>&lt;p&gt;Update:&lt;br /&gt;&lt;br /&gt;I have implemented a timeout after 13 seconds, so it disconnects a device if it is connected longer than 13 seconds. The issue is when it is paired with Windows 10, it blocks the timer somehow and it can&amp;#39;t disconnect. Any suggestions?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;**@brief Function for handling BLE events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 * @param[in]   p_context   Unused.
 */
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    uint32_t err_code;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            uart_init();
            NRF_LOG_INFO(&amp;quot;Connected&amp;quot;);
            //err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            //APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr, m_conn_handle);
            APP_ERROR_CHECK(err_code);
            // Start the inactivity timer
            err_code = app_timer_start(m_inactivity_timer_id, APP_TIMER_TICKS(13000), NULL);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            // Stop the inactivity timer
            err_code = app_timer_stop(m_inactivity_timer_id);
            APP_ERROR_CHECK(err_code);
            // Wait for UART to finish
            while(app_uart_tx_done());
            app_uart_close();
            NRF_LOG_INFO(&amp;quot;Disconnected&amp;quot;);
            // LED indication will be changed when advertising starts.
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            break;

        case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
        {
            NRF_LOG_DEBUG(&amp;quot;PHY update request.&amp;quot;);
            ble_gap_phys_t const phys =
            {
                .rx_phys = BLE_GAP_PHY_AUTO,
                .tx_phys = BLE_GAP_PHY_AUTO,
            };
            err_code = sd_ble_gap_phy_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, &amp;amp;phys);
            APP_ERROR_CHECK(err_code);
        } break;

        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
            // Pairing not supported
            err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
            // No system attributes have been stored.
            err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GATTC_EVT_TIMEOUT:
            // Stop the inactivity timer
            err_code = app_timer_stop(m_inactivity_timer_id);
            APP_ERROR_CHECK(err_code);
            // Disconnect on GATT Client timeout event.
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gattc_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GATTS_EVT_TIMEOUT:
            // Stop the inactivity timer
            err_code = app_timer_stop(m_inactivity_timer_id);
            APP_ERROR_CHECK(err_code);
            // Disconnect on GATT Server timeout event.
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gatts_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break;

        default:
            // No implementation needed.
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/thread/513458?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2024 14:15:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aba3251a-c1d3-4e56-9b48-22259b04b5fd</guid><dc:creator>Corapche</dc:creator><description>&lt;p&gt;Ok, I started with that example. So far, I tweaked the&amp;nbsp;peer_manager_init function. This seems to disable access Windows 10 connecting with the devkit, but connect with the phone, which is what I need. Now I want to integrate that function in my project and add peer_manager.c with its&amp;#39; dependencies. I&amp;#39;m stuck on that part with Segger. How do I add that with the dependencies? I have&amp;nbsp;&lt;span&gt;peer_manager.c in the components folder of the project.&lt;/span&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1733321641224v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/thread/513260?ContentTypeID=1</link><pubDate>Tue, 03 Dec 2024 15:22:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05da813b-9efd-4f05-ad64-d327e84dbafd</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;The HID keyboard example should support passkey.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/thread/513181?ContentTypeID=1</link><pubDate>Tue, 03 Dec 2024 11:39:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:159624f9-e9c9-46b5-a5fc-1d2f93f7d910</guid><dc:creator>Corapche</dc:creator><description>&lt;p&gt;I will check this. BTW, is it possible to add password before pairing a device?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/thread/513145?ContentTypeID=1</link><pubDate>Tue, 03 Dec 2024 09:31:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ed29cac-e850-4334-97c6-e15d185de1e0</guid><dc:creator>Kenneth</dc:creator><description>[quote user=""]Tried to pair it with Android, but it rejects the pairing.[/quote]
&lt;p&gt;This may indicate the problem is not really the Windows PC, but that the device is advertising with whitelist, and will then only connect to a previous bonded device. Maybe use the restart advertisement without whitelist api, this will allow connection with new peer device. The HID examples show this.&lt;/p&gt;
&lt;p&gt;But as mentioned, if you don&amp;#39;t change the gap address and you already&amp;nbsp;have a central device in the area with a bonded relationship, the central device (even if it&amp;#39;s not Windows) will try to connect.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/thread/513118?ContentTypeID=1</link><pubDate>Tue, 03 Dec 2024 08:12:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94a7f0ab-505e-43bf-8ebc-1903cb21b929</guid><dc:creator>Corapche</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is not an option because the device could be potentially abused by a 3rd party (blocking the device with pairing). The devices can not change advertising because they have a fixed name (specifications based from the project). Is there any other way that this could be fixed?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to disable pairing with Windows 10</title><link>https://devzone.nordicsemi.com/thread/513054?ContentTypeID=1</link><pubDate>Mon, 02 Dec 2024 17:47:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26f6e2d5-886e-4faa-852c-88ca07845bb5</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Ideally you should go into Bluetooth setting of Windows and remove the BLE peripheral device from there, else Windows will automatically try to connect every time it&amp;#39;s within range.&lt;/p&gt;
&lt;p&gt;The other way is really to change the gap address of the BLE peripheral, since it then will appear as a new BLE device. You can find an example here:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/57881/store-custom-application-data-using-peer-manager/234701"&gt;RE: Store Custom application data using peer manager&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>