Hello,
I'm working with SDK 11 on nRF52832.
I want to get the IRK from a connection event. I need to identify the connected device.
My following code :
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
uint32_t err_code;
switch (p_ble_evt->header.evt_id)
{
case BLE_GAP_EVT_CONNECTED: {
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
app_timer_start(m_debug_timer_id, DEBUG_TIMER_INTERVAL, NULL);
ble_gap_addr_t addr;
pm_peer_data_flash_t compared_data;
if( im_address_resolve(&p_ble_evt->evt.gap_evt.params.connected.peer_addr,
&compared_data.p_bonding_data->peer_id.id_info) == true) {
// match
} else {
// no matching
}
break;
}
default:
// No implementation needed.
break;
}
}
When I check : &compared_data.p_bonding_data->peer_id.id_info
I can read an IRK but it's always the same even if I change the smartphone.
I have something like that :
- Addr_type = 2
- Addr = xx:xx:xx:xx:xx:xx
- IRK = xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
How can I get the correct IRK for the connected device. On a connection_evt I want to extract the IRK and the resolvable adress to manually check if they match.
I' have tried to connect with nRF connect and also bonding.
Thank you in advance.