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

Erase bond info

Hi,

Is there any simpler way to erase bond info by not pressing button 2?

In function advertising_init(), I set init.config.ble_adv_whitelist_enabled = false;

I am using hid mouse example in SDK 15.2 and even after disabling whitelist the bond info is not fully erased. 

What exactly happens internally after pressing button 2? Does the OS or the nrf remove bond info?

Parents
  • Hi.

    You can erase bonds where it suits you. Most examples just checks in the start up if button 2 is pressed down, and deletes any bonds if it is pressed down.

    In the \ble_peripheral\ble_app_hids_mouse example you also find a function which can delete bonds, named static void delete_bonds(void), you can just call this function to delete bonds.

    static void delete_bonds(void)
    {
        ret_code_t err_code;
    
        NRF_LOG_INFO("Erase bonds!");
    
        err_code = pm_peers_delete();
        APP_ERROR_CHECK(err_code);
    }

    This function calls pm_peers_delete() which is the function that deletes bonds.

    - Andreas

Reply
  • Hi.

    You can erase bonds where it suits you. Most examples just checks in the start up if button 2 is pressed down, and deletes any bonds if it is pressed down.

    In the \ble_peripheral\ble_app_hids_mouse example you also find a function which can delete bonds, named static void delete_bonds(void), you can just call this function to delete bonds.

    static void delete_bonds(void)
    {
        ret_code_t err_code;
    
        NRF_LOG_INFO("Erase bonds!");
    
        err_code = pm_peers_delete();
        APP_ERROR_CHECK(err_code);
    }

    This function calls pm_peers_delete() which is the function that deletes bonds.

    - Andreas

Children
  • Hi AndreasF,

    Thank you for your reply.

    Current scenario- I connected nrf with Macbook. Removed the device & shut down the laptop. Then I connected with my Windows machine & it connected just fine. And I did not press a button to erase bond info. But I have to erase the bond info if both laptops are switched on.

    What if I do not disconnect with the previous machine and go my friend's house and try to connect to his machine? I do not want a button press. Everything should happen through firmware without human intervention. How do I implement the logic?

  • Hi.

    I've been out of office this week, so sorry for late reply.

    As I said, you can erase bonds where it suits you. If you don't erase bonds, the nRF is still bonded.

    bscdb said:

    Current scenario- I connected nrf with Macbook. Removed the device & shut down the laptop. Then I connected with my Windows machine & it connected just fine. And I did not press a button to erase bond info. But I have to erase the bond info if both laptops are switched on.

    What if I do not disconnect with the previous machine and go my friend's house and try to connect to his machine? I do not want a button press. Everything should happen through firmware without human intervention. How do I implement the logic?

     I'm a bit unsure what you mean here actually. Could you elaborate?

    - Andreas

Related