I'm using an nRF52DK to monitor the RSSI and MAC address of my two phones through ble_evt_handler BLE_GAP_EVT_SCAN_REQ_REPORT.
I tested both Android and iPhone. They both showed strange behaviors regarding the Bluetooth address.
The iPhone changed its own address to a totally different one at each session.
The Android phone keeps its own address but the LSB byte keeps changing the value at each scan as follows:
<info> app: RSSI: -49<info> app: C5 F3 85 AC 00 CF<info> app: RSSI: -38<info> app: C5 F3 85 AC 00 DA<info> app: RSSI: -40<info> app: C5 F3 85 AC 00 D8<info> app: RSSI: -50<info> app: C5 F3 85 AC 00 CE<info> app: RSSI: -45<info> app: C5 F3 85 AC 00 D3<info> app: RSSI: -41<info> app: C5 F3 85 AC 00 D7<info> app: RSSI: -45<info> app: C5 F3 85 AC 00 D3
If we pair the phone and the nRF52DK, do they 'remember' each other address? How does that work if the addresses are changed?
That depends. If the peer device is using a static address our peer manager will remember the address for later usage. i.e. directed advertising or whitelisting. If the peer uses a private resolvable address, we would use the IRK for whitelisting and check that the peer suppores centra address resolution before doing directed advertising. The bond between the devices is not reestablished until the Long Term Encryption key has been verified, so the address is not used for that.
Hi run_ar, is there a way we can tell that it is a static address or private address? I noticed the nRF52DK always keeps the same address. Is there any particular rule, i.e., the central can change its address but the peripheral always keeps a same address?
There is no rule like that. Both central and peripheral can use a resolvable private address or a static address. It depends on the configuration. However two bits of the address is used to indicate what address type is used.
Hi run_ar, please can you tell me which 2 bits of the address that tell which address type?
Just check the address type of ble_gap_addr_t, this returnes the addr_type, both in the ble_gap_evt_adv_report_t and in the ble_gap_evt_connected_t event. For details See GAP Address types
Thanks for your explanation run_ar.