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

Reading IRK and gap_evt.params.connected.irk_match issue

Hello all, I have implemented own bond manager with saving context to flash on nRF51422 SD110. The problem is in getting IRK and creating a whitelist with it after disconnection. As far as I understand,

at BLE_GAP_EVT_CONNECTED I get &ble_evt->evt.gap_evt.params.connected.peer_addr.addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE so IRK will be used to resolve central address.

at BLE_GAP_EVT_SEC_PARAMS_REQUEST we provide pointer to data structure where the IRK will be stored after BLE_GAP_EVT_AUTH_STATUS received

...
keys_exchanged.keys_central.p_id_key   = 
&m_peer_table[m_connection_table[index].bonded_dev_id].peer_id; 
...
err_code = sd_ble_gap_sec_params_reply(p_ble_evt->evt.gap_evt.conn_handle,
                                                   BLE_GAP_SEC_STATUS_SUCCESS,
                                                   &m_application_table[0].sec_param, 
                                                   &keys_exchanged);

at BLE_GAP_EVT_AUTH_STATUS I read m_peer_table and IRK remains blank. The .id_bitmap changed.

Than, after reconnection
_ble_evt->evt.gap_evt.params.connected.irk_match ==0 I create whitelist with presaved .id_bitmapthat states that IRK present. Device start advertice with whitelist (like with IRK) but all devices able see this advertising and connect/bond to device.

What should I do to get IRK? May be any example available?

Related