diff --git a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp index 5dc06f2bf8..0e16c674e8 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp @@ -17,9 +17,26 @@ */ #include "mbed.h" -#include "us_ticker_api.h" +#include "platform/CriticalSectionLock.h" +#include "hal/us_ticker_api.h" +#include "platform/mbed_assert.h" + #include "ble/BLE.h" -#include "CriticalSectionLock.h" +#include "ble/driver/CordioHCIDriver.h" + +#include "source/pal/PalAttClient.h" +#include "source/pal/PalSecurityManager.h" +#include "source/pal/PalGap.h" +#include "source/pal/PalSigningMonitor.h" +#include "source/pal/PalAttClientToGattClient.h" + +#include "source/BLEInstanceBaseImpl.h" +#include "source/GattServerImpl.h" +#include "source/PalSecurityManagerImpl.h" +#include "source/PalAttClientImpl.h" +#include "source/PalGenericAccessServiceImpl.h" +#include "source/PalGapImpl.h" + #include "wsf_types.h" #include "wsf_msg.h" #include "wsf_os.h" @@ -34,24 +51,8 @@ #include "att_api.h" #include "smp_api.h" #include "hci_drv.h" -#include "mbed_assert.h" #include "bstream.h" -#include "source/pal/PalAttClient.h" -#include "source/pal/PalSecurityManager.h" -#include "source/pal/PalGap.h" -#include "source/pal/PalSigningMonitor.h" -#include "source/pal/PalAttClientToGattClient.h" -#include "source/BLEInstanceBase.h" -#include "ble/driver/CordioHCIDriver.h" -#include "GattServerImpl.h" -#include "PalSecurityManagerImpl.h" - -#include "internal/PalAttClientImpl.h" -#include "internal/PalGenericAccessServiceImpl.h" -#include "PalGapImpl.h" -#include "internal/BLEInstanceBaseImpl.h" - using namespace std::chrono; @@ -123,9 +124,7 @@ BLEInstanceBase::BLEInstanceBase(CordioHCIDriver &hci_driver) : stack_setup(); } -BLEInstanceBase::~BLEInstanceBase() -{ -} +BLEInstanceBase::~BLEInstanceBase() = default; /** * The singleton which represents the BLE transport for the BLE. @@ -217,7 +216,7 @@ ble::Gap &BLEInstanceBase::getGap() const ble::Gap &BLEInstanceBase::getGap() const { - BLEInstanceBase &self = const_cast(*this); + auto &self = const_cast(*this); return const_cast(self.getGap()); }; @@ -237,7 +236,7 @@ ble::GattServer &BLEInstanceBase::getGattServer() const ble::GattServer &BLEInstanceBase::getGattServer() const { - BLEInstanceBase &self = const_cast(*this); + auto &self = const_cast(*this); return const_cast(self.getGattServer()); } @@ -273,8 +272,8 @@ ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl() { // Creation of a proxy monitor to let the security manager register to // the gatt client and gatt server. - static struct : PalSigningMonitor { - void set_signing_event_handler(PalSigningMonitorEventHandler *handler) + static struct : ble::PalSigningMonitor { + void set_signing_event_handler(PalSigningMonitorEventHandler *handler) final { #if BLE_FEATURE_GATT_CLIENT BLEInstanceBase::deviceInstance().getGattClientImpl().set_signing_event_handler(handler); diff --git a/connectivity/FEATURE_BLE/source/cordio/include/ble/internal/BLEInstanceBaseImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h similarity index 85% rename from connectivity/FEATURE_BLE/source/cordio/include/ble/internal/BLEInstanceBaseImpl.h rename to connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h index e256f4e14a..b91e9e30e0 100644 --- a/connectivity/FEATURE_BLE/source/cordio/include/ble/internal/BLEInstanceBaseImpl.h +++ b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.h @@ -20,27 +20,30 @@ #define IMPL_BLE_INSTANCE_BASE_H_ #include "ble/BLE.h" -#include "ble/common/blecommon.h" -#include "source/BLEInstanceBase.h" -#include "ble/driver/CordioHCIDriver.h" #include "ble/GattServer.h" +#include "ble/GattClient.h" +#include "ble/Gap.h" +#include "ble/SecurityManager.h" + +#include "ble/common/blecommon.h" +#include "ble/driver/CordioHCIDriver.h" + +#include "source/BLEInstanceBase.h" #include "source/pal/PalAttClient.h" #include "source/pal/PalGattClient.h" -#include "ble/GattClient.h" #include "source/pal/PalGap.h" -#include "ble/Gap.h" #include "source/pal/PalGenericAccessService.h" -#include "ble/SecurityManager.h" #include "source/pal/PalEventQueue.h" -#include "drivers/LowPowerTimer.h" #include "source/pal/PalSecurityManager.h" #include "source/generic/GapImpl.h" #include "source/generic/GattClientImpl.h" -#include "source/GattServerImpl.h" #include "source/generic/SecurityManagerImpl.h" -#include "internal/PalEventQueueImpl.h" +#include "source/GattServerImpl.h" +#include "source/PalEventQueueImpl.h" + +#include "drivers/LowPowerTimer.h" namespace ble { @@ -51,7 +54,7 @@ namespace impl { /** * @see BLEInstanceBase */ -class BLEInstanceBase : public ble::BLEInstanceBase { +class BLEInstanceBase final : public ble::BLEInstanceBase { friend PalSigningMonitor; /** @@ -75,36 +78,36 @@ public: /** * @see BLEInstanceBase::init */ - virtual ble_error_t init( + ble_error_t init( FunctionPointerWithContext<::BLE::InitializationCompleteCallbackContext *> initCallback - ); + ) final; /** * @see BLEInstanceBase::hasInitialized */ - virtual bool hasInitialized() const; + bool hasInitialized() const final; /** * @see BLEInstanceBase::shutdown */ - virtual ble_error_t shutdown(); + ble_error_t shutdown() final; /** * @see BLEInstanceBase::getVersion */ - virtual const char *getVersion(); + const char *getVersion() final; ble::impl::Gap &getGapImpl(); /** * @see BLEInstanceBase::getGap */ - virtual ble::Gap &getGap(); + ble::Gap &getGap() final; /** * @see BLEInstanceBase::getGap */ - virtual const ble::Gap &getGap() const; + const ble::Gap &getGap() const final; #if BLE_FEATURE_GATT_SERVER @@ -113,12 +116,12 @@ public: /** * @see BLEInstanceBase::getGattServer */ - virtual ble::GattServer &getGattServer(); + ble::GattServer &getGattServer() final; /** * @see BLEInstanceBase::getGattServer */ - virtual const ble::GattServer &getGattServer() const; + const ble::GattServer &getGattServer() const final; #endif // BLE_FEATURE_GATT_SERVER @@ -129,7 +132,7 @@ public: /** * @see BLEInstanceBase::getGattClient */ - virtual ble::GattClient &getGattClient(); + ble::GattClient &getGattClient() final; /** * Get the PAL Gatt Client. @@ -147,24 +150,24 @@ public: /** * @see BLEInstanceBase::getSecurityManager */ - virtual ble::SecurityManager &getSecurityManager(); + ble::SecurityManager &getSecurityManager() final; /** * @see BLEInstanceBase::getSecurityManager */ - virtual const ble::SecurityManager &getSecurityManager() const; + const ble::SecurityManager &getSecurityManager() const final; #endif // BLE_FEATURE_SECURITY /** * @see BLEInstanceBase::waitForEvent */ - virtual void waitForEvent(); + void waitForEvent(); /** * @see BLEInstanceBase::processEvents */ - virtual void processEvents(); + void processEvents() final; private: static void stack_handler(wsfEventMask_t event, wsfMsgHdr_t *msg); diff --git a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp index 434ee52b09..8cb7d4bd62 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.cpp @@ -18,8 +18,8 @@ #include "ble/common/BLERoles.h" #include -#include "GattServerImpl.h" -#include "BLEInstanceBaseImpl.h" +#include "source/GattServerImpl.h" +#include "source/BLEInstanceBaseImpl.h" #include "wsf_types.h" #include "att_api.h" diff --git a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h index ad91e422d3..32d44005e8 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h +++ b/connectivity/FEATURE_BLE/source/cordio/source/GattServerImpl.h @@ -25,7 +25,6 @@ #include "wsf_types.h" #include "att_api.h" - #include "ble/GattServer.h" #include "ble/Gap.h" #include "ble/SecurityManager.h" @@ -38,7 +37,6 @@ #include "ble/common/CallChainOfFunctionPointersWithContext.h" #include "ble/common/blecommon.h" - #include "source/BLEInstanceBase.h" #include "source/generic/GattServerEvents.h" #include "source/pal/PalSigningMonitor.h" diff --git a/connectivity/FEATURE_BLE/source/cordio/source/PalAttClientImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/PalAttClientImpl.cpp index 817535f4df..35c299d781 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/PalAttClientImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/PalAttClientImpl.cpp @@ -17,11 +17,12 @@ */ #include "source/pal/PalAttClient.h" -#include "GattServerImpl.h" #include "source/pal/PalSimpleAttServerMessage.h" #include "source/pal/PalGattClient.h" -#include "BLEInstanceBaseImpl.h" -#include "internal/PalAttClientImpl.h" + +#include "source/GattServerImpl.h" +#include "source/BLEInstanceBaseImpl.h" +#include "source/PalAttClientImpl.h" #include "att_api.h" #include "att_defs.h" diff --git a/connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalAttClientImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/PalAttClientImpl.h similarity index 100% rename from connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalAttClientImpl.h rename to connectivity/FEATURE_BLE/source/cordio/source/PalAttClientImpl.h diff --git a/connectivity/FEATURE_BLE/source/cordio/source/PalEventQueueImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/PalEventQueueImpl.cpp index 29c9c8e5e6..e1079df2da 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/PalEventQueueImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/PalEventQueueImpl.cpp @@ -16,8 +16,8 @@ * limitations under the License. */ -#include "internal/PalEventQueueImpl.h" #include "source/BLEInstanceBase.h" +#include "source/PalEventQueueImpl.h" namespace ble { namespace impl { diff --git a/connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalEventQueueImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/PalEventQueueImpl.h similarity index 100% rename from connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalEventQueueImpl.h rename to connectivity/FEATURE_BLE/source/cordio/source/PalEventQueueImpl.h diff --git a/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp index 38c985da97..07af679582 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "PalGapImpl.h" +#include "source/PalGapImpl.h" #include "hci_api.h" #include "dm_api.h" #include "dm_main.h" diff --git a/connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalGapImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.h similarity index 100% rename from connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalGapImpl.h rename to connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.h diff --git a/connectivity/FEATURE_BLE/source/cordio/source/PalGenericAccessServiceImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/PalGenericAccessServiceImpl.cpp index abf7cd59fb..0e2fe68ab9 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/PalGenericAccessServiceImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/PalGenericAccessServiceImpl.cpp @@ -16,8 +16,8 @@ * limitations under the License. */ -#include "internal/PalGenericAccessServiceImpl.h" -#include "GattServerImpl.h" +#include "source/PalGenericAccessServiceImpl.h" +#include "source/GattServerImpl.h" namespace ble { namespace impl { diff --git a/connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalGenericAccessServiceImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/PalGenericAccessServiceImpl.h similarity index 100% rename from connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalGenericAccessServiceImpl.h rename to connectivity/FEATURE_BLE/source/cordio/source/PalGenericAccessServiceImpl.h diff --git a/connectivity/FEATURE_BLE/source/cordio/source/PalSecurityManagerImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/PalSecurityManagerImpl.cpp index 59aa223af1..83094d06e9 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/PalSecurityManagerImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/PalSecurityManagerImpl.cpp @@ -20,8 +20,8 @@ #include "ble/common/BLERoles.h" #include "ble/common/blecommon.h" -#include "internal/PalSecurityManagerImpl.h" -#include "internal/PalAttClientImpl.h" +#include "source/PalSecurityManagerImpl.h" +#include "source/PalAttClientImpl.h" #include "dm_api.h" #include "att_api.h" #include "smp_api.h" diff --git a/connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalSecurityManagerImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/PalSecurityManagerImpl.h similarity index 100% rename from connectivity/FEATURE_BLE/source/cordio/include/ble/internal/PalSecurityManagerImpl.h rename to connectivity/FEATURE_BLE/source/cordio/source/PalSecurityManagerImpl.h diff --git a/connectivity/FEATURE_BLE/source/generic/GapImpl.h b/connectivity/FEATURE_BLE/source/generic/GapImpl.h index 4daa2d5ead..02c7c3d59a 100644 --- a/connectivity/FEATURE_BLE/source/generic/GapImpl.h +++ b/connectivity/FEATURE_BLE/source/generic/GapImpl.h @@ -53,17 +53,17 @@ class PalSecurityManager; class PalGap; -class BLEInstanceBase; - namespace impl { +class BLEInstanceBase; + class Gap : - public PalConnectionMonitor, + public ble::PalConnectionMonitor, public PalGapEventHandler { friend PalConnectionMonitor; friend PalGapEventHandler; friend PalGap; - friend BLEInstanceBase; + friend impl::BLEInstanceBase; using EventHandler = ::ble::Gap::EventHandler; using GapShutdownCallback_t = ::ble::Gap::GapShutdownCallback_t; diff --git a/connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h b/connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h index b93d471f3e..00ff378106 100644 --- a/connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h +++ b/connectivity/FEATURE_BLE/source/generic/SecurityManagerImpl.h @@ -41,7 +41,6 @@ namespace ble { class PalGenericAccessService; -class BLEInstanceBase; namespace impl { @@ -450,9 +449,9 @@ private: public: SecurityManager( - PalSecurityManager &palImpl, - PalConnectionMonitor &connMonitorImpl, - PalSigningMonitor &signingMonitorImpl + ble::PalSecurityManager &palImpl, + ble::PalConnectionMonitor &connMonitorImpl, + ble::PalSigningMonitor &signingMonitorImpl ) : eventHandler(nullptr), _pal(palImpl), _connection_monitor(connMonitorImpl),