How do I obtain unique connectable BLE MAC address for my device ?

Zephyr / SDK 2.1.2 / nRF52833, acting as BLE peripheral.
My system consists of multiple peripherals, and I want each of these peripherals broadcast its own unique MAC address via non-connectable advertisement
Central device (which doesn't use Nordic) will use it to chose peripheral to connect to when such peripheral sends connectable advertisement.

Question - how can I obtain this MAC address ?

static void connected(struct bt_conn *conn, uint8_t err)
{
if (err)
{
printk("Connection failed (err %u)\n", err);
return;
}

//Generate random data for challenge on every new conenction
bt_rand(challenge_buf, BLE_CHALLENGE_LENGTH);

//Reset the authenticated flag for every new connection
is_ble_authenticated = false;

printk("Connected with MTU(%u)\n", bt_nus_get_mtu(conn));
struct bt_conn_info conn_info;
if(bt_conn_get_info(conn, &conn_info)) {
printk("connected: failed to get connection info\n");
}
if(conn_info.state != BT_CONN_STATE_CONNECTED) {
printk("connected, but connection state is NOT connected ???\n");
}
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(conn_info.le.src, addr, sizeof(addr));
printk("My MAC addr is %s\n", addr);

I get same MAC address printed every time I connect to this device,
but I'm concerned that it is marked as "random" because addr->type is BT_ADDR_LE_RANDOM

Related