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

How to delete the bond info when connected with 51822

Hi nordic engineer:

I want to know the right process to delete the bonds when the device connected.

There is a button used for bonding. When it pressing by more than 3 seconds, it should go into a bond process, no matter it was connected or not.
I got a app_error_handler() under connected.
Here is my operation:
                            app_sched_execute();
                            power_manage();
			if(bind_info_clear == true)
			{
				err_code=sd_softdevice_disable();
				APP_ERROR_CHECK(err_code);
				// Re-initialize
				bond_manager_init();
				ble_stack_init();
				advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE);
				advertising_start();
				bind_info_clear = false;
			}
 
It must stop the ble first so I disable the softdevie(is it correct?), then delete the bond flash, and re-init the ble stack to enable the softdevice(or need to call sd_softdevice_enable()?), after that, re-start the advertising...
I am confuse on how to disconnect the ble and stop it when doing the flash operation.

If there is any example for this application should be better...

Thanks. Jim

Related