Hi,
I want to my central device to search for peripherals by specific, hardcoced IRKs. I have setup whitelist that cooperates with bonding and peer manager. The thing is that untill flag m_whitelist_disabled is true the central device accepts every peripheral, and after NRF_BLE_SCAN_EVT_WHITELIST_REQUEST event happen then flag change to false and every peripheral device that was on time bonded is now whitelisted. But it is not how We want our device to work. We decided to hardcode IRKs whitelist that the central device can accept. I searched on forum and found that I can use sd_ble_gap_device_identities_set() and sd_ble_gap_whitelist_set() functions, but I receive hard fault every time after sd_ble_gap_device_identities_set() function. Could someone maybe explain or show me an example about manually setting whitelist. Below is my code and what I tried so far. This event NRF_BLE_SCAN_EVT_WHITELIST_REQUEST is triggered in scan_evt_handler.
case NRF_BLE_SCAN_EVT_WHITELIST_REQUEST: { NRF_LOG_DEBUG("SCAN EVENT: NRF_BLE_SCAN_EVT_WHITELIST_REQUEST"); //on_whitelist_req(); ble_gap_id_key_t id_key = {0}; ble_gap_irk_t irk = {0xA2,0xCE,0x21,0xF3,0x12,0x0E,0x6D,0x69,0xFB,0xC4,0x1A,0x43,0x12,0xD9,0xEF,0xB7}; ble_gap_id_key_t const * key_ptr; key_ptr = &id_key; memcpy(&id_key.id_info.irk[0], &irk.irk[0], sizeof(ble_gap_irk_t)); id_key.id_addr_info.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE; sd_ble_gap_device_identities_set(key_ptr, NULL, 1); }
I am working on NRF52840 with SDK 16 S140