mirror of https://github.com/ARMmbed/mbed-os.git
added #if guards to cordio ble
parent
bed567825f
commit
5a97706aab
|
@ -17,7 +17,7 @@
|
||||||
#ifndef MBED_BLE_H__
|
#ifndef MBED_BLE_H__
|
||||||
#define MBED_BLE_H__
|
#define MBED_BLE_H__
|
||||||
|
|
||||||
#include "BLERoles.h
|
#include "BLERoles.h"
|
||||||
|
|
||||||
#include "blecommon.h"
|
#include "blecommon.h"
|
||||||
#include "ble/Gap.h"
|
#include "ble/Gap.h"
|
||||||
|
@ -844,7 +844,6 @@ public:
|
||||||
MBED_DEPRECATED("Use ble.gap().stopAdvertising(...)")
|
MBED_DEPRECATED("Use ble.gap().stopAdvertising(...)")
|
||||||
ble_error_t stopAdvertising(void);
|
ble_error_t stopAdvertising(void);
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
/**
|
/**
|
||||||
* Set up parameters for GAP scanning (observer mode).
|
* Set up parameters for GAP scanning (observer mode).
|
||||||
*
|
*
|
||||||
|
@ -1042,7 +1041,6 @@ public:
|
||||||
{
|
{
|
||||||
return gap().stopScan();
|
return gap().stopScan();
|
||||||
}
|
}
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a connection (GAP Link Establishment).
|
* Create a connection (GAP Link Establishment).
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#ifndef MBED_DISCOVERED_CHARACTERISTIC_H__
|
#ifndef MBED_DISCOVERED_CHARACTERISTIC_H__
|
||||||
#define MBED_DISCOVERED_CHARACTERISTIC_H__
|
#define MBED_DISCOVERED_CHARACTERISTIC_H__
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#include "UUID.h"
|
#include "UUID.h"
|
||||||
#include "ble/Gap.h"
|
#include "ble/Gap.h"
|
||||||
#include "GattAttribute.h"
|
#include "GattAttribute.h"
|
||||||
|
@ -636,6 +634,4 @@ protected:
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#endif /*MBED_DISCOVERED_CHARACTERISTIC_H__*/
|
#endif /*MBED_DISCOVERED_CHARACTERISTIC_H__*/
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#ifndef MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
|
#ifndef MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
|
||||||
#define MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
|
#define MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#include "UUID.h"
|
#include "UUID.h"
|
||||||
#include "ble/Gap.h"
|
#include "ble/Gap.h"
|
||||||
#include "GattAttribute.h"
|
#include "GattAttribute.h"
|
||||||
|
@ -152,6 +150,4 @@ private:
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#endif /* MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__ */
|
#endif /* MBED_DISCOVERED_CHARACTERISTIC_DESCRIPTOR_H__ */
|
||||||
|
|
|
@ -66,9 +66,7 @@ public:
|
||||||
using ble::interface::Gap<Impl>::stopAdvertising;
|
using ble::interface::Gap<Impl>::stopAdvertising;
|
||||||
using ble::interface::Gap<Impl>::connect;
|
using ble::interface::Gap<Impl>::connect;
|
||||||
using ble::interface::Gap<Impl>::disconnect;
|
using ble::interface::Gap<Impl>::disconnect;
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
using ble::interface::Gap<Impl>::startScan;
|
using ble::interface::Gap<Impl>::startScan;
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address-type for BLEProtocol addresses.
|
* Address-type for BLEProtocol addresses.
|
||||||
|
@ -1657,7 +1655,6 @@ public:
|
||||||
)
|
)
|
||||||
void clearScanResponse(void);
|
void clearScanResponse(void);
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
/**
|
/**
|
||||||
* Set the parameters used during a scan procedure.
|
* Set the parameters used during a scan procedure.
|
||||||
*
|
*
|
||||||
|
@ -1868,8 +1865,6 @@ public:
|
||||||
void (T::*callbackMember)(const AdvertisementCallbackParams_t *params)
|
void (T::*callbackMember)(const AdvertisementCallbackParams_t *params)
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable radio-notification events.
|
* Enable radio-notification events.
|
||||||
*
|
*
|
||||||
|
@ -2624,8 +2619,6 @@ protected:
|
||||||
#pragma diag_suppress 1361
|
#pragma diag_suppress 1361
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ble_error_t LegacyGap<Impl>::startScan(
|
ble_error_t LegacyGap<Impl>::startScan(
|
||||||
|
@ -2644,8 +2637,6 @@ ble_error_t LegacyGap<Impl>::startScan(
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void LegacyGap<Impl>::onConnection(T *tptr, void (T::*mptr)(const ConnectionCallbackParams_t *))
|
void LegacyGap<Impl>::onConnection(T *tptr, void (T::*mptr)(const ConnectionCallbackParams_t *))
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#ifndef MBED_GATT_CLIENT_H__
|
#ifndef MBED_GATT_CLIENT_H__
|
||||||
#define MBED_GATT_CLIENT_H__
|
#define MBED_GATT_CLIENT_H__
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#include "ble/common/StaticInterface.h"
|
#include "ble/common/StaticInterface.h"
|
||||||
#include "ble/GattAttribute.h"
|
#include "ble/GattAttribute.h"
|
||||||
#include "ble/ServiceDiscovery.h"
|
#include "ble/ServiceDiscovery.h"
|
||||||
|
@ -880,6 +878,4 @@ private:
|
||||||
using ble::impl::GattClient;
|
using ble::impl::GattClient;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#endif /* ifndef MBED_GATT_CLIENT_H__ */
|
#endif /* ifndef MBED_GATT_CLIENT_H__ */
|
||||||
|
|
|
@ -757,7 +757,6 @@ public:
|
||||||
|
|
||||||
/* scanning */
|
/* scanning */
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
/** Set new scan parameters.
|
/** Set new scan parameters.
|
||||||
*
|
*
|
||||||
* @param params Scan parameters, @see GapScanParameters for details.
|
* @param params Scan parameters, @see GapScanParameters for details.
|
||||||
|
@ -796,8 +795,6 @@ public:
|
||||||
*/
|
*/
|
||||||
ble_error_t stopScan();
|
ble_error_t stopScan();
|
||||||
|
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
/** Synchronize with periodic advertising from an advertiser and begin receiving periodic
|
/** Synchronize with periodic advertising from an advertiser and begin receiving periodic
|
||||||
* advertising packets.
|
* advertising packets.
|
||||||
*
|
*
|
||||||
|
|
|
@ -127,8 +127,10 @@ public:
|
||||||
GenericGap(
|
GenericGap(
|
||||||
pal::EventQueue &event_queue,
|
pal::EventQueue &event_queue,
|
||||||
PalGap &pal_gap,
|
PalGap &pal_gap,
|
||||||
pal::GenericAccessService &generic_access_service,
|
pal::GenericAccessService &generic_access_service
|
||||||
|
#if BLE_FEATURE_SECURITY
|
||||||
PalSecurityManager &pal_sm
|
PalSecurityManager &pal_sm
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,7 +236,6 @@ public:
|
||||||
*/
|
*/
|
||||||
bool isPeriodicAdvertisingActive_(advertising_handle_t handle);
|
bool isPeriodicAdvertisingActive_(advertising_handle_t handle);
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
/** @copydoc Gap::setScanParameters
|
/** @copydoc Gap::setScanParameters
|
||||||
*/
|
*/
|
||||||
ble_error_t setScanParameters_(const ScanParameters ¶ms);
|
ble_error_t setScanParameters_(const ScanParameters ¶ms);
|
||||||
|
@ -246,7 +247,6 @@ public:
|
||||||
duplicates_filter_t filtering,
|
duplicates_filter_t filtering,
|
||||||
scan_period_t period
|
scan_period_t period
|
||||||
);
|
);
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
/** @copydoc Gap::createSync
|
/** @copydoc Gap::createSync
|
||||||
*/
|
*/
|
||||||
|
@ -333,12 +333,10 @@ public:
|
||||||
*/
|
*/
|
||||||
ble_error_t stopAdvertising_();
|
ble_error_t stopAdvertising_();
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
/**
|
/**
|
||||||
* @see Gap::stopScan
|
* @see Gap::stopScan
|
||||||
*/
|
*/
|
||||||
ble_error_t stopScan_();
|
ble_error_t stopScan_();
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Gap::connect
|
* @see Gap::connect
|
||||||
|
@ -789,7 +787,9 @@ private:
|
||||||
pal::EventQueue &_event_queue;
|
pal::EventQueue &_event_queue;
|
||||||
PalGap &_pal_gap;
|
PalGap &_pal_gap;
|
||||||
pal::GenericAccessService &_gap_service;
|
pal::GenericAccessService &_gap_service;
|
||||||
|
#if BLE_FEATURE_SECURITY
|
||||||
PalSecurityManager &_pal_sm;
|
PalSecurityManager &_pal_sm;
|
||||||
|
#endif
|
||||||
BLEProtocol::AddressType_t _address_type;
|
BLEProtocol::AddressType_t _address_type;
|
||||||
ble::address_t _address;
|
ble::address_t _address;
|
||||||
pal::initiator_policy_t _initiator_policy_mode;
|
pal::initiator_policy_t _initiator_policy_mode;
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#ifndef MBED_BLE_GENERIC_GATT_CLIENT
|
#ifndef MBED_BLE_GENERIC_GATT_CLIENT
|
||||||
#define MBED_BLE_GENERIC_GATT_CLIENT
|
#define MBED_BLE_GENERIC_GATT_CLIENT
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "ble/GattClient.h"
|
#include "ble/GattClient.h"
|
||||||
#include "ble/pal/PalGattClient.h"
|
#include "ble/pal/PalGattClient.h"
|
||||||
|
@ -37,7 +35,9 @@ namespace generic {
|
||||||
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
||||||
class GenericGattClient :
|
class GenericGattClient :
|
||||||
public interface::GattClient<GenericGattClient<TPalGattClient, SigningMonitorEventHandler> >,
|
public interface::GattClient<GenericGattClient<TPalGattClient, SigningMonitorEventHandler> >,
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
public pal::SigningEventMonitor<GenericGattClient<TPalGattClient, SigningMonitorEventHandler>, SigningMonitorEventHandler>,
|
public pal::SigningEventMonitor<GenericGattClient<TPalGattClient, SigningMonitorEventHandler>, SigningMonitorEventHandler>,
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
public pal::GattClientEventHandler<GenericGattClient<TPalGattClient, SigningMonitorEventHandler> > {
|
public pal::GattClientEventHandler<GenericGattClient<TPalGattClient, SigningMonitorEventHandler> > {
|
||||||
|
|
||||||
using interface::GattClient<GenericGattClient<TPalGattClient, SigningMonitorEventHandler> >::eventHandler;
|
using interface::GattClient<GenericGattClient<TPalGattClient, SigningMonitorEventHandler> >::eventHandler;
|
||||||
|
@ -136,10 +136,12 @@ public:
|
||||||
*/
|
*/
|
||||||
ble_error_t reset_(void);
|
ble_error_t reset_(void);
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* @see ble::pal::SigningEventMonitor::set_signing_event_handler
|
* @see ble::pal::SigningEventMonitor::set_signing_event_handler
|
||||||
*/
|
*/
|
||||||
void set_signing_event_handler_(SigningMonitorEventHandler *signing_event_handler);
|
void set_signing_event_handler_(SigningMonitorEventHandler *signing_event_handler);
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see pal::GattClient::EventHandler::on_att_mtu_change
|
* @see pal::GattClient::EventHandler::on_att_mtu_change
|
||||||
|
@ -171,7 +173,9 @@ private:
|
||||||
|
|
||||||
PalGattClient* const _pal_client;
|
PalGattClient* const _pal_client;
|
||||||
ServiceDiscovery::TerminationCallback_t _termination_callback;
|
ServiceDiscovery::TerminationCallback_t _termination_callback;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
SigningMonitorEventHandler* _signing_event_handler;
|
SigningMonitorEventHandler* _signing_event_handler;
|
||||||
|
#endif
|
||||||
mutable ProcedureControlBlock* control_blocks;
|
mutable ProcedureControlBlock* control_blocks;
|
||||||
bool _is_reseting;
|
bool _is_reseting;
|
||||||
};
|
};
|
||||||
|
@ -179,6 +183,4 @@ private:
|
||||||
} // generic
|
} // generic
|
||||||
} // ble
|
} // ble
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#endif /* MBED_BLE_GENERIC_GATT_CLIENT */
|
#endif /* MBED_BLE_GENERIC_GATT_CLIENT */
|
||||||
|
|
|
@ -35,8 +35,10 @@ template <template<class> class TPalSecurityManager, template<class> class Signi
|
||||||
class GenericSecurityManager :
|
class GenericSecurityManager :
|
||||||
public interface::SecurityManager<GenericSecurityManager<TPalSecurityManager, SigningMonitor > >, // SecurityManager
|
public interface::SecurityManager<GenericSecurityManager<TPalSecurityManager, SigningMonitor > >, // SecurityManager
|
||||||
public pal::SecurityManagerEventHandler<GenericSecurityManager<TPalSecurityManager, SigningMonitor> >, // PalSmEventHandler
|
public pal::SecurityManagerEventHandler<GenericSecurityManager<TPalSecurityManager, SigningMonitor> >, // PalSmEventHandler
|
||||||
public pal::ConnectionEventMonitorEventHandler<GenericSecurityManager<TPalSecurityManager, SigningMonitor> >, // ConnectionObserver
|
public pal::ConnectionEventMonitorEventHandler<GenericSecurityManager<TPalSecurityManager, SigningMonitor> > // ConnectionObserver
|
||||||
public pal::SigningMonitorEventHandler<GenericSecurityManager<TPalSecurityManager, SigningMonitor> > //SigningObserver
|
#if BLE_FEATURE_SIGNING
|
||||||
|
, public pal::SigningMonitorEventHandler<GenericSecurityManager<TPalSecurityManager, SigningMonitor> > //SigningObserver
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
{
|
{
|
||||||
// typedefs
|
// typedefs
|
||||||
typedef interface::SecurityManager<GenericSecurityManager> SecurityManager;
|
typedef interface::SecurityManager<GenericSecurityManager> SecurityManager;
|
||||||
|
@ -594,6 +596,7 @@ public:
|
||||||
connection_handle_t connection
|
connection_handle_t connection
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
/** @copydoc ble::pal::SecurityManager::on_signed_write_received
|
/** @copydoc ble::pal::SecurityManager::on_signed_write_received
|
||||||
*/
|
*/
|
||||||
void on_signed_write_received_(
|
void on_signed_write_received_(
|
||||||
|
@ -610,6 +613,7 @@ public:
|
||||||
/** @copydoc ble::pal::SecurityManager::on_signed_write
|
/** @copydoc ble::pal::SecurityManager::on_signed_write
|
||||||
*/
|
*/
|
||||||
void on_signed_write_();
|
void on_signed_write_();
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
/** @copydoc ble::pal::SecurityManager::on_slave_security_request
|
/** @copydoc ble::pal::SecurityManager::on_slave_security_request
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#ifndef __BLE_UART_SERVICE_H__
|
#ifndef __BLE_UART_SERVICE_H__
|
||||||
#define __BLE_UART_SERVICE_H__
|
#define __BLE_UART_SERVICE_H__
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
||||||
#ifdef YOTTA_CFG_MBED_OS
|
#ifdef YOTTA_CFG_MBED_OS
|
||||||
#include "mbed-drivers/mbed.h"
|
#include "mbed-drivers/mbed.h"
|
||||||
#include "mbed-drivers/Stream.h"
|
#include "mbed-drivers/Stream.h"
|
||||||
|
@ -217,6 +215,4 @@ protected:
|
||||||
* application. */
|
* application. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
||||||
#endif /* #ifndef __BLE_UART_SERVICE_H__*/
|
#endif /* #ifndef __BLE_UART_SERVICE_H__*/
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#ifndef SERVICES_URIBEACONCONFIGSERVICE_H_
|
#ifndef SERVICES_URIBEACONCONFIGSERVICE_H_
|
||||||
#define SERVICES_URIBEACONCONFIGSERVICE_H_
|
#define SERVICES_URIBEACONCONFIGSERVICE_H_
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
||||||
#include "ble/BLE.h"
|
#include "ble/BLE.h"
|
||||||
|
|
||||||
#ifdef YOTTA_CFG_MBED_OS
|
#ifdef YOTTA_CFG_MBED_OS
|
||||||
|
@ -482,6 +480,4 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
||||||
#endif // SERVICES_URIBEACONCONFIGSERVICE_H_
|
#endif // SERVICES_URIBEACONCONFIGSERVICE_H_
|
||||||
|
|
|
@ -454,8 +454,6 @@ ble_error_t BLE::stopAdvertising(void) {
|
||||||
return gap().stopAdvertising();
|
return gap().stopAdvertising();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
ble_error_t BLE::setScanParams(uint16_t interval,
|
ble_error_t BLE::setScanParams(uint16_t interval,
|
||||||
uint16_t window,
|
uint16_t window,
|
||||||
uint16_t timeout,
|
uint16_t timeout,
|
||||||
|
@ -483,8 +481,6 @@ ble_error_t BLE::startScan(void (*callback)(const Gap::AdvertisementCallbackPara
|
||||||
return gap().startScan(callback);
|
return gap().startScan(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
ble_error_t BLE::disconnect(Gap::Handle_t connectionHandle, Gap::DisconnectionReason_t reason) {
|
ble_error_t BLE::disconnect(Gap::Handle_t connectionHandle, Gap::DisconnectionReason_t reason) {
|
||||||
return gap().disconnect(connectionHandle, reason);
|
return gap().disconnect(connectionHandle, reason);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
#include "ble/DiscoveredCharacteristic.h"
|
#include "ble/DiscoveredCharacteristic.h"
|
||||||
#include "ble/GattClient.h"
|
#include "ble/GattClient.h"
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
ble_error_t
|
ble_error_t
|
||||||
DiscoveredCharacteristic::read(uint16_t offset) const
|
DiscoveredCharacteristic::read(uint16_t offset) const
|
||||||
{
|
{
|
||||||
|
@ -167,5 +165,3 @@ ble_error_t DiscoveredCharacteristic::discoverDescriptors(
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
|
@ -426,8 +426,6 @@ ble_error_t LegacyGap<Impl>::accumulateScanResponse(
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
void LegacyGap<Impl>::clearScanResponse(void)
|
void LegacyGap<Impl>::clearScanResponse(void)
|
||||||
{
|
{
|
||||||
|
@ -529,8 +527,6 @@ ble_error_t LegacyGap<Impl>::startScan(
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
GapAdvertisingParams &LegacyGap<Impl>::getAdvertisingParams(void)
|
GapAdvertisingParams &LegacyGap<Impl>::getAdvertisingParams(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -156,8 +156,6 @@ bool Gap<Impl>::isPeriodicAdvertisingActive(advertising_handle_t handle)
|
||||||
return impl()->isPeriodicAdvertisingActive_(handle);
|
return impl()->isPeriodicAdvertisingActive_(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
ble_error_t Gap<Impl>::setScanParameters(const ScanParameters ¶ms)
|
ble_error_t Gap<Impl>::setScanParameters(const ScanParameters ¶ms)
|
||||||
{
|
{
|
||||||
|
@ -180,8 +178,6 @@ ble_error_t Gap<Impl>::stopScan()
|
||||||
return impl()->stopScan_();
|
return impl()->stopScan_();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template<class Impl>
|
template<class Impl>
|
||||||
ble_error_t Gap<Impl>::createSync(
|
ble_error_t Gap<Impl>::createSync(
|
||||||
peer_address_type_t peerAddressType,
|
peer_address_type_t peerAddressType,
|
||||||
|
|
|
@ -425,12 +425,16 @@ template <template<class> class PalGapImpl, class PalSecurityManager, class Conn
|
||||||
GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::GenericGap(
|
GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::GenericGap(
|
||||||
pal::EventQueue &event_queue,
|
pal::EventQueue &event_queue,
|
||||||
PalGapImpl<GenericGap> &pal_gap,
|
PalGapImpl<GenericGap> &pal_gap,
|
||||||
pal::GenericAccessService &generic_access_service,
|
pal::GenericAccessService &generic_access_service
|
||||||
PalSecurityManager &pal_sm
|
#if BLE_FEATURE_SECURITY
|
||||||
|
, PalSecurityManager &pal_sm
|
||||||
|
#endif
|
||||||
) : _event_queue(event_queue),
|
) : _event_queue(event_queue),
|
||||||
_pal_gap(pal_gap),
|
_pal_gap(pal_gap),
|
||||||
_gap_service(generic_access_service),
|
_gap_service(generic_access_service),
|
||||||
|
#if BLE_FEATURE_SECURITY
|
||||||
_pal_sm(pal_sm),
|
_pal_sm(pal_sm),
|
||||||
|
#endif
|
||||||
_address_type(LegacyAddressType::PUBLIC),
|
_address_type(LegacyAddressType::PUBLIC),
|
||||||
_initiator_policy_mode(pal::initiator_policy_t::NO_FILTER),
|
_initiator_policy_mode(pal::initiator_policy_t::NO_FILTER),
|
||||||
_scanning_filter_policy(pal::scanning_filter_policy_t::NO_FILTER),
|
_scanning_filter_policy(pal::scanning_filter_policy_t::NO_FILTER),
|
||||||
|
@ -574,8 +578,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||||
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::stopScan_()
|
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::stopScan_()
|
||||||
{
|
{
|
||||||
|
@ -606,8 +608,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||||
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::connect_(
|
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::connect_(
|
||||||
const BLEProtocol::AddressBytes_t peerAddr,
|
const BLEProtocol::AddressBytes_t peerAddr,
|
||||||
|
@ -633,10 +633,8 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
||||||
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
// Force scan stop before initiating the scan used for connection
|
// Force scan stop before initiating the scan used for connection
|
||||||
LegacyGap::stopScan();
|
LegacyGap::stopScan();
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
return _pal_gap.create_connection(
|
return _pal_gap.create_connection(
|
||||||
scanParams->getInterval(),
|
scanParams->getInterval(),
|
||||||
|
@ -2082,8 +2080,11 @@ bool GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
byte_array_t<8> random_data;
|
byte_array_t<8> random_data;
|
||||||
|
#if BLE_FEATURE_SECURITY
|
||||||
ble_error_t ret = _pal_sm.get_random_data(random_data);
|
ble_error_t ret = _pal_sm.get_random_data(random_data);
|
||||||
|
#else
|
||||||
|
ble_error_t ret = BLE_ERROR_NOT_IMPLEMENTED;
|
||||||
|
#endif // BLE_FEATURE_SECURITY
|
||||||
if (ret != BLE_ERROR_NONE) {
|
if (ret != BLE_ERROR_NONE) {
|
||||||
// Abort
|
// Abort
|
||||||
return false;
|
return false;
|
||||||
|
@ -3035,8 +3036,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||||
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::setScanParameters_(const ScanParameters ¶ms)
|
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::setScanParameters_(const ScanParameters ¶ms)
|
||||||
{
|
{
|
||||||
|
@ -3136,8 +3135,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLE_ROLE_OBSERVER
|
|
||||||
|
|
||||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||||
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::createSync_(
|
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::createSync_(
|
||||||
peer_address_type_t peerAddressType,
|
peer_address_type_t peerAddressType,
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -953,7 +951,9 @@ template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
||||||
GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::GenericGattClient(PalGattClient* pal_client) :
|
GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::GenericGattClient(PalGattClient* pal_client) :
|
||||||
_pal_client(pal_client),
|
_pal_client(pal_client),
|
||||||
_termination_callback(),
|
_termination_callback(),
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
_signing_event_handler(NULL),
|
_signing_event_handler(NULL),
|
||||||
|
#endif
|
||||||
control_blocks(NULL),
|
control_blocks(NULL),
|
||||||
_is_reseting(false) {
|
_is_reseting(false) {
|
||||||
_pal_client->when_server_message_received(
|
_pal_client->when_server_message_received(
|
||||||
|
@ -1106,6 +1106,7 @@ ble_error_t GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::write
|
||||||
|
|
||||||
uint16_t mtu = get_mtu(connection_handle);
|
uint16_t mtu = get_mtu(connection_handle);
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
/* if link is encrypted signed writes should be normal writes */
|
/* if link is encrypted signed writes should be normal writes */
|
||||||
if (cmd == Base::GATT_OP_SIGNED_WRITE_CMD) {
|
if (cmd == Base::GATT_OP_SIGNED_WRITE_CMD) {
|
||||||
ble::link_encryption_t encryption(ble::link_encryption_t::NOT_ENCRYPTED);
|
ble::link_encryption_t encryption(ble::link_encryption_t::NOT_ENCRYPTED);
|
||||||
|
@ -1120,6 +1121,7 @@ ble_error_t GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::write
|
||||||
cmd = Base::GATT_OP_WRITE_CMD;
|
cmd = Base::GATT_OP_WRITE_CMD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
if (cmd == Base::GATT_OP_WRITE_CMD) {
|
if (cmd == Base::GATT_OP_WRITE_CMD) {
|
||||||
if (length > (uint16_t) (mtu - WRITE_HEADER_LENGTH)) {
|
if (length > (uint16_t) (mtu - WRITE_HEADER_LENGTH)) {
|
||||||
|
@ -1131,6 +1133,7 @@ ble_error_t GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::write
|
||||||
make_const_ArrayView(value, length)
|
make_const_ArrayView(value, length)
|
||||||
);
|
);
|
||||||
} else if (cmd == Base::GATT_OP_SIGNED_WRITE_CMD) {
|
} else if (cmd == Base::GATT_OP_SIGNED_WRITE_CMD) {
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
if (length > (uint16_t) (mtu - WRITE_HEADER_LENGTH - CMAC_LENGTH - MAC_COUNTER_LENGTH)) {
|
if (length > (uint16_t) (mtu - WRITE_HEADER_LENGTH - CMAC_LENGTH - MAC_COUNTER_LENGTH)) {
|
||||||
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
@ -1139,10 +1142,12 @@ ble_error_t GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::write
|
||||||
attribute_handle,
|
attribute_handle,
|
||||||
make_const_ArrayView(value, length)
|
make_const_ArrayView(value, length)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (_signing_event_handler && (status == BLE_ERROR_NONE)) {
|
if (_signing_event_handler && (status == BLE_ERROR_NONE)) {
|
||||||
_signing_event_handler->on_signed_write();
|
_signing_event_handler->on_signed_write();
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
} else {
|
} else {
|
||||||
uint8_t* data = NULL;
|
uint8_t* data = NULL;
|
||||||
|
|
||||||
|
@ -1309,12 +1314,14 @@ ble_error_t GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::reset
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
||||||
void GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::set_signing_event_handler_(
|
void GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::set_signing_event_handler_(
|
||||||
SigningMonitorEventHandler *signing_event_handler
|
SigningMonitorEventHandler *signing_event_handler
|
||||||
) {
|
) {
|
||||||
_signing_event_handler = signing_event_handler;
|
_signing_event_handler = signing_event_handler;
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
template<template<class> class TPalGattClient, class SigningMonitorEventHandler>
|
||||||
void GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::on_att_mtu_change_(
|
void GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::on_att_mtu_change_(
|
||||||
|
@ -1491,4 +1498,3 @@ uint16_t GenericGattClient<TPalGattClient, SigningMonitorEventHandler>::get_mtu(
|
||||||
} // namespace pal
|
} // namespace pal
|
||||||
} // namespace ble
|
} // namespace ble
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_CLIENT
|
|
||||||
|
|
|
@ -1280,6 +1280,7 @@ void GenericSecurityManager<TPalSecurityManager, SigningMonitor>::on_valid_mic_t
|
||||||
(void)connection;
|
(void)connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
template<template<class> class TPalSecurityManager, template<class> class SigningMonitor>
|
template<template<class> class TPalSecurityManager, template<class> class SigningMonitor>
|
||||||
void GenericSecurityManager<TPalSecurityManager, SigningMonitor>::on_signed_write_received_(
|
void GenericSecurityManager<TPalSecurityManager, SigningMonitor>::on_signed_write_received_(
|
||||||
connection_handle_t connection,
|
connection_handle_t connection,
|
||||||
|
@ -1324,6 +1325,7 @@ void GenericSecurityManager<TPalSecurityManager, SigningMonitor>::on_signed_writ
|
||||||
MBED_ASSERT(_db);
|
MBED_ASSERT(_db);
|
||||||
_db->set_local_sign_counter(_db->get_local_sign_counter() + 1);
|
_db->set_local_sign_counter(_db->get_local_sign_counter() + 1);
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
template<template<class> class TPalSecurityManager, template<class> class SigningMonitor>
|
template<template<class> class TPalSecurityManager, template<class> class SigningMonitor>
|
||||||
void GenericSecurityManager<TPalSecurityManager, SigningMonitor>::on_slave_security_request_(
|
void GenericSecurityManager<TPalSecurityManager, SigningMonitor>::on_slave_security_request_(
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
#include "ble/services/UARTService.h"
|
#include "ble/services/UARTService.h"
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
||||||
const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID] = {
|
const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID] = {
|
||||||
0x6E, 0x40, 0x00, 0x00, 0xB5, 0xA3, 0xF3, 0x93,
|
0x6E, 0x40, 0x00, 0x00, 0xB5, 0xA3, 0xF3, 0x93,
|
||||||
0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
|
0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
|
||||||
|
@ -42,4 +40,3 @@ const uint8_t UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] = {
|
||||||
0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
|
0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
#include "ble/services/URIBeaconConfigService.h"
|
#include "ble/services/URIBeaconConfigService.h"
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
||||||
#define UUID_URI_BEACON(FIRST, SECOND) { \
|
#define UUID_URI_BEACON(FIRST, SECOND) { \
|
||||||
0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba, \
|
0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba, \
|
||||||
0xab, 0x96, 0x99, 0xb9, 0x1a, 0xc9, 0x81, 0xd8, \
|
0xab, 0x96, 0x99, 0xb9, 0x1a, 0xc9, 0x81, 0xd8, \
|
||||||
|
@ -35,5 +33,3 @@ const uint8_t UUID_BEACON_PERIOD_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_B
|
||||||
const uint8_t UUID_RESET_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x89);
|
const uint8_t UUID_RESET_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x89);
|
||||||
|
|
||||||
const uint8_t BEACON_UUID[sizeof(UUID::ShortUUIDBytes_t)] = {0xD8, 0xFE};
|
const uint8_t BEACON_UUID[sizeof(UUID::ShortUUIDBytes_t)] = {0xD8, 0xFE};
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
|
@ -53,8 +53,10 @@ class BLE;
|
||||||
/**
|
/**
|
||||||
* Cordio implementation of ::GattServer
|
* Cordio implementation of ::GattServer
|
||||||
*/
|
*/
|
||||||
class GattServer : public ::ble::interface::GattServer<GattServer>,
|
class GattServer : public ::ble::interface::GattServer<GattServer>
|
||||||
public pal::SigningEventMonitor<GattServer, impl::SigningEventHandler>
|
#if BLE_FEATURE_SIGNING
|
||||||
|
, public pal::SigningEventMonitor<GattServer, impl::SigningEventHandler>
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
friend ble::vendor::cordio::BLE;
|
friend ble::vendor::cordio::BLE;
|
||||||
friend ble::pal::vendor::cordio::CordioAttClient;
|
friend ble::pal::vendor::cordio::CordioAttClient;
|
||||||
|
@ -176,6 +178,7 @@ public:
|
||||||
*/
|
*/
|
||||||
ble_error_t reset_(void);
|
ble_error_t reset_(void);
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* @see pal::SigningEventMonitor::set_signing_event_handler
|
* @see pal::SigningEventMonitor::set_signing_event_handler
|
||||||
*/
|
*/
|
||||||
|
@ -184,6 +187,7 @@ public:
|
||||||
) {
|
) {
|
||||||
_signing_event_handler = signing_event_handler;
|
_signing_event_handler = signing_event_handler;
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -246,7 +250,9 @@ private:
|
||||||
internal_service_t *next;
|
internal_service_t *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
impl::SigningEventHandler *_signing_event_handler;
|
impl::SigningEventHandler *_signing_event_handler;
|
||||||
|
#endif
|
||||||
|
|
||||||
attsCccSet_t cccds[MAX_CCCD_CNT];
|
attsCccSet_t cccds[MAX_CCCD_CNT];
|
||||||
uint16_t cccd_values[MAX_CCCD_CNT];
|
uint16_t cccd_values[MAX_CCCD_CNT];
|
||||||
|
|
|
@ -36,7 +36,11 @@ namespace cordio {
|
||||||
class CordioAttClient : public ::ble::pal::AttClient<CordioAttClient> {
|
class CordioAttClient : public ::ble::pal::AttClient<CordioAttClient> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CordioAttClient() : ::ble::pal::AttClient<CordioAttClient>(), _local_sign_counter(0) { }
|
CordioAttClient() : ::ble::pal::AttClient<CordioAttClient>(), _local_sign_counter(0) {
|
||||||
|
#if !(BLE_FEATURE_ATT)
|
||||||
|
#error "Both GattClient and GattSever disabled in config file."
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
~CordioAttClient() { }
|
~CordioAttClient() { }
|
||||||
|
|
||||||
|
|
|
@ -238,6 +238,7 @@ public:
|
||||||
*/
|
*/
|
||||||
ble_error_t set_irk_(const irk_t &irk);
|
ble_error_t set_irk_(const irk_t &irk);
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
/**
|
/**
|
||||||
* @see ::ble::pal::SecurityManager::set_csrk
|
* @see ::ble::pal::SecurityManager::set_csrk
|
||||||
*/
|
*/
|
||||||
|
@ -257,6 +258,7 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
ble_error_t remove_peer_csrk_(connection_handle_t connection);
|
ble_error_t remove_peer_csrk_(connection_handle_t connection);
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Authentication
|
// Authentication
|
||||||
|
@ -362,7 +364,9 @@ private:
|
||||||
// cb_completed is set when the previous block has completed
|
// cb_completed is set when the previous block has completed
|
||||||
void process_privacy_control_blocks(bool cb_completed);
|
void process_privacy_control_blocks(bool cb_completed);
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
void cleanup_peer_csrks();
|
void cleanup_peer_csrks();
|
||||||
|
#endif
|
||||||
|
|
||||||
bool _use_default_passkey;
|
bool _use_default_passkey;
|
||||||
passkey_num_t _default_passkey;
|
passkey_num_t _default_passkey;
|
||||||
|
@ -372,8 +376,11 @@ private:
|
||||||
PrivacyControlBlock* _pending_privacy_control_blocks;
|
PrivacyControlBlock* _pending_privacy_control_blocks;
|
||||||
bool _processing_privacy_control_block;
|
bool _processing_privacy_control_block;
|
||||||
irk_t _irk;
|
irk_t _irk;
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
csrk_t _csrk;
|
csrk_t _csrk;
|
||||||
csrk_t* _peer_csrks[DM_CONN_MAX];
|
csrk_t* _peer_csrks[DM_CONN_MAX];
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
};
|
};
|
||||||
|
|
||||||
} // cordio
|
} // cordio
|
||||||
|
|
|
@ -36,7 +36,9 @@
|
||||||
#include "mbed_assert.h"
|
#include "mbed_assert.h"
|
||||||
|
|
||||||
#include "CordioPalAttClient.h"
|
#include "CordioPalAttClient.h"
|
||||||
|
#if BLE_FEATURE_SECURITY
|
||||||
#include "CordioPalSecurityManager.h"
|
#include "CordioPalSecurityManager.h"
|
||||||
|
#endif BLE_FEATURE_SECURITY
|
||||||
|
|
||||||
/*! WSF handler ID */
|
/*! WSF handler ID */
|
||||||
wsfHandlerId_t stack_handler_id;
|
wsfHandlerId_t stack_handler_id;
|
||||||
|
@ -181,8 +183,10 @@ impl::GenericGapImpl& BLE::getGap()
|
||||||
static impl::GenericGapImpl gap(
|
static impl::GenericGapImpl gap(
|
||||||
_event_queue,
|
_event_queue,
|
||||||
impl::PalGapImpl::get_gap(),
|
impl::PalGapImpl::get_gap(),
|
||||||
cordio_gap_service,
|
cordio_gap_service
|
||||||
impl::PalSecurityManagerImpl::get_security_manager()
|
#if BLE_FEATURE_SECURITY
|
||||||
|
, impl::PalSecurityManagerImpl::get_security_manager()
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
return gap;
|
return gap;
|
||||||
|
@ -225,7 +229,6 @@ impl::PalGattClientImpl& BLE::getPalGattClient()
|
||||||
#endif // BLE_FEATURE_GATT_CLIENT
|
#endif // BLE_FEATURE_GATT_CLIENT
|
||||||
|
|
||||||
#if BLE_FEATURE_SECURITY
|
#if BLE_FEATURE_SECURITY
|
||||||
|
|
||||||
SecurityManager& BLE::getSecurityManager()
|
SecurityManager& BLE::getSecurityManager()
|
||||||
{
|
{
|
||||||
static vendor::cordio::SigningEventMonitor<impl::GenericSecurityManagerImpl> signing_event_monitor;
|
static vendor::cordio::SigningEventMonitor<impl::GenericSecurityManagerImpl> signing_event_monitor;
|
||||||
|
@ -243,7 +246,6 @@ const SecurityManager& BLE::getSecurityManager() const
|
||||||
const BLE &self = const_cast<BLE&>(*this);
|
const BLE &self = const_cast<BLE&>(*this);
|
||||||
return const_cast<const SecurityManager&>(self.getSecurityManager());
|
return const_cast<const SecurityManager&>(self.getSecurityManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BLE_FEATURE_SECURITY
|
#endif // BLE_FEATURE_SECURITY
|
||||||
|
|
||||||
void BLE::waitForEvent()
|
void BLE::waitForEvent()
|
||||||
|
@ -274,9 +276,11 @@ void BLE::processEvents()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SECURITY
|
||||||
if (impl::PalSecurityManagerImpl::get_security_manager().sm_handler(msg)) {
|
if (impl::PalSecurityManagerImpl::get_security_manager().sm_handler(msg)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_SECURITY
|
||||||
|
|
||||||
switch(msg->event) {
|
switch(msg->event) {
|
||||||
case DM_RESET_CMPL_IND: {
|
case DM_RESET_CMPL_IND: {
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "CordioBLE.h"
|
#include "CordioBLE.h"
|
||||||
#include "CordioGattServer.h"
|
#include "CordioGattServer.h"
|
||||||
|
@ -928,6 +926,7 @@ uint8_t GattServer::atts_write_cb(
|
||||||
case ATT_PDU_WRITE_CMD:
|
case ATT_PDU_WRITE_CMD:
|
||||||
writeOp = GattWriteCallbackParams::OP_WRITE_CMD;
|
writeOp = GattWriteCallbackParams::OP_WRITE_CMD;
|
||||||
break;
|
break;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
case ATT_PDU_SIGNED_WRITE_CMD:
|
case ATT_PDU_SIGNED_WRITE_CMD:
|
||||||
if (getInstance()._signing_event_handler) {
|
if (getInstance()._signing_event_handler) {
|
||||||
getInstance()._signing_event_handler->on_signed_write_received(
|
getInstance()._signing_event_handler->on_signed_write_received(
|
||||||
|
@ -937,6 +936,7 @@ uint8_t GattServer::atts_write_cb(
|
||||||
}
|
}
|
||||||
writeOp = GattWriteCallbackParams::OP_SIGN_WRITE_CMD;
|
writeOp = GattWriteCallbackParams::OP_SIGN_WRITE_CMD;
|
||||||
break;
|
break;
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
case ATT_PDU_PREP_WRITE_REQ:
|
case ATT_PDU_PREP_WRITE_REQ:
|
||||||
writeOp = GattWriteCallbackParams::OP_PREP_WRITE_REQ;
|
writeOp = GattWriteCallbackParams::OP_PREP_WRITE_REQ;
|
||||||
break;
|
break;
|
||||||
|
@ -1276,7 +1276,9 @@ bool GattServer::is_update_authorized(
|
||||||
}
|
}
|
||||||
|
|
||||||
GattServer::GattServer() :
|
GattServer::GattServer() :
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
_signing_event_handler(NULL),
|
_signing_event_handler(NULL),
|
||||||
|
#endif
|
||||||
cccds(),
|
cccds(),
|
||||||
cccd_values(),
|
cccd_values(),
|
||||||
cccd_handles(),
|
cccd_handles(),
|
||||||
|
@ -1289,10 +1291,12 @@ GattServer::GattServer() :
|
||||||
allocated_blocks(NULL),
|
allocated_blocks(NULL),
|
||||||
currentHandle(0)
|
currentHandle(0)
|
||||||
{
|
{
|
||||||
|
#if !(BLE_FEATURE_GATT_SERVER)
|
||||||
|
#error "GattSever disabled in config file."
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cordio
|
} // namespace cordio
|
||||||
} // namespace vendor
|
} // namespace vendor
|
||||||
} // namespace ble
|
} // namespace ble
|
||||||
|
|
||||||
#endif // BLE_FEATURE_GATT_SERVER
|
|
||||||
|
|
|
@ -35,10 +35,14 @@ CordioSecurityManager<EventHandler>::CordioSecurityManager() :
|
||||||
_lesc_keys_generated(false),
|
_lesc_keys_generated(false),
|
||||||
_public_key_x(),
|
_public_key_x(),
|
||||||
_pending_privacy_control_blocks(NULL),
|
_pending_privacy_control_blocks(NULL),
|
||||||
_processing_privacy_control_block(false),
|
_processing_privacy_control_block(false)
|
||||||
_peer_csrks()
|
#if BLE_FEATURE_SIGNING
|
||||||
|
, _peer_csrks()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#if !(BLE_FEATURE_SECURITY)
|
||||||
|
#error "Security Manager feature disabledin the config file"
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class EventHandler>
|
template <class EventHandler>
|
||||||
|
@ -58,7 +62,9 @@ ble_error_t CordioSecurityManager<EventHandler>::initialize_()
|
||||||
_use_default_passkey = false;
|
_use_default_passkey = false;
|
||||||
_default_passkey = 0;
|
_default_passkey = 0;
|
||||||
_lesc_keys_generated = false;
|
_lesc_keys_generated = false;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
memset(_peer_csrks, 0, sizeof(_peer_csrks));
|
memset(_peer_csrks, 0, sizeof(_peer_csrks));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// FIXME: need help from the stack or local calculation
|
// FIXME: need help from the stack or local calculation
|
||||||
|
@ -72,14 +78,18 @@ ble_error_t CordioSecurityManager<EventHandler>::initialize_()
|
||||||
template <class EventHandler>
|
template <class EventHandler>
|
||||||
ble_error_t CordioSecurityManager<EventHandler>::terminate_()
|
ble_error_t CordioSecurityManager<EventHandler>::terminate_()
|
||||||
{
|
{
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
cleanup_peer_csrks();
|
cleanup_peer_csrks();
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class EventHandler>
|
template <class EventHandler>
|
||||||
ble_error_t CordioSecurityManager<EventHandler>::reset_()
|
ble_error_t CordioSecurityManager<EventHandler>::reset_()
|
||||||
{
|
{
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
cleanup_peer_csrks();
|
cleanup_peer_csrks();
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
initialize();
|
initialize();
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -321,6 +331,7 @@ ble_error_t CordioSecurityManager<EventHandler>::set_irk_(const irk_t& irk)
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
template <class EventHandler>
|
template <class EventHandler>
|
||||||
ble_error_t CordioSecurityManager<EventHandler>::set_csrk_(
|
ble_error_t CordioSecurityManager<EventHandler>::set_csrk_(
|
||||||
const csrk_t& csrk,
|
const csrk_t& csrk,
|
||||||
|
@ -378,6 +389,7 @@ ble_error_t CordioSecurityManager<EventHandler>::remove_peer_csrk_(connection_ha
|
||||||
AttsSetCsrk(connection, NULL, false);
|
AttsSetCsrk(connection, NULL, false);
|
||||||
return BLE_ERROR_NONE;
|
return BLE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Global parameters
|
// Global parameters
|
||||||
|
@ -704,12 +716,13 @@ bool CordioSecurityManager<EventHandler>::sm_handler(const wsfMsgHdr_t* msg) {
|
||||||
irk_t(reinterpret_cast<uint8_t*>(evt->keyData.irk.key))
|
irk_t(reinterpret_cast<uint8_t*>(evt->keyData.irk.key))
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
case DM_KEY_CSRK:
|
case DM_KEY_CSRK:
|
||||||
handler->on_keys_distributed_csrk(
|
handler->on_keys_distributed_csrk(
|
||||||
connection, evt->keyData.csrk.key
|
connection, evt->keyData.csrk.key
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -996,6 +1009,7 @@ void CordioSecurityManager<EventHandler>::process_privacy_control_blocks(bool cb
|
||||||
_pending_privacy_control_blocks = next;
|
_pending_privacy_control_blocks = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BLE_FEATURE_SIGNING
|
||||||
template <class EventHandler>
|
template <class EventHandler>
|
||||||
void CordioSecurityManager<EventHandler>::cleanup_peer_csrks() {
|
void CordioSecurityManager<EventHandler>::cleanup_peer_csrks() {
|
||||||
for (size_t i = 0; i < DM_CONN_MAX; ++i) {
|
for (size_t i = 0; i < DM_CONN_MAX; ++i) {
|
||||||
|
@ -1005,6 +1019,7 @@ void CordioSecurityManager<EventHandler>::cleanup_peer_csrks() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // BLE_FEATURE_SIGNING
|
||||||
|
|
||||||
} // cordio
|
} // cordio
|
||||||
} // vendor
|
} // vendor
|
||||||
|
|
Loading…
Reference in New Issue