Closed bfriedkin closed 2 months ago
Thanks for the detailed report and letting us know, we will look into.
This issue is reported on nimble-1.3.0-idf which is very old and release/v3.3 is EOL. There is no such issue on later release branches. Closing this issue, please feel to reopen in case of any updates
Environment
Problem Description
When a BLE client connects to a peer device, the peer id and ota addresses returned by the
ble_gap_conn_find()
function, when called from theBLE_GAP_EVENT_CONNECT
event handler, does not match the address previously reported for the same peer in theBLE_GAP_EVENT_DISC
handler.This problem seems to be related to changes in the
nimble-1.1.0-idf-v3.3
subcomponent update, referred to in this case. The problem does not occur when using a fresh checkout of ESP-IDF v3.3.2 with no patches applied.Expected Behavior
The address provided in the
addr
field in theble_gap_disc_desc
record should match thepeer_id_addr
field in theble_gap_conn_desc
record returned byble_gap_conn_find()
called after connecting to the peripheral.Actual Behavior
The
peer_id_addr
val
andtype
values are different compared to the address reported while scanning when running thenimble-1.1.0-idf-v3.3
subcomponent update.Note this behavior might be specific to the way iOS uses RPA, though the problem does not exist in Bluedroid, nor when running NimBLE without the update.
If it is not possible to resolve this difference, I would be interested in a workaround that allows us to somehow get the scanned address from the
BLE_GAP_EVENT_CONNECT
handler. Our code currently keeps a record corresponding to the pending connection. That record includes the scanned address. Then when connecting our code checks that the address reported on connection matches the scanned address. This check now fails when running with thenimble-1.1.0-idf-v3.3
update.Steps to reproduce
ble_gap_disc_desc
record in theBLE_GAP_EVENT_DISC
handlerBLE_GAP_EVENT_CONNECT
handler, note thepeer_id_addr
type
andval
fields are different compared to the address reported for the same peripheral when scanningCode to reproduce this issue
It should be possible to reproduce this issue with a modified version of the
blecent
example app. I haven't done that, but it easily reproduces with our apps.Debug Logs
I traced the address and address type received by our ESP32 device app that scans for and connects to the virtual heart rate peripheral. The traces show the different in addresses:
The
found HR
trace shows the address reported during scanning. The format is printable (big endian). The subsequentpeer id address
andpeer ota address
are traced from theBLE_GAP_EVENT_CONNECT
handler. The bytes are listed in little endian order. You can see however that the addresses are the same but different compared to the same peripheral's address when scanning.