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

[S110][nrf51822] Device Manager getting bonded devices

How can I read list of bonded devices from flash with using Device Manager ?

Parents
  • Unfortunatelly it does not work. I have 3 bonded devices but this function returns 0 for fields pp_addrs and pp_irks. This is my code located in function device_manager_evt_handler

        if (p_event->event_id ==  DM_EVT_DEVICE_CONTEXT_LOADED)
        {
    	   ble_gap_addr_t    *pp_addrs[DEVICE_MANAGER_MAX_BONDS]; 
          ble_gap_irk_t       *pp_irks[DEVICE_MANAGER_MAX_BONDS];
    
       ble_gap_whitelist_t  whitelist;
       memset(&whitelist, 0, sizeof(whitelist));
       whitelist.pp_addrs = pp_addrs;
       whitelist.pp_irks = pp_irks;
    
       err_code = dm_whitelist_create(&m_app_handle, &whitelist);
        }
    

    Also I was trying to do this by using dm_peer_addr_get

    for (int i=0; i< DEVICE_MANAGER_MAX_BONDS; i++)
    {
    	dm_handle_t dHandle;
    	dHandle.appl_id = 1;
    	dHandle.device_id = i;
    	dHandle.connection_id = 0;
    	
    	ble_gap_addr_t gapAddr;
    	err_code = dm_peer_addr_get(&dHandle,  &gapAddr);
    	
    }
    

    And I've found the issue inside dm_peer_addr_get For all bonded devices I have id_bitmap = 0xFE, ADDR_ENTRY = 0x02 and in result below block is never beeing executed.

        if ((m_peer_table[p_handle->device_id].id_bitmap & ADDR_ENTRY) == 0)
        {
            DM_TRC("[DM]:[DI 0x%02X]: Address get for bonded device.\r\n",
                   p_handle->device_id);
    
            (*p_addr) = m_peer_table[p_handle->device_id].peer_id.id_addr_info;
            err_code  = NRF_SUCCESS;
        }
    

    image description

    I can make a list of devices by making changes in device_manager_peripheral.c file. But I don't want to touch SDK files. My goal is to count bonded devices. Because I want to make something like circular bonding. For example during bonding 5th device I want to delete the oldest one.

  • I know this is done in the reference designs for desktop and remote, so it should be doable without messing with the SDK internals. What SDK version do you use?

Reply Children
No Data
Related