This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is it possible in a HID mode disable bonding to HID?

Hi!

SDK15, s132, SD6.0.0, nRF52832

I have nRF52832 in central mode and some bonded HID devices and another nRF52832 peripherial devices.

Now in the my central nRF52832 I start advertise with HID services. If any smartphon wants to bond with my device, it can bond with passkey. 

How to make on my nRF52832 HID device that all boneded devices will works and connect, but there will be no bond request from any not bonded smartphon?

Parents Reply Children
  • Yes, I mean just allow connect, but without bonding. If I set pm_sec_params_set() with p_sec_param = NULL, I can't connect to already bonded devices with central. As you remember, I use central with whitelist and advertise with HID service and with nus services. When pm_sec_params_set() with p_sec_param = NULL I also need possibility connect to previous bonded devices with central.

  • If you need to customize for such specific use case, I think you need to modify the peer manager code on your need. The bonding process start with SEC_PARAMS_REQUEST event and you can call sd_ble_gap_sec_params_reply() with PAIRING_NOT_SUP. Please have a look here

    Note that an already bonded device when reconnecting and re-encryp the link, there will be no SEC_PARAMS_REQUEST event, but a SEC_INFO_REQUEST event. Please have a look here.

  • I try to use ble_app_bms project.

    In func static void advertising_init(void) I configure whitelist for works. 

    init.config.ble_adv_whitelist_enabled = false;

    also I configure flags with BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE

    But if I try to comment slow advertise- project fall.

    What should correct for works with whitelist and one advertise settings? Slow, for example.

    static void advertising_init(void)
    {
        ret_code_t     err_code;
        ble_advertising_init_t init;
    
        memset(&init, 0, sizeof(init));
    
        init.advdata.name_type                = BLE_ADVDATA_FULL_NAME;
        init.advdata.include_appearance       = true;
        init.advdata.flags                    = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
        
        init.advdata.uuids_complete.uuid_cnt  = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
        init.advdata.uuids_complete.p_uuids   = m_adv_uuids;
    
        init.config.ble_adv_whitelist_enabled = true; // false
        init.config.ble_adv_fast_enabled      = true;
        init.config.ble_adv_fast_interval     = APP_ADV_FAST_INTERVAL;
    ////    init.config.ble_adv_fast_timeout      = APP_ADV_DURATION;
    ////    init.config.ble_adv_slow_enabled      = false;
    
        init.evt_handler   = on_adv_evt;
        init.error_handler = ble_advertising_error_handler;
    
        err_code = ble_advertising_init(&m_advertising, &init);
        APP_ERROR_CHECK(err_code);
    
        ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    }

  • You may need to look at the HID mouse example that show bonding and whitelist, but the general idea is that you will now need to handle the BLE_ADV_EVT_WHITELIST_REQUEST event in on_adv_evt() to reply with the ble_advertising_whitelist_reply().

Related