mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			BLE: Move cordio implementation include into source folder
							parent
							
								
									029ed3a0c5
								
							
						
					
					
						commit
						cf91053f93
					
				| 
						 | 
				
			
			@ -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<BLEInstanceBase &>(*this);
 | 
			
		||||
    auto &self = const_cast<BLEInstanceBase &>(*this);
 | 
			
		||||
    return const_cast<const ble::Gap &>(self.getGap());
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -237,7 +236,7 @@ ble::GattServer &BLEInstanceBase::getGattServer()
 | 
			
		|||
 | 
			
		||||
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());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			@ -18,8 +18,8 @@
 | 
			
		|||
 | 
			
		||||
#include "ble/common/BLERoles.h"
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include "GattServerImpl.h"
 | 
			
		||||
#include "BLEInstanceBaseImpl.h"
 | 
			
		||||
#include "source/GattServerImpl.h"
 | 
			
		||||
#include "source/BLEInstanceBaseImpl.h"
 | 
			
		||||
#include "wsf_types.h"
 | 
			
		||||
#include "att_api.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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,8 +16,8 @@
 | 
			
		|||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "internal/PalEventQueueImpl.h"
 | 
			
		||||
#include "source/BLEInstanceBase.h"
 | 
			
		||||
#include "source/PalEventQueueImpl.h"
 | 
			
		||||
 | 
			
		||||
namespace ble {
 | 
			
		||||
namespace impl {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue