mirror of https://github.com/ARMmbed/mbed-os.git
BLE - Devirtualize ble::generic::GenericGap
Expected types are similar to the type expected by the constructor: - PalGap - PalSecurityManager - ConnectionEventMonitorEventHandler Note that for the PalGap we expect a **template** of the form PalGap<EventHandler>pull/9727/head
parent
e70fb27d55
commit
39e938bf8e
|
@ -19,19 +19,19 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "ble/BLE.h"
|
||||
#include "ble/BLEProtocol.h"
|
||||
#include "ble/Gap.h"
|
||||
#include "ble/pal/PalGap.h"
|
||||
#include "ble/pal/PalSecurityManager.h"
|
||||
#include "ble/pal/GapEvents.h"
|
||||
#include "ble/pal/GapTypes.h"
|
||||
#include "ble/BLETypes.h"
|
||||
#include "ble/pal/GenericAccessService.h"
|
||||
#include "ble/pal/EventQueue.h"
|
||||
#include "ble/pal/ConnectionEventMonitor.h"
|
||||
#include "ble/pal/Deprecated.h"
|
||||
|
||||
#include "drivers/Timeout.h"
|
||||
#include "platform/mbed_error.h"
|
||||
|
||||
namespace ble {
|
||||
namespace generic {
|
||||
|
@ -42,10 +42,69 @@ namespace generic {
|
|||
*
|
||||
* @attention: Not part of the public interface of BLE API.
|
||||
*/
|
||||
template<
|
||||
template<class> class TPalGap,
|
||||
class PalSecurityManager,
|
||||
class ConnectionEventMonitorEventHandler
|
||||
>
|
||||
class GenericGap :
|
||||
public ::Gap,
|
||||
public pal::ConnectionEventMonitor,
|
||||
public pal::Gap::EventHandler {
|
||||
public interface::LegacyGap<
|
||||
GenericGap<TPalGap, PalSecurityManager, ConnectionEventMonitorEventHandler>
|
||||
>,
|
||||
public pal::ConnectionEventMonitor<
|
||||
ConnectionEventMonitorEventHandler
|
||||
>,
|
||||
public pal::GapEventHandler<
|
||||
GenericGap<TPalGap, PalSecurityManager, ConnectionEventMonitorEventHandler>
|
||||
>
|
||||
{
|
||||
// Typedef of base and companion classes .
|
||||
typedef ::ble::interface::LegacyGap<GenericGap> LegacyGap;
|
||||
typedef ::ble::interface::Gap<GenericGap> Gap;
|
||||
typedef pal::ConnectionEventMonitor<ConnectionEventMonitorEventHandler> ConnectionEventMonitor;
|
||||
typedef TPalGap<GenericGap> PalGap;
|
||||
typedef pal::GapEventHandler<GenericGap> PalGapEventHandler;
|
||||
|
||||
// Friendship with base classes
|
||||
friend LegacyGap;
|
||||
friend Gap;
|
||||
friend ConnectionEventMonitor;
|
||||
friend pal::GapEventHandler<GenericGap>;
|
||||
friend PalGap;
|
||||
|
||||
// Imports from LegacyGap
|
||||
using LegacyGap::_eventHandler;
|
||||
using LegacyGap::default_peripheral_privacy_configuration;
|
||||
using LegacyGap::default_central_privacy_configuration;
|
||||
using LegacyGap::state;
|
||||
|
||||
typedef typename LegacyGap::Address_t Address_t;
|
||||
typedef typename LegacyGap::PeerAddressType_t PeerAddressType_t;
|
||||
typedef typename LegacyGap::ConnectionParams_t ConnectionParams_t;
|
||||
typedef typename LegacyGap::Handle_t Handle_t;
|
||||
typedef typename LegacyGap::CodedSymbolPerBit_t CodedSymbolPerBit_t;
|
||||
typedef typename LegacyGap::Whitelist_t Whitelist_t;
|
||||
typedef typename LegacyGap::DisconnectionReason_t DisconnectionReason_t;
|
||||
typedef typename LegacyGap::AdvertisingPolicyMode_t AdvertisingPolicyMode_t;
|
||||
typedef typename LegacyGap::ScanningPolicyMode_t ScanningPolicyMode_t;
|
||||
typedef typename LegacyGap::InitiatorPolicyMode_t InitiatorPolicyMode_t;
|
||||
typedef typename LegacyGap::PeripheralPrivacyConfiguration_t PeripheralPrivacyConfiguration_t;
|
||||
typedef typename LegacyGap::CentralPrivacyConfiguration_t CentralPrivacyConfiguration_t;
|
||||
typedef typename LegacyGap::Role_t Role_t;
|
||||
|
||||
// Imports from Gap
|
||||
using ble::interface::Gap<GenericGap>::getMaxAdvertisingSetNumber;
|
||||
using ble::interface::Gap<GenericGap>::getMaxAdvertisingDataLength;
|
||||
using ble::interface::Gap<GenericGap>::isFeatureSupported;
|
||||
using ble::interface::Gap<GenericGap>::useVersionOneAPI;
|
||||
using ble::interface::Gap<GenericGap>::useVersionTwoAPI;
|
||||
|
||||
// Imports from PalGap EventHandler
|
||||
using PalGapEventHandler::on_scan_timeout;
|
||||
|
||||
// Imports from ConnectionEventMonitor
|
||||
using ConnectionEventMonitor::_connection_event_handler;
|
||||
using ConnectionEventMonitor::set_connection_event_handler;
|
||||
|
||||
public:
|
||||
/* TODO: move to config */
|
||||
|
@ -67,73 +126,73 @@ public:
|
|||
*/
|
||||
GenericGap(
|
||||
pal::EventQueue &event_queue,
|
||||
pal::Gap &pal_gap,
|
||||
PalGap &pal_gap,
|
||||
pal::GenericAccessService &generic_access_service,
|
||||
pal::SecurityManager &pal_sm
|
||||
PalSecurityManager &pal_sm
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::~Gap
|
||||
*/
|
||||
virtual ~GenericGap();
|
||||
~GenericGap();
|
||||
|
||||
/** @copydoc Gap::IsFeatureSupported
|
||||
*/
|
||||
virtual bool isFeatureSupported(
|
||||
bool isFeatureSupported_(
|
||||
controller_supported_features_t feature
|
||||
);
|
||||
|
||||
/** @copydoc Gap::getMaxAdvertisingSetNumber
|
||||
*/
|
||||
virtual uint8_t getMaxAdvertisingSetNumber();
|
||||
uint8_t getMaxAdvertisingSetNumber_();
|
||||
|
||||
/** @copydoc Gap::getMaxAdvertisingDataLength
|
||||
*/
|
||||
virtual uint16_t getMaxAdvertisingDataLength();
|
||||
uint16_t getMaxAdvertisingDataLength_();
|
||||
|
||||
/** @copydoc Gap::getMaxConnectableAdvertisingDataLength
|
||||
*/
|
||||
virtual uint16_t getMaxConnectableAdvertisingDataLength();
|
||||
uint16_t getMaxConnectableAdvertisingDataLength_();
|
||||
|
||||
/** @copydoc Gap::getMaxActiveSetAdvertisingDataLength
|
||||
*/
|
||||
virtual uint16_t getMaxActiveSetAdvertisingDataLength();
|
||||
uint16_t getMaxActiveSetAdvertisingDataLength_();
|
||||
|
||||
/** @copydoc Gap::createAdvertisingSet
|
||||
*/
|
||||
virtual ble_error_t createAdvertisingSet(
|
||||
ble_error_t createAdvertisingSet_(
|
||||
advertising_handle_t *handle,
|
||||
const AdvertisingParameters ¶meters
|
||||
);
|
||||
|
||||
/** @copydoc Gap::destroyAdvertisingSet
|
||||
*/
|
||||
virtual ble_error_t destroyAdvertisingSet(advertising_handle_t handle);
|
||||
ble_error_t destroyAdvertisingSet_(advertising_handle_t handle);
|
||||
|
||||
/** @copydoc Gap::setAdvertisingParams
|
||||
*/
|
||||
virtual ble_error_t setAdvertisingParameters(
|
||||
ble_error_t setAdvertisingParameters_(
|
||||
advertising_handle_t handle,
|
||||
const AdvertisingParameters ¶ms
|
||||
);
|
||||
|
||||
/** @copydoc Gap::setAdvertisingPayload
|
||||
*/
|
||||
virtual ble_error_t setAdvertisingPayload(
|
||||
ble_error_t setAdvertisingPayload_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
);
|
||||
|
||||
/** @copydoc Gap::setAdvertisingScanResponse
|
||||
*/
|
||||
virtual ble_error_t setAdvertisingScanResponse(
|
||||
ble_error_t setAdvertisingScanResponse_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> response
|
||||
);
|
||||
|
||||
/** @copydoc Gap::startAdvertising
|
||||
*/
|
||||
virtual ble_error_t startAdvertising(
|
||||
ble_error_t startAdvertising_(
|
||||
advertising_handle_t handle,
|
||||
adv_duration_t maxDuration,
|
||||
uint8_t maxEvents
|
||||
|
@ -141,15 +200,15 @@ public:
|
|||
|
||||
/** @copydoc Gap::stopAdvertising
|
||||
*/
|
||||
virtual ble_error_t stopAdvertising(advertising_handle_t handle);
|
||||
ble_error_t stopAdvertising_(advertising_handle_t handle);
|
||||
|
||||
/** @copydoc Gap::isAdvertisingActive
|
||||
*/
|
||||
virtual bool isAdvertisingActive(advertising_handle_t handle);
|
||||
bool isAdvertisingActive_(advertising_handle_t handle);
|
||||
|
||||
/** @copydoc Gap::setPeriodicAdvertisingParameters
|
||||
*/
|
||||
virtual ble_error_t setPeriodicAdvertisingParameters(
|
||||
ble_error_t setPeriodicAdvertisingParameters_(
|
||||
advertising_handle_t handle,
|
||||
periodic_interval_t periodicAdvertisingIntervalMin,
|
||||
periodic_interval_t periodicAdvertisingIntervalMax,
|
||||
|
@ -158,30 +217,30 @@ public:
|
|||
|
||||
/** @copydoc Gap::setPeriodicAdvertisingPayload
|
||||
*/
|
||||
virtual ble_error_t setPeriodicAdvertisingPayload(
|
||||
ble_error_t setPeriodicAdvertisingPayload_(
|
||||
advertising_handle_t handle,
|
||||
mbed::Span<const uint8_t> payload
|
||||
);
|
||||
|
||||
/** @copydoc Gap::startPeriodicAdvertising
|
||||
*/
|
||||
virtual ble_error_t startPeriodicAdvertising(advertising_handle_t handle);
|
||||
ble_error_t startPeriodicAdvertising_(advertising_handle_t handle);
|
||||
|
||||
/** @copydoc Gap::stopPeriodicAdvertising
|
||||
*/
|
||||
virtual ble_error_t stopPeriodicAdvertising(advertising_handle_t handle);
|
||||
ble_error_t stopPeriodicAdvertising_(advertising_handle_t handle);
|
||||
|
||||
/** @copydoc Gap::isPeriodicAdvertisingActive
|
||||
*/
|
||||
virtual bool isPeriodicAdvertisingActive(advertising_handle_t handle);
|
||||
bool isPeriodicAdvertisingActive_(advertising_handle_t handle);
|
||||
|
||||
/** @copydoc Gap::setScanParameters
|
||||
*/
|
||||
virtual ble_error_t setScanParameters(const ScanParameters ¶ms);
|
||||
ble_error_t setScanParameters_(const ScanParameters ¶ms);
|
||||
|
||||
/** @copydoc Gap::startScan
|
||||
*/
|
||||
virtual ble_error_t startScan(
|
||||
ble_error_t startScan_(
|
||||
scan_duration_t duration,
|
||||
duplicates_filter_t filtering,
|
||||
scan_period_t period
|
||||
|
@ -189,7 +248,7 @@ public:
|
|||
|
||||
/** @copydoc Gap::createSync
|
||||
*/
|
||||
virtual ble_error_t createSync(
|
||||
ble_error_t createSync_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const ble::address_t &peerAddress,
|
||||
advertising_sid_t sid,
|
||||
|
@ -199,22 +258,22 @@ public:
|
|||
|
||||
/** @copydoc Gap::createSync
|
||||
*/
|
||||
virtual ble_error_t createSync(
|
||||
ble_error_t createSync_(
|
||||
slave_latency_t maxPacketSkip,
|
||||
sync_timeout_t timeout
|
||||
);
|
||||
|
||||
/** @copydoc Gap::cancelCreateSync
|
||||
*/
|
||||
virtual ble_error_t cancelCreateSync();
|
||||
ble_error_t cancelCreateSync_();
|
||||
|
||||
/** @copydoc Gap::terminateSync
|
||||
*/
|
||||
virtual ble_error_t terminateSync(periodic_sync_handle_t handle);
|
||||
ble_error_t terminateSync_(periodic_sync_handle_t handle);
|
||||
|
||||
/** @copydoc Gap::addDeviceToPeriodicAdvertiserList
|
||||
*/
|
||||
virtual ble_error_t addDeviceToPeriodicAdvertiserList(
|
||||
ble_error_t addDeviceToPeriodicAdvertiserList_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const ble::address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
|
@ -222,7 +281,7 @@ public:
|
|||
|
||||
/** @copydoc Gap::removeDeviceFromPeriodicAdvertiserList
|
||||
*/
|
||||
virtual ble_error_t removeDeviceFromPeriodicAdvertiserList(
|
||||
ble_error_t removeDeviceFromPeriodicAdvertiserList_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const ble::address_t &peerAddress,
|
||||
advertising_sid_t sid
|
||||
|
@ -230,16 +289,16 @@ public:
|
|||
|
||||
/** @copydoc Gap::clearPeriodicAdvertiserList
|
||||
*/
|
||||
virtual ble_error_t clearPeriodicAdvertiserList();
|
||||
ble_error_t clearPeriodicAdvertiserList_();
|
||||
|
||||
/** @copydoc Gap::getMaxPeriodicAdvertiserListSize
|
||||
*/
|
||||
virtual uint8_t getMaxPeriodicAdvertiserListSize();
|
||||
uint8_t getMaxPeriodicAdvertiserListSize_();
|
||||
|
||||
/**
|
||||
* @see Gap::setAddress
|
||||
*/
|
||||
virtual ble_error_t setAddress(
|
||||
ble_error_t setAddress_(
|
||||
BLEProtocol::AddressType_t type,
|
||||
const BLEProtocol::AddressBytes_t address
|
||||
);
|
||||
|
@ -247,7 +306,7 @@ public:
|
|||
/**
|
||||
* @see Gap::getAddress
|
||||
*/
|
||||
virtual ble_error_t getAddress(
|
||||
ble_error_t getAddress_(
|
||||
BLEProtocol::AddressType_t *type,
|
||||
BLEProtocol::AddressBytes_t address
|
||||
);
|
||||
|
@ -255,32 +314,32 @@ public:
|
|||
/**
|
||||
* @see Gap::getMinAdvertisingInterval
|
||||
*/
|
||||
virtual uint16_t getMinAdvertisingInterval() const;
|
||||
uint16_t getMinAdvertisingInterval_() const;
|
||||
|
||||
/**
|
||||
* @see Gap::getMinNonConnectableAdvertisingInterval
|
||||
*/
|
||||
virtual uint16_t getMinNonConnectableAdvertisingInterval() const;
|
||||
uint16_t getMinNonConnectableAdvertisingInterval_() const;
|
||||
|
||||
/**
|
||||
* @see Gap::getMaxAdvertisingInterval
|
||||
*/
|
||||
virtual uint16_t getMaxAdvertisingInterval() const;
|
||||
uint16_t getMaxAdvertisingInterval_() const;
|
||||
|
||||
/**
|
||||
* @see Gap::stopAdvertising
|
||||
*/
|
||||
virtual ble_error_t stopAdvertising();
|
||||
ble_error_t stopAdvertising_();
|
||||
|
||||
/**
|
||||
* @see Gap::stopScan
|
||||
*/
|
||||
virtual ble_error_t stopScan();
|
||||
ble_error_t stopScan_();
|
||||
|
||||
/**
|
||||
* @see Gap::connect
|
||||
*/
|
||||
virtual ble_error_t connect(
|
||||
ble_error_t connect_(
|
||||
const BLEProtocol::AddressBytes_t peerAddr,
|
||||
PeerAddressType_t peerAddrType,
|
||||
const ConnectionParams_t *connectionParams,
|
||||
|
@ -290,7 +349,7 @@ public:
|
|||
/**
|
||||
* @see Gap::connect
|
||||
*/
|
||||
virtual ble_error_t connect(
|
||||
ble_error_t connect_(
|
||||
const BLEProtocol::AddressBytes_t peerAddr,
|
||||
BLEProtocol::AddressType_t peerAddrType,
|
||||
const ConnectionParams_t *connectionParams,
|
||||
|
@ -300,7 +359,7 @@ public:
|
|||
/**
|
||||
* @see Gap::connect
|
||||
*/
|
||||
virtual ble_error_t connect(
|
||||
ble_error_t connect_(
|
||||
peer_address_type_t peerAddressType,
|
||||
const ble::address_t &peerAddress,
|
||||
const ConnectionParameters &connectionParams
|
||||
|
@ -309,13 +368,13 @@ public:
|
|||
/**
|
||||
* @see Gap::cancelConnect
|
||||
*/
|
||||
virtual ble_error_t cancelConnect();
|
||||
ble_error_t cancelConnect_();
|
||||
|
||||
virtual ble_error_t manageConnectionParametersUpdateRequest(
|
||||
ble_error_t manageConnectionParametersUpdateRequest_(
|
||||
bool userManageConnectionUpdateRequest
|
||||
);
|
||||
|
||||
virtual ble_error_t updateConnectionParameters(
|
||||
ble_error_t updateConnectionParameters_(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
|
@ -325,7 +384,7 @@ public:
|
|||
conn_event_length_t maxConnectionEventLength
|
||||
);
|
||||
|
||||
virtual ble_error_t acceptConnectionParametersUpdate(
|
||||
ble_error_t acceptConnectionParametersUpdate_(
|
||||
connection_handle_t connectionHandle,
|
||||
conn_interval_t minConnectionInterval,
|
||||
conn_interval_t maxConnectionInterval,
|
||||
|
@ -335,19 +394,19 @@ public:
|
|||
conn_event_length_t maxConnectionEventLength
|
||||
);
|
||||
|
||||
virtual ble_error_t rejectConnectionParametersUpdate(
|
||||
ble_error_t rejectConnectionParametersUpdate_(
|
||||
connection_handle_t connectionHandle
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::readPhy
|
||||
*/
|
||||
virtual ble_error_t readPhy(Handle_t connection);
|
||||
ble_error_t readPhy_(Handle_t connection);
|
||||
|
||||
/**
|
||||
* @see Gap::setPreferredPhys
|
||||
*/
|
||||
virtual ble_error_t setPreferredPhys(
|
||||
ble_error_t setPreferredPhys_(
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys
|
||||
);
|
||||
|
@ -355,14 +414,14 @@ public:
|
|||
/**
|
||||
* @see Gap::setPhy
|
||||
*/
|
||||
virtual ble_error_t setPhy(
|
||||
ble_error_t setPhy_(
|
||||
Handle_t connection,
|
||||
const phy_set_t *txPhys,
|
||||
const phy_set_t *rxPhys,
|
||||
CodedSymbolPerBit_t codedSymbol
|
||||
);
|
||||
|
||||
virtual ble_error_t disconnect(
|
||||
ble_error_t disconnect_(
|
||||
connection_handle_t connectionHandle,
|
||||
local_disconnection_reason_t reason
|
||||
);
|
||||
|
@ -370,15 +429,20 @@ public:
|
|||
/**
|
||||
* @see Gap::disconnect
|
||||
*/
|
||||
virtual ble_error_t disconnect(
|
||||
ble_error_t disconnect_(
|
||||
Handle_t connectionHandle,
|
||||
DisconnectionReason_t reason
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::disconnect
|
||||
*/
|
||||
ble_error_t disconnect_(DisconnectionReason_t reason);
|
||||
|
||||
/**
|
||||
* @see Gap::updateConnectionParams
|
||||
*/
|
||||
virtual ble_error_t updateConnectionParams(
|
||||
ble_error_t updateConnectionParams_(
|
||||
Handle_t handle,
|
||||
const ConnectionParams_t *params
|
||||
);
|
||||
|
@ -386,139 +450,139 @@ public:
|
|||
/**
|
||||
* @see Gap::getPreferredConnectionParams
|
||||
*/
|
||||
virtual ble_error_t getPreferredConnectionParams(
|
||||
ble_error_t getPreferredConnectionParams_(
|
||||
ConnectionParams_t *params
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::setPreferredConnectionParams
|
||||
*/
|
||||
virtual ble_error_t setPreferredConnectionParams(
|
||||
ble_error_t setPreferredConnectionParams_(
|
||||
const ConnectionParams_t *params
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::setDeviceName
|
||||
*/
|
||||
virtual ble_error_t setDeviceName(const uint8_t *deviceName);
|
||||
ble_error_t setDeviceName_(const uint8_t *deviceName);
|
||||
|
||||
/**
|
||||
* @see Gap::getDeviceName
|
||||
*/
|
||||
virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP);
|
||||
ble_error_t getDeviceName_(uint8_t *deviceName, unsigned *lengthP);
|
||||
|
||||
/**
|
||||
* @see Gap::setAppearance
|
||||
*/
|
||||
virtual ble_error_t setAppearance(GapAdvertisingData::Appearance appearance);
|
||||
ble_error_t setAppearance_(GapAdvertisingData::Appearance appearance);
|
||||
|
||||
/**
|
||||
* @see Gap::getAppearance
|
||||
*/
|
||||
virtual ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP);
|
||||
ble_error_t getAppearance_(GapAdvertisingData::Appearance *appearanceP);
|
||||
|
||||
/**
|
||||
* @see Gap::setTxPower
|
||||
*/
|
||||
virtual ble_error_t setTxPower(int8_t txPower);
|
||||
ble_error_t setTxPower_(int8_t txPower);
|
||||
|
||||
/**
|
||||
* @see Gap::getPermittedTxPowerValues
|
||||
*/
|
||||
virtual void getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP);
|
||||
void getPermittedTxPowerValues_(const int8_t **valueArrayPP, size_t *countP);
|
||||
|
||||
/**
|
||||
* @see Gap::getMaxWhitelistSize
|
||||
*/
|
||||
virtual uint8_t getMaxWhitelistSize(void) const;
|
||||
uint8_t getMaxWhitelistSize_(void) const;
|
||||
|
||||
/**
|
||||
* @see Gap::getWhitelist
|
||||
*/
|
||||
virtual ble_error_t getWhitelist(Whitelist_t &whitelist) const;
|
||||
ble_error_t getWhitelist_(Whitelist_t &whitelist) const;
|
||||
|
||||
/**
|
||||
* @see Gap::setWhitelist
|
||||
*/
|
||||
virtual ble_error_t setWhitelist(const Whitelist_t &whitelist);
|
||||
ble_error_t setWhitelist_(const Whitelist_t &whitelist);
|
||||
|
||||
/**
|
||||
* @see Gap::setAdvertisingPolicyMode
|
||||
*/
|
||||
virtual ble_error_t setAdvertisingPolicyMode(AdvertisingPolicyMode_t mode);
|
||||
ble_error_t setAdvertisingPolicyMode_(AdvertisingPolicyMode_t mode);
|
||||
|
||||
/**
|
||||
* @see Gap::setScanningPolicyMode
|
||||
*/
|
||||
virtual ble_error_t setScanningPolicyMode(ScanningPolicyMode_t mode);
|
||||
ble_error_t setScanningPolicyMode_(ScanningPolicyMode_t mode);
|
||||
|
||||
/**
|
||||
* @see Gap::setInitiatorPolicyMode
|
||||
*/
|
||||
virtual ble_error_t setInitiatorPolicyMode(InitiatorPolicyMode_t mode);
|
||||
ble_error_t setInitiatorPolicyMode_(InitiatorPolicyMode_t mode);
|
||||
|
||||
/**
|
||||
* @see Gap::getAdvertisingPolicyMode
|
||||
*/
|
||||
virtual AdvertisingPolicyMode_t getAdvertisingPolicyMode(void) const;
|
||||
AdvertisingPolicyMode_t getAdvertisingPolicyMode_(void) const;
|
||||
|
||||
/**
|
||||
* @see Gap::getScanningPolicyMode
|
||||
*/
|
||||
virtual ScanningPolicyMode_t getScanningPolicyMode(void) const;
|
||||
ScanningPolicyMode_t getScanningPolicyMode_(void) const;
|
||||
|
||||
/**
|
||||
* @see Gap::getInitiatorPolicyMode
|
||||
*/
|
||||
virtual InitiatorPolicyMode_t getInitiatorPolicyMode(void) const;
|
||||
InitiatorPolicyMode_t getInitiatorPolicyMode_(void) const;
|
||||
|
||||
/**
|
||||
* @see Gap::startRadioScan
|
||||
*/
|
||||
virtual ble_error_t startRadioScan(const GapScanningParams &scanningParams);
|
||||
ble_error_t startRadioScan_(const GapScanningParams &scanningParams);
|
||||
|
||||
/**
|
||||
* @see Gap::initRadioNotification
|
||||
*/
|
||||
virtual ble_error_t initRadioNotification(void);
|
||||
ble_error_t initRadioNotification_(void);
|
||||
|
||||
/**
|
||||
* @see Gap::enablePrivacy
|
||||
*/
|
||||
virtual ble_error_t enablePrivacy(bool enable);
|
||||
ble_error_t enablePrivacy_(bool enable);
|
||||
|
||||
/**
|
||||
* @see Gap::setPeripheralPrivacyConfiguration
|
||||
*/
|
||||
virtual ble_error_t setPeripheralPrivacyConfiguration(
|
||||
ble_error_t setPeripheralPrivacyConfiguration_(
|
||||
const PeripheralPrivacyConfiguration_t *configuration
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::getPeripheralPrivacyConfiguration
|
||||
*/
|
||||
virtual ble_error_t getPeripheralPrivacyConfiguration(
|
||||
ble_error_t getPeripheralPrivacyConfiguration_(
|
||||
PeripheralPrivacyConfiguration_t *configuration
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::setCentralPrivacyConfiguration
|
||||
*/
|
||||
virtual ble_error_t setCentralPrivacyConfiguration(
|
||||
ble_error_t setCentralPrivacyConfiguration_(
|
||||
const CentralPrivacyConfiguration_t *configuration
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::getCentralPrivacyConfiguration
|
||||
*/
|
||||
virtual ble_error_t getCentralPrivacyConfiguration(
|
||||
ble_error_t getCentralPrivacyConfiguration_(
|
||||
CentralPrivacyConfiguration_t *configuration
|
||||
);
|
||||
|
||||
/**
|
||||
* @see Gap::setAdvertisingData
|
||||
*/
|
||||
virtual ble_error_t setAdvertisingData(
|
||||
ble_error_t setAdvertisingData_(
|
||||
const GapAdvertisingData &advData,
|
||||
const GapAdvertisingData &scanResponse
|
||||
);
|
||||
|
@ -526,17 +590,17 @@ public:
|
|||
/**
|
||||
* @see Gap::startAdvertising
|
||||
*/
|
||||
virtual ble_error_t startAdvertising(const GapAdvertisingParams ¶ms);
|
||||
ble_error_t startAdvertising_(const GapAdvertisingParams ¶ms);
|
||||
|
||||
/**
|
||||
* @see Gap::reset
|
||||
*/
|
||||
virtual ble_error_t reset(void);
|
||||
ble_error_t reset_(void);
|
||||
|
||||
/**
|
||||
* @copydoc ::Gap::processConnectionEvent
|
||||
*/
|
||||
virtual void processConnectionEvent(
|
||||
void processConnectionEvent(
|
||||
Handle_t handle,
|
||||
Role_t role,
|
||||
peer_address_type_t peerAddrType,
|
||||
|
@ -551,7 +615,7 @@ public:
|
|||
/**
|
||||
* @copydoc ::Gap::processDisconnectionEvent
|
||||
*/
|
||||
virtual void processDisconnectionEvent(
|
||||
void processDisconnectionEvent(
|
||||
Handle_t handle,
|
||||
DisconnectionReason_t reason
|
||||
);
|
||||
|
@ -564,13 +628,6 @@ private:
|
|||
bool scan_response
|
||||
);
|
||||
|
||||
/** @note Implements ConnectionEventMonitor.
|
||||
* @copydoc ConnectionEventMonitor::set_connection_event_handler
|
||||
*/
|
||||
void set_connection_event_handler(pal::ConnectionEventMonitor::EventHandler *_connection_event_handler);
|
||||
|
||||
void on_scan_timeout();
|
||||
|
||||
void process_scan_timeout();
|
||||
|
||||
void on_advertising_timeout();
|
||||
|
@ -614,33 +671,33 @@ private:
|
|||
|
||||
void on_address_rotation_timeout();
|
||||
|
||||
virtual void useVersionOneAPI() const;
|
||||
void useVersionOneAPI_() const;
|
||||
|
||||
virtual void useVersionTwoAPI() const;
|
||||
void useVersionTwoAPI_() const;
|
||||
|
||||
/* implements pal::Gap::EventHandler */
|
||||
private:
|
||||
virtual void on_read_phy(
|
||||
void on_read_phy_(
|
||||
pal::hci_error_code_t hci_status,
|
||||
Handle_t connection_handle,
|
||||
phy_t tx_phy,
|
||||
phy_t rx_phy
|
||||
);
|
||||
|
||||
virtual void on_data_length_change(
|
||||
void on_data_length_change_(
|
||||
connection_handle_t connection_handle,
|
||||
uint16_t tx_size,
|
||||
uint16_t rx_size
|
||||
);
|
||||
|
||||
virtual void on_phy_update_complete(
|
||||
void on_phy_update_complete_(
|
||||
pal::hci_error_code_t hci_status,
|
||||
Handle_t connection_handle,
|
||||
phy_t tx_phy,
|
||||
phy_t rx_phy
|
||||
);
|
||||
|
||||
virtual void on_enhanced_connection_complete(
|
||||
void on_enhanced_connection_complete_(
|
||||
pal::hci_error_code_t status,
|
||||
connection_handle_t connection_handle,
|
||||
pal::connection_role_t own_role,
|
||||
|
@ -654,7 +711,7 @@ private:
|
|||
pal::clock_accuracy_t master_clock_accuracy
|
||||
);
|
||||
|
||||
virtual void on_extended_advertising_report(
|
||||
void on_extended_advertising_report_(
|
||||
advertising_event_t event_type,
|
||||
const pal::connection_peer_address_type_t *address_type,
|
||||
const ble::address_t &address,
|
||||
|
@ -670,7 +727,7 @@ private:
|
|||
const uint8_t *data
|
||||
);
|
||||
|
||||
virtual void on_periodic_advertising_sync_established(
|
||||
void on_periodic_advertising_sync_established_(
|
||||
pal::hci_error_code_t error,
|
||||
pal::sync_handle_t sync_handle,
|
||||
advertising_sid_t advertising_sid,
|
||||
|
@ -681,7 +738,7 @@ private:
|
|||
pal::clock_accuracy_t clock_accuracy
|
||||
);
|
||||
|
||||
virtual void on_periodic_advertising_report(
|
||||
void on_periodic_advertising_report_(
|
||||
pal::sync_handle_t sync_handle,
|
||||
pal::advertising_power_t tx_power,
|
||||
pal::rssi_t rssi,
|
||||
|
@ -690,22 +747,22 @@ private:
|
|||
const uint8_t *data
|
||||
);
|
||||
|
||||
virtual void on_periodic_advertising_sync_loss(pal::sync_handle_t sync_handle);
|
||||
void on_periodic_advertising_sync_loss_(pal::sync_handle_t sync_handle);
|
||||
|
||||
virtual void on_advertising_set_terminated(
|
||||
void on_advertising_set_terminated_(
|
||||
pal::hci_error_code_t status,
|
||||
advertising_handle_t advertising_handle,
|
||||
connection_handle_t connection_handle,
|
||||
uint8_t number_of_completed_extended_advertising_events
|
||||
);
|
||||
|
||||
virtual void on_scan_request_received(
|
||||
void on_scan_request_received_(
|
||||
advertising_handle_t advertising_handle,
|
||||
pal::connection_peer_address_type_t scanner_address_type,
|
||||
const ble::address_t &address
|
||||
);
|
||||
|
||||
virtual void on_connection_update_complete(
|
||||
void on_connection_update_complete_(
|
||||
pal::hci_error_code_t status,
|
||||
connection_handle_t connection_handle,
|
||||
uint16_t connection_interval,
|
||||
|
@ -713,7 +770,7 @@ private:
|
|||
uint16_t supervision_timeout
|
||||
);
|
||||
|
||||
virtual void on_remote_connection_parameter(
|
||||
void on_remote_connection_parameter_(
|
||||
connection_handle_t connection_handle,
|
||||
uint16_t connection_interval_min,
|
||||
uint16_t connection_interval_max,
|
||||
|
@ -721,11 +778,14 @@ private:
|
|||
uint16_t supervision_timeout
|
||||
);
|
||||
|
||||
void on_scan_timeout_();
|
||||
|
||||
|
||||
private:
|
||||
pal::EventQueue &_event_queue;
|
||||
pal::Gap &_pal_gap;
|
||||
PalGap &_pal_gap;
|
||||
pal::GenericAccessService &_gap_service;
|
||||
pal::SecurityManager &_pal_sm;
|
||||
PalSecurityManager &_pal_sm;
|
||||
BLEProtocol::AddressType_t _address_type;
|
||||
ble::address_t _address;
|
||||
pal::initiator_policy_t _initiator_policy_mode;
|
||||
|
@ -743,7 +803,6 @@ private:
|
|||
mbed::Timeout _advertising_timeout;
|
||||
mbed::Timeout _scan_timeout;
|
||||
mbed::Ticker _address_rotation_ticker;
|
||||
pal::ConnectionEventMonitor::EventHandler *_connection_event_handler;
|
||||
|
||||
template<size_t bit_size>
|
||||
struct BitArray {
|
||||
|
@ -811,7 +870,7 @@ private:
|
|||
bool is_extended_advertising_available();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace generic
|
||||
} // namespace ble
|
||||
|
||||
#endif /* MBED_BLE_GENERIC_GAP */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue