How can I read list of bonded devices from flash with using Device Manager ?
How can I read list of bonded devices from flash with using Device Manager ?
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;
}
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'm using SDK 10 (nRF51_SDK_10.0.0_dc26b5e)
I'm using SDK 10 (nRF51_SDK_10.0.0_dc26b5e)