BLE - Conditionally include address rotation at compile time

pull/9790/head
Vincent Coubard 2019-02-28 13:26:51 +00:00
parent 632851e5ae
commit eeb14c5ce6
1 changed files with 10 additions and 0 deletions

View File

@ -570,8 +570,10 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
_advertising_timeout.detach(); _advertising_timeout.detach();
state.advertising = false; state.advertising = false;
#if BLE_FEATURE_PRIVACY
// Stop address rotation if required // Stop address rotation if required
set_random_address_rotation(false); set_random_address_rotation(false);
#endif
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} }
@ -598,8 +600,10 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
return err; return err;
} }
#if BLE_FEATURE_PRIVACY
// Stop address rotation if required // Stop address rotation if required
set_random_address_rotation(false); set_random_address_rotation(false);
#endif
_scan_timeout.detach(); _scan_timeout.detach();
@ -1599,7 +1603,9 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
/* if timeout happened on a 4.2 chip we need to stop the scan manually */ /* if timeout happened on a 4.2 chip we need to stop the scan manually */
if (!is_extended_advertising_available()) { if (!is_extended_advertising_available()) {
_pal_gap.scan_enable(false, false); _pal_gap.scan_enable(false, false);
#if BLE_FEATURE_PRIVACY
set_random_address_rotation(false); set_random_address_rotation(false);
#endif
} }
_scan_enabled = false; _scan_enabled = false;
@ -1637,8 +1643,10 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
// TODO: define the mechanism signaling the error // TODO: define the mechanism signaling the error
} }
#if BLE_FEATURE_PRIVACY
// Stop address rotation if required // Stop address rotation if required
set_random_address_rotation(false); set_random_address_rotation(false);
#endif
BLE_DEPRECATED_API_USE_BEGIN() BLE_DEPRECATED_API_USE_BEGIN()
LegacyGap::processTimeoutEvent(LegacyGap::TIMEOUT_SRC_ADVERTISING); LegacyGap::processTimeoutEvent(LegacyGap::TIMEOUT_SRC_ADVERTISING);
@ -1837,8 +1845,10 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
_advertising_timeout.detach(); _advertising_timeout.detach();
_pal_gap.advertising_enable(false); _pal_gap.advertising_enable(false);
#if BLE_FEATURE_PRIVACY
// Stop address rotation if required // Stop address rotation if required
set_random_address_rotation(false); set_random_address_rotation(false);
#endif
} }
#endif // BLE_ROLE_PERIPHERAL #endif // BLE_ROLE_PERIPHERAL