Fix build when host based privacy is enabled without connection roles

This commit is contained in:
h2zero
2025-04-25 15:59:20 -06:00
parent e55ad9019c
commit da31f90436

View File

@ -1069,18 +1069,16 @@ bool NimBLEDevice::setOwnAddrType(uint8_t type) {
m_ownAddrType = type;
# if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
if (type == BLE_OWN_ADDR_RPA_PUBLIC_DEFAULT || type == BLE_OWN_ADDR_RPA_RANDOM_DEFAULT) {
# ifdef CONFIG_IDF_TARGET_ESP32
// esp32 controller does not support RPA so we must use the random static for calls to the stack
// the host will take care of the random private address generation/setting.
m_ownAddrType = BLE_OWN_ADDR_RANDOM;
rc = ble_hs_pvcy_rpa_config(NIMBLE_HOST_ENABLE_RPA);
# endif
} else {
# ifdef CONFIG_IDF_TARGET_ESP32
rc = ble_hs_pvcy_rpa_config(NIMBLE_HOST_DISABLE_PRIVACY);
# endif
}
# endif
return rc == 0;
} // setOwnAddrType