mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
fix(nimble): Connect with OTA address for host based privacy
This commit is contained in:
@@ -346,10 +346,23 @@ ble_cts_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_cts_cent_gap_event, NULL);
|
||||
if (rc != 0) {
|
||||
|
||||
@@ -468,10 +468,23 @@ ble_htp_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_htp_cent_gap_event, NULL);
|
||||
if (rc != 0) {
|
||||
|
||||
@@ -356,10 +356,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) {
|
||||
|
||||
@@ -626,9 +626,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
|
||||
|
||||
rc = ble_gap_connect(own_addr_type, addr, 30000, NULL,
|
||||
|
||||
Reference in New Issue
Block a user