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

How to recognize unpair android command at firmware BLE_GAP_EVT_DISCONNECTED event

Hello! 

I use nRF52-DK wuth android device. DK connects to android device and  works with it well. But I want a paired DK make unpaired from android device by performing unpair command, which will be accompanied by pm_peers_delete() functions (or something else) in firmware. For this I am trying to use BLE_GAP_EVT_DISCONNECTED event at firmware. But I can't recognize unpair android event from another android events (like just switch power off). I have not met example with this future implemented. I feel that I am going in wrong way or I should use another events. Would you give me prompt or show code example with true way to implement this future.

Parents
  • Hi, 

     

    But I can't recognize unpair android event from another android events (like just switch power off).

     You will get both of the disconnect reasons are the BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION.

    The peer manager which handles pairing requests will for security reasons reject new pairing requests from an already bonded peer device. You could add the following event handling to the PM callback if you want to allow repairing:

           case PM_EVT_CONN_SEC_CONFIG_REQ: 
           {
                pm_conn_sec_config_t config = {.allow_repairing = true};
                pm_conn_sec_config_reply(p_evt->conn_handle, &config);
           }

    The other alternative is to actually delete the bond from the nRF device. For the SDK examples, you can delete all bonds by pressing board button 2 while resetting the device.

     -Amanda H.

Reply
  • Hi, 

     

    But I can't recognize unpair android event from another android events (like just switch power off).

     You will get both of the disconnect reasons are the BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION.

    The peer manager which handles pairing requests will for security reasons reject new pairing requests from an already bonded peer device. You could add the following event handling to the PM callback if you want to allow repairing:

           case PM_EVT_CONN_SEC_CONFIG_REQ: 
           {
                pm_conn_sec_config_t config = {.allow_repairing = true};
                pm_conn_sec_config_reply(p_evt->conn_handle, &config);
           }

    The other alternative is to actually delete the bond from the nRF device. For the SDK examples, you can delete all bonds by pressing board button 2 while resetting the device.

     -Amanda H.

Children
Related