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

dm_device_delete_all(& m_dm_app_id); doesn't work

I use SDK9 nRF51. I use white list. When I want to delete all bounded devices, I call this function. But it doesn't work. It not deleted. Why I can't to delete bounded devices?

Parents
  • Hi, are you not getting any DM_EVT_DEVICE_CONTEXT_DELETED events after calling this api? There should be one event for each deleted entry.

    Example (does a sys reset once finished):

    static uint32_t device_manager_evt_handler(dm_handle_t const * p_handle,
                                               dm_event_t const  * p_event,
                                               ret_code_t        event_result)
    {
        uint32_t err_code;
       
        static bool device_delete_all_started;
    
        // Recovery in the event of DM_DEVICE_CONTEXT_FULL
        if(event_result == DM_DEVICE_CONTEXT_FULL)
        {
            /* Clear all devices from the bond table*/ 
            err_code = dm_device_delete_all(&m_app_handle);
            APP_ERROR_CHECK(err_code);
            
            device_delete_all_started = true;
                 
        }
        if (p_event->event_id ==DM_EVT_DEVICE_CONTEXT_DELETED)
        {
            
             /* Wait for all devices to be cleared before perfoming a sys reset */ 
             if(device_delete_all_started && (p_handle->device_id == DEVICE_MANAGER_MAX_BONDS -1))
             {
                 err_code = sd_nvic_SystemReset();
                 APP_ERROR_CHECK(err_code);
             }
             
        }
    
Reply
  • Hi, are you not getting any DM_EVT_DEVICE_CONTEXT_DELETED events after calling this api? There should be one event for each deleted entry.

    Example (does a sys reset once finished):

    static uint32_t device_manager_evt_handler(dm_handle_t const * p_handle,
                                               dm_event_t const  * p_event,
                                               ret_code_t        event_result)
    {
        uint32_t err_code;
       
        static bool device_delete_all_started;
    
        // Recovery in the event of DM_DEVICE_CONTEXT_FULL
        if(event_result == DM_DEVICE_CONTEXT_FULL)
        {
            /* Clear all devices from the bond table*/ 
            err_code = dm_device_delete_all(&m_app_handle);
            APP_ERROR_CHECK(err_code);
            
            device_delete_all_started = true;
                 
        }
        if (p_event->event_id ==DM_EVT_DEVICE_CONTEXT_DELETED)
        {
            
             /* Wait for all devices to be cleared before perfoming a sys reset */ 
             if(device_delete_all_started && (p_handle->device_id == DEVICE_MANAGER_MAX_BONDS -1))
             {
                 err_code = sd_nvic_SystemReset();
                 APP_ERROR_CHECK(err_code);
             }
             
        }
    
Children
No Data
Related