diff --git a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp index 4a93bc41eec..abe30f20809 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp @@ -26,7 +26,9 @@ #include "source/pal/PalAttClient.h" #include "source/pal/PalSecurityManager.h" #include "source/pal/PalGap.h" +#if BLE_FEATURE_SIGNING #include "source/pal/PalSigningMonitor.h" +#endif //BLE_FEATURE_SIGNING #include "source/pal/PalAttClientToGattClient.h" #include "source/BLEInstanceBaseImpl.h" @@ -283,6 +285,7 @@ PalGattClient &BLEInstanceBase::getPalGattClient() #if BLE_FEATURE_SECURITY ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl() { +#if BLE_FEATURE_SIGNING // Creation of a proxy monitor to let the security manager register to // the gatt client and gatt server. static struct : ble::PalSigningMonitor { @@ -296,11 +299,14 @@ ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl() #endif // BLE_FEATURE_GATT_SERVER } } signing_event_monitor; +#endif //BLE_FEATURE_SIGNING static ble::impl::SecurityManager m_instance( ble::impl::PalSecurityManager::get_security_manager(), - getGapImpl(), - signing_event_monitor + getGapImpl() +#if BLE_FEATURE_SIGNING + , signing_event_monitor +#endif //BLE_FEATURE_SIGNING #if BLE_FEATURE_PRIVACY , getPrivateAddressRegistry() #endif //BLE_FEATURE_PRIVACY diff --git a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h index 9d2289ae6d3..16ad08d4d2d 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h +++ b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h @@ -54,8 +54,9 @@ #endif namespace ble { - +#if BLE_FEATURE_SIGNING class PalSigningMonitor; +#endif //BLE_FEATURE_SIGNING namespace impl { @@ -70,8 +71,9 @@ class BLEInstanceBase final : public ble::BLEInstanceBase { using Timeout = mbed::Timeout; using Timer = mbed::Timer; #endif - +#if BLE_FEATURE_SIGNING friend PalSigningMonitor; +#endif //BLE_FEATURE_SIGNING /** * Construction with an HCI driver. diff --git a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp index bd28238352d..c770ab932b7 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp @@ -1629,7 +1629,9 @@ GattServer::GattServer() : updatesEnabledCallback(nullptr), updatesDisabledCallback(nullptr), confirmationReceivedCallback(nullptr), +#if BLE_FEATURE_SIGNING _signing_event_handler(nullptr), +#endif //BLE_FEATURE_SIGNING cccds(), cccd_values(), cccd_handles(), @@ -1645,12 +1647,14 @@ GattServer::GattServer() : { } +#if BLE_FEATURE_SIGNING void GattServer::set_signing_event_handler( PalSigningMonitorEventHandler *signing_event_handler ) { _signing_event_handler = signing_event_handler; } +#endif //BLE_FEATURE_SIGNING void GattServer::onDataSent(const DataSentCallback_t &callback) { diff --git a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h index 73374c50b13..fbef21aa46b 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h +++ b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h @@ -39,7 +39,9 @@ #include "source/BLEInstanceBase.h" #include "source/generic/GattServerEvents.h" +#if BLE_FEATURE_SIGNING #include "source/pal/PalSigningMonitor.h" +#endif //BLE_FEATURE_SIGNING namespace ble { @@ -49,10 +51,16 @@ class PalGenericAccessService; class BLE; namespace impl { -class GattServer : public PalSigningMonitor { +class GattServer +#if BLE_FEATURE_SIGNING + : public PalSigningMonitor +#endif //BLE_FEATURE_SIGNING +{ friend ble::BLE; friend ble::PalAttClient; +#if BLE_FEATURE_SIGNING friend PalSigningMonitor; +#endif //BLE_FEATURE_SIGNING friend PalGenericAccessService; using EventHandler = ble::GattServer::EventHandler; @@ -214,11 +222,11 @@ class GattServer : public PalSigningMonitor { void initialize(); static uint8_t atts_auth_cb(dmConnId_t connId, uint8_t permit, uint16_t handle); - +#if BLE_FEATURE_SIGNING void set_signing_event_handler( PalSigningMonitorEventHandler *signing_event_handler ) override; - +#endif //BLE_FEATURE_SIGNING private: GattServer(); @@ -361,8 +369,9 @@ class GattServer : public PalSigningMonitor { * The registered callback handler for confirmation received events. */ EventCallback_t confirmationReceivedCallback; - +#if BLE_FEATURE_SIGNING PalSigningMonitorEventHandler *_signing_event_handler; +#endif //BLE_FEATURE_SIGNING attsCccSet_t cccds[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT]; uint16_t cccd_values[MBED_CONF_BLE_API_IMPLEMENTATION_MAX_CCCD_COUNT]; diff --git a/connectivity/FEATURE_BLE/source/generic/GattClientImpl.h b/connectivity/FEATURE_BLE/source/generic/GattClientImpl.h index bf13e13e6ec..ee1a3e23dfa 100644 --- a/connectivity/FEATURE_BLE/source/generic/GattClientImpl.h +++ b/connectivity/FEATURE_BLE/source/generic/GattClientImpl.h @@ -30,7 +30,9 @@ #include "ble/gatt/CharacteristicDescriptorDiscovery.h" #include "ble/gatt/GattCallbackParamTypes.h" #include "source/pal/PalGattClient.h" +#if BLE_FEATURE_SIGNING #include "source/pal/PalSigningMonitor.h" +#endif //BLE_FEATURE_SIGNING #include "ble/GattClient.h" namespace ble { @@ -40,9 +42,13 @@ class BLEInstanceBase; namespace impl { class GattClient : +#if BLE_FEATURE_SIGNING public PalSigningMonitor, +#endif //BLE_FEATURE_SIGNING public PalGattClientEventHandler { +#if BLE_FEATURE_SIGNING friend PalSigningMonitor; +#endif //BLE_FEATURE_SIGNING friend BLEInstanceBase; public: using EventHandler = ble::GattClient::EventHandler; @@ -163,11 +169,12 @@ class GattClient : /* private implementation follows */ private: +#if BLE_FEATURE_SIGNING /** * @see ble::PalSigningMonitor::set_signing_event_handler */ void set_signing_event_handler(PalSigningMonitorEventHandler *signing_event_handler) override; - +#endif //BLE_FEATURE_SIGNING /** * @see PalGattClient::EventHandler::on_att_mtu_change */ @@ -244,7 +251,9 @@ class GattClient : PalGattClient &_pal_client; ServiceDiscovery::TerminationCallback_t _termination_callback; +#if BLE_FEATURE_SIGNING PalSigningMonitorEventHandler *_signing_event_handler; +#endif // BLE_FEATURE_SIGNING mutable ProcedureControlBlock *control_blocks; bool _is_reseting; diff --git a/connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h b/connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h index 22a92f736bb..8f144a755a8 100644 --- a/connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h +++ b/connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h @@ -33,7 +33,9 @@ #include "source/pal/GapTypes.h" #include "source/pal/PalConnectionMonitor.h" +#if BLE_FEATURE_SIGNING #include "source/pal/PalSigningMonitor.h" +#endif //BLE_FEATURE_SIGNING #include "source/pal/PalSecurityManager.h" #include "source/generic/SecurityDb.h" @@ -479,15 +481,19 @@ class SecurityManager : public: SecurityManager( ble::PalSecurityManager &palImpl, - ble::PalConnectionMonitor &connMonitorImpl, - ble::PalSigningMonitor &signingMonitorImpl + ble::PalConnectionMonitor &connMonitorImpl +#if BLE_FEATURE_SIGNING + , ble::PalSigningMonitor &signingMonitorImpl +#endif //BLE_FEATURE_SIGNING #if BLE_FEATURE_PRIVACY , PrivateAddressController &privateAddressController #endif // BLE_FEATURE_PRIVACY ) : eventHandler(nullptr), _pal(palImpl), _connection_monitor(connMonitorImpl), +#if BLE_FEATURE_SIGNING _signing_monitor(signingMonitorImpl), +#endif //BLE_FEATURE_SIGNING _db(nullptr), #if BLE_FEATURE_PRIVACY _private_address_controller(privateAddressController), @@ -681,7 +687,9 @@ class SecurityManager : PalSecurityManager &_pal; PalConnectionMonitor &_connection_monitor; +#if BLE_FEATURE_SIGNING PalSigningMonitor &_signing_monitor; +#endif //BLE_FEATURE_SIGNING SecurityDb *_db; #if BLE_FEATURE_PRIVACY diff --git a/connectivity/FEATURE_BLE/source/pal/PalAttClientToGattClient.cpp b/connectivity/FEATURE_BLE/source/pal/PalAttClientToGattClient.cpp index 6fe57930429..037e7831842 100644 --- a/connectivity/FEATURE_BLE/source/pal/PalAttClientToGattClient.cpp +++ b/connectivity/FEATURE_BLE/source/pal/PalAttClientToGattClient.cpp @@ -184,7 +184,7 @@ ble_error_t PalAttClientToGattClient::write_without_response( ); } - +#if BLE_FEATURE_SIGNING ble_error_t PalAttClientToGattClient::signed_write_without_response( connection_handle_t connection_handle, attribute_handle_t characteristic_value_handle, @@ -197,7 +197,7 @@ ble_error_t PalAttClientToGattClient::signed_write_without_response( value ); } - +#endif // BLE_FEATURE_SIGNING ble_error_t PalAttClientToGattClient::write_attribute( connection_handle_t connection_handle, diff --git a/connectivity/FEATURE_BLE/source/pal/PalAttClientToGattClient.h b/connectivity/FEATURE_BLE/source/pal/PalAttClientToGattClient.h index bb843760e67..860f8e3822a 100644 --- a/connectivity/FEATURE_BLE/source/pal/PalAttClientToGattClient.h +++ b/connectivity/FEATURE_BLE/source/pal/PalAttClientToGattClient.h @@ -140,7 +140,7 @@ class PalAttClientToGattClient : public PalGattClient { attribute_handle_t characteristic_value_handle, const Span& value ) override; - +#if BLE_FEATURE_SIGNING /** * @see ble::PalGattClient::signed_write_without_response */ @@ -149,7 +149,7 @@ class PalAttClientToGattClient : public PalGattClient { attribute_handle_t characteristic_value_handle, const Span& value ) override; - +#endif //BLE_FEATURE_SIGNING /** * @see ble::PalGattClient::write_attribute */ diff --git a/connectivity/FEATURE_BLE/source/pal/PalGattClient.h b/connectivity/FEATURE_BLE/source/pal/PalGattClient.h index c9a11d2b60c..677de1d29af 100644 --- a/connectivity/FEATURE_BLE/source/pal/PalGattClient.h +++ b/connectivity/FEATURE_BLE/source/pal/PalGattClient.h @@ -472,7 +472,7 @@ class PalGattClient { attribute_handle_t characteristic_value_handle, const Span& value ) = 0; - +#if BLE_FEATURE_SIGNING /** * Send a Signed Write without Response command to the server. * @@ -494,7 +494,7 @@ class PalGattClient { attribute_handle_t characteristic_value_handle, const Span& value ) = 0; - +#endif //BLE_FEATURE_SIGNING /** * Send a write request to the server. *