BLE: Move cordio implementation include into source folder

pull/13475/head
Vincent Coubard 2020-08-24 17:34:08 +01:00
parent 029ed3a0c5
commit cf91053f93
16 changed files with 70 additions and 70 deletions

View File

@ -17,9 +17,26 @@
*/ */
#include "mbed.h" #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 "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_types.h"
#include "wsf_msg.h" #include "wsf_msg.h"
#include "wsf_os.h" #include "wsf_os.h"
@ -34,24 +51,8 @@
#include "att_api.h" #include "att_api.h"
#include "smp_api.h" #include "smp_api.h"
#include "hci_drv.h" #include "hci_drv.h"
#include "mbed_assert.h"
#include "bstream.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; using namespace std::chrono;
@ -123,9 +124,7 @@ BLEInstanceBase::BLEInstanceBase(CordioHCIDriver &hci_driver) :
stack_setup(); stack_setup();
} }
BLEInstanceBase::~BLEInstanceBase() BLEInstanceBase::~BLEInstanceBase() = default;
{
}
/** /**
* The singleton which represents the BLE transport for the BLE. * The singleton which represents the BLE transport for the BLE.
@ -217,7 +216,7 @@ ble::Gap &BLEInstanceBase::getGap()
const ble::Gap &BLEInstanceBase::getGap() const const ble::Gap &BLEInstanceBase::getGap() const
{ {
BLEInstanceBase &self = const_cast<BLEInstanceBase &>(*this); auto &self = const_cast<BLEInstanceBase &>(*this);
return const_cast<const ble::Gap &>(self.getGap()); return const_cast<const ble::Gap &>(self.getGap());
}; };
@ -237,7 +236,7 @@ ble::GattServer &BLEInstanceBase::getGattServer()
const ble::GattServer &BLEInstanceBase::getGattServer() const const ble::GattServer &BLEInstanceBase::getGattServer() const
{ {
BLEInstanceBase &self = const_cast<BLEInstanceBase &>(*this); auto &self = const_cast<BLEInstanceBase &>(*this);
return const_cast<const ble::GattServer &>(self.getGattServer()); return const_cast<const ble::GattServer &>(self.getGattServer());
} }
@ -273,8 +272,8 @@ ble::impl::SecurityManager &BLEInstanceBase::getSecurityManagerImpl()
{ {
// Creation of a proxy monitor to let the security manager register to // Creation of a proxy monitor to let the security manager register to
// the gatt client and gatt server. // the gatt client and gatt server.
static struct : PalSigningMonitor { static struct : ble::PalSigningMonitor {
void set_signing_event_handler(PalSigningMonitorEventHandler *handler) void set_signing_event_handler(PalSigningMonitorEventHandler *handler) final
{ {
#if BLE_FEATURE_GATT_CLIENT #if BLE_FEATURE_GATT_CLIENT
BLEInstanceBase::deviceInstance().getGattClientImpl().set_signing_event_handler(handler); BLEInstanceBase::deviceInstance().getGattClientImpl().set_signing_event_handler(handler);

View File

@ -20,27 +20,30 @@
#define IMPL_BLE_INSTANCE_BASE_H_ #define IMPL_BLE_INSTANCE_BASE_H_
#include "ble/BLE.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/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/PalAttClient.h"
#include "source/pal/PalGattClient.h" #include "source/pal/PalGattClient.h"
#include "ble/GattClient.h"
#include "source/pal/PalGap.h" #include "source/pal/PalGap.h"
#include "ble/Gap.h"
#include "source/pal/PalGenericAccessService.h" #include "source/pal/PalGenericAccessService.h"
#include "ble/SecurityManager.h"
#include "source/pal/PalEventQueue.h" #include "source/pal/PalEventQueue.h"
#include "drivers/LowPowerTimer.h"
#include "source/pal/PalSecurityManager.h" #include "source/pal/PalSecurityManager.h"
#include "source/generic/GapImpl.h" #include "source/generic/GapImpl.h"
#include "source/generic/GattClientImpl.h" #include "source/generic/GattClientImpl.h"
#include "source/GattServerImpl.h"
#include "source/generic/SecurityManagerImpl.h" #include "source/generic/SecurityManagerImpl.h"
#include "internal/PalEventQueueImpl.h" #include "source/GattServerImpl.h"
#include "source/PalEventQueueImpl.h"
#include "drivers/LowPowerTimer.h"
namespace ble { namespace ble {
@ -51,7 +54,7 @@ namespace impl {
/** /**
* @see BLEInstanceBase * @see BLEInstanceBase
*/ */
class BLEInstanceBase : public ble::BLEInstanceBase { class BLEInstanceBase final : public ble::BLEInstanceBase {
friend PalSigningMonitor; friend PalSigningMonitor;
/** /**
@ -75,36 +78,36 @@ public:
/** /**
* @see BLEInstanceBase::init * @see BLEInstanceBase::init
*/ */
virtual ble_error_t init( ble_error_t init(
FunctionPointerWithContext<::BLE::InitializationCompleteCallbackContext *> initCallback FunctionPointerWithContext<::BLE::InitializationCompleteCallbackContext *> initCallback
); ) final;
/** /**
* @see BLEInstanceBase::hasInitialized * @see BLEInstanceBase::hasInitialized
*/ */
virtual bool hasInitialized() const; bool hasInitialized() const final;
/** /**
* @see BLEInstanceBase::shutdown * @see BLEInstanceBase::shutdown
*/ */
virtual ble_error_t shutdown(); ble_error_t shutdown() final;
/** /**
* @see BLEInstanceBase::getVersion * @see BLEInstanceBase::getVersion
*/ */
virtual const char *getVersion(); const char *getVersion() final;
ble::impl::Gap &getGapImpl(); ble::impl::Gap &getGapImpl();
/** /**
* @see BLEInstanceBase::getGap * @see BLEInstanceBase::getGap
*/ */
virtual ble::Gap &getGap(); ble::Gap &getGap() final;
/** /**
* @see BLEInstanceBase::getGap * @see BLEInstanceBase::getGap
*/ */
virtual const ble::Gap &getGap() const; const ble::Gap &getGap() const final;
#if BLE_FEATURE_GATT_SERVER #if BLE_FEATURE_GATT_SERVER
@ -113,12 +116,12 @@ public:
/** /**
* @see BLEInstanceBase::getGattServer * @see BLEInstanceBase::getGattServer
*/ */
virtual ble::GattServer &getGattServer(); ble::GattServer &getGattServer() final;
/** /**
* @see BLEInstanceBase::getGattServer * @see BLEInstanceBase::getGattServer
*/ */
virtual const ble::GattServer &getGattServer() const; const ble::GattServer &getGattServer() const final;
#endif // BLE_FEATURE_GATT_SERVER #endif // BLE_FEATURE_GATT_SERVER
@ -129,7 +132,7 @@ public:
/** /**
* @see BLEInstanceBase::getGattClient * @see BLEInstanceBase::getGattClient
*/ */
virtual ble::GattClient &getGattClient(); ble::GattClient &getGattClient() final;
/** /**
* Get the PAL Gatt Client. * Get the PAL Gatt Client.
@ -147,24 +150,24 @@ public:
/** /**
* @see BLEInstanceBase::getSecurityManager * @see BLEInstanceBase::getSecurityManager
*/ */
virtual ble::SecurityManager &getSecurityManager(); ble::SecurityManager &getSecurityManager() final;
/** /**
* @see BLEInstanceBase::getSecurityManager * @see BLEInstanceBase::getSecurityManager
*/ */
virtual const ble::SecurityManager &getSecurityManager() const; const ble::SecurityManager &getSecurityManager() const final;
#endif // BLE_FEATURE_SECURITY #endif // BLE_FEATURE_SECURITY
/** /**
* @see BLEInstanceBase::waitForEvent * @see BLEInstanceBase::waitForEvent
*/ */
virtual void waitForEvent(); void waitForEvent();
/** /**
* @see BLEInstanceBase::processEvents * @see BLEInstanceBase::processEvents
*/ */
virtual void processEvents(); void processEvents() final;
private: private:
static void stack_handler(wsfEventMask_t event, wsfMsgHdr_t *msg); static void stack_handler(wsfEventMask_t event, wsfMsgHdr_t *msg);

View File

@ -18,8 +18,8 @@
#include "ble/common/BLERoles.h" #include "ble/common/BLERoles.h"
#include <algorithm> #include <algorithm>
#include "GattServerImpl.h" #include "source/GattServerImpl.h"
#include "BLEInstanceBaseImpl.h" #include "source/BLEInstanceBaseImpl.h"
#include "wsf_types.h" #include "wsf_types.h"
#include "att_api.h" #include "att_api.h"

View File

@ -25,7 +25,6 @@
#include "wsf_types.h" #include "wsf_types.h"
#include "att_api.h" #include "att_api.h"
#include "ble/GattServer.h" #include "ble/GattServer.h"
#include "ble/Gap.h" #include "ble/Gap.h"
#include "ble/SecurityManager.h" #include "ble/SecurityManager.h"
@ -38,7 +37,6 @@
#include "ble/common/CallChainOfFunctionPointersWithContext.h" #include "ble/common/CallChainOfFunctionPointersWithContext.h"
#include "ble/common/blecommon.h" #include "ble/common/blecommon.h"
#include "source/BLEInstanceBase.h" #include "source/BLEInstanceBase.h"
#include "source/generic/GattServerEvents.h" #include "source/generic/GattServerEvents.h"
#include "source/pal/PalSigningMonitor.h" #include "source/pal/PalSigningMonitor.h"

View File

@ -17,11 +17,12 @@
*/ */
#include "source/pal/PalAttClient.h" #include "source/pal/PalAttClient.h"
#include "GattServerImpl.h"
#include "source/pal/PalSimpleAttServerMessage.h" #include "source/pal/PalSimpleAttServerMessage.h"
#include "source/pal/PalGattClient.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_api.h"
#include "att_defs.h" #include "att_defs.h"

View File

@ -16,8 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include "internal/PalEventQueueImpl.h"
#include "source/BLEInstanceBase.h" #include "source/BLEInstanceBase.h"
#include "source/PalEventQueueImpl.h"
namespace ble { namespace ble {
namespace impl { namespace impl {

View File

@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "PalGapImpl.h" #include "source/PalGapImpl.h"
#include "hci_api.h" #include "hci_api.h"
#include "dm_api.h" #include "dm_api.h"
#include "dm_main.h" #include "dm_main.h"

View File

@ -16,8 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include "internal/PalGenericAccessServiceImpl.h" #include "source/PalGenericAccessServiceImpl.h"
#include "GattServerImpl.h" #include "source/GattServerImpl.h"
namespace ble { namespace ble {
namespace impl { namespace impl {

View File

@ -20,8 +20,8 @@
#include "ble/common/BLERoles.h" #include "ble/common/BLERoles.h"
#include "ble/common/blecommon.h" #include "ble/common/blecommon.h"
#include "internal/PalSecurityManagerImpl.h" #include "source/PalSecurityManagerImpl.h"
#include "internal/PalAttClientImpl.h" #include "source/PalAttClientImpl.h"
#include "dm_api.h" #include "dm_api.h"
#include "att_api.h" #include "att_api.h"
#include "smp_api.h" #include "smp_api.h"

View File

@ -53,17 +53,17 @@ class PalSecurityManager;
class PalGap; class PalGap;
class BLEInstanceBase;
namespace impl { namespace impl {
class BLEInstanceBase;
class Gap : class Gap :
public PalConnectionMonitor, public ble::PalConnectionMonitor,
public PalGapEventHandler { public PalGapEventHandler {
friend PalConnectionMonitor; friend PalConnectionMonitor;
friend PalGapEventHandler; friend PalGapEventHandler;
friend PalGap; friend PalGap;
friend BLEInstanceBase; friend impl::BLEInstanceBase;
using EventHandler = ::ble::Gap::EventHandler; using EventHandler = ::ble::Gap::EventHandler;
using GapShutdownCallback_t = ::ble::Gap::GapShutdownCallback_t; using GapShutdownCallback_t = ::ble::Gap::GapShutdownCallback_t;

View File

@ -41,7 +41,6 @@
namespace ble { namespace ble {
class PalGenericAccessService; class PalGenericAccessService;
class BLEInstanceBase;
namespace impl { namespace impl {
@ -450,9 +449,9 @@ private:
public: public:
SecurityManager( SecurityManager(
PalSecurityManager &palImpl, ble::PalSecurityManager &palImpl,
PalConnectionMonitor &connMonitorImpl, ble::PalConnectionMonitor &connMonitorImpl,
PalSigningMonitor &signingMonitorImpl ble::PalSigningMonitor &signingMonitorImpl
) : eventHandler(nullptr), ) : eventHandler(nullptr),
_pal(palImpl), _pal(palImpl),
_connection_monitor(connMonitorImpl), _connection_monitor(connMonitorImpl),