fix(nimble): Connect with OTA address for host based privacy

This commit is contained in:
Astha Verma
2026-09-18 16:41:17 +05:30
parent cf5cf044b0
commit 93b388ef1f
7 changed files with 77 additions and 9 deletions
@@ -376,9 +376,21 @@ ble_cts_cent_connect_if_interesting(void *disc)
#endif
#if CONFIG_EXAMPLE_EXTENDED_ADV
addr = &((struct ble_gap_ext_disc_desc *)disc)->addr;
struct ble_gap_ext_disc_desc *disc_desc = disc;
#else
addr = &((struct ble_gap_disc_desc *)disc)->addr;
struct ble_gap_disc_desc *disc_desc = disc;
#endif
addr = &disc_desc->addr;
#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
/*
* With host-based privacy, the advertising report's peer address may be
* resolved to the identity address by the Host. The Controller does not
* perform peer RPA resolution, so use the current OTA address when
* initiating the connection.
*/
addr = &disc_desc->ota_addr;
#endif
#if CONFIG_EXAMPLE_CI_ID && CONFIG_EXAMPLE_CI_PIPELINE_ID
@@ -498,9 +498,21 @@ ble_htp_cent_connect_if_interesting(void *disc)
#endif
#if CONFIG_EXAMPLE_EXTENDED_ADV
addr = &((struct ble_gap_ext_disc_desc *)disc)->addr;
struct ble_gap_ext_disc_desc *disc_desc = disc;
#else
addr = &((struct ble_gap_disc_desc *)disc)->addr;
struct ble_gap_disc_desc *disc_desc = disc;
#endif
addr = &disc_desc->addr;
#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
/*
* With host-based privacy, the advertising report's peer address may be
* resolved to the identity address by the Host. The Controller does not
* perform peer RPA resolution, so use the current OTA address when
* initiating the connection.
*/
addr = &disc_desc->ota_addr;
#endif
#if CONFIG_EXAMPLE_CI_ID && CONFIG_EXAMPLE_CI_PIPELINE_ID
@@ -435,10 +435,23 @@ ble_prox_cent_connect_if_interesting(void *disc)
* timeout.
*/
#if CONFIG_EXAMPLE_EXTENDED_ADV
addr = &((struct ble_gap_ext_disc_desc *)disc)->addr;
struct ble_gap_ext_disc_desc *disc_desc = disc;
#else
addr = &((struct ble_gap_disc_desc *)disc)->addr;
struct ble_gap_disc_desc *disc_desc = disc;
#endif
addr = &disc_desc->addr;
#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
/*
* With host-based privacy, the advertising report's peer address may be
* resolved to the identity address by the Host. The Controller does not
* perform peer RPA resolution, so use the current OTA address when
* initiating the connection.
*/
addr = &disc_desc->ota_addr;
#endif
rc = ble_gap_connect(own_addr_type, addr, 30000, NULL,
ble_prox_cent_gap_event, NULL);
if (rc != 0) {
+14 -2
View File
@@ -678,9 +678,21 @@ blecent_connect_if_interesting(void *disc)
* timeout.
*/
#if CONFIG_EXAMPLE_EXTENDED_ADV
addr = &((struct ble_gap_ext_disc_desc *)disc)->addr;
struct ble_gap_ext_disc_desc *disc_desc = disc;
#else
addr = &((struct ble_gap_disc_desc *)disc)->addr;
struct ble_gap_disc_desc *disc_desc = disc;
#endif
addr = &disc_desc->addr;
#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
/*
* With host-based privacy, the advertising report's peer address may be
* resolved to the identity address by the Host. The Controller does not
* perform peer RPA resolution, so use the current OTA address when
* initiating the connection.
*/
addr = &disc_desc->ota_addr;
#endif
#if CONFIG_EXAMPLE_CI_ID && CONFIG_EXAMPLE_CI_PIPELINE_ID