diff --git a/features/FEATURE_BLE/ble/gap/Gap.h b/features/FEATURE_BLE/ble/gap/Gap.h index cc6be12873..ce70d5aeaf 100644 --- a/features/FEATURE_BLE/ble/gap/Gap.h +++ b/features/FEATURE_BLE/ble/gap/Gap.h @@ -285,7 +285,6 @@ public: * Definition of the general handler of Gap related events. */ struct EventHandler { -#if BLE_ROLE_BROADCASTER /** * Called when an advertising device receive a scan response. * @@ -314,8 +313,7 @@ public: virtual void onAdvertisingEnd(const AdvertisingEndEvent &event) { } -#endif // BLE_ROLE_BROADCASTER -#if BLE_ROLE_OBSERVER + /** * Called when a scanner receives an advertising or a scan response packet. * @@ -337,10 +335,7 @@ public: virtual void onScanTimeout(const ScanTimeoutEvent &event) { } -#endif // BLE_ROLE_OBSERVER -#if BLE_ROLE_OBSERVER -#if BLE_FEATURE_PERIODIC_ADVERTISING /** * Called when first advertising packet in periodic advertising is received. * @@ -385,10 +380,7 @@ public: ) { } -#endif // BLE_ROLE_OBSERVER -#endif // BLE_FEATURE_PERIODIC_ADVERTISING -#if BLE_FEATURE_CONNECTABLE /** * Called when connection attempt ends or an advertising device has been * connected. @@ -449,8 +441,7 @@ public: virtual void onDisconnectionComplete(const DisconnectionCompleteEvent &event) { } -#endif // BLE_FEATURE_CONNECTABLE -#if BLE_FEATURE_PHY_MANAGEMENT + /** * Function invoked when the current transmitter and receiver PHY have * been read for a given connection. @@ -511,7 +502,6 @@ public: ) { } -#endif // BLE_FEATURE_PHY_MANAGEMENT /** * Function invoked when the connections changes the maximum number of octets @@ -919,7 +909,6 @@ public: #endif // BLE_ROLE_OBSERVER #endif // BLE_FEATURE_PERIODIC_ADVERTISING -#if BLE_FEATURE_CONNECTABLE #if BLE_ROLE_CENTRAL /** * Initiate a connection to a peer. @@ -955,6 +944,7 @@ public: ble_error_t cancelConnect(); #endif // BLE_ROLE_CENTRAL +#if BLE_FEATURE_CONNECTABLE /** * Update connection parameters of an existing connection. * @@ -1166,6 +1156,19 @@ public: ); #endif // BLE_FEATURE_PHY_MANAGEMENT + /** + * Default peripheral privacy configuration. + */ + static const peripheral_privacy_configuration_t + default_peripheral_privacy_configuration; + + /** + * Default peripheral privacy configuration. + */ + static const central_privay_configuration_t + default_central_privacy_configuration; + + #if BLE_FEATURE_PRIVACY /** * Enable or disable privacy mode of the local device. @@ -1203,12 +1206,6 @@ public: ble_error_t enablePrivacy(bool enable); #if BLE_ROLE_BROADCASTER - /** - * Default peripheral privacy configuration. - */ - static const peripheral_privacy_configuration_t - default_peripheral_privacy_configuration; - /** * Set the privacy configuration used by the peripheral role. * @@ -1234,12 +1231,6 @@ public: #endif // BLE_ROLE_BROADCASTER #if BLE_ROLE_OBSERVER - /** - * Default peripheral privacy configuration. - */ - static const central_privay_configuration_t - default_central_privacy_configuration; - /** * Set the privacy configuration used by the central role. * @@ -1418,13 +1409,14 @@ protected: ); void useVersionOneAPI_() const; void useVersionTwoAPI_() const; -#endif // !defined(DOXYGEN_ONLY) protected: /** * Event handler provided by the application. */ EventHandler *_eventHandler; + +#endif // !defined(DOXYGEN_ONLY) }; /** diff --git a/features/FEATURE_BLE/source/gap/Gap.tpp b/features/FEATURE_BLE/source/gap/Gap.tpp index 753dc61591..a0c2084f14 100644 --- a/features/FEATURE_BLE/source/gap/Gap.tpp +++ b/features/FEATURE_BLE/source/gap/Gap.tpp @@ -266,7 +266,7 @@ uint8_t Gap::getMaxPeriodicAdvertiserListSize() } #endif // BLE_FEATURE_PERIODIC_ADVERTISING -#if BLE_FEATURE_CONNECTABLE +#if BLE_ROLE_CENTRAL template ble_error_t Gap::connect( peer_address_type_t peerAddressType, @@ -286,7 +286,9 @@ ble_error_t Gap::cancelConnect() { return impl()->cancelConnect_(); } +#endif +#if BLE_FEATURE_CONNECTABLE template ble_error_t Gap::updateConnectionParameters( connection_handle_t connectionHandle, @@ -388,6 +390,7 @@ ble_error_t Gap::setPhy( codedSymbol ); } +#endif // BLE_FEATURE_PHY_MANAGEMENT template void Gap::useVersionOneAPI() const @@ -405,26 +408,21 @@ template Gap::Gap() : _eventHandler(NULL) { } -#endif // BLE_FEATURE_PHY_MANAGEMENT + /* -------------------- Future deprecation ------------------------- */ -#if BLE_FEATURE_PRIVACY -#if BLE_ROLE_BROADCASTER template const peripheral_privacy_configuration_t Gap::default_peripheral_privacy_configuration = { /* use_non_resolvable_random_address */ false, /* resolution_strategy */ peripheral_privacy_configuration_t::PERFORM_PAIRING_PROCEDURE }; -#endif // BLE_ROLE_BROADCASTER -#if BLE_ROLE_OBSERVER + template const central_privay_configuration_t Gap::default_central_privacy_configuration = { /* use_non_resolvable_random_address */ false, /* resolution_strategy */ central_privay_configuration_t::RESOLVE_AND_FORWARD }; -#endif // BLE_ROLE_OBSERVER -#endif // BLE_FEATURE_PRIVACY #if BLE_FEATURE_PRIVACY template