HID example how to disable automatically bound

Hi,

I'm using SDK17.02 HID example on nRF52810.

What can I do so that my device is not automatically bound when it connects with other new devices.

Parents
  • Hi Taylor, 

    By default when a phone connect to a HID device it will automatically request bonding. It's the default behavior because HID device is usually a keyboard or mouse so the link should be encrypted. 

    You can reject the pairing request from the phone if the device doesn't want to bond at the moment. 

    You can have a look at this post: Option to disable Peer Manager 

    Note that you can block connection from unwanted device by using whitelisting. This way you don't need to modify the peer manager. 

  • Hi Hung Bui,

    There is a new question.

    I have enabled automatically request bonding. When I want to  automatically disconnect with a phone,  my device will automatically connecting again. For example the  battery on low power.

    I have tried using sd_ble_gap_disconnect and stopping advertising immediately, it doesn't work.

    BTW, I could not delete bonding information because my device need to connect automatically when I start advertising again.

     

  • Hi Taylor, 
    If you disconnect and stop advertising it shouldn't be reconnected. 
    There are 2 things you need to check: 

     - Check if you actually disconnect after you call sd_ble_gap_disconnect (). You can check if you receive BLE_GAP_EVT_DISCONNECTED event. You can also verify using a sniffer

    - Check if the code automatically start advertising after disconnected. In most of our code we will start advertising after we disconnect. Please make sure you remove such code. If you use ble_advertising module, you need to set ble_adv_on_disconnect_disabled=true using ble_advertising_modes_config_set() call. 

Reply
  • Hi Taylor, 
    If you disconnect and stop advertising it shouldn't be reconnected. 
    There are 2 things you need to check: 

     - Check if you actually disconnect after you call sd_ble_gap_disconnect (). You can check if you receive BLE_GAP_EVT_DISCONNECTED event. You can also verify using a sniffer

    - Check if the code automatically start advertising after disconnected. In most of our code we will start advertising after we disconnect. Please make sure you remove such code. If you use ble_advertising module, you need to set ble_adv_on_disconnect_disabled=true using ble_advertising_modes_config_set() call. 

Children
Related