diff --git a/features/FEATURE_BLE/ble/BLETypes.h b/features/FEATURE_BLE/ble/BLETypes.h index b6b8f769d4..652e46a4ef 100644 --- a/features/FEATURE_BLE/ble/BLETypes.h +++ b/features/FEATURE_BLE/ble/BLETypes.h @@ -528,7 +528,6 @@ struct att_security_requirement_t : SafeEnum { * @note This physical transport was available since Bluetooth 4.0 */ LE_1M = 1, -#if BLE_FEATURE_PHY_MANAGEMENT + /** * 2Mbit/s LE. * @@ -675,7 +671,6 @@ struct phy_t : SafeEnum { * @note This transport has been introduced with the Bluetooth 5. */ LE_CODED -#endif // BLE_FEATURE_PHY_MANAGEMENT }; /** @@ -722,10 +717,8 @@ public: _value() { set_1m(phy_1m); -#if BLE_FEATURE_PHY_MANAGEMENT set_2m(phy_2m); set_coded(phy_coded); -#endif // BLE_FEATURE_PHY_MANAGEMENT } /** @@ -739,14 +732,12 @@ public: case phy_t::LE_1M: set_1m(true); break; -#if BLE_FEATURE_PHY_MANAGEMENT case phy_t::LE_2M: set_2m(true); break; case phy_t::LE_CODED: set_coded(true); break; -#endif // BLE_FEATURE_PHY_MANAGEMENT default: break; } @@ -761,7 +752,6 @@ public: } } -#if BLE_FEATURE_PHY_MANAGEMENT /** Prefer 2M PHY. */ void set_2m(bool enabled = true) { if (enabled) { @@ -779,7 +769,6 @@ public: _value &= ~PHY_SET_CODED; } } -#endif // BLE_FEATURE_PHY_MANAGEMENT bool get_1m() const { return (_value & PHY_SET_1M); diff --git a/features/FEATURE_BLE/ble/gap/AdvertisingParameters.h b/features/FEATURE_BLE/ble/gap/AdvertisingParameters.h index eec52df011..497e171084 100644 --- a/features/FEATURE_BLE/ble/gap/AdvertisingParameters.h +++ b/features/FEATURE_BLE/ble/gap/AdvertisingParameters.h @@ -392,7 +392,6 @@ public: return _peerAddressType; }; -#if BLE_FEATURE_WHITELIST /** Set the filter policy of whitelist use during advertising; * * @param mode Policy to use. @@ -404,7 +403,6 @@ public: _policy = mode; return *this; } -#endif // BLE_FEATURE_WHITELIST /** Get the filter policy of whitelist use during advertising; * diff --git a/features/FEATURE_BLE/ble/gap/ConnectionParameters.h b/features/FEATURE_BLE/ble/gap/ConnectionParameters.h index 51b10f394f..93237da58a 100644 --- a/features/FEATURE_BLE/ble/gap/ConnectionParameters.h +++ b/features/FEATURE_BLE/ble/gap/ConnectionParameters.h @@ -121,9 +121,9 @@ namespace ble { class ConnectionParameters { enum { LE_1M_INDEX = 0, -#if BLE_FEATURE_PHY_MANAGEMENT LE_2M_INDEX = 1, LE_CODED_INDEX = 2, +#if BLE_FEATURE_PHY_MANAGEMENT MAX_PARAM_PHYS = 3 #else MAX_PARAM_PHYS = 1 @@ -212,7 +212,6 @@ public: return *this; } -#if BLE_FEATURE_PHY_MANAGEMENT /** * Enable or disable PHYs. * @@ -224,9 +223,11 @@ public: */ ConnectionParameters &togglePhy(bool phy1M, bool phy2M, bool phyCoded) { +#if BLE_FEATURE_PHY_MANAGEMENT handlePhyToggle(phy_t::LE_1M, phy1M); handlePhyToggle(phy_t::LE_2M, phy2M); handlePhyToggle(phy_t::LE_CODED, phyCoded); +#endif // BLE_FEATURE_PHY_MANAGEMENT return *this; } @@ -239,7 +240,9 @@ public: */ ConnectionParameters &disablePhy(phy_t phy = phy_t::LE_1M) { +#if BLE_FEATURE_PHY_MANAGEMENT handlePhyToggle(phy, false); +#endif // BLE_FEATURE_PHY_MANAGEMENT return *this; } @@ -252,11 +255,12 @@ public: */ ConnectionParameters &enablePhy(phy_t phy = phy_t::LE_1M) { +#if BLE_FEATURE_PHY_MANAGEMENT handlePhyToggle(phy, true); +#endif // BLE_FEATURE_PHY_MANAGEMENT return *this; } -#endif // BLE_FEATURE_PHY_MANAGEMENT /* getters */ /** @@ -284,7 +288,6 @@ public: ); } -#if BLE_FEATURE_WHITELIST /** * Set if the whitelist should be used to find the peer. * @@ -294,11 +297,12 @@ public: */ ConnectionParameters &setFilter(initiator_filter_policy_t filterPolicy) { +#if BLE_FEATURE_WHITELIST _filterPolicy = filterPolicy; - +#endif // BLE_FEATURE_WHITELIST return *this; } -#endif // BLE_FEATURE_WHITELIST + /** * Return the initiator policy. * diff --git a/features/FEATURE_BLE/ble/gap/ScanParameters.h b/features/FEATURE_BLE/ble/gap/ScanParameters.h index 72b35a23be..bffee5de9f 100644 --- a/features/FEATURE_BLE/ble/gap/ScanParameters.h +++ b/features/FEATURE_BLE/ble/gap/ScanParameters.h @@ -160,7 +160,6 @@ public: return own_address_type; } -#if BLE_FEATURE_WHITELIST /** * Set the filter to apply during scanning. * @param filter_policy The filter to apply during scanning. @@ -171,7 +170,6 @@ public: scanning_filter_policy = filter_policy; return *this; } -#endif // BLE_FEATURE_WHITELIST /** * Get the filter to use during scanning @@ -185,7 +183,6 @@ public: #endif // BLE_FEATURE_WHITELIST } -#if BLE_FEATURE_PHY_MANAGEMENT /** * Enable or disable PHYs that should be used during scanning. * @param enable_1m True to enable the 1M phy and false to disable it. @@ -194,11 +191,12 @@ public: */ ScanParameters &setPhys(bool enable_1m, bool enable_coded) { +#if BLE_FEATURE_PHY_MANAGEMENT phys.set_1m(enable_1m); phys.set_coded(enable_coded); +#endif // BLE_FEATURE_PHY_MANAGEMENT return *this; } -#endif // BLE_FEATURE_PHY_MANAGEMENT /** * Get the PHYs to use during scanning. @@ -236,7 +234,6 @@ public: return phy_1m_configuration; } -#if BLE_FEATURE_PHY_MANAGEMENT /** * Set the coded PHY scan configuration. * @param interval The scan interval to use. @@ -250,13 +247,14 @@ public: bool active_scanning ) { +#if BLE_FEATURE_PHY_MANAGEMENT phys.set_coded(true); phy_coded_configuration = phy_configuration_t( interval, window, active_scanning ); +#endif // BLE_FEATURE_PHY_MANAGEMENT return *this; } -#endif // BLE_FEATURE_PHY_MANAGEMENT /** * Get the coded PHY scan configuration. diff --git a/features/FEATURE_BLE/ble/gap/Types.h b/features/FEATURE_BLE/ble/gap/Types.h index 70557ec82b..9cd255e34b 100644 --- a/features/FEATURE_BLE/ble/gap/Types.h +++ b/features/FEATURE_BLE/ble/gap/Types.h @@ -389,7 +389,7 @@ struct advertising_filter_policy_t : SafeEnum { * addressed to this device. */ NO_FILTER = 0x00, -#if BLE_FEATURE_WHITELIST + /** * Accept only advertising packets from devices in the whitelist except * directed advertising packets not addressed to this device. @@ -459,7 +458,6 @@ struct scanning_filter_policy_t : SafeEnum { * resolvable private address that cannot be resolved are also accepted. */ FILTER_ADVERTISING_INCLUDE_UNRESOLVABLE_DIRECTED = 3 -#endif // BLE_FEATURE_WHITELIST }; /** @@ -482,12 +480,11 @@ struct initiator_filter_policy_t : SafeEnum * The whitelist is not used to determine which advertiser to connect to. */ NO_FILTER, -#if BLE_FEATURE_WHITELIST + /** * The whitelist is used to determine which advertiser to connect to. */ USE_WHITE_LIST -#endif // BLE_FEATURE_WHITELIST }; /** diff --git a/features/FEATURE_BLE/source/GapScanningParams.cpp b/features/FEATURE_BLE/source/GapScanningParams.cpp index 0b946aeea3..1d9f1cb26f 100644 --- a/features/FEATURE_BLE/source/GapScanningParams.cpp +++ b/features/FEATURE_BLE/source/GapScanningParams.cpp @@ -14,10 +14,6 @@ * limitations under the License. */ -#include "BLERoles.h" - -#if BLE_ROLE_OBSERVER - #include "ble/Gap.h" #include "ble/GapScanningParams.h" @@ -77,5 +73,3 @@ GapScanningParams::setActiveScanning(bool activeScanning) { _activeScanning = activeScanning; } - -#endif