I've been trying to use the Device Manager to store and recall bonding information for use in whitelists. Unfortunately the dm_whitelist_create function always seems to return an empty list.
As an experiment, using a nRF51 DK, I took the ble_app_gls example from SDK 10.0.0 and added some code to bsp_event_handler to call dm_whitelist_create and print the results to the UART whenever a key was pressed:
case BSP_EVENT_KEY_3:
{
ble_gap_whitelist_t whitelist;
ble_gap_addr_t * p_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
ble_gap_irk_t * p_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
// Initialize whitelist parameters.
whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
whitelist.irk_count = 0;
whitelist.pp_addrs = p_whitelist_addr;
whitelist.pp_irks = p_whitelist_irk;
// Request creating of whitelist by Device Manager
err_code = dm_whitelist_create(&m_app_handle, &whitelist);
APP_ERROR_CHECK(err_code);
printf("Whitelist: ADDRs = %i, IRKs = %i\r\n", whitelist.addr_count, whitelist.irk_count);
break;
}
Even after successfully connecting and bonding to a device, the address and IRK counts remained at zero.
Should bonding information be stored automatically by the DM on connection or is there another step I need to do to store this data? Or am I using dm_whitelist_create incorrectly above?