mirror of https://github.com/ARMmbed/mbed-os.git
BLE: Fix code formating issues in Gap subsystem.
parent
f64b37ba0d
commit
b49870d8ae
|
@ -28,7 +28,9 @@
|
|||
#ifdef YOTTA_CFG_MBED_OS
|
||||
#include "mbed-drivers/mbed_error.h"
|
||||
#else
|
||||
|
||||
#include "platform/mbed_error.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include "platform/mbed_toolchain.h"
|
||||
|
@ -132,8 +134,7 @@ class BLEInstanceBase;
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
class BLE
|
||||
{
|
||||
class BLE {
|
||||
public:
|
||||
/**
|
||||
* Opaque type used to store the ID of a BLE instance.
|
||||
|
@ -178,7 +179,8 @@ public:
|
|||
*
|
||||
* @return Instance id of this BLE instance.
|
||||
*/
|
||||
InstanceID_t getInstanceID(void) const {
|
||||
InstanceID_t getInstanceID(void) const
|
||||
{
|
||||
return instanceID;
|
||||
}
|
||||
|
||||
|
@ -192,13 +194,13 @@ public:
|
|||
/**
|
||||
* The ble instance which have events to process.
|
||||
*/
|
||||
BLE& ble;
|
||||
BLE &ble;
|
||||
};
|
||||
|
||||
/**
|
||||
* Events to process event handler
|
||||
*/
|
||||
typedef FunctionPointerWithContext<OnEventsToProcessCallbackContext*>
|
||||
typedef FunctionPointerWithContext<OnEventsToProcessCallbackContext *>
|
||||
OnEventsToProcessCallback_t;
|
||||
|
||||
/**
|
||||
|
@ -209,7 +211,7 @@ public:
|
|||
*
|
||||
* @param on_event_cb Callback invoked when there are new events to process.
|
||||
*/
|
||||
void onEventsToProcess(const OnEventsToProcessCallback_t& on_event_cb);
|
||||
void onEventsToProcess(const OnEventsToProcessCallback_t &on_event_cb);
|
||||
|
||||
/**
|
||||
* Process ALL pending events living in the BLE stack and return once all
|
||||
|
@ -229,7 +231,7 @@ public:
|
|||
/**
|
||||
* Reference to the BLE object that has been initialized
|
||||
*/
|
||||
BLE& ble;
|
||||
BLE &ble;
|
||||
|
||||
/**
|
||||
* Error status of the initialization.
|
||||
|
@ -283,7 +285,8 @@ public:
|
|||
* @attention This should be called before using anything else in the BLE
|
||||
* API.
|
||||
*/
|
||||
ble_error_t init(InitializationCompleteCallback_t completion_cb = NULL) {
|
||||
ble_error_t init(InitializationCompleteCallback_t completion_cb = NULL)
|
||||
{
|
||||
FunctionPointerWithContext<InitializationCompleteCallbackContext *> callback(completion_cb);
|
||||
return initImplementation(callback);
|
||||
}
|
||||
|
@ -299,7 +302,8 @@ public:
|
|||
* initialization is complete.
|
||||
*/
|
||||
template<typename T>
|
||||
ble_error_t init(T *object, void (T::*completion_cb)(InitializationCompleteCallbackContext *context)) {
|
||||
ble_error_t init(T *object, void (T::*completion_cb)(InitializationCompleteCallbackContext *context))
|
||||
{
|
||||
FunctionPointerWithContext<InitializationCompleteCallbackContext *> callback(object, completion_cb);
|
||||
return initImplementation(callback);
|
||||
}
|
||||
|
@ -357,7 +361,7 @@ public:
|
|||
*
|
||||
* @return A reference to a GattServer object associated to this BLE instance.
|
||||
*/
|
||||
GattServer& gattServer();
|
||||
GattServer &gattServer();
|
||||
|
||||
/**
|
||||
* A const alternative to gattServer().
|
||||
|
@ -365,7 +369,7 @@ public:
|
|||
* @return A const reference to a GattServer object associated to this BLE
|
||||
* instance.
|
||||
*/
|
||||
const GattServer& gattServer() const;
|
||||
const GattServer &gattServer() const;
|
||||
|
||||
/**
|
||||
* Accessors to GattClient. All GattClient related functionality requires
|
||||
|
@ -373,7 +377,7 @@ public:
|
|||
*
|
||||
* @return A reference to a GattClient object associated to this BLE instance.
|
||||
*/
|
||||
GattClient& gattClient();
|
||||
GattClient &gattClient();
|
||||
|
||||
/**
|
||||
* A const alternative to gattClient().
|
||||
|
@ -381,7 +385,7 @@ public:
|
|||
* @return A const reference to a GattClient object associated to this BLE
|
||||
* instance.
|
||||
*/
|
||||
const GattClient& gattClient() const;
|
||||
const GattClient &gattClient() const;
|
||||
|
||||
/**
|
||||
* Accessors to SecurityManager. All SecurityManager-related functionality
|
||||
|
@ -390,7 +394,7 @@ public:
|
|||
* @return A reference to a SecurityManager object associated to this BLE
|
||||
* instance.
|
||||
*/
|
||||
SecurityManager& securityManager();
|
||||
SecurityManager &securityManager();
|
||||
|
||||
/**
|
||||
* A const alternative to securityManager().
|
||||
|
@ -398,7 +402,7 @@ public:
|
|||
* @return A const reference to a SecurityManager object associated to this
|
||||
* BLE instance.
|
||||
*/
|
||||
const SecurityManager& securityManager() const;
|
||||
const SecurityManager &securityManager() const;
|
||||
|
||||
/**
|
||||
* Translate error code into a printable string.
|
||||
|
@ -407,7 +411,7 @@ public:
|
|||
*
|
||||
* @return A pointer to a const string describing the error.
|
||||
*/
|
||||
static const char* errorToString(ble_error_t error);
|
||||
static const char *errorToString(ble_error_t error);
|
||||
|
||||
/*
|
||||
* Deprecation alert!
|
||||
|
@ -471,7 +475,8 @@ public:
|
|||
MBED_DEPRECATED("Use ble.gap().getAddress(...)")
|
||||
ble_error_t getAddress(
|
||||
BLEProtocol::AddressType_t *typeP, BLEProtocol::AddressBytes_t address
|
||||
) {
|
||||
)
|
||||
{
|
||||
return gap().getAddress(typeP, address);
|
||||
}
|
||||
|
||||
|
@ -524,7 +529,8 @@ public:
|
|||
* ble.gap().getMinAdvertisingInterval(...).
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().getMinAdvertisingInterval(...)")
|
||||
uint16_t getMinAdvertisingInterval(void) const {
|
||||
uint16_t getMinAdvertisingInterval(void) const
|
||||
{
|
||||
return gap().getMinAdvertisingInterval();
|
||||
}
|
||||
|
||||
|
@ -537,7 +543,8 @@ public:
|
|||
* ble.gap().getMinNonConnectableAdvertisingInterval(...).
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().getMinNonConnectableAdvertisingInterval(...)")
|
||||
uint16_t getMinNonConnectableAdvertisingInterval(void) const {
|
||||
uint16_t getMinNonConnectableAdvertisingInterval(void) const
|
||||
{
|
||||
return gap().getMinNonConnectableAdvertisingInterval();
|
||||
}
|
||||
|
||||
|
@ -550,7 +557,8 @@ public:
|
|||
* ble.gap().getMaxAdvertisingInterval(...).
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().getMaxAdvertisingInterval(...)")
|
||||
uint16_t getMaxAdvertisingInterval(void) const {
|
||||
uint16_t getMaxAdvertisingInterval(void) const
|
||||
{
|
||||
return gap().getMaxAdvertisingInterval();
|
||||
}
|
||||
|
||||
|
@ -801,10 +809,12 @@ public:
|
|||
* ble.gap().setScanParams(...).
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().setScanParams(...)")
|
||||
ble_error_t setScanParams(uint16_t interval = GapScanningParams::SCAN_INTERVAL_MAX,
|
||||
uint16_t window = GapScanningParams::SCAN_WINDOW_MAX,
|
||||
uint16_t timeout = 0,
|
||||
bool activeScanning = false);
|
||||
ble_error_t setScanParams(
|
||||
uint16_t interval = GapScanningParams::SCAN_INTERVAL_MAX,
|
||||
uint16_t window = GapScanningParams::SCAN_WINDOW_MAX,
|
||||
uint16_t timeout = 0,
|
||||
bool activeScanning = false
|
||||
);
|
||||
|
||||
/**
|
||||
* Set up the scanInterval parameter for GAP scanning (observer mode).
|
||||
|
@ -934,7 +944,8 @@ public:
|
|||
* ble.gap().stopScan().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().stopScan()")
|
||||
ble_error_t stopScan(void) {
|
||||
ble_error_t stopScan(void)
|
||||
{
|
||||
return gap().stopScan();
|
||||
}
|
||||
|
||||
|
@ -958,10 +969,12 @@ public:
|
|||
* ble.gap().connect(...).
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().connect(...)")
|
||||
ble_error_t connect(const BLEProtocol::AddressBytes_t peerAddr,
|
||||
BLEProtocol::AddressType_t peerAddrType = BLEProtocol::AddressType::RANDOM_STATIC,
|
||||
const Gap::ConnectionParams_t *connectionParams = NULL,
|
||||
const GapScanningParams *scanParams = NULL);
|
||||
ble_error_t connect(
|
||||
const BLEProtocol::AddressBytes_t peerAddr,
|
||||
BLEProtocol::AddressType_t peerAddrType = BLEProtocol::AddressType::RANDOM_STATIC,
|
||||
const Gap::ConnectionParams_t *connectionParams = NULL,
|
||||
const GapScanningParams *scanParams = NULL
|
||||
);
|
||||
|
||||
/**
|
||||
* This call initiates the disconnection procedure, and its completion is
|
||||
|
@ -1025,7 +1038,8 @@ public:
|
|||
* ble.gap().getPreferredConnectionParams().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().getPreferredConnectionParams(...)")
|
||||
ble_error_t getPreferredConnectionParams(Gap::ConnectionParams_t *params) {
|
||||
ble_error_t getPreferredConnectionParams(Gap::ConnectionParams_t *params)
|
||||
{
|
||||
return gap().getPreferredConnectionParams(params);
|
||||
}
|
||||
|
||||
|
@ -1043,7 +1057,8 @@ public:
|
|||
* ble.gap().setPreferredConnectionParams().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().setPreferredConnectionParams(...)")
|
||||
ble_error_t setPreferredConnectionParams(const Gap::ConnectionParams_t *params) {
|
||||
ble_error_t setPreferredConnectionParams(const Gap::ConnectionParams_t *params)
|
||||
{
|
||||
return gap().setPreferredConnectionParams(params);
|
||||
}
|
||||
|
||||
|
@ -1076,7 +1091,8 @@ public:
|
|||
* ble.gap().setDeviceName().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().setDeviceName(...)")
|
||||
ble_error_t setDeviceName(const uint8_t *deviceName) {
|
||||
ble_error_t setDeviceName(const uint8_t *deviceName)
|
||||
{
|
||||
return gap().setDeviceName(deviceName);
|
||||
}
|
||||
|
||||
|
@ -1104,7 +1120,8 @@ public:
|
|||
* ble.gap().getDeviceName().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().getDeviceName(...)")
|
||||
ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP) {
|
||||
ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP)
|
||||
{
|
||||
return gap().getDeviceName(deviceName, lengthP);
|
||||
}
|
||||
|
||||
|
@ -1119,7 +1136,8 @@ public:
|
|||
* ble.gap().setAppearance().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().setAppearance(...)")
|
||||
ble_error_t setAppearance(GapAdvertisingData::Appearance appearance) {
|
||||
ble_error_t setAppearance(GapAdvertisingData::Appearance appearance)
|
||||
{
|
||||
return gap().setAppearance(appearance);
|
||||
}
|
||||
|
||||
|
@ -1134,7 +1152,8 @@ public:
|
|||
* ble.gap().getAppearance().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gap().getAppearance(...)")
|
||||
ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP) {
|
||||
ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP)
|
||||
{
|
||||
return gap().getAppearance(appearanceP);
|
||||
}
|
||||
|
||||
|
@ -1176,7 +1195,8 @@ public:
|
|||
* ble.gattServer().addService().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gattServer().addService(...)")
|
||||
ble_error_t addService(GattService &service) {
|
||||
ble_error_t addService(GattService &service)
|
||||
{
|
||||
return gattServer().addService(service);
|
||||
}
|
||||
|
||||
|
@ -1201,7 +1221,8 @@ public:
|
|||
* ble.gattServer().read().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gattServer().read(...)")
|
||||
ble_error_t readCharacteristicValue(GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP) {
|
||||
ble_error_t readCharacteristicValue(GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP)
|
||||
{
|
||||
return gattServer().read(attributeHandle, buffer, lengthP);
|
||||
}
|
||||
|
||||
|
@ -1232,7 +1253,13 @@ public:
|
|||
* ble.gattServer().read().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gattServer().read(...)")
|
||||
ble_error_t readCharacteristicValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP) {
|
||||
ble_error_t readCharacteristicValue(
|
||||
Gap::Handle_t connectionHandle,
|
||||
GattAttribute::Handle_t attributeHandle,
|
||||
uint8_t *buffer,
|
||||
uint16_t *lengthP
|
||||
)
|
||||
{
|
||||
return gattServer().read(connectionHandle, attributeHandle, buffer, lengthP);
|
||||
}
|
||||
|
||||
|
@ -1260,10 +1287,13 @@ public:
|
|||
* ble.gattServer().write().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gattServer().write(...)")
|
||||
ble_error_t updateCharacteristicValue(GattAttribute::Handle_t attributeHandle,
|
||||
const uint8_t *value,
|
||||
uint16_t size,
|
||||
bool localOnly = false) {
|
||||
ble_error_t updateCharacteristicValue(
|
||||
GattAttribute::Handle_t attributeHandle,
|
||||
const uint8_t *value,
|
||||
uint16_t size,
|
||||
bool localOnly = false
|
||||
)
|
||||
{
|
||||
return gattServer().write(attributeHandle, value, size, localOnly);
|
||||
}
|
||||
|
||||
|
@ -1295,11 +1325,14 @@ public:
|
|||
* ble.gattServer().write().
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gattServer().write(...)")
|
||||
ble_error_t updateCharacteristicValue(Gap::Handle_t connectionHandle,
|
||||
GattAttribute::Handle_t attributeHandle,
|
||||
const uint8_t *value,
|
||||
uint16_t size,
|
||||
bool localOnly = false) {
|
||||
ble_error_t updateCharacteristicValue(
|
||||
Gap::Handle_t connectionHandle,
|
||||
GattAttribute::Handle_t attributeHandle,
|
||||
const uint8_t *value,
|
||||
uint16_t size,
|
||||
bool localOnly = false
|
||||
)
|
||||
{
|
||||
return gattServer().write(connectionHandle, attributeHandle, value, size, localOnly);
|
||||
}
|
||||
|
||||
|
@ -1324,10 +1357,13 @@ public:
|
|||
* ble.securityManager().init(...).
|
||||
*/
|
||||
MBED_DEPRECATED("Use ble.gattServer().write(...)")
|
||||
ble_error_t initializeSecurity(bool enableBonding = true,
|
||||
bool requireMITM = true,
|
||||
SecurityManager::SecurityIOCapabilities_t iocaps = SecurityManager::IO_CAPS_NONE,
|
||||
const SecurityManager::Passkey_t passkey = NULL) {
|
||||
ble_error_t initializeSecurity(
|
||||
bool enableBonding = true,
|
||||
bool requireMITM = true,
|
||||
SecurityManager::SecurityIOCapabilities_t iocaps = SecurityManager::IO_CAPS_NONE,
|
||||
const SecurityManager::Passkey_t passkey = NULL
|
||||
)
|
||||
{
|
||||
return securityManager().init(enableBonding, requireMITM, iocaps, passkey);
|
||||
}
|
||||
|
||||
|
@ -1345,7 +1381,8 @@ public:
|
|||
* ble.securityManager().getLinkSecurity(...).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.securityManager().getLinkSecurity(...)")
|
||||
ble_error_t getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP) {
|
||||
ble_error_t getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP)
|
||||
{
|
||||
return securityManager().getLinkSecurity(connectionHandle, securityStatusP);
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1400,8 @@ public:
|
|||
* ble.securityManager().purgeAllBondingState().
|
||||
*/
|
||||
MBED_DEPRECATED("ble.securityManager().purgeAllBondingState(...)")
|
||||
ble_error_t purgeAllBondingState(void) {
|
||||
ble_error_t purgeAllBondingState(void)
|
||||
{
|
||||
return securityManager().purgeAllBondingState();
|
||||
}
|
||||
|
||||
|
@ -1412,7 +1450,8 @@ public:
|
|||
*/
|
||||
template<typename T>
|
||||
MBED_DEPRECATED("ble.gap().onDisconnectionComplete(callback)")
|
||||
void onDisconnection(T *tptr, void (T::*mptr)(const Gap::DisconnectionCallbackParams_t*)) {
|
||||
void onDisconnection(T *tptr, void (T::*mptr)(const Gap::DisconnectionCallbackParams_t *))
|
||||
{
|
||||
gap().onDisconnection(tptr, mptr);
|
||||
}
|
||||
|
||||
|
@ -1457,7 +1496,8 @@ public:
|
|||
* ble.gattServer().onDataSent(...).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.gattServer().onDataSent(...)")
|
||||
void onDataSent(void (*callback)(unsigned count)) {
|
||||
void onDataSent(void (*callback)(unsigned count))
|
||||
{
|
||||
gattServer().onDataSent(callback);
|
||||
}
|
||||
|
||||
|
@ -1470,9 +1510,10 @@ public:
|
|||
* to ble.onDataSent(...) should be replaced with
|
||||
* ble.gattServer().onDataSent(...).
|
||||
*/
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
MBED_DEPRECATED("ble.gattServer().onDataSent(...)")
|
||||
void onDataSent(T * objPtr, void (T::*memberPtr)(unsigned count)) {
|
||||
void onDataSent(T *objPtr, void (T::*memberPtr)(unsigned count))
|
||||
{
|
||||
gattServer().onDataSent(objPtr, memberPtr);
|
||||
}
|
||||
|
||||
|
@ -1497,7 +1538,8 @@ public:
|
|||
* ble.gattServer().onDataWritten(...).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.gattServer().onDataWritten(...)")
|
||||
void onDataWritten(void (*callback)(const GattWriteCallbackParams *eventDataP)) {
|
||||
void onDataWritten(void (*callback)(const GattWriteCallbackParams *eventDataP))
|
||||
{
|
||||
gattServer().onDataWritten(callback);
|
||||
}
|
||||
|
||||
|
@ -1510,9 +1552,10 @@ public:
|
|||
* to ble.onDataWritten(...) should be replaced with
|
||||
* ble.gattServer().onDataWritten(...).
|
||||
*/
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
MBED_DEPRECATED("ble.gattServer().onDataWritten(...)")
|
||||
void onDataWritten(T * objPtr, void (T::*memberPtr)(const GattWriteCallbackParams *context)) {
|
||||
void onDataWritten(T *objPtr, void (T::*memberPtr)(const GattWriteCallbackParams *context))
|
||||
{
|
||||
gattServer().onDataWritten(objPtr, memberPtr);
|
||||
}
|
||||
|
||||
|
@ -1541,7 +1584,8 @@ public:
|
|||
* ble.gattServer().onDataRead(...).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.gattServer().onDataRead(...)")
|
||||
ble_error_t onDataRead(void (*callback)(const GattReadCallbackParams *eventDataP)) {
|
||||
ble_error_t onDataRead(void (*callback)(const GattReadCallbackParams *eventDataP))
|
||||
{
|
||||
return gattServer().onDataRead(callback);
|
||||
}
|
||||
|
||||
|
@ -1554,9 +1598,10 @@ public:
|
|||
* to ble.onDataRead(...) should be replaced with
|
||||
* ble.gattServer().onDataRead(...).
|
||||
*/
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
MBED_DEPRECATED("ble.gattServer().onDataRead(...)")
|
||||
ble_error_t onDataRead(T * objPtr, void (T::*memberPtr)(const GattReadCallbackParams *context)) {
|
||||
ble_error_t onDataRead(T *objPtr, void (T::*memberPtr)(const GattReadCallbackParams *context))
|
||||
{
|
||||
return gattServer().onDataRead(objPtr, memberPtr);
|
||||
}
|
||||
|
||||
|
@ -1570,7 +1615,8 @@ public:
|
|||
* ble.gattServer().onUpdatesEnabled(callback).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.gattServer().onUpdatesEnabled(...)")
|
||||
void onUpdatesEnabled(GattServer::EventCallback_t callback) {
|
||||
void onUpdatesEnabled(GattServer::EventCallback_t callback)
|
||||
{
|
||||
gattServer().onUpdatesEnabled(callback);
|
||||
}
|
||||
|
||||
|
@ -1584,7 +1630,8 @@ public:
|
|||
* ble.gattServer().onUpdatesDisabled(callback).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.gattServer().onUpdatesDisabled(...)")
|
||||
void onUpdatesDisabled(GattServer::EventCallback_t callback) {
|
||||
void onUpdatesDisabled(GattServer::EventCallback_t callback)
|
||||
{
|
||||
gattServer().onUpdatesDisabled(callback);
|
||||
}
|
||||
|
||||
|
@ -1598,7 +1645,8 @@ public:
|
|||
* ble.gattServer().onConfirmationReceived(callback).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.gattServer().onConfirmationReceived(...)")
|
||||
void onConfirmationReceived(GattServer::EventCallback_t callback) {
|
||||
void onConfirmationReceived(GattServer::EventCallback_t callback)
|
||||
{
|
||||
gattServer().onConfirmationReceived(callback);
|
||||
}
|
||||
|
||||
|
@ -1615,7 +1663,8 @@ public:
|
|||
* ble.securityManager().onSecuritySetupInitiated(callback).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.securityManager().onSecuritySetupInitiated(callback)")
|
||||
void onSecuritySetupInitiated(SecurityManager::SecuritySetupInitiatedCallback_t callback) {
|
||||
void onSecuritySetupInitiated(SecurityManager::SecuritySetupInitiatedCallback_t callback)
|
||||
{
|
||||
securityManager().onSecuritySetupInitiated(callback);
|
||||
}
|
||||
|
||||
|
@ -1631,7 +1680,8 @@ public:
|
|||
* ble.securityManager().onSecuritySetupCompleted(callback).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.securityManager().onSecuritySetupCompleted(callback)")
|
||||
void onSecuritySetupCompleted(SecurityManager::SecuritySetupCompletedCallback_t callback) {
|
||||
void onSecuritySetupCompleted(SecurityManager::SecuritySetupCompletedCallback_t callback)
|
||||
{
|
||||
securityManager().onSecuritySetupCompleted(callback);
|
||||
}
|
||||
|
||||
|
@ -1649,7 +1699,8 @@ public:
|
|||
* ble.securityManager().onLinkSecured(callback).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.securityManager().onLinkSecured(callback)")
|
||||
void onLinkSecured(SecurityManager::LinkSecuredCallback_t callback) {
|
||||
void onLinkSecured(SecurityManager::LinkSecuredCallback_t callback)
|
||||
{
|
||||
securityManager().onLinkSecured(callback);
|
||||
}
|
||||
|
||||
|
@ -1663,7 +1714,8 @@ public:
|
|||
* ble.securityManager().onSecurityContextStored(callback).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.securityManager().onSecurityContextStored(callback)")
|
||||
void onSecurityContextStored(SecurityManager::HandleSpecificEvent_t callback) {
|
||||
void onSecurityContextStored(SecurityManager::HandleSpecificEvent_t callback)
|
||||
{
|
||||
securityManager().onSecurityContextStored(callback);
|
||||
}
|
||||
|
||||
|
@ -1680,7 +1732,8 @@ public:
|
|||
* ble.securityManager().onPasskeyDisplay(callback).
|
||||
*/
|
||||
MBED_DEPRECATED("ble.securityManager().onPasskeyDisplay(callback)")
|
||||
void onPasskeyDisplay(SecurityManager::PasskeyDisplayCallback_t callback) {
|
||||
void onPasskeyDisplay(SecurityManager::PasskeyDisplayCallback_t callback)
|
||||
{
|
||||
return securityManager().onPasskeyDisplay(callback);
|
||||
}
|
||||
|
||||
|
@ -1708,7 +1761,8 @@ private:
|
|||
|
||||
private:
|
||||
// Prevent copy construction and copy assignment of BLE.
|
||||
BLE(const BLE&);
|
||||
BLE(const BLE &);
|
||||
|
||||
BLE &operator=(const BLE &);
|
||||
|
||||
private:
|
||||
|
|
|
@ -739,7 +739,7 @@ public:
|
|||
/**
|
||||
* Connection parameters.
|
||||
*/
|
||||
const ConnectionParams_t *connectionParams;
|
||||
const ConnectionParams_t *connectionParams;
|
||||
|
||||
/**
|
||||
* Resolvable address used by the peer.
|
||||
|
@ -865,13 +865,14 @@ public:
|
|||
DisconnectionReason_t reasonIn
|
||||
) : handle(handleIn),
|
||||
reason(reasonIn)
|
||||
{}
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Number of microseconds in 1.25 milliseconds.
|
||||
*/
|
||||
static const uint16_t UNIT_1_25_MS = 1250;
|
||||
static const uint16_t UNIT_1_25_MS = 1250;
|
||||
|
||||
/**
|
||||
* Convert milliseconds into 1.25ms units.
|
||||
|
@ -924,7 +925,7 @@ public:
|
|||
*
|
||||
* @see Gap::onDisconnection().
|
||||
*/
|
||||
typedef FunctionPointerWithContext<const DisconnectionCallbackParams_t*>
|
||||
typedef FunctionPointerWithContext<const DisconnectionCallbackParams_t *>
|
||||
DisconnectionEventCallback_t;
|
||||
|
||||
/**
|
||||
|
@ -932,7 +933,7 @@ public:
|
|||
*
|
||||
* @see Gap::onDisconnection().
|
||||
*/
|
||||
typedef CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t*>
|
||||
typedef CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t *>
|
||||
DisconnectionEventCallbackChain_t;
|
||||
|
||||
/**
|
||||
|
@ -1033,7 +1034,7 @@ public:
|
|||
*/
|
||||
static ble_error_t getRandomAddressType(
|
||||
const BLEProtocol::AddressBytes_t address,
|
||||
RandomAddressType_t* addressType
|
||||
RandomAddressType_t *addressType
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -1088,9 +1089,9 @@ public:
|
|||
* Use stopAdvertising(advertising_handle_t).
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"Use stopAdvertising(advertising_handle_t) instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"Use stopAdvertising(advertising_handle_t) instead."
|
||||
)
|
||||
virtual ble_error_t stopAdvertising(void);
|
||||
|
||||
|
@ -1232,7 +1233,7 @@ public:
|
|||
virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params)
|
||||
{
|
||||
/* Avoid compiler warnings about unused variables. */
|
||||
(void)params;
|
||||
(void) params;
|
||||
|
||||
/* Requesting action from porter(s): override this API if this capability
|
||||
is supported. */
|
||||
|
@ -1254,9 +1255,10 @@ public:
|
|||
*/
|
||||
virtual ble_error_t setPreferredConnectionParams(
|
||||
const ConnectionParams_t *params
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Avoid compiler warnings about unused variables. */
|
||||
(void)params;
|
||||
(void) params;
|
||||
|
||||
/* Requesting action from porter(s): override this API if this capability
|
||||
is supported. */
|
||||
|
@ -1301,9 +1303,10 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE if the device name was set correctly.
|
||||
*/
|
||||
virtual ble_error_t setDeviceName(const uint8_t *deviceName) {
|
||||
virtual ble_error_t setDeviceName(const uint8_t *deviceName)
|
||||
{
|
||||
/* Avoid compiler warnings about unused variables. */
|
||||
(void)deviceName;
|
||||
(void) deviceName;
|
||||
|
||||
/* Requesting action from porter(s): override this API if this capability
|
||||
is supported. */
|
||||
|
@ -1335,8 +1338,8 @@ public:
|
|||
virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP)
|
||||
{
|
||||
/* avoid compiler warnings about unused variables */
|
||||
(void)deviceName;
|
||||
(void)lengthP;
|
||||
(void) deviceName;
|
||||
(void) lengthP;
|
||||
|
||||
/* Requesting action from porter(s): override this API if this capability
|
||||
is supported. */
|
||||
|
@ -1353,7 +1356,7 @@ public:
|
|||
virtual ble_error_t setAppearance(GapAdvertisingData::Appearance appearance)
|
||||
{
|
||||
/* Avoid compiler warnings about unused variables. */
|
||||
(void)appearance;
|
||||
(void) appearance;
|
||||
|
||||
/* Requesting action from porter(s): override this API if this capability
|
||||
is supported. */
|
||||
|
@ -1371,7 +1374,7 @@ public:
|
|||
virtual ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP)
|
||||
{
|
||||
/* Avoid compiler warnings about unused variables. */
|
||||
(void)appearanceP;
|
||||
(void) appearanceP;
|
||||
|
||||
/* Requesting action from porter(s): override this API if this capability
|
||||
is supported. */
|
||||
|
@ -1390,9 +1393,9 @@ public:
|
|||
* See ble::AdvertisingParameters and setAdvertisingParameters.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"See ble::AdvertisingParameters and setAdvertisingParameters."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"See ble::AdvertisingParameters and setAdvertisingParameters."
|
||||
)
|
||||
virtual ble_error_t setTxPower(int8_t txPower);
|
||||
|
||||
|
@ -1467,9 +1470,9 @@ public:
|
|||
* This setting is now part of ble::AdvertisingParameters.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"This setting is now part of ble::AdvertisingParameters."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"This setting is now part of ble::AdvertisingParameters."
|
||||
)
|
||||
virtual ble_error_t setAdvertisingPolicyMode(AdvertisingPolicyMode_t mode);
|
||||
|
||||
|
@ -1518,8 +1521,8 @@ public:
|
|||
* @deprecated Deprecated since addition of extended advertising support.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
)
|
||||
virtual AdvertisingPolicyMode_t getAdvertisingPolicyMode(void) const;
|
||||
|
||||
|
@ -1586,9 +1589,9 @@ public:
|
|||
* isAdvertisingActive() and getConnectionCount().
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use isAdvertisingActive() and getConnectionCount()."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use isAdvertisingActive() and getConnectionCount()."
|
||||
)
|
||||
GapState_t getState(void) const;
|
||||
|
||||
|
@ -1601,9 +1604,9 @@ public:
|
|||
* This option is now part of ble::AdvertisingParameters.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"This option is now part of ble::AdvertisingParameters"
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"This option is now part of ble::AdvertisingParameters"
|
||||
)
|
||||
void setAdvertisingType(GapAdvertisingParams::AdvertisingType_t advType);
|
||||
|
||||
|
@ -1660,9 +1663,9 @@ public:
|
|||
* Use startAdvertising(advertising_handle_t, adv_duration_t, uint8_t) instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use startAdvertising(advertising_handle_t, adv_duration_t, uint8_t) instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use startAdvertising(advertising_handle_t, adv_duration_t, uint8_t) instead."
|
||||
)
|
||||
ble_error_t startAdvertising(void);
|
||||
|
||||
|
@ -1674,10 +1677,10 @@ public:
|
|||
* bool).
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setAdvertisingPayload(ble::advertising_handle_t, mbed::Span<uint8_t>,"
|
||||
"bool)."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setAdvertisingPayload(ble::advertising_handle_t, mbed::Span<uint8_t>,"
|
||||
"bool)."
|
||||
)
|
||||
void clearAdvertisingPayload(void);
|
||||
|
||||
|
@ -1703,9 +1706,9 @@ public:
|
|||
* Use ble::AdvertisingDataBuilder.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
)
|
||||
ble_error_t accumulateAdvertisingPayload(uint8_t flags);
|
||||
|
||||
|
@ -1731,9 +1734,9 @@ public:
|
|||
* Use ble::AdvertisingDataBuilder instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
)
|
||||
ble_error_t accumulateAdvertisingPayload(GapAdvertisingData::Appearance app);
|
||||
|
||||
|
@ -1759,9 +1762,9 @@ public:
|
|||
* Use ble::AdvertisingDataBuilder instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
)
|
||||
ble_error_t accumulateAdvertisingPayloadTxPower(int8_t power);
|
||||
|
||||
|
@ -1795,9 +1798,9 @@ public:
|
|||
* Use ble::AdvertisingDataBuilder instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
)
|
||||
ble_error_t accumulateAdvertisingPayload(
|
||||
GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len
|
||||
|
@ -1831,9 +1834,9 @@ public:
|
|||
* Use ble::AdvertisingDataBuilder instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
" Use ble::AdvertisingDataBuilder instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
" Use ble::AdvertisingDataBuilder instead."
|
||||
)
|
||||
ble_error_t updateAdvertisingPayload(
|
||||
GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len
|
||||
|
@ -1852,9 +1855,9 @@ public:
|
|||
* Use ble::AdvertisingDataBuilder instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
)
|
||||
ble_error_t setAdvertisingPayload(const GapAdvertisingData &payload);
|
||||
|
||||
|
@ -1866,8 +1869,8 @@ public:
|
|||
* @deprecated Deprecated since addition of extended advertising support.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
)
|
||||
const GapAdvertisingData &getAdvertisingPayload(void) const;
|
||||
|
||||
|
@ -1885,9 +1888,9 @@ public:
|
|||
* Use createAdvertisingSet().
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"Use ble::AdvertisingDataBuilder instead."
|
||||
)
|
||||
ble_error_t accumulateScanResponse(
|
||||
GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len
|
||||
|
@ -1903,9 +1906,9 @@ public:
|
|||
* Use setAdvertisingScanResponse().
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setAdvertisingScanResponse() instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setAdvertisingScanResponse() instead."
|
||||
)
|
||||
void clearScanResponse(void);
|
||||
|
||||
|
@ -1974,7 +1977,7 @@ public:
|
|||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setScanParameters(const ScanParameters &) instead."
|
||||
)
|
||||
ble_error_t setScanParams(const GapScanningParams& scanningParams);
|
||||
ble_error_t setScanParams(const GapScanningParams &scanningParams);
|
||||
|
||||
/**
|
||||
* Set the interval parameter used during scanning procedures.
|
||||
|
@ -2157,9 +2160,9 @@ private:
|
|||
* Implement setAdvertisingPayload() and setAdvertisingScanResponse() instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Implement setAdvertisingPayload() and setAdvertisingScanResponse() instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Implement setAdvertisingPayload() and setAdvertisingScanResponse() instead."
|
||||
)
|
||||
virtual ble_error_t setAdvertisingData(
|
||||
const GapAdvertisingData &advData,
|
||||
|
@ -2181,10 +2184,10 @@ private:
|
|||
* instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Implement startAdvertising(advertising_handle_t, adv_duration_t, uint8_t)"
|
||||
"instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
"Implement startAdvertising(advertising_handle_t, adv_duration_t, uint8_t)"
|
||||
"instead."
|
||||
)
|
||||
virtual ble_error_t startAdvertising(const GapAdvertisingParams ¶ms) = 0;
|
||||
|
||||
|
@ -2197,8 +2200,8 @@ public:
|
|||
* @deprecated Deprecated since addition of extended advertising support.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
)
|
||||
GapAdvertisingParams &getAdvertisingParams(void);
|
||||
|
||||
|
@ -2210,8 +2213,8 @@ public:
|
|||
* @deprecated Deprecated since addition of extended advertising support.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
)
|
||||
const GapAdvertisingParams &getAdvertisingParams(void) const;
|
||||
|
||||
|
@ -2224,9 +2227,9 @@ public:
|
|||
* Use setAdvertisingParameters() instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"Use setAdvertisingParameters() instead."
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support."
|
||||
"Use setAdvertisingParameters() instead."
|
||||
)
|
||||
void setAdvertisingParams(const GapAdvertisingParams &newParams);
|
||||
|
||||
|
@ -2269,7 +2272,7 @@ public:
|
|||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setEventHandler() instead."
|
||||
)
|
||||
TimeoutEventCallbackChain_t& onTimeout();
|
||||
TimeoutEventCallbackChain_t &onTimeout();
|
||||
|
||||
/**
|
||||
* Register a callback handling connection events.
|
||||
|
@ -2305,7 +2308,7 @@ public:
|
|||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setEventHandler() instead."
|
||||
)
|
||||
void onConnection(T *tptr, void (T::*mptr)(const ConnectionCallbackParams_t*));
|
||||
void onConnection(T *tptr, void (T::*mptr)(const ConnectionCallbackParams_t *));
|
||||
|
||||
/**
|
||||
* Get the callchain of registered connection event handlers.
|
||||
|
@ -2324,7 +2327,7 @@ public:
|
|||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setEventHandler() instead."
|
||||
)
|
||||
ConnectionEventCallbackChain_t& onConnection();
|
||||
ConnectionEventCallbackChain_t &onConnection();
|
||||
|
||||
/**
|
||||
* Register a callback handling disconnection events.
|
||||
|
@ -2360,7 +2363,7 @@ public:
|
|||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setEventHandler() instead."
|
||||
)
|
||||
void onDisconnection(T *tptr, void (T::*mptr)(const DisconnectionCallbackParams_t*));
|
||||
void onDisconnection(T *tptr, void (T::*mptr)(const DisconnectionCallbackParams_t *));
|
||||
|
||||
/**
|
||||
* Get the callchain of registered disconnection event handlers.
|
||||
|
@ -2379,7 +2382,7 @@ public:
|
|||
"Deprecated since addition of extended advertising support. "
|
||||
"Use setEventHandler() instead."
|
||||
)
|
||||
DisconnectionEventCallbackChain_t& onDisconnection();
|
||||
DisconnectionEventCallbackChain_t &onDisconnection();
|
||||
|
||||
/**
|
||||
* Set the radio-notification events handler.
|
||||
|
@ -2416,7 +2419,7 @@ public:
|
|||
* @deprecated Deprecated since addition of extended advertising support.
|
||||
* Use setEventHandler() instead.
|
||||
*/
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.11.0",
|
||||
"Deprecated since addition of extended advertising support. "
|
||||
|
@ -2435,7 +2438,7 @@ public:
|
|||
* @note To unregister a shutdown event handler, use
|
||||
* onShutdown().detach(callback).
|
||||
*/
|
||||
void onShutdown(const GapShutdownCallback_t& callback);
|
||||
void onShutdown(const GapShutdownCallback_t &callback);
|
||||
|
||||
/**
|
||||
* Register a Gap shutdown event handler.
|
||||
|
@ -2443,7 +2446,7 @@ public:
|
|||
* @param[in] objPtr Instance used to invoke @p memberPtr.
|
||||
* @param[in] memberPtr Shutdown event handler to register.
|
||||
*/
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
void onShutdown(T *objPtr, void (T::*memberPtr)(const Gap *))
|
||||
{
|
||||
shutdownCallChain.add(objPtr, memberPtr);
|
||||
|
@ -2458,7 +2461,7 @@ public:
|
|||
*
|
||||
* @return A reference to the shutdown event callback chain.
|
||||
*/
|
||||
GapShutdownCallbackChain_t& onShutdown();
|
||||
GapShutdownCallbackChain_t &onShutdown();
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -2487,8 +2490,8 @@ public:
|
|||
|
||||
/* Clear Gap state */
|
||||
state.advertising = 0;
|
||||
state.connected = 0;
|
||||
connectionCount = 0;
|
||||
state.connected = 0;
|
||||
connectionCount = 0;
|
||||
|
||||
/* Clear scanning state */
|
||||
scanningActive = false;
|
||||
|
@ -2502,7 +2505,7 @@ public:
|
|||
connectionCallChain.clear();
|
||||
disconnectionCallChain.clear();
|
||||
radioNotificationCallback = NULL;
|
||||
onAdvertisementReport = NULL;
|
||||
onAdvertisementReport = NULL;
|
||||
_eventHandler = NULL;
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
|
@ -2524,7 +2527,8 @@ protected:
|
|||
radioNotificationCallback(),
|
||||
onAdvertisementReport(),
|
||||
connectionCallChain(),
|
||||
disconnectionCallChain() {
|
||||
disconnectionCallChain()
|
||||
{
|
||||
_advPayload.clear();
|
||||
_scanResponse.clear();
|
||||
}
|
||||
|
@ -2591,9 +2595,9 @@ public:
|
|||
* instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.9.0",
|
||||
"The type BLEProtocol::AddressType_t is not suitable when privacy is "
|
||||
"enabled. Use the overload that accepts a PeerAddressType_t instead."
|
||||
"mbed-os-5.9.0",
|
||||
"The type BLEProtocol::AddressType_t is not suitable when privacy is "
|
||||
"enabled. Use the overload that accepts a PeerAddressType_t instead."
|
||||
)
|
||||
void processConnectionEvent(
|
||||
Handle_t handle,
|
||||
|
@ -2692,9 +2696,9 @@ public:
|
|||
* instead.
|
||||
*/
|
||||
MBED_DEPRECATED_SINCE(
|
||||
"mbed-os-5.9.0",
|
||||
"The type BLEProtocol::AddressType_t is not suitable when privacy is "
|
||||
"enabled. Use the overload that accepts a PeerAddressType_t instead."
|
||||
"mbed-os-5.9.0",
|
||||
"The type BLEProtocol::AddressType_t is not suitable when privacy is "
|
||||
"enabled. Use the overload that accepts a PeerAddressType_t instead."
|
||||
)
|
||||
void processAdvertisementReport(
|
||||
const BLEProtocol::AddressBytes_t peerAddr,
|
||||
|
@ -2810,7 +2814,8 @@ private:
|
|||
private:
|
||||
/* Disallow copy and assignment. */
|
||||
Gap(const Gap &);
|
||||
Gap& operator=(const Gap &);
|
||||
|
||||
Gap &operator=(const Gap &);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -2832,7 +2837,8 @@ template<typename T>
|
|||
ble_error_t Gap::startScan(
|
||||
T *object,
|
||||
void (T::*callbackMember)(const AdvertisementCallbackParams_t *params)
|
||||
) {
|
||||
)
|
||||
{
|
||||
ble_error_t err = BLE_ERROR_NONE;
|
||||
if (object && callbackMember) {
|
||||
if ((err = startRadioScan(_scanningParams)) == BLE_ERROR_NONE) {
|
||||
|
@ -2846,18 +2852,18 @@ ble_error_t Gap::startScan(
|
|||
|
||||
|
||||
template<typename T>
|
||||
void Gap::onConnection(T *tptr, void (T::*mptr)(const ConnectionCallbackParams_t*))
|
||||
void Gap::onConnection(T *tptr, void (T::*mptr)(const ConnectionCallbackParams_t *))
|
||||
{
|
||||
connectionCallChain.add(tptr, mptr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Gap::onDisconnection(T *tptr, void (T::*mptr)(const DisconnectionCallbackParams_t*))
|
||||
void Gap::onDisconnection(T *tptr, void (T::*mptr)(const DisconnectionCallbackParams_t *))
|
||||
{
|
||||
disconnectionCallChain.add(tptr, mptr);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
void Gap::onRadioNotification(T *tptr, void (T::*mptr)(bool))
|
||||
{
|
||||
radioNotificationCallback.attach(tptr, mptr);
|
||||
|
|
|
@ -174,7 +174,7 @@ struct adv_data_flags_t {
|
|||
enum {
|
||||
LE_LIMITED_DISCOVERABLE = 0x01, /**< Discoverable for a limited period of time.*/
|
||||
LE_GENERAL_DISCOVERABLE = 0x02, /**< Discoverable at any moment. */
|
||||
BREDR_NOT_SUPPORTED = 0x04, /**< LE only and does not support Bluetooth Enhanced DataRate. */
|
||||
BREDR_NOT_SUPPORTED = 0x04, /**< LE only and does not support Bluetooth Enhanced DataRate. */
|
||||
SIMULTANEOUS_LE_BREDR_C = 0x08, /**< Not relevant - dual mode only. */
|
||||
SIMULTANEOUS_LE_BREDR_H = 0x10 /**< Not relevant - dual mode only. */
|
||||
};
|
||||
|
@ -186,7 +186,7 @@ struct adv_data_flags_t {
|
|||
{
|
||||
}
|
||||
|
||||
adv_data_flags_t& setGeneralDiscoverable(bool enable = true)
|
||||
adv_data_flags_t &setGeneralDiscoverable(bool enable = true)
|
||||
{
|
||||
_value &= ~0x03;
|
||||
if (enable) {
|
||||
|
@ -195,7 +195,7 @@ struct adv_data_flags_t {
|
|||
return *this;
|
||||
}
|
||||
|
||||
adv_data_flags_t& setLimitedDiscoverable(bool enable = true)
|
||||
adv_data_flags_t &setLimitedDiscoverable(bool enable = true)
|
||||
{
|
||||
_value &= ~0x03;
|
||||
if (enable) {
|
||||
|
@ -204,7 +204,7 @@ struct adv_data_flags_t {
|
|||
return *this;
|
||||
}
|
||||
|
||||
adv_data_flags_t& setBredrNotSupported(bool enable = true)
|
||||
adv_data_flags_t &setBredrNotSupported(bool enable = true)
|
||||
{
|
||||
_value &= ~BREDR_NOT_SUPPORTED;
|
||||
if (enable) {
|
||||
|
@ -213,7 +213,7 @@ struct adv_data_flags_t {
|
|||
return *this;
|
||||
}
|
||||
|
||||
adv_data_flags_t& setSimultaneousLeBredrC(bool enable = true)
|
||||
adv_data_flags_t &setSimultaneousLeBredrC(bool enable = true)
|
||||
{
|
||||
_value &= ~SIMULTANEOUS_LE_BREDR_C;
|
||||
if (enable) {
|
||||
|
@ -222,7 +222,7 @@ struct adv_data_flags_t {
|
|||
return *this;
|
||||
}
|
||||
|
||||
adv_data_flags_t& setSimultaneousLeBredrH(bool enable = true)
|
||||
adv_data_flags_t &setSimultaneousLeBredrH(bool enable = true)
|
||||
{
|
||||
_value &= ~SIMULTANEOUS_LE_BREDR_H;
|
||||
if (enable) {
|
||||
|
@ -233,27 +233,27 @@ struct adv_data_flags_t {
|
|||
|
||||
bool getGeneralDiscoverable()
|
||||
{
|
||||
return _value& LE_GENERAL_DISCOVERABLE;
|
||||
return _value & LE_GENERAL_DISCOVERABLE;
|
||||
}
|
||||
|
||||
bool getlimitedDiscoverable()
|
||||
{
|
||||
return _value& LE_LIMITED_DISCOVERABLE;
|
||||
return _value & LE_LIMITED_DISCOVERABLE;
|
||||
}
|
||||
|
||||
bool getBrEdrNotSupported()
|
||||
{
|
||||
return _value& BREDR_NOT_SUPPORTED;
|
||||
return _value & BREDR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
bool getSimultaneousLeBredrC()
|
||||
{
|
||||
return _value& SIMULTANEOUS_LE_BREDR_C;
|
||||
return _value & SIMULTANEOUS_LE_BREDR_C;
|
||||
}
|
||||
|
||||
bool getSimultaneousLeBredrH()
|
||||
{
|
||||
return _value& SIMULTANEOUS_LE_BREDR_H;
|
||||
return _value & SIMULTANEOUS_LE_BREDR_H;
|
||||
}
|
||||
|
||||
void clear()
|
||||
|
@ -534,12 +534,13 @@ struct adv_data_appearance_t : SafeEnum<adv_data_appearance_t, uint16_t> {
|
|||
/**
|
||||
* Construct a new instance of adv_data_appearance_t.
|
||||
*/
|
||||
adv_data_appearance_t(type value) : SafeEnum(value) { }
|
||||
adv_data_appearance_t(type value) : SafeEnum(value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class AdvertisingDataBuilder
|
||||
{
|
||||
class AdvertisingDataBuilder {
|
||||
public:
|
||||
/** Advertising data needs a user provided buffer to store the data.
|
||||
*
|
||||
|
@ -554,7 +555,7 @@ public:
|
|||
* @param buffer_size Size of the buffer.
|
||||
* @note Use Gap::getMaxAdvertisingDataLength() to find out how much can be accepted.
|
||||
*/
|
||||
AdvertisingDataBuilder(uint8_t* buffer, size_t buffer_size);
|
||||
AdvertisingDataBuilder(uint8_t *buffer, size_t buffer_size);
|
||||
|
||||
/**
|
||||
* Get the subspan of the buffer containing valid data.
|
||||
|
@ -724,7 +725,7 @@ public:
|
|||
* @retval BLE_ERROR_BUFFER_OVERFLOW if buffer is too small to contain the new data.
|
||||
* @retval BLE_ERROR_INVALID_PARAM if size of data is too big too fit in an individual data field.
|
||||
*/
|
||||
ble_error_t setName(const char* name, bool complete = true);
|
||||
ble_error_t setName(const char *name, bool complete = true);
|
||||
|
||||
/**
|
||||
* Add manufacturer specific data to the advertising payload.
|
||||
|
@ -835,7 +836,7 @@ private:
|
|||
* element being the length of the field followed by the value of the field.
|
||||
* NULL if the field is not present in the payload.
|
||||
*/
|
||||
uint8_t* findField(adv_data_type_t type);
|
||||
uint8_t *findField(adv_data_type_t type);
|
||||
|
||||
/**
|
||||
* Get field size (includes type and size bytes)
|
||||
|
@ -874,7 +875,7 @@ private:
|
|||
*/
|
||||
ble_error_t appendToField(
|
||||
mbed::Span<const uint8_t> fieldData,
|
||||
uint8_t* field
|
||||
uint8_t *field
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -893,7 +894,7 @@ private:
|
|||
ble_error_t replaceField(
|
||||
adv_data_type_t advDataType,
|
||||
mbed::Span<const uint8_t> fieldData,
|
||||
uint8_t* field
|
||||
uint8_t *field
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -903,7 +904,7 @@ private:
|
|||
*
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
ble_error_t removeField(uint8_t* field);
|
||||
ble_error_t removeField(uint8_t *field);
|
||||
|
||||
/**
|
||||
* Add a list of UUIDs to given types.
|
||||
|
|
|
@ -190,8 +190,8 @@ public:
|
|||
*
|
||||
* @return reference to this object.
|
||||
*/
|
||||
AdvertisingParameters& setPrimaryInterval(
|
||||
adv_interval_t min , adv_interval_t max
|
||||
AdvertisingParameters &setPrimaryInterval(
|
||||
adv_interval_t min, adv_interval_t max
|
||||
)
|
||||
{
|
||||
_minInterval = min;
|
||||
|
|
|
@ -407,7 +407,7 @@ private:
|
|||
uint8_t phyToIndex(phy_t phy) const
|
||||
{
|
||||
uint8_t index;
|
||||
switch(phy.value()) {
|
||||
switch (phy.value()) {
|
||||
case phy_t::LE_1M:
|
||||
index = 0;
|
||||
break;
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace ble {
|
|||
*/
|
||||
struct AdvertisingReportEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
/** Create a advertising report event.
|
||||
*
|
||||
* @param type Type of advertising used.
|
||||
|
@ -74,6 +75,7 @@ struct AdvertisingReportEvent {
|
|||
advertisingData(advertisingData)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Get event type. */
|
||||
|
@ -170,6 +172,7 @@ private:
|
|||
*/
|
||||
struct ConnectionCompleteEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
/** Create a connection complete event.
|
||||
*
|
||||
* @param success BLE_ERROR_NONE if connection succeeded.
|
||||
|
@ -210,6 +213,7 @@ struct ConnectionCompleteEvent {
|
|||
masterClockAccuracy(masterClockAccuracy)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Get connection complete event status. */
|
||||
|
@ -299,6 +303,7 @@ private:
|
|||
*/
|
||||
struct PeriodicAdvertisingSyncEstablishedEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
/** Create advertising sync event.
|
||||
*
|
||||
* @param success BLE_ERROR_NONE if synchronisation was achieved.
|
||||
|
@ -330,6 +335,7 @@ struct PeriodicAdvertisingSyncEstablishedEvent {
|
|||
peerClockAccuracy(peerClockAccuracy)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Get sync establishment status. */
|
||||
|
@ -398,6 +404,7 @@ private:
|
|||
*/
|
||||
struct PeriodicAdvertisingReportEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
/** Create periodic advertising report event.
|
||||
*
|
||||
* @param syncHandle Periodic advertising sync handle
|
||||
|
@ -420,6 +427,7 @@ struct PeriodicAdvertisingReportEvent {
|
|||
payload(payload)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Get periodic advertising sync handle. */
|
||||
|
@ -467,6 +475,7 @@ private:
|
|||
*/
|
||||
struct PeriodicAdvertisingSyncLoss {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
/** Create periodic advertising sync loss event.
|
||||
*
|
||||
* @param syncHandle Periodic advertising sync handle.
|
||||
|
@ -477,6 +486,7 @@ struct PeriodicAdvertisingSyncLoss {
|
|||
syncHandle(syncHandle)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Get periodic sync handle. */
|
||||
|
@ -503,6 +513,7 @@ struct ScanTimeoutEvent { };
|
|||
*/
|
||||
struct AdvertisingEndEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
/** Create advertising end event.
|
||||
*
|
||||
* @param advHandle Advertising set handle.
|
||||
|
@ -522,6 +533,7 @@ struct AdvertisingEndEvent {
|
|||
connected(connected)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Get advertising handle. */
|
||||
|
@ -562,6 +574,7 @@ private:
|
|||
*/
|
||||
struct ScanRequestEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
/** Create scan request event.
|
||||
*
|
||||
* @param advHandle Advertising handle.
|
||||
|
@ -578,6 +591,7 @@ struct ScanRequestEvent {
|
|||
peerAddress(peerAddress)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** Get advertising handle. */
|
||||
|
@ -611,6 +625,7 @@ private:
|
|||
*/
|
||||
struct DisconnectionEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
DisconnectionEvent(
|
||||
connection_handle_t connectionHandle,
|
||||
const disconnection_reason_t &reason
|
||||
|
@ -618,6 +633,7 @@ struct DisconnectionEvent {
|
|||
connectionHandle(connectionHandle), reason(reason)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -648,6 +664,7 @@ private:
|
|||
*/
|
||||
struct UpdateConnectionParametersRequestEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
UpdateConnectionParametersRequestEvent(
|
||||
connection_handle_t connectionHandle,
|
||||
const conn_interval_t &minConnectionInterval,
|
||||
|
@ -662,6 +679,7 @@ struct UpdateConnectionParametersRequestEvent {
|
|||
supervisionTimeout(supervision_timeout)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -719,6 +737,7 @@ private:
|
|||
*/
|
||||
struct ConnectionParametersUpdateCompleteEvent {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
||||
ConnectionParametersUpdateCompleteEvent(
|
||||
ble_error_t status,
|
||||
connection_handle_t connectionHandle,
|
||||
|
@ -733,6 +752,7 @@ struct ConnectionParametersUpdateCompleteEvent {
|
|||
supervisionTimeout(supervisionTimeout)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
*
|
||||
* @see startScan()
|
||||
*/
|
||||
virtual void onScanTimeout(const ScanTimeoutEvent & event)
|
||||
virtual void onScanTimeout(const ScanTimeoutEvent &event)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -729,12 +729,16 @@ protected:
|
|||
/** Can only be called if use_non_deprecated_scan_api() hasn't been called.
|
||||
* This guards against mixed use of deprecated and nondeprecated API.
|
||||
*/
|
||||
virtual void useVersionOneAPI() const { }
|
||||
virtual void useVersionOneAPI() const
|
||||
{
|
||||
}
|
||||
|
||||
/** Can only be called if use_deprecated_scan_api() hasn't been called.
|
||||
* This guards against mixed use of deprecated and nondeprecated API.
|
||||
*/
|
||||
virtual void useVersionTwoAPI() const { }
|
||||
virtual void useVersionTwoAPI() const
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* -------- soon to be deprecated API -------- */
|
||||
|
@ -842,7 +846,7 @@ public:
|
|||
*/
|
||||
ResolutionStrategy resolution_strategy;
|
||||
};
|
||||
|
||||
|
||||
static const PeripheralPrivacyConfiguration_t
|
||||
default_peripheral_privacy_configuration;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
ScanParameters& set_own_address_type(own_address_type_t address)
|
||||
ScanParameters &set_own_address_type(own_address_type_t address)
|
||||
{
|
||||
own_address_type = address;
|
||||
return *this;
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
return own_address_type;
|
||||
}
|
||||
|
||||
ScanParameters& set_scanning_filter_policy(scanning_filter_policy_t filter_policy)
|
||||
ScanParameters &set_scanning_filter_policy(scanning_filter_policy_t filter_policy)
|
||||
{
|
||||
scanning_filter_policy = filter_policy;
|
||||
return *this;
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
return scanning_filter_policy;
|
||||
}
|
||||
|
||||
ScanParameters& set_scanning_phys(bool enable_1m, bool enable_coded)
|
||||
ScanParameters &set_scanning_phys(bool enable_1m, bool enable_coded)
|
||||
{
|
||||
phys.set_1m(enable_1m);
|
||||
phys.set_coded(enable_coded);
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
return phys;
|
||||
}
|
||||
|
||||
ScanParameters& set_1m_phy_configuration(
|
||||
ScanParameters &set_1m_phy_configuration(
|
||||
scan_interval_t interval,
|
||||
scan_window_t window,
|
||||
bool active_scanning
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
return phy_1m_configuration;
|
||||
}
|
||||
|
||||
ScanParameters& set_coded_phy_configuration(
|
||||
ScanParameters &set_coded_phy_configuration(
|
||||
scan_interval_t interval,
|
||||
scan_window_t window,
|
||||
bool active_scanning
|
||||
|
|
|
@ -111,7 +111,7 @@ struct advertising_type_t : SafeEnum<advertising_type_t, uint8_t> {
|
|||
|
||||
/** Used to indicate if the packet is complete and if it's truncated.
|
||||
*/
|
||||
struct advertising_data_status_t : SafeEnum<advertising_data_status_t, uint8_t >{
|
||||
struct advertising_data_status_t : SafeEnum<advertising_data_status_t, uint8_t> {
|
||||
enum type {
|
||||
COMPLETE = 0x00, /**< Advertising payload complete. */
|
||||
INCOMPLETE_MORE_DATA = 0x01, /**< Partial advertising payload, more to come. */
|
||||
|
@ -330,7 +330,9 @@ struct scanning_filter_policy_t : SafeEnum<scanning_filter_policy_t, uint8_t> {
|
|||
/**
|
||||
* Construct a new instance of scanning_filter_policy_t.
|
||||
*/
|
||||
scanning_filter_policy_t(type value) : SafeEnum(value) { }
|
||||
scanning_filter_policy_t(type value) : SafeEnum(value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -359,7 +361,7 @@ struct initiator_filter_policy_t : SafeEnum<initiator_filter_policy_t, uint8_t>
|
|||
*
|
||||
* @see Bluetooth Core Specification 4.2 (Vol. 6), Part B, Section 4.3.3.
|
||||
*/
|
||||
struct duplicates_filter_t : SafeEnum<duplicates_filter_t, uint8_t >{
|
||||
struct duplicates_filter_t : SafeEnum<duplicates_filter_t, uint8_t> {
|
||||
enum type {
|
||||
/**
|
||||
* Disable duplicate filtering.
|
||||
|
@ -442,7 +444,7 @@ struct target_peer_address_type_t : SafeEnum<target_peer_address_type_t, uint8_t
|
|||
/**
|
||||
* Accuracy of the master clock.
|
||||
*/
|
||||
struct clock_accuracy_t : SafeEnum<clock_accuracy_t, uint8_t > {
|
||||
struct clock_accuracy_t : SafeEnum<clock_accuracy_t, uint8_t> {
|
||||
enum type {
|
||||
/**
|
||||
* 500 PPM
|
||||
|
@ -491,16 +493,25 @@ struct clock_accuracy_t : SafeEnum<clock_accuracy_t, uint8_t > {
|
|||
*/
|
||||
uint16_t get_ppm()
|
||||
{
|
||||
switch(value()) {
|
||||
case PPM_500: return 500;
|
||||
case PPM_250: return 250;
|
||||
case PPM_150: return 150;
|
||||
case PPM_100: return 100;
|
||||
case PPM_75: return 75;
|
||||
case PPM_50: return 50;
|
||||
case PPM_30: return 30;
|
||||
case PPM_20: return 20;
|
||||
default: return 0;
|
||||
switch (value()) {
|
||||
case PPM_500:
|
||||
return 500;
|
||||
case PPM_250:
|
||||
return 250;
|
||||
case PPM_150:
|
||||
return 150;
|
||||
case PPM_100:
|
||||
return 100;
|
||||
case PPM_75:
|
||||
return 75;
|
||||
case PPM_50:
|
||||
return 50;
|
||||
case PPM_30:
|
||||
return 30;
|
||||
case PPM_20:
|
||||
return 20;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -527,7 +538,7 @@ struct clock_accuracy_t : SafeEnum<clock_accuracy_t, uint8_t > {
|
|||
*
|
||||
* @attention A device can fulfill different roles concurrently.
|
||||
*/
|
||||
struct connection_role_t :SafeEnum<connection_role_t, uint8_t> {
|
||||
struct connection_role_t : SafeEnum<connection_role_t, uint8_t> {
|
||||
/** struct scoped enum wrapped by the class */
|
||||
enum type {
|
||||
/**
|
||||
|
@ -684,8 +695,6 @@ struct disconnection_reason_t : SafeEnum<disconnection_reason_t, uint8_t> {
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace ble
|
||||
|
||||
#endif //BLE_GAP_TYPES_H
|
||||
|
|
|
@ -42,14 +42,16 @@ namespace generic {
|
|||
*
|
||||
* @attention: Not part of the public interface of BLE API.
|
||||
*/
|
||||
class GenericGap : public ::Gap,
|
||||
public pal::ConnectionEventMonitor,
|
||||
public pal::Gap::EventHandler {
|
||||
class GenericGap :
|
||||
public ::Gap,
|
||||
public pal::ConnectionEventMonitor,
|
||||
public pal::Gap::EventHandler {
|
||||
|
||||
public:
|
||||
/* TODO: move to config */
|
||||
static const uint8_t MAX_ADVERTISING_SETS = 15;
|
||||
static const size_t MAX_HCI_DATA_LENGTH = 251;
|
||||
|
||||
/**
|
||||
* Construct a GenericGap.
|
||||
*
|
||||
|
@ -341,18 +343,18 @@ public:
|
|||
* @see Gap::setPreferredPhys
|
||||
*/
|
||||
virtual ble_error_t setPreferredPhys(
|
||||
const phy_set_t* txPhys,
|
||||
const phy_set_t* rxPhys
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::setPhy
|
||||
*/
|
||||
virtual ble_error_t setPhy(
|
||||
Handle_t connection,
|
||||
const phy_set_t* txPhys,
|
||||
const phy_set_t* rxPhys,
|
||||
CodedSymbolPerBit_t codedSymbol
|
||||
Handle_t connection,
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
CodedSymbolPerBit_t codedSymbol
|
||||
);
|
||||
|
||||
virtual ble_error_t disconnect(
|
||||
|
@ -603,7 +605,7 @@ private:
|
|||
|
||||
void update_random_address();
|
||||
|
||||
bool getUnresolvableRandomAddress(ble::address_t& address);
|
||||
bool getUnresolvableRandomAddress(ble::address_t &address);
|
||||
|
||||
void on_address_rotation_timeout();
|
||||
|
||||
|
@ -707,8 +709,9 @@ private:
|
|||
uint16_t connection_latency,
|
||||
uint16_t supervision_timeout
|
||||
);
|
||||
|
||||
private:
|
||||
pal::EventQueue& _event_queue;
|
||||
pal::EventQueue &_event_queue;
|
||||
pal::Gap &_pal_gap;
|
||||
pal::GenericAccessService &_gap_service;
|
||||
pal::SecurityManager &_pal_sm;
|
||||
|
|
|
@ -63,11 +63,14 @@ struct connection_peer_address_type_t :
|
|||
* Construct a new connection_peer_address_type_t instance.
|
||||
*/
|
||||
connection_peer_address_type_t(type value) :
|
||||
SafeEnum<connection_peer_address_type_t, uint8_t>(value) { }
|
||||
SafeEnum<connection_peer_address_type_t, uint8_t>(value)
|
||||
{
|
||||
}
|
||||
|
||||
explicit connection_peer_address_type_t(uint8_t raw_value) :
|
||||
SafeEnum<connection_peer_address_type_t, uint8_t>(raw_value)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -87,7 +90,9 @@ struct whitelist_address_type_t : SafeEnum<whitelist_address_type_t, uint8_t> {
|
|||
* Construct a new whitelist_address_type_t instance.
|
||||
*/
|
||||
whitelist_address_type_t(type value) :
|
||||
SafeEnum<whitelist_address_type_t, uint8_t>(value) { }
|
||||
SafeEnum<whitelist_address_type_t, uint8_t>(value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -113,11 +118,14 @@ struct advertising_channel_map_t : SafeEnum<advertising_channel_map_t, uint8_t>
|
|||
* Construct a new advertising_channel_map_t instance.
|
||||
*/
|
||||
advertising_channel_map_t(type value) :
|
||||
SafeEnum<advertising_channel_map_t, uint8_t>(value) { }
|
||||
SafeEnum<advertising_channel_map_t, uint8_t>(value)
|
||||
{
|
||||
}
|
||||
|
||||
advertising_channel_map_t(bool ch37, bool ch38, bool ch39) :
|
||||
SafeEnum<advertising_channel_map_t, uint8_t>(ch37 | (ch38 << 1) | (ch39 << 2))
|
||||
{ }
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -206,13 +214,17 @@ struct hci_error_code_t : SafeEnum<hci_error_code_t, uint8_t> {
|
|||
* Construct a new hci_error_code_t instance.
|
||||
*/
|
||||
hci_error_code_t(type value) :
|
||||
SafeEnum<hci_error_code_t, uint8_t>(value) { }
|
||||
SafeEnum<hci_error_code_t, uint8_t>(value)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new hci_error_code_t from a raw value.
|
||||
*/
|
||||
explicit hci_error_code_t(uint8_t raw_value) :
|
||||
SafeEnum<hci_error_code_t, uint8_t>(static_cast<type>(raw_value)) { }
|
||||
SafeEnum<hci_error_code_t, uint8_t>(static_cast<type>(raw_value))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -233,7 +245,8 @@ struct advertising_data_t {
|
|||
*
|
||||
* @param input_value Reference to the array containing the advertising data
|
||||
*/
|
||||
advertising_data_t(const uint8_t (&input_value)[31]) {
|
||||
advertising_data_t(const uint8_t (&input_value)[31])
|
||||
{
|
||||
memcpy(value, input_value, sizeof(value));
|
||||
}
|
||||
|
||||
|
@ -244,7 +257,8 @@ struct advertising_data_t {
|
|||
*
|
||||
* @param len Length of the buffer.
|
||||
*/
|
||||
advertising_data_t(const uint8_t* input_value, size_t len) {
|
||||
advertising_data_t(const uint8_t *input_value, size_t len)
|
||||
{
|
||||
const size_t actual_len = std::min(len, sizeof(value));
|
||||
memcpy(value, input_value, actual_len);
|
||||
memset(value + actual_len, 0x00, sizeof(value) - actual_len);
|
||||
|
@ -254,8 +268,9 @@ struct advertising_data_t {
|
|||
* Equal operator between two advertising data.
|
||||
*/
|
||||
friend bool operator==(
|
||||
const advertising_data_t& lhs, const advertising_data_t& rhs
|
||||
) {
|
||||
const advertising_data_t &lhs, const advertising_data_t &rhs
|
||||
)
|
||||
{
|
||||
return memcmp(lhs.value, rhs.value, sizeof(lhs.value)) == 0;
|
||||
}
|
||||
|
||||
|
@ -263,29 +278,33 @@ struct advertising_data_t {
|
|||
* Non equal operator between two advertising data.
|
||||
*/
|
||||
friend bool operator!=(
|
||||
const advertising_data_t& lhs, const advertising_data_t& rhs
|
||||
) {
|
||||
const advertising_data_t &lhs, const advertising_data_t &rhs
|
||||
)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscript operator used to access the content of the advertising data.
|
||||
*/
|
||||
uint8_t operator[](uint8_t i) const {
|
||||
uint8_t operator[](uint8_t i) const
|
||||
{
|
||||
return value[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a pointer to the advertising data buffer.
|
||||
*/
|
||||
const uint8_t* data() const {
|
||||
const uint8_t *data() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return (fixed) size of advertising data.
|
||||
*/
|
||||
uint8_t size() const {
|
||||
uint8_t size() const
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
|
@ -329,7 +348,9 @@ struct received_advertising_type_t :
|
|||
* Construct a new received_advertising_type_t value.
|
||||
*/
|
||||
received_advertising_type_t(type value) :
|
||||
SafeEnum<received_advertising_type_t, uint8_t>(value) { }
|
||||
SafeEnum<received_advertising_type_t, uint8_t>(value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -352,7 +373,8 @@ struct advertising_event_properties_t {
|
|||
use_legacy_pdu(false),
|
||||
omit_advertiser_address(false),
|
||||
include_tx_power(false)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an advertising_event_properties_t with all fields defined by
|
||||
|
@ -383,7 +405,8 @@ struct advertising_event_properties_t {
|
|||
use_legacy_pdu(use_legacy_pdu),
|
||||
omit_advertiser_address(omit_advertisser_address),
|
||||
include_tx_power(include_tx_power)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an advertising_event_property_t from a legacy advertising_type_t.
|
||||
|
@ -469,7 +492,8 @@ struct advertising_event_properties_t {
|
|||
* Construct the value expected by a BT controller.
|
||||
* @return All fields in a uint16_t understandable by BT stacks.
|
||||
*/
|
||||
uint16_t value() {
|
||||
uint16_t value()
|
||||
{
|
||||
uint16_t result = 0;
|
||||
result |= connectable << 0;
|
||||
result |= scannable << 1;
|
||||
|
@ -522,7 +546,7 @@ typedef ble::rssi_t rssi_t;
|
|||
* Description of an advertising fragment.
|
||||
*/
|
||||
struct advertising_fragment_description_t :
|
||||
SafeEnum<advertising_fragment_description_t, uint8_t >{
|
||||
SafeEnum<advertising_fragment_description_t, uint8_t> {
|
||||
|
||||
enum type {
|
||||
/**
|
||||
|
@ -562,7 +586,9 @@ struct advertising_fragment_description_t :
|
|||
* Construct a new advertising_fragment_description_t value.
|
||||
*/
|
||||
advertising_fragment_description_t(type value) :
|
||||
SafeEnum<advertising_fragment_description_t, uint8_t>(value) { }
|
||||
SafeEnum<advertising_fragment_description_t, uint8_t>(value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
typedef ble::duplicates_filter_t duplicates_filter_t;
|
||||
|
@ -575,41 +601,52 @@ typedef ble::periodic_sync_handle_t sync_handle_t;
|
|||
typedef ble::advertising_data_status_t advertising_data_status_t;
|
||||
|
||||
struct extended_advertising_report_event_type_t {
|
||||
extended_advertising_report_event_type_t(uint8_t value) : value(value) { }
|
||||
extended_advertising_report_event_type_t(uint8_t value) : value(value)
|
||||
{
|
||||
}
|
||||
|
||||
bool connectable() {
|
||||
bool connectable()
|
||||
{
|
||||
return static_cast<bool>(value & (1 << 0));
|
||||
}
|
||||
|
||||
bool scannable_advertising() {
|
||||
bool scannable_advertising()
|
||||
{
|
||||
return static_cast<bool>(value & (1 << 1));
|
||||
}
|
||||
|
||||
bool directed_advertising() {
|
||||
bool directed_advertising()
|
||||
{
|
||||
return static_cast<bool>(value & (1 << 2));
|
||||
}
|
||||
|
||||
bool scan_response() {
|
||||
bool scan_response()
|
||||
{
|
||||
return static_cast<bool>(value & (1 << 3));
|
||||
}
|
||||
|
||||
bool legacy_advertising() {
|
||||
bool legacy_advertising()
|
||||
{
|
||||
return static_cast<bool>(value & (1 << 4));
|
||||
}
|
||||
|
||||
advertising_data_status_t data_status() {
|
||||
advertising_data_status_t data_status()
|
||||
{
|
||||
return static_cast<advertising_data_status_t::type>((value >> 5) & 0x03);
|
||||
}
|
||||
|
||||
bool complete() {
|
||||
bool complete()
|
||||
{
|
||||
return data_status() == advertising_data_status_t::COMPLETE;
|
||||
}
|
||||
|
||||
bool more_data_to_come() {
|
||||
bool more_data_to_come()
|
||||
{
|
||||
return data_status() == advertising_data_status_t::INCOMPLETE_MORE_DATA;
|
||||
}
|
||||
|
||||
bool truncated() {
|
||||
bool truncated()
|
||||
{
|
||||
return data_status() == advertising_data_status_t::INCOMPLETE_DATA_TRUNCATED;
|
||||
}
|
||||
|
||||
|
@ -651,9 +688,13 @@ struct direct_address_type_t : SafeEnum<direct_address_type_t, uint8_t> {
|
|||
* Construct a new direct_address_type_t instance.
|
||||
*/
|
||||
direct_address_type_t(type value) :
|
||||
SafeEnum<direct_address_type_t, uint8_t>(value) { }
|
||||
SafeEnum<direct_address_type_t, uint8_t>(value)
|
||||
{
|
||||
}
|
||||
|
||||
explicit direct_address_type_t(uint8_t raw_value) : SafeEnum(raw_value) { }
|
||||
explicit direct_address_type_t(uint8_t raw_value) : SafeEnum(raw_value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
typedef ble::clock_accuracy_t clock_accuracy_t;
|
||||
|
|
|
@ -294,7 +294,7 @@ struct Gap {
|
|||
* @return BLE_ERROR_NONE if the request has been successfully sent or the
|
||||
* appropriate error otherwise.
|
||||
*/
|
||||
virtual ble_error_t set_random_address(const address_t& address) = 0;
|
||||
virtual ble_error_t set_random_address(const address_t &address) = 0;
|
||||
|
||||
/**
|
||||
* Set the random device address used by an advertising set.
|
||||
|
@ -316,7 +316,7 @@ struct Gap {
|
|||
* @note See Bluetooth 5 Vol 2, Part E: 7.8.52 LE Set Advertising Set Random
|
||||
* Address Command
|
||||
*/
|
||||
virtual ble_error_t set_advertising_set_random_address(
|
||||
virtual ble_error_t set_advertising_set_random_address(
|
||||
advertising_handle_t advertising_handle,
|
||||
const address_t &address
|
||||
) = 0;
|
||||
|
@ -384,7 +384,7 @@ struct Gap {
|
|||
advertising_type_t advertising_type,
|
||||
own_address_type_t own_address_type,
|
||||
advertising_peer_address_type_t peer_address_type,
|
||||
const address_t& peer_address,
|
||||
const address_t &peer_address,
|
||||
advertising_channel_map_t advertising_channel_map,
|
||||
advertising_filter_policy_t advertising_filter_policy
|
||||
) = 0;
|
||||
|
@ -518,7 +518,7 @@ struct Gap {
|
|||
*/
|
||||
virtual ble_error_t set_advertising_data(
|
||||
uint8_t advertising_data_length,
|
||||
const advertising_data_t& advertising_data
|
||||
const advertising_data_t &advertising_data
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
|
@ -611,7 +611,7 @@ struct Gap {
|
|||
*/
|
||||
virtual ble_error_t set_scan_response_data(
|
||||
uint8_t scan_response_data_length,
|
||||
const advertising_data_t& scan_response_data
|
||||
const advertising_data_t &scan_response_data
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
|
@ -727,9 +727,9 @@ struct Gap {
|
|||
virtual ble_error_t extended_advertising_enable(
|
||||
bool enable,
|
||||
uint8_t number_of_sets,
|
||||
const advertising_handle_t* handles,
|
||||
const uint16_t* durations,
|
||||
const uint8_t* max_extended_advertising_events
|
||||
const advertising_handle_t *handles,
|
||||
const uint16_t *durations,
|
||||
const uint8_t *max_extended_advertising_events
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
|
@ -1159,7 +1159,7 @@ struct Gap {
|
|||
uint16_t scan_window,
|
||||
initiator_policy_t initiator_policy,
|
||||
connection_peer_address_type_t peer_address_type,
|
||||
const address_t& peer_address,
|
||||
const address_t &peer_address,
|
||||
own_address_type_t own_address_type,
|
||||
uint16_t connection_interval_min,
|
||||
uint16_t connection_interval_max,
|
||||
|
@ -1252,14 +1252,14 @@ struct Gap {
|
|||
peer_address_type_t peer_address_type,
|
||||
const address_t &peer_address,
|
||||
phy_set_t initiating_phys,
|
||||
const uint16_t* scan_intervals,
|
||||
const uint16_t* scan_windows,
|
||||
const uint16_t* connection_intervals_min,
|
||||
const uint16_t* connection_intervals_max,
|
||||
const uint16_t* connection_latencies,
|
||||
const uint16_t* supervision_timeouts,
|
||||
const uint16_t* minimum_connection_event_lengths,
|
||||
const uint16_t* maximum_connection_event_lengths
|
||||
const uint16_t *scan_intervals,
|
||||
const uint16_t *scan_windows,
|
||||
const uint16_t *connection_intervals_min,
|
||||
const uint16_t *connection_intervals_max,
|
||||
const uint16_t *connection_latencies,
|
||||
const uint16_t *supervision_timeouts,
|
||||
const uint16_t *minimum_connection_event_lengths,
|
||||
const uint16_t *maximum_connection_event_lengths
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
|
@ -1524,7 +1524,7 @@ struct Gap {
|
|||
* @return true if privacy is supported, false otherwise.
|
||||
*
|
||||
* @note: See Bluetooth 5 Vol 3 Part C: 10.7 Privacy feature.
|
||||
*/
|
||||
*/
|
||||
virtual bool is_privacy_supported() = 0;
|
||||
|
||||
/** Enable or disable private addresses resolution
|
||||
|
@ -1549,7 +1549,7 @@ struct Gap {
|
|||
virtual bool is_feature_supported(
|
||||
controller_supported_features_t feature
|
||||
) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @see Gap::readPhy
|
||||
*/
|
||||
|
@ -1559,18 +1559,18 @@ struct Gap {
|
|||
* @see Gap::setPreferredPhys
|
||||
*/
|
||||
virtual ble_error_t set_preferred_phys(
|
||||
const phy_set_t& tx_phys,
|
||||
const phy_set_t& rx_phys
|
||||
const phy_set_t &tx_phys,
|
||||
const phy_set_t &rx_phys
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* @see Gap::setPhy
|
||||
*/
|
||||
virtual ble_error_t set_phy(
|
||||
connection_handle_t connection,
|
||||
const phy_set_t& tx_phys,
|
||||
const phy_set_t& rx_phys,
|
||||
coded_symbol_per_bit_t coded_symbol
|
||||
connection_handle_t connection,
|
||||
const phy_set_t &tx_phys,
|
||||
const phy_set_t &rx_phys,
|
||||
coded_symbol_per_bit_t coded_symbol
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
|
@ -1580,7 +1580,7 @@ struct Gap {
|
|||
* LE subsystem.
|
||||
* It accept a single parameter in input: The event received.
|
||||
*/
|
||||
void when_gap_event_received(mbed::Callback<void(const GapEvent&)> cb)
|
||||
void when_gap_event_received(mbed::Callback<void(const GapEvent &)> cb)
|
||||
{
|
||||
_gap_event_cb = cb;
|
||||
}
|
||||
|
@ -1593,11 +1593,13 @@ public:
|
|||
* @param[in] event_handler the new event handler interface implementation. Memory
|
||||
* owned by caller who is responsible for updating this pointer if interface changes.
|
||||
*/
|
||||
void set_event_handler(EventHandler *event_handler) {
|
||||
void set_event_handler(EventHandler *event_handler)
|
||||
{
|
||||
_pal_event_handler = event_handler;
|
||||
}
|
||||
|
||||
EventHandler* get_event_handler() {
|
||||
EventHandler *get_event_handler()
|
||||
{
|
||||
return _pal_event_handler;
|
||||
}
|
||||
|
||||
|
@ -1605,9 +1607,13 @@ protected:
|
|||
EventHandler *_pal_event_handler;
|
||||
|
||||
protected:
|
||||
Gap() : _pal_event_handler(NULL) { }
|
||||
Gap() : _pal_event_handler(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~Gap() { }
|
||||
virtual ~Gap()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation shall call this function whenever the LE subsystem
|
||||
|
@ -1615,7 +1621,7 @@ protected:
|
|||
*
|
||||
* @param gap_event The event to emit to higher layer.
|
||||
*/
|
||||
void emit_gap_event(const GapEvent& gap_event)
|
||||
void emit_gap_event(const GapEvent &gap_event)
|
||||
{
|
||||
if (_gap_event_cb) {
|
||||
_gap_event_cb(gap_event);
|
||||
|
@ -1629,9 +1635,10 @@ public:
|
|||
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E - 7.8.49
|
||||
*/
|
||||
static uint8_t create_all_phys_value(
|
||||
const phy_set_t& tx_phys,
|
||||
const phy_set_t& rx_phys
|
||||
) {
|
||||
const phy_set_t &tx_phys,
|
||||
const phy_set_t &rx_phys
|
||||
)
|
||||
{
|
||||
/* if phy set is empty set corresponding all_phys bit to 1 */
|
||||
uint8_t all_phys = 0;
|
||||
if (tx_phys.value() == 0) {
|
||||
|
@ -1647,12 +1654,13 @@ private:
|
|||
/**
|
||||
* Callback called when an event is emitted by the LE subsystem.
|
||||
*/
|
||||
mbed::Callback<void(const GapEvent&)> _gap_event_cb;
|
||||
mbed::Callback<void(const GapEvent &)> _gap_event_cb;
|
||||
|
||||
private:
|
||||
// Disallow copy construction and copy assignment.
|
||||
Gap(const Gap&);
|
||||
Gap& operator=(const Gap&);
|
||||
Gap(const Gap &);
|
||||
|
||||
Gap &operator=(const Gap &);
|
||||
};
|
||||
|
||||
} // namespace pal
|
||||
|
|
|
@ -20,22 +20,26 @@ namespace ble {
|
|||
|
||||
AdvertisingDataBuilder::AdvertisingDataBuilder(mbed::Span<uint8_t> buffer) :
|
||||
_buffer(buffer),
|
||||
_payload_length(0) {
|
||||
_payload_length(0)
|
||||
{
|
||||
}
|
||||
|
||||
AdvertisingDataBuilder::AdvertisingDataBuilder(uint8_t* buffer, size_t buffer_size) :
|
||||
AdvertisingDataBuilder::AdvertisingDataBuilder(uint8_t *buffer, size_t buffer_size) :
|
||||
_buffer(buffer, buffer_size),
|
||||
_payload_length(0) {
|
||||
_payload_length(0)
|
||||
{
|
||||
}
|
||||
|
||||
mbed::Span<const uint8_t> AdvertisingDataBuilder::getAdvertisingData() const {
|
||||
mbed::Span<const uint8_t> AdvertisingDataBuilder::getAdvertisingData() const
|
||||
{
|
||||
return _buffer.first(_payload_length);
|
||||
}
|
||||
|
||||
ble_error_t AdvertisingDataBuilder::addData(
|
||||
adv_data_type_t advDataType,
|
||||
mbed::Span<const uint8_t> fieldData
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (findField(advDataType)) {
|
||||
return BLE_ERROR_OPERATION_NOT_PERMITTED;
|
||||
} else {
|
||||
|
@ -46,8 +50,9 @@ ble_error_t AdvertisingDataBuilder::addData(
|
|||
ble_error_t AdvertisingDataBuilder::replaceData(
|
||||
adv_data_type_t advDataType,
|
||||
mbed::Span<const uint8_t> fieldData
|
||||
) {
|
||||
uint8_t* field = findField(advDataType);
|
||||
)
|
||||
{
|
||||
uint8_t *field = findField(advDataType);
|
||||
|
||||
if (field) {
|
||||
return replaceField(advDataType, fieldData, field);
|
||||
|
@ -59,8 +64,9 @@ ble_error_t AdvertisingDataBuilder::replaceData(
|
|||
ble_error_t AdvertisingDataBuilder::appendData(
|
||||
adv_data_type_t advDataType,
|
||||
mbed::Span<const uint8_t> fieldData
|
||||
) {
|
||||
uint8_t* field = findField(advDataType);
|
||||
)
|
||||
{
|
||||
uint8_t *field = findField(advDataType);
|
||||
|
||||
if (field) {
|
||||
return appendToField(fieldData, field);
|
||||
|
@ -71,8 +77,9 @@ ble_error_t AdvertisingDataBuilder::appendData(
|
|||
|
||||
ble_error_t AdvertisingDataBuilder::removeData(
|
||||
adv_data_type_t advDataType
|
||||
) {
|
||||
uint8_t* field = findField(advDataType);
|
||||
)
|
||||
{
|
||||
uint8_t *field = findField(advDataType);
|
||||
|
||||
if (field) {
|
||||
return removeField(field);
|
||||
|
@ -84,8 +91,9 @@ ble_error_t AdvertisingDataBuilder::removeData(
|
|||
ble_error_t AdvertisingDataBuilder::addOrReplaceData(
|
||||
adv_data_type_t advDataType,
|
||||
mbed::Span<const uint8_t> fieldData
|
||||
) {
|
||||
uint8_t* field = findField(advDataType);
|
||||
)
|
||||
{
|
||||
uint8_t *field = findField(advDataType);
|
||||
|
||||
if (field) {
|
||||
return replaceField(advDataType, fieldData, field);
|
||||
|
@ -97,8 +105,9 @@ ble_error_t AdvertisingDataBuilder::addOrReplaceData(
|
|||
ble_error_t AdvertisingDataBuilder::addOrAppendData(
|
||||
adv_data_type_t advDataType,
|
||||
mbed::Span<const uint8_t> fieldData
|
||||
) {
|
||||
uint8_t* field = findField(advDataType);
|
||||
)
|
||||
{
|
||||
uint8_t *field = findField(advDataType);
|
||||
|
||||
if (field) {
|
||||
return appendToField(fieldData, field);
|
||||
|
@ -107,39 +116,44 @@ ble_error_t AdvertisingDataBuilder::addOrAppendData(
|
|||
}
|
||||
}
|
||||
|
||||
void AdvertisingDataBuilder::clear() {
|
||||
void AdvertisingDataBuilder::clear()
|
||||
{
|
||||
memset(_buffer.data(), 0, _buffer.size());
|
||||
_payload_length = 0;
|
||||
}
|
||||
|
||||
ble_error_t AdvertisingDataBuilder::setAppearance(
|
||||
adv_data_appearance_t appearance
|
||||
) {
|
||||
)
|
||||
{
|
||||
uint8_t appearence_byte = appearance.value();
|
||||
mbed::Span<const uint8_t> appearance_span((const uint8_t*) &appearence_byte, 2);
|
||||
mbed::Span<const uint8_t> appearance_span((const uint8_t *) &appearence_byte, 2);
|
||||
return addOrReplaceData(adv_data_type_t::APPEARANCE, appearance_span);
|
||||
}
|
||||
|
||||
ble_error_t AdvertisingDataBuilder::setFlags(
|
||||
adv_data_flags_t flags
|
||||
) {
|
||||
)
|
||||
{
|
||||
uint8_t flags_byte = flags.value();
|
||||
mbed::Span<const uint8_t> flags_span((const uint8_t*) &flags_byte, 1);
|
||||
mbed::Span<const uint8_t> flags_span((const uint8_t *) &flags_byte, 1);
|
||||
return addOrReplaceData(adv_data_type_t::FLAGS, flags_span);
|
||||
}
|
||||
|
||||
ble_error_t AdvertisingDataBuilder::setTxPowerAdvertised(
|
||||
advertising_power_t txPower
|
||||
) {
|
||||
mbed::Span<const uint8_t> power_span((const uint8_t*) &txPower, 1);
|
||||
)
|
||||
{
|
||||
mbed::Span<const uint8_t> power_span((const uint8_t *) &txPower, 1);
|
||||
return addOrReplaceData(adv_data_type_t::TX_POWER_LEVEL, power_span);
|
||||
}
|
||||
|
||||
ble_error_t AdvertisingDataBuilder::setName(
|
||||
const char* name,
|
||||
const char *name,
|
||||
bool complete
|
||||
) {
|
||||
mbed::Span<const uint8_t> power_span((const uint8_t*)name, strlen(name));
|
||||
)
|
||||
{
|
||||
mbed::Span<const uint8_t> power_span((const uint8_t *) name, strlen(name));
|
||||
|
||||
if (complete) {
|
||||
return addOrReplaceData(adv_data_type_t::COMPLETE_LOCAL_NAME, power_span);
|
||||
|
@ -150,7 +164,8 @@ ble_error_t AdvertisingDataBuilder::setName(
|
|||
|
||||
ble_error_t AdvertisingDataBuilder::setManufacturerSpecificData(
|
||||
mbed::Span<const uint8_t> data
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (data.size() < 2) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -160,34 +175,37 @@ ble_error_t AdvertisingDataBuilder::setManufacturerSpecificData(
|
|||
|
||||
ble_error_t AdvertisingDataBuilder::setAdvertisingInterval(
|
||||
adv_interval_t interval
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (interval.value() > 0xFFFF) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
return addOrReplaceData(
|
||||
adv_data_type_t::ADVERTISING_INTERVAL,
|
||||
mbed::make_Span((const uint8_t*)interval.storage(), 2)
|
||||
mbed::make_Span((const uint8_t *) interval.storage(), 2)
|
||||
);
|
||||
}
|
||||
|
||||
ble_error_t AdvertisingDataBuilder::setConnectionIntervalPreference(
|
||||
conn_interval_t min,
|
||||
conn_interval_t max
|
||||
) {
|
||||
uint32_t interval = max.value();
|
||||
)
|
||||
{
|
||||
uint32_t interval = max.value();
|
||||
interval = interval << 16;
|
||||
interval |= min.value();
|
||||
return addOrReplaceData(
|
||||
adv_data_type_t::SLAVE_CONNECTION_INTERVAL_RANGE,
|
||||
mbed::make_Span((const uint8_t*)&interval, 4)
|
||||
mbed::make_Span((const uint8_t *) &interval, 4)
|
||||
);
|
||||
}
|
||||
|
||||
ble_error_t AdvertisingDataBuilder::setServiceData(
|
||||
UUID service,
|
||||
mbed::Span<const uint8_t> data
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (service.getLen() + data.size() > 0xFE) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -232,7 +250,8 @@ ble_error_t AdvertisingDataBuilder::setServiceData(
|
|||
ble_error_t AdvertisingDataBuilder::setLocalServiceList(
|
||||
mbed::Span<const UUID> data,
|
||||
bool complete
|
||||
) {
|
||||
)
|
||||
{
|
||||
adv_data_type_t short_type = complete ?
|
||||
adv_data_type_t::COMPLETE_LIST_16BIT_SERVICE_IDS :
|
||||
adv_data_type_t::INCOMPLETE_LIST_16BIT_SERVICE_IDS;
|
||||
|
@ -246,7 +265,8 @@ ble_error_t AdvertisingDataBuilder::setLocalServiceList(
|
|||
|
||||
ble_error_t AdvertisingDataBuilder::setRequestedServiceList(
|
||||
mbed::Span<const UUID> data
|
||||
) {
|
||||
)
|
||||
{
|
||||
adv_data_type_t short_type = adv_data_type_t::LIST_16BIT_SOLICITATION_IDS;
|
||||
adv_data_type_t long_type = adv_data_type_t::LIST_128BIT_SOLICITATION_IDS;
|
||||
|
||||
|
@ -256,21 +276,22 @@ ble_error_t AdvertisingDataBuilder::setRequestedServiceList(
|
|||
ble_error_t AdvertisingDataBuilder::getData(
|
||||
mbed::Span<const uint8_t> &data,
|
||||
adv_data_type_t advDataType
|
||||
) {
|
||||
)
|
||||
{
|
||||
uint8_t *field = findField(advDataType);
|
||||
if (field) {
|
||||
uint8_t data_length = field[0] - 1 /* skip type */;
|
||||
data = mbed::make_Span((const uint8_t*)(field + 2 /* skip type and length */), data_length);
|
||||
data = mbed::make_Span((const uint8_t *) (field + 2 /* skip type and length */), data_length);
|
||||
return BLE_ERROR_NONE;
|
||||
} else {
|
||||
return BLE_ERROR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* AdvertisingDataBuilder::findField(adv_data_type_t type)
|
||||
uint8_t *AdvertisingDataBuilder::findField(adv_data_type_t type)
|
||||
{
|
||||
/* Scan through advertisement data */
|
||||
for (uint8_t idx = 0; idx < _payload_length; ) {
|
||||
for (uint8_t idx = 0; idx < _payload_length;) {
|
||||
uint8_t fieldType = _buffer[idx + 1];
|
||||
|
||||
if (fieldType == type) {
|
||||
|
@ -284,7 +305,8 @@ uint8_t* AdvertisingDataBuilder::findField(adv_data_type_t type)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
uint8_t AdvertisingDataBuilder::getFieldSize(adv_data_type_t type) {
|
||||
uint8_t AdvertisingDataBuilder::getFieldSize(adv_data_type_t type)
|
||||
{
|
||||
uint8_t *field = findField(type);
|
||||
if (field) {
|
||||
return field[0] + 1;
|
||||
|
@ -296,7 +318,8 @@ uint8_t AdvertisingDataBuilder::getFieldSize(adv_data_type_t type) {
|
|||
ble_error_t AdvertisingDataBuilder::addField(
|
||||
adv_data_type_t advDataType,
|
||||
mbed::Span<const uint8_t> fieldData
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (fieldData.size() > 0xFE) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -323,8 +346,9 @@ ble_error_t AdvertisingDataBuilder::addField(
|
|||
|
||||
ble_error_t AdvertisingDataBuilder::appendToField(
|
||||
mbed::Span<const uint8_t> fieldData,
|
||||
uint8_t* field
|
||||
) {
|
||||
uint8_t *field
|
||||
)
|
||||
{
|
||||
if (fieldData.size() + field[0] > 0xFF /* field[0] already includes the type byte */) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -335,8 +359,8 @@ ble_error_t AdvertisingDataBuilder::appendToField(
|
|||
|
||||
/* get the size of bytes in the payload after the field */
|
||||
size_t remainder_size = _payload_length -
|
||||
(field - _buffer.data()) - /* length of all data before the field */
|
||||
(old_data_length + 1) /* length of the old field */;
|
||||
(field - _buffer.data()) - /* length of all data before the field */
|
||||
(old_data_length + 1) /* length of the old field */;
|
||||
|
||||
/* move data after the field to fit new data */
|
||||
if (remainder_size) {
|
||||
|
@ -363,8 +387,9 @@ ble_error_t AdvertisingDataBuilder::appendToField(
|
|||
ble_error_t AdvertisingDataBuilder::replaceField(
|
||||
adv_data_type_t advDataType,
|
||||
mbed::Span<const uint8_t> fieldData,
|
||||
uint8_t* field
|
||||
) {
|
||||
uint8_t *field
|
||||
)
|
||||
{
|
||||
if (fieldData.size() > 0xFE) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -389,7 +414,7 @@ ble_error_t AdvertisingDataBuilder::replaceField(
|
|||
}
|
||||
}
|
||||
|
||||
ble_error_t AdvertisingDataBuilder::removeField(uint8_t* field)
|
||||
ble_error_t AdvertisingDataBuilder::removeField(uint8_t *field)
|
||||
{
|
||||
/* stored length + the byte containing length */
|
||||
uint8_t old_field_length = field[0] + 1;
|
||||
|
@ -405,7 +430,8 @@ ble_error_t AdvertisingDataBuilder::setUUIDData(
|
|||
mbed::Span<const UUID> data,
|
||||
adv_data_type_t shortType,
|
||||
adv_data_type_t longType
|
||||
) {
|
||||
)
|
||||
{
|
||||
ble_error_t status = BLE_ERROR_NONE;
|
||||
|
||||
/* first count all the bytes we need to store all the UUIDs */
|
||||
|
@ -426,7 +452,7 @@ ble_error_t AdvertisingDataBuilder::setUUIDData(
|
|||
|
||||
/* calculate total size including headers for types */
|
||||
size_t total_size = size_long + (!!size_long) * 2 +
|
||||
size_short + (!!size_short) * 2;
|
||||
size_short + (!!size_short) * 2;
|
||||
|
||||
/* count all the bytes of existing data */
|
||||
size_t old_size = getFieldSize(shortType) + getFieldSize(longType);
|
||||
|
|
|
@ -54,7 +54,7 @@ ConnectionParameters::ConnectionParameters(
|
|||
|
||||
/* setters */
|
||||
|
||||
ConnectionParameters & ConnectionParameters::setScanParameters(
|
||||
ConnectionParameters &ConnectionParameters::setScanParameters(
|
||||
phy_t phy,
|
||||
scan_interval_t scanInterval,
|
||||
scan_window_t scanWindow
|
||||
|
@ -70,7 +70,7 @@ ConnectionParameters & ConnectionParameters::setScanParameters(
|
|||
return *this;
|
||||
}
|
||||
|
||||
ConnectionParameters & ConnectionParameters::setConnectionParameters(
|
||||
ConnectionParameters &ConnectionParameters::setConnectionParameters(
|
||||
phy_t phy,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
|
|
|
@ -53,7 +53,8 @@ ble_error_t Gap::destroyAdvertisingSet(advertising_handle_t handle)
|
|||
ble_error_t Gap::setAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -62,7 +63,8 @@ ble_error_t Gap::setAdvertisingPayload(
|
|||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload,
|
||||
bool minimiseFragmentation
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -71,7 +73,8 @@ ble_error_t Gap::setAdvertisingScanResponse(
|
|||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response,
|
||||
bool minimiseFragmentation
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -80,7 +83,8 @@ ble_error_t Gap::startAdvertising(
|
|||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration,
|
||||
uint8_t maxEvents
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -91,7 +95,8 @@ ble_error_t Gap::stopAdvertising(advertising_handle_t handle)
|
|||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool Gap::isAdvertisingActive(advertising_handle_t handle) {
|
||||
bool Gap::isAdvertisingActive(advertising_handle_t handle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -100,7 +105,8 @@ ble_error_t Gap::setPeriodicAdvertisingParameters(
|
|||
periodic_interval_t periodicAdvertisingIntervalMin,
|
||||
periodic_interval_t periodicAdvertisingIntervalMax,
|
||||
bool advertiseTxPower
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -108,7 +114,8 @@ ble_error_t Gap::setPeriodicAdvertisingParameters(
|
|||
ble_error_t Gap::setPeriodicAdvertisingPayload(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -131,7 +138,7 @@ bool Gap::isPeriodicAdvertisingActive(advertising_handle_t handle)
|
|||
return false;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setScanParameters(const ScanParameters& params)
|
||||
ble_error_t Gap::setScanParameters(const ScanParameters ¶ms)
|
||||
{
|
||||
useVersionTwoAPI();
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
|
@ -142,7 +149,8 @@ ble_error_t Gap::startScan(
|
|||
duplicates_filter_t filtering,
|
||||
scan_duration_t duration,
|
||||
scan_period_t period
|
||||
) {
|
||||
)
|
||||
{
|
||||
useVersionTwoAPI();
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -161,7 +169,8 @@ ble_error_t Gap::createSync(
|
|||
uint8_t sid,
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -169,7 +178,8 @@ ble_error_t Gap::createSync(
|
|||
ble_error_t Gap::createSync(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -180,7 +190,8 @@ ble_error_t Gap::cancelCreateSync()
|
|||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::terminateSync(periodic_sync_handle_t handle) {
|
||||
ble_error_t Gap::terminateSync(periodic_sync_handle_t handle)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -189,7 +200,8 @@ ble_error_t Gap::addDeviceToPeriodicAdvertiserList(
|
|||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -198,7 +210,8 @@ ble_error_t Gap::removeDeviceFromPeriodicAdvertiserList(
|
|||
peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -219,12 +232,14 @@ ble_error_t Gap::connect(
|
|||
target_peer_address_type_t peerAddressType,
|
||||
const address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
) {
|
||||
)
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::cancelConnect() {
|
||||
ble_error_t Gap::cancelConnect()
|
||||
{
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -237,13 +252,15 @@ ble_error_t Gap::updateConnectionParameters(
|
|||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::manageConnectionParametersUpdateRequest(
|
||||
bool userManageConnectionUpdateRequest
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -255,20 +272,23 @@ ble_error_t Gap::acceptConnectionParametersUpdate(
|
|||
supervision_timeout_t supervision_timeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::rejectConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::disconnect(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
) {
|
||||
)
|
||||
{
|
||||
// Forward to the old implementation for now.
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -281,7 +301,8 @@ ble_error_t Gap::readPhy(connection_handle_t connection)
|
|||
ble_error_t Gap::setPreferredPhys(
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -290,7 +311,8 @@ ble_error_t Gap::setPhy(
|
|||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
coded_symbol_per_bit_t codedSymbol
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -313,29 +335,32 @@ ble_error_t Gap::enablePrivacy(bool enable)
|
|||
|
||||
ble_error_t Gap::setPeripheralPrivacyConfiguration(
|
||||
const PeripheralPrivacyConfiguration_t *configuration
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::getPeripheralPrivacyConfiguration(
|
||||
PeripheralPrivacyConfiguration_t *configuration
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::setCentralPrivacyConfiguration(
|
||||
const CentralPrivacyConfiguration_t *configuration
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ble_error_t Gap::getCentralPrivacyConfiguration(
|
||||
CentralPrivacyConfiguration_t *configuration
|
||||
) {
|
||||
)
|
||||
{
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace ble
|
||||
|
||||
|
|
|
@ -68,7 +68,8 @@ static const mbed_error_status_t mixed_scan_api_error =
|
|||
* Return true if value is included in the range [lower_bound : higher_bound]
|
||||
*/
|
||||
template<typename T>
|
||||
static bool is_in_range(T value, T lower_bound, T higher_bound) {
|
||||
static bool is_in_range(T value, T lower_bound, T higher_bound)
|
||||
{
|
||||
if (value < lower_bound || value > higher_bound) {
|
||||
return false;
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ static bool is_in_range(T value, T lower_bound, T higher_bound) {
|
|||
/*
|
||||
* Return true if the scan parameters are valid or false otherwise.
|
||||
*/
|
||||
static bool is_scan_params_valid(const GapScanningParams* params)
|
||||
static bool is_scan_params_valid(const GapScanningParams *params)
|
||||
{
|
||||
if (params == NULL) {
|
||||
return false;
|
||||
|
@ -98,7 +99,7 @@ static bool is_scan_params_valid(const GapScanningParams* params)
|
|||
/*
|
||||
* Return true if the connection parameters are valid or false otherwise.
|
||||
*/
|
||||
static bool is_connection_params_valid(const ::Gap::ConnectionParams_t* params)
|
||||
static bool is_connection_params_valid(const ::Gap::ConnectionParams_t *params)
|
||||
{
|
||||
if (params == NULL) {
|
||||
return false;
|
||||
|
@ -121,7 +122,7 @@ static bool is_connection_params_valid(const ::Gap::ConnectionParams_t* params)
|
|||
}
|
||||
|
||||
uint16_t max_connection_interval_ms =
|
||||
((uint32_t)params->maxConnectionInterval * 125) / 100;
|
||||
((uint32_t) params->maxConnectionInterval * 125) / 100;
|
||||
uint16_t min_connection_supervision_timeout =
|
||||
((1 + params->slaveLatency) * max_connection_interval_ms * 2) / 10;
|
||||
|
||||
|
@ -141,7 +142,7 @@ static bool is_connection_params_valid(const ::Gap::ConnectionParams_t* params)
|
|||
* timeout to be equal to 0xFFFF. When it is the case that value can be
|
||||
* interpreted as "non specific".
|
||||
*/
|
||||
static bool is_preferred_connection_params_valid(const ::Gap::ConnectionParams_t* params)
|
||||
static bool is_preferred_connection_params_valid(const ::Gap::ConnectionParams_t *params)
|
||||
{
|
||||
if (params == NULL) {
|
||||
return false;
|
||||
|
@ -169,12 +170,12 @@ static bool is_preferred_connection_params_valid(const ::Gap::ConnectionParams_t
|
|||
return false;
|
||||
}
|
||||
|
||||
if (params->maxConnectionInterval == 0xFFFF) {
|
||||
if (params->maxConnectionInterval == 0xFFFF) {
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t max_connection_interval_ms =
|
||||
((uint32_t)params->maxConnectionInterval * 125) / 100;
|
||||
((uint32_t) params->maxConnectionInterval * 125) / 100;
|
||||
uint16_t min_connection_supervision_timeout =
|
||||
((1 + params->slaveLatency) * max_connection_interval_ms * 2) / 10;
|
||||
|
||||
|
@ -188,7 +189,7 @@ static bool is_preferred_connection_params_valid(const ::Gap::ConnectionParams_t
|
|||
/**
|
||||
* Check if random bytes of an address are valid.
|
||||
*/
|
||||
static bool is_prand_valid(const uint8_t* bytes, size_t len)
|
||||
static bool is_prand_valid(const uint8_t *bytes, size_t len)
|
||||
{
|
||||
// at least one bit of the random part of the static address shall be
|
||||
// equal to 0 and at least one bit of the random part of the static
|
||||
|
@ -252,7 +253,8 @@ static bool is_random_static_address(const BLEProtocol::AddressBytes_t address)
|
|||
*/
|
||||
static bool is_random_private_non_resolvable_address(
|
||||
const BLEProtocol::AddressBytes_t address
|
||||
) {
|
||||
)
|
||||
{
|
||||
// top two msb bits shall be equal to 0b00.
|
||||
if ((address[5] & 0xC0) != 0x00) {
|
||||
return false;
|
||||
|
@ -266,7 +268,8 @@ static bool is_random_private_non_resolvable_address(
|
|||
*/
|
||||
static bool is_random_private_resolvable_address(
|
||||
const BLEProtocol::AddressBytes_t address
|
||||
) {
|
||||
)
|
||||
{
|
||||
// top two msb bits shall be equal to 0b01.
|
||||
if ((address[5] & 0xC0) != 0x40) {
|
||||
return false;
|
||||
|
@ -317,14 +320,14 @@ static bool is_disconnection_reason_valid(::Gap::DisconnectionReason_t reason)
|
|||
/*
|
||||
* Return true if the whitelist in input is valid or false otherwise.
|
||||
*/
|
||||
static bool is_whitelist_valid(const ::Gap::Whitelist_t& whitelist)
|
||||
static bool is_whitelist_valid(const ::Gap::Whitelist_t &whitelist)
|
||||
{
|
||||
if (whitelist.size > whitelist.capacity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < whitelist.size; ++i) {
|
||||
const BLEProtocol::Address_t& address = whitelist.addresses[i];
|
||||
const BLEProtocol::Address_t &address = whitelist.addresses[i];
|
||||
if (address.type != BLEProtocol::AddressType::PUBLIC &&
|
||||
address.type != BLEProtocol::AddressType::RANDOM_STATIC
|
||||
) {
|
||||
|
@ -344,10 +347,11 @@ static bool is_whitelist_valid(const ::Gap::Whitelist_t& whitelist)
|
|||
* Return true if device is present in the whitelist.
|
||||
*/
|
||||
static bool is_in_whitelist(
|
||||
const BLEProtocol::Address_t& device, const ::Gap::Whitelist_t& whitelist
|
||||
) {
|
||||
const BLEProtocol::Address_t &device, const ::Gap::Whitelist_t &whitelist
|
||||
)
|
||||
{
|
||||
for (size_t i = 0; i < whitelist.size; ++i) {
|
||||
const BLEProtocol::Address_t& potential_device = whitelist.addresses[i];
|
||||
const BLEProtocol::Address_t &potential_device = whitelist.addresses[i];
|
||||
|
||||
if (potential_device.type != device.type) {
|
||||
continue;
|
||||
|
@ -365,10 +369,11 @@ static bool is_in_whitelist(
|
|||
*/
|
||||
static pal::whitelist_address_type_t to_whitelist_address_type(
|
||||
BLEProtocol::AddressType_t address_type
|
||||
) {
|
||||
return (address_type == BLEProtocol::AddressType::PUBLIC) ?
|
||||
pal::whitelist_address_type_t::PUBLIC_DEVICE_ADDRESS :
|
||||
pal::whitelist_address_type_t::RANDOM_DEVICE_ADDRESS;
|
||||
)
|
||||
{
|
||||
return (address_type == BLEProtocol::AddressType::PUBLIC) ?
|
||||
pal::whitelist_address_type_t::PUBLIC_DEVICE_ADDRESS :
|
||||
pal::whitelist_address_type_t::RANDOM_DEVICE_ADDRESS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -376,17 +381,18 @@ static pal::whitelist_address_type_t to_whitelist_address_type(
|
|||
*/
|
||||
static peer_address_type_t to_peer_address_type(
|
||||
LegacyAddressType_t address_type
|
||||
) {
|
||||
return (address_type == LegacyAddressType::PUBLIC) ?
|
||||
peer_address_type_t::PUBLIC :
|
||||
peer_address_type_t::RANDOM;
|
||||
)
|
||||
{
|
||||
return (address_type == LegacyAddressType::PUBLIC) ?
|
||||
peer_address_type_t::PUBLIC :
|
||||
peer_address_type_t::RANDOM;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Return true if the advertising parameters are valid.
|
||||
*/
|
||||
static bool is_advertising_params_valid(const GapAdvertisingParams& params)
|
||||
static bool is_advertising_params_valid(const GapAdvertisingParams ¶ms)
|
||||
{
|
||||
if (is_in_range(params.getIntervalInADVUnits(), advertising_interval_min, advertising_interval_max) == false) {
|
||||
return false;
|
||||
|
@ -402,10 +408,10 @@ static bool is_advertising_params_valid(const GapAdvertisingParams& params)
|
|||
} // end of anonymous namespace
|
||||
|
||||
GenericGap::GenericGap(
|
||||
pal::EventQueue& event_queue,
|
||||
pal::Gap& pal_gap,
|
||||
pal::GenericAccessService& generic_access_service,
|
||||
pal::SecurityManager& pal_sm
|
||||
pal::EventQueue &event_queue,
|
||||
pal::Gap &pal_gap,
|
||||
pal::GenericAccessService &generic_access_service,
|
||||
pal::SecurityManager &pal_sm
|
||||
) : _event_queue(event_queue),
|
||||
_pal_gap(pal_gap),
|
||||
_gap_service(generic_access_service),
|
||||
|
@ -449,14 +455,16 @@ GenericGap::~GenericGap()
|
|||
|
||||
bool GenericGap::isFeatureSupported(
|
||||
controller_supported_features_t feature
|
||||
) {
|
||||
)
|
||||
{
|
||||
return _pal_gap.is_feature_supported(feature);
|
||||
}
|
||||
|
||||
ble_error_t GenericGap::setAddress(
|
||||
LegacyAddressType_t type,
|
||||
const Address_t address
|
||||
) {
|
||||
)
|
||||
{
|
||||
switch (type) {
|
||||
case LegacyAddressType::PUBLIC:
|
||||
// The public address cannot be set, just set the type to public
|
||||
|
@ -495,7 +503,8 @@ ble_error_t GenericGap::setAddress(
|
|||
ble_error_t GenericGap::getAddress(
|
||||
LegacyAddressType_t *type,
|
||||
Address_t address
|
||||
) {
|
||||
)
|
||||
{
|
||||
*type = _address_type;
|
||||
ble::address_t address_value;
|
||||
|
||||
|
@ -564,7 +573,8 @@ ble_error_t GenericGap::connect(
|
|||
PeerAddressType_t peerAddrType,
|
||||
const ConnectionParams_t *connectionParams,
|
||||
const GapScanningParams *scanParams
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (connectionParams == NULL) {
|
||||
connectionParams = &default_connection_params;
|
||||
}
|
||||
|
@ -604,9 +614,10 @@ ble_error_t GenericGap::connect(
|
|||
ble_error_t GenericGap::connect(
|
||||
const Address_t peerAddr,
|
||||
LegacyAddressType_t peerAddrType,
|
||||
const ConnectionParams_t* connectionParams,
|
||||
const GapScanningParams* scanParams
|
||||
) {
|
||||
const ConnectionParams_t *connectionParams,
|
||||
const GapScanningParams *scanParams
|
||||
)
|
||||
{
|
||||
return connect(
|
||||
peerAddr,
|
||||
to_peer_address_type(peerAddrType),
|
||||
|
@ -620,7 +631,8 @@ ble_error_t GenericGap::connect(
|
|||
target_peer_address_type_t peerAddressType,
|
||||
const ble::address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (!connectionParams.getNumberOfEnabledPhys()) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -635,9 +647,9 @@ ble_error_t GenericGap::connect(
|
|||
return _pal_gap.extended_create_connection(
|
||||
connectionParams.getFilterPolicy(),
|
||||
connectionParams.getOwnAddressType(),
|
||||
(peer_address_type_t::type)peerAddressType.value(),
|
||||
(peer_address_type_t::type) peerAddressType.value(),
|
||||
peerAddress,
|
||||
(phy_set_t)connectionParams.getPhySet(),
|
||||
(phy_set_t) connectionParams.getPhySet(),
|
||||
connectionParams.getScanIntervalArray(),
|
||||
connectionParams.getScanWindowArray(),
|
||||
connectionParams.getMinConnectionIntervalArray(),
|
||||
|
@ -649,7 +661,8 @@ ble_error_t GenericGap::connect(
|
|||
);
|
||||
}
|
||||
|
||||
ble_error_t GenericGap::manageConnectionParametersUpdateRequest(bool flag) {
|
||||
ble_error_t GenericGap::manageConnectionParametersUpdateRequest(bool flag)
|
||||
{
|
||||
_user_manage_connection_parameter_requests = flag;
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
@ -662,7 +675,8 @@ ble_error_t GenericGap::updateConnectionParameters(
|
|||
supervision_timeout_t supervisionTimeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (supervisionTimeout <= (1 + slaveLatency.value()) * maxConnectionInterval * 2) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -686,7 +700,8 @@ ble_error_t GenericGap::acceptConnectionParametersUpdate(
|
|||
supervision_timeout_t supervisionTimeout,
|
||||
conn_event_length_t minConnectionEventLength,
|
||||
conn_event_length_t maxConnectionEventLength
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (supervisionTimeout <= (1 + slaveLatency.value()) * maxConnectionInterval * 2) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -704,7 +719,8 @@ ble_error_t GenericGap::acceptConnectionParametersUpdate(
|
|||
|
||||
ble_error_t GenericGap::rejectConnectionParametersUpdate(
|
||||
connection_handle_t connectionHandle
|
||||
) {
|
||||
)
|
||||
{
|
||||
return _pal_gap.reject_connection_parameter_request(
|
||||
connectionHandle,
|
||||
pal::hci_error_code_t::UNACCEPTABLE_CONNECTION_PARAMETERS
|
||||
|
@ -716,27 +732,30 @@ ble_error_t GenericGap::cancelConnect()
|
|||
return _pal_gap.cancel_connection_creation();
|
||||
}
|
||||
|
||||
ble_error_t GenericGap::readPhy(Handle_t connection) {
|
||||
ble_error_t GenericGap::readPhy(Handle_t connection)
|
||||
{
|
||||
return _pal_gap.read_phy(connection);
|
||||
}
|
||||
|
||||
ble_error_t GenericGap::setPreferredPhys(
|
||||
const phy_set_t* txPhys,
|
||||
const phy_set_t* rxPhys
|
||||
) {
|
||||
phy_set_t tx_phys(txPhys? txPhys->value() : 0);
|
||||
phy_set_t rx_phys(rxPhys? rxPhys->value() : 0);
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
)
|
||||
{
|
||||
phy_set_t tx_phys(txPhys ? txPhys->value() : 0);
|
||||
phy_set_t rx_phys(rxPhys ? rxPhys->value() : 0);
|
||||
return _pal_gap.set_preferred_phys(tx_phys, rx_phys);
|
||||
}
|
||||
|
||||
ble_error_t GenericGap::setPhy(
|
||||
Handle_t connection,
|
||||
const phy_set_t* txPhys,
|
||||
const phy_set_t* rxPhys,
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
CodedSymbolPerBit_t codedSymbol
|
||||
) {
|
||||
phy_set_t tx_phys(txPhys? txPhys->value() : 0);
|
||||
phy_set_t rx_phys(rxPhys? rxPhys->value() : 0);
|
||||
)
|
||||
{
|
||||
phy_set_t tx_phys(txPhys ? txPhys->value() : 0);
|
||||
phy_set_t rx_phys(rxPhys ? rxPhys->value() : 0);
|
||||
return _pal_gap.set_phy(connection, tx_phys, rx_phys, codedSymbol);
|
||||
}
|
||||
|
||||
|
@ -746,7 +765,8 @@ void GenericGap::on_read_phy(
|
|||
Handle_t connection_handle,
|
||||
phy_t tx_phy,
|
||||
phy_t rx_phy
|
||||
) {
|
||||
)
|
||||
{
|
||||
ble_error_t status = BLE_ERROR_NONE;
|
||||
if (pal::hci_error_code_t::SUCCESS != hci_status) {
|
||||
status = BLE_ERROR_UNSPECIFIED;
|
||||
|
@ -762,7 +782,8 @@ void GenericGap::on_phy_update_complete(
|
|||
Handle_t connection_handle,
|
||||
phy_t tx_phy,
|
||||
phy_t rx_phy
|
||||
) {
|
||||
)
|
||||
{
|
||||
ble_error_t status = BLE_ERROR_NONE;
|
||||
if (pal::hci_error_code_t::SUCCESS != hci_status) {
|
||||
status = BLE_ERROR_UNSPECIFIED;
|
||||
|
@ -776,7 +797,8 @@ void GenericGap::on_phy_update_complete(
|
|||
ble_error_t GenericGap::disconnect(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
) {
|
||||
)
|
||||
{
|
||||
return _pal_gap.disconnect(connectionHandle, reason);
|
||||
}
|
||||
|
||||
|
@ -821,7 +843,7 @@ ble_error_t GenericGap::getPreferredConnectionParams(ConnectionParams_t *params)
|
|||
|
||||
ble_error_t GenericGap::setPreferredConnectionParams(const ConnectionParams_t *params)
|
||||
{
|
||||
if(is_preferred_connection_params_valid(params) == false) {
|
||||
if (is_preferred_connection_params_valid(params) == false) {
|
||||
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
|
@ -894,7 +916,7 @@ uint8_t GenericGap::getMaxWhitelistSize(void) const
|
|||
|
||||
ble_error_t GenericGap::getWhitelist(Whitelist_t &whitelist) const
|
||||
{
|
||||
if(initialize_whitelist() == false) {
|
||||
if (initialize_whitelist() == false) {
|
||||
return BLE_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
|
@ -916,7 +938,7 @@ ble_error_t GenericGap::setWhitelist(const Whitelist_t &whitelist)
|
|||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if(initialize_whitelist() == false) {
|
||||
if (initialize_whitelist() == false) {
|
||||
return BLE_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
|
@ -926,7 +948,7 @@ ble_error_t GenericGap::setWhitelist(const Whitelist_t &whitelist)
|
|||
|
||||
// first evict devices not in the existing whitelist
|
||||
for (size_t i = 0; i < _whitelist.size; ++i) {
|
||||
const BLEProtocol::Address_t& device = _whitelist.addresses[i];
|
||||
const BLEProtocol::Address_t &device = _whitelist.addresses[i];
|
||||
|
||||
if (is_in_whitelist(device, whitelist) == false) {
|
||||
ble_error_t err = _pal_gap.remove_device_from_whitelist(
|
||||
|
@ -937,7 +959,7 @@ ble_error_t GenericGap::setWhitelist(const Whitelist_t &whitelist)
|
|||
// try to restore the whitelist to its initial state
|
||||
if (err) {
|
||||
for (size_t j = 0; j < i; ++j) {
|
||||
const BLEProtocol::Address_t& device = _whitelist.addresses[j];
|
||||
const BLEProtocol::Address_t &device = _whitelist.addresses[j];
|
||||
|
||||
if (is_in_whitelist(device, whitelist) == false) {
|
||||
_pal_gap.add_device_to_whitelist(
|
||||
|
@ -953,7 +975,7 @@ ble_error_t GenericGap::setWhitelist(const Whitelist_t &whitelist)
|
|||
|
||||
// second add devices which were not in the initial whitelist
|
||||
for (size_t i = 0; i < whitelist.size; ++i) {
|
||||
const BLEProtocol::Address_t& device = whitelist.addresses[i];
|
||||
const BLEProtocol::Address_t &device = whitelist.addresses[i];
|
||||
|
||||
if (is_in_whitelist(device, _whitelist) == false) {
|
||||
ble_error_t err = _pal_gap.add_device_to_whitelist(
|
||||
|
@ -965,7 +987,7 @@ ble_error_t GenericGap::setWhitelist(const Whitelist_t &whitelist)
|
|||
if (err) {
|
||||
// first remove the devices added
|
||||
for (size_t j = 0; j < i; ++j) {
|
||||
const BLEProtocol::Address_t& device = whitelist.addresses[j];
|
||||
const BLEProtocol::Address_t &device = whitelist.addresses[j];
|
||||
|
||||
if (is_in_whitelist(device, _whitelist) == false) {
|
||||
_pal_gap.remove_device_from_whitelist(
|
||||
|
@ -977,7 +999,7 @@ ble_error_t GenericGap::setWhitelist(const Whitelist_t &whitelist)
|
|||
|
||||
// second add the devices of the initial list evicted
|
||||
for (size_t i = 0; i < _whitelist.size; ++i) {
|
||||
const BLEProtocol::Address_t& device = _whitelist.addresses[i];
|
||||
const BLEProtocol::Address_t &device = _whitelist.addresses[i];
|
||||
|
||||
if (is_in_whitelist(device, whitelist) == false) {
|
||||
_pal_gap.add_device_to_whitelist(
|
||||
|
@ -1065,8 +1087,7 @@ ble_error_t GenericGap::startRadioScan(const GapScanningParams &scanningParams)
|
|||
|
||||
pal::own_address_type_t own_address_type = get_own_address_type(CENTRAL_SCAN /* central, can use non resolvable address for scan requests */);
|
||||
|
||||
if(_privacy_enabled && (own_address_type == pal::own_address_type_t::RANDOM_ADDRESS))
|
||||
{
|
||||
if (_privacy_enabled && (own_address_type == pal::own_address_type_t::RANDOM_ADDRESS)) {
|
||||
// Use non-resolvable static random address
|
||||
set_random_address_rotation(true);
|
||||
}
|
||||
|
@ -1108,13 +1129,12 @@ ble_error_t GenericGap::initRadioNotification(void)
|
|||
|
||||
ble_error_t GenericGap::enablePrivacy(bool enable)
|
||||
{
|
||||
if(enable == _privacy_enabled) {
|
||||
if (enable == _privacy_enabled) {
|
||||
// No change
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
if(enable && !_pal_gap.is_privacy_supported())
|
||||
{
|
||||
if (enable && !_pal_gap.is_privacy_supported()) {
|
||||
// Privacy is not supported by the implementation
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -1182,7 +1202,7 @@ ble_error_t GenericGap::setAdvertisingData(const GapAdvertisingData &advData, co
|
|||
);
|
||||
}
|
||||
|
||||
ble_error_t GenericGap::startAdvertising(const GapAdvertisingParams& params)
|
||||
ble_error_t GenericGap::startAdvertising(const GapAdvertisingParams ¶ms)
|
||||
{
|
||||
if (is_advertising_params_valid(params) == false) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
|
@ -1191,14 +1211,13 @@ ble_error_t GenericGap::startAdvertising(const GapAdvertisingParams& params)
|
|||
// We can only use non resolvable addresses if the device is non connectable
|
||||
AddressUseType_t address_use_type =
|
||||
((params.getAdvertisingType() == GapAdvertisingParams::ADV_SCANNABLE_UNDIRECTED) ||
|
||||
(params.getAdvertisingType() == GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED)) ?
|
||||
(params.getAdvertisingType() == GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED)) ?
|
||||
PERIPHERAL_NON_CONNECTABLE :
|
||||
PERIPHERAL_CONNECTABLE;
|
||||
|
||||
pal::own_address_type_t own_address_type = get_own_address_type(address_use_type);
|
||||
|
||||
if(_privacy_enabled && (own_address_type == pal::own_address_type_t::RANDOM_ADDRESS))
|
||||
{
|
||||
if (_privacy_enabled && (own_address_type == pal::own_address_type_t::RANDOM_ADDRESS)) {
|
||||
// Use non-resolvable static random address
|
||||
set_random_address_rotation(true);
|
||||
}
|
||||
|
@ -1263,7 +1282,8 @@ void GenericGap::processConnectionEvent(
|
|||
const ConnectionParams_t *connectionParams,
|
||||
const uint8_t *peerResolvableAddr,
|
||||
const uint8_t *localResolvableAddr
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (_connection_event_handler) {
|
||||
_connection_event_handler->on_connected(
|
||||
handle,
|
||||
|
@ -1294,7 +1314,8 @@ BLE_DEPRECATED_API_USE_END()
|
|||
void GenericGap::processDisconnectionEvent(
|
||||
Handle_t handle,
|
||||
DisconnectionReason_t reason
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (_connection_event_handler) {
|
||||
_connection_event_handler->on_disconnected(
|
||||
handle,
|
||||
|
@ -1359,31 +1380,31 @@ BLE_DEPRECATED_API_USE_BEGIN()
|
|||
BLE_DEPRECATED_API_USE_END()
|
||||
}
|
||||
|
||||
void GenericGap::on_gap_event_received(const pal::GapEvent& e)
|
||||
void GenericGap::on_gap_event_received(const pal::GapEvent &e)
|
||||
{
|
||||
switch (e.type.value()) {
|
||||
case pal::GapEventType::ADVERTISING_REPORT:
|
||||
on_advertising_report(static_cast<const pal::GapAdvertisingReportEvent&>(e));
|
||||
on_advertising_report(static_cast<const pal::GapAdvertisingReportEvent &>(e));
|
||||
break;
|
||||
|
||||
case pal::GapEventType::CONNECTION_COMPLETE:
|
||||
on_connection_complete(static_cast<const pal::GapConnectionCompleteEvent&>(e));
|
||||
on_connection_complete(static_cast<const pal::GapConnectionCompleteEvent &>(e));
|
||||
break;
|
||||
|
||||
case pal::GapEventType::CONNECTION_UPDATE:
|
||||
on_connection_update(static_cast<const pal::GapConnectionUpdateEvent&>(e));
|
||||
on_connection_update(static_cast<const pal::GapConnectionUpdateEvent &>(e));
|
||||
break;
|
||||
|
||||
case pal::GapEventType::DISCONNECTION_COMPLETE:
|
||||
on_disconnection_complete(static_cast<const pal::GapDisconnectionCompleteEvent&>(e));
|
||||
on_disconnection_complete(static_cast<const pal::GapDisconnectionCompleteEvent &>(e));
|
||||
break;
|
||||
|
||||
case pal::GapEventType::REMOTE_CONNECTION_PARAMETER_REQUEST:
|
||||
on_connection_parameter_request(static_cast<const pal::GapRemoteConnectionParameterRequestEvent&>(e));
|
||||
on_connection_parameter_request(static_cast<const pal::GapRemoteConnectionParameterRequestEvent &>(e));
|
||||
break;
|
||||
|
||||
case pal::GapEventType::UNEXPECTED_ERROR:
|
||||
on_unexpected_error(static_cast<const pal::GapUnexpectedErrorEvent&>(e));
|
||||
on_unexpected_error(static_cast<const pal::GapUnexpectedErrorEvent &>(e));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1391,13 +1412,13 @@ void GenericGap::on_gap_event_received(const pal::GapEvent& e)
|
|||
}
|
||||
}
|
||||
|
||||
void GenericGap::on_advertising_report(const pal::GapAdvertisingReportEvent& e)
|
||||
void GenericGap::on_advertising_report(const pal::GapAdvertisingReportEvent &e)
|
||||
{
|
||||
for (size_t i = 0; i < e.size(); ++i) {
|
||||
pal::GapAdvertisingReportEvent::advertising_t advertising = e[i];
|
||||
|
||||
// Check if the address hasn't been resolved
|
||||
if(_privacy_enabled &&
|
||||
if (_privacy_enabled &&
|
||||
_central_privacy_configuration.resolution_strategy == CentralPrivacyConfiguration_t::RESOLVE_AND_FILTER &&
|
||||
advertising.address_type == pal::connection_peer_address_type_t::RANDOM_ADDRESS &&
|
||||
is_random_private_resolvable_address(advertising.address.data())
|
||||
|
@ -1425,7 +1446,7 @@ BLE_DEPRECATED_API_USE_END()
|
|||
}
|
||||
}
|
||||
|
||||
void GenericGap::on_connection_complete(const pal::GapConnectionCompleteEvent& e)
|
||||
void GenericGap::on_connection_complete(const pal::GapConnectionCompleteEvent &e)
|
||||
{
|
||||
if (e.status != pal::hci_error_code_t::SUCCESS) {
|
||||
// for now notify user that the connection failled by issuing a timeout
|
||||
|
@ -1454,7 +1475,7 @@ BLE_DEPRECATED_API_USE_END()
|
|||
}
|
||||
|
||||
if (random_address_type == RandomAddressType_t::RESOLVABLE_PRIVATE) {
|
||||
switch(_peripheral_privacy_configuration.resolution_strategy) {
|
||||
switch (_peripheral_privacy_configuration.resolution_strategy) {
|
||||
case PeripheralPrivacyConfiguration_t::REJECT_NON_RESOLVED_ADDRESS:
|
||||
// Reject connection request - the user will get notified through a callback
|
||||
_pal_gap.disconnect(
|
||||
|
@ -1514,17 +1535,17 @@ BLE_DEPRECATED_API_USE_END()
|
|||
);
|
||||
|
||||
// Now starts pairing or authentication procedures if required
|
||||
if(needs_pairing) {
|
||||
if (needs_pairing) {
|
||||
SecurityManager &sm = createBLEInstance()->getSecurityManager();
|
||||
// Request authentication to start pairing procedure
|
||||
sm.requestAuthentication(e.connection_handle);
|
||||
} else if(needs_authentication) {
|
||||
} else if (needs_authentication) {
|
||||
// TODO: GAP Authentication != Security Manager authentication
|
||||
// Needs to be implemented
|
||||
}
|
||||
}
|
||||
|
||||
void GenericGap::on_disconnection_complete(const pal::GapDisconnectionCompleteEvent& e)
|
||||
void GenericGap::on_disconnection_complete(const pal::GapDisconnectionCompleteEvent &e)
|
||||
{
|
||||
if (e.status == pal::hci_error_code_t::SUCCESS) {
|
||||
processDisconnectionEvent(
|
||||
|
@ -1536,7 +1557,7 @@ void GenericGap::on_disconnection_complete(const pal::GapDisconnectionCompleteEv
|
|||
}
|
||||
}
|
||||
|
||||
void GenericGap::on_connection_parameter_request(const pal::GapRemoteConnectionParameterRequestEvent& e)
|
||||
void GenericGap::on_connection_parameter_request(const pal::GapRemoteConnectionParameterRequestEvent &e)
|
||||
{
|
||||
// intern behavior, accept all new parameter requests
|
||||
// TODO: expose an API so user code can accept or reject such request
|
||||
|
@ -1551,13 +1572,13 @@ void GenericGap::on_connection_parameter_request(const pal::GapRemoteConnectionP
|
|||
);
|
||||
}
|
||||
|
||||
void GenericGap::on_connection_update(const pal::GapConnectionUpdateEvent& e)
|
||||
void GenericGap::on_connection_update(const pal::GapConnectionUpdateEvent &e)
|
||||
{
|
||||
// TODO: add feature in interface to notify the user that the connection
|
||||
// has been updated.
|
||||
}
|
||||
|
||||
void GenericGap::on_unexpected_error(const pal::GapUnexpectedErrorEvent& e)
|
||||
void GenericGap::on_unexpected_error(const pal::GapUnexpectedErrorEvent &e)
|
||||
{
|
||||
// TODO: add feature in interface to notify the user that the connection
|
||||
// has been updated.
|
||||
|
@ -1565,16 +1586,16 @@ void GenericGap::on_unexpected_error(const pal::GapUnexpectedErrorEvent& e)
|
|||
|
||||
pal::own_address_type_t GenericGap::get_own_address_type(AddressUseType_t address_use_type)
|
||||
{
|
||||
if(_privacy_enabled) {
|
||||
if (_privacy_enabled) {
|
||||
bool use_non_resolvable_address = false;
|
||||
if(address_use_type == CENTRAL_SCAN) {
|
||||
if (address_use_type == CENTRAL_SCAN) {
|
||||
use_non_resolvable_address = _central_privacy_configuration.use_non_resolvable_random_address;
|
||||
} else if (address_use_type == PERIPHERAL_NON_CONNECTABLE) {
|
||||
use_non_resolvable_address = _peripheral_privacy_configuration.use_non_resolvable_random_address;
|
||||
}
|
||||
|
||||
// An non resolvable private address should be generated
|
||||
if(use_non_resolvable_address) {
|
||||
if (use_non_resolvable_address) {
|
||||
return pal::own_address_type_t::RANDOM_ADDRESS;
|
||||
}
|
||||
|
||||
|
@ -1606,7 +1627,7 @@ bool GenericGap::initialize_whitelist() const
|
|||
return false;
|
||||
}
|
||||
|
||||
_whitelist.addresses = new (std::nothrow) BLEProtocol::Address_t[whitelist_capacity] ;
|
||||
_whitelist.addresses = new(std::nothrow) BLEProtocol::Address_t[whitelist_capacity];
|
||||
if (_whitelist.addresses == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1622,7 +1643,7 @@ ble_error_t GenericGap::update_address_resolution_setting()
|
|||
// Only disable if privacy is disabled or resolution is not requested in either central or peripheral mode
|
||||
bool enable = true;
|
||||
|
||||
if(!_privacy_enabled) {
|
||||
if (!_privacy_enabled) {
|
||||
enable = false;
|
||||
}
|
||||
else if( (_peripheral_privacy_configuration.resolution_strategy == PeripheralPrivacyConfiguration_t::DO_NOT_RESOLVE)
|
||||
|
@ -1635,13 +1656,13 @@ ble_error_t GenericGap::update_address_resolution_setting()
|
|||
|
||||
void GenericGap::set_random_address_rotation(bool enable)
|
||||
{
|
||||
if(enable == _random_address_rotating) {
|
||||
if (enable == _random_address_rotating) {
|
||||
return;
|
||||
}
|
||||
|
||||
_random_address_rotating = enable;
|
||||
|
||||
if(enable) {
|
||||
if (enable) {
|
||||
// Set first address
|
||||
update_random_address();
|
||||
|
||||
|
@ -1650,8 +1671,7 @@ void GenericGap::set_random_address_rotation(bool enable)
|
|||
mbed::callback(this, &GenericGap::on_address_rotation_timeout),
|
||||
15 * 60 * 1000000U
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Stop ticker
|
||||
_address_rotation_ticker.detach();
|
||||
|
||||
|
@ -1664,8 +1684,7 @@ void GenericGap::set_random_address_rotation(bool enable)
|
|||
|
||||
void GenericGap::update_random_address()
|
||||
{
|
||||
if(!_random_address_rotating)
|
||||
{
|
||||
if (!_random_address_rotating) {
|
||||
// This event might have been queued before we disabled address rotation
|
||||
return;
|
||||
}
|
||||
|
@ -1681,7 +1700,7 @@ void GenericGap::update_random_address()
|
|||
|
||||
/* ignore the error, if it fails to cycle because it's connectable */
|
||||
_pal_gap.set_advertising_set_random_address(
|
||||
(advertising_handle_t)i,
|
||||
(advertising_handle_t) i,
|
||||
address
|
||||
);
|
||||
}
|
||||
|
@ -1706,7 +1725,8 @@ void GenericGap::update_random_address()
|
|||
_address = address;
|
||||
}
|
||||
|
||||
bool GenericGap::getUnresolvableRandomAddress(ble::address_t& address) {
|
||||
bool GenericGap::getUnresolvableRandomAddress(ble::address_t &address)
|
||||
{
|
||||
do {
|
||||
byte_array_t<8> random_data;
|
||||
|
||||
|
@ -1723,8 +1743,7 @@ bool GenericGap::getUnresolvableRandomAddress(ble::address_t& address) {
|
|||
// Copy to address - will copy first 6 bytes
|
||||
address = ble::address_t(random_data.data());
|
||||
|
||||
if(!is_random_private_non_resolvable_address(address.data()))
|
||||
{
|
||||
if (!is_random_private_non_resolvable_address(address.data())) {
|
||||
// If address is invalid, which is unlikely (all 0s or all 1s), try again
|
||||
// If implementation is faulty, we'll get stuck here
|
||||
continue;
|
||||
|
@ -1732,7 +1751,8 @@ bool GenericGap::getUnresolvableRandomAddress(ble::address_t& address) {
|
|||
|
||||
// Address is valid
|
||||
break;
|
||||
} while(true);
|
||||
}
|
||||
while (true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1794,7 +1814,8 @@ ble_error_t GenericGap::createAdvertisingSet(
|
|||
return BLE_ERROR_NO_MEM;
|
||||
}
|
||||
|
||||
ble_error_t GenericGap::destroyAdvertisingSet(advertising_handle_t handle) {
|
||||
ble_error_t GenericGap::destroyAdvertisingSet(advertising_handle_t handle)
|
||||
{
|
||||
if (is_extended_advertising_available()) {
|
||||
return BLE_ERROR_OPERATION_NOT_PERMITTED;
|
||||
}
|
||||
|
@ -1831,7 +1852,8 @@ ble_error_t GenericGap::destroyAdvertisingSet(advertising_handle_t handle) {
|
|||
ble_error_t GenericGap::setAdvertisingParameters(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (handle >= getMaxAdvertisingSetNumber()) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -1909,7 +1931,8 @@ ble_error_t GenericGap::setAdvertisingPayload(
|
|||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload,
|
||||
bool minimiseFragmentation
|
||||
) {
|
||||
)
|
||||
{
|
||||
return setAdvertisingData(handle, payload, minimiseFragmentation, false);
|
||||
}
|
||||
|
||||
|
@ -1917,7 +1940,8 @@ ble_error_t GenericGap::setAdvertisingScanResponse(
|
|||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response,
|
||||
bool minimiseFragmentation
|
||||
) {
|
||||
)
|
||||
{
|
||||
return setAdvertisingData(handle, response, minimiseFragmentation, true);
|
||||
}
|
||||
|
||||
|
@ -1926,12 +1950,13 @@ ble_error_t GenericGap::setAdvertisingData(
|
|||
mbed::Span<const uint8_t> payload,
|
||||
bool minimiseFragmentation,
|
||||
bool scan_response
|
||||
) {
|
||||
)
|
||||
{
|
||||
// type declarations
|
||||
typedef pal::advertising_fragment_description_t op_t;
|
||||
typedef ble_error_t (pal::Gap::*legacy_set_data_fn_t)(
|
||||
uint8_t ,
|
||||
const pal::advertising_data_t&
|
||||
uint8_t,
|
||||
const pal::advertising_data_t &
|
||||
);
|
||||
typedef ble_error_t (pal::Gap::*set_data_fn_t)(
|
||||
advertising_handle_t advertising_handle,
|
||||
|
@ -2020,7 +2045,8 @@ ble_error_t GenericGap::startAdvertising(
|
|||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration,
|
||||
uint8_t maxEvents
|
||||
) {
|
||||
)
|
||||
{
|
||||
ble_error_t error = BLE_ERROR_NONE;
|
||||
|
||||
if (handle >= getMaxAdvertisingSetNumber()) {
|
||||
|
@ -2082,7 +2108,8 @@ ble_error_t GenericGap::startAdvertising(
|
|||
return error;
|
||||
}
|
||||
|
||||
ble_error_t GenericGap::stopAdvertising(advertising_handle_t handle) {
|
||||
ble_error_t GenericGap::stopAdvertising(advertising_handle_t handle)
|
||||
{
|
||||
if (handle >= getMaxAdvertisingSetNumber()) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -2112,7 +2139,8 @@ ble_error_t GenericGap::stopAdvertising(advertising_handle_t handle) {
|
|||
);
|
||||
}
|
||||
|
||||
bool GenericGap::isAdvertisingActive(advertising_handle_t handle) {
|
||||
bool GenericGap::isAdvertisingActive(advertising_handle_t handle)
|
||||
{
|
||||
if (handle >= getMaxAdvertisingSetNumber()) {
|
||||
return BLE_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
@ -2289,7 +2317,8 @@ void GenericGap::on_enhanced_connection_complete(
|
|||
uint16_t connection_latency,
|
||||
uint16_t supervision_timeout,
|
||||
pal::clock_accuracy_t master_clock_accuracy
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (!_eventHandler) {
|
||||
return;
|
||||
}
|
||||
|
@ -2297,9 +2326,9 @@ void GenericGap::on_enhanced_connection_complete(
|
|||
_eventHandler->onConnectionComplete(
|
||||
ConnectionCompleteEvent(
|
||||
(status == pal::hci_error_code_t::SUCCESS) ? BLE_ERROR_NONE : BLE_ERROR_INTERNAL_STACK_FAILURE,
|
||||
(connection_handle_t)connection_handle,
|
||||
(connection_handle_t) connection_handle,
|
||||
own_role,
|
||||
(peer_address_type_t::type)peer_address_type.value(),
|
||||
(peer_address_type_t::type) peer_address_type.value(),
|
||||
peer_address,
|
||||
local_resolvable_private_address,
|
||||
peer_resolvable_private_address,
|
||||
|
@ -2464,7 +2493,8 @@ void GenericGap::on_connection_update_complete(
|
|||
uint16_t connection_interval,
|
||||
uint16_t connection_latency,
|
||||
uint16_t supervision_timeout
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (!_eventHandler) {
|
||||
return;
|
||||
}
|
||||
|
@ -2486,7 +2516,8 @@ void GenericGap::on_remote_connection_parameter(
|
|||
uint16_t connection_interval_max,
|
||||
uint16_t connection_latency,
|
||||
uint16_t supervision_timeout
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (_user_manage_connection_parameter_requests) {
|
||||
// ignore for now as it is
|
||||
_pal_gap.accept_connection_parameter_request(
|
||||
|
@ -2569,8 +2600,7 @@ ble_error_t GenericGap::startScan(
|
|||
{
|
||||
useVersionTwoAPI();
|
||||
|
||||
if(_privacy_enabled && _central_privacy_configuration.use_non_resolvable_random_address)
|
||||
{
|
||||
if (_privacy_enabled && _central_privacy_configuration.use_non_resolvable_random_address) {
|
||||
set_random_address_rotation(true);
|
||||
}
|
||||
|
||||
|
@ -2642,7 +2672,8 @@ ble_error_t GenericGap::createSync(
|
|||
ble_error_t GenericGap::createSync(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
) {
|
||||
)
|
||||
{
|
||||
if (is_extended_advertising_available() == false) {
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -2704,7 +2735,7 @@ ble_error_t GenericGap::addDeviceToPeriodicAdvertiserList(
|
|||
|
||||
ble_error_t GenericGap::removeDeviceFromPeriodicAdvertiserList(
|
||||
peer_address_type_t peerAddressType,
|
||||
const ble::address_t &peerAddress,
|
||||
const ble::address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue