Remove deprecated implementations from GenericGap & LegacyGap

pull/12730/head
Lingkai Dong 2020-03-20 11:57:36 +00:00
parent 55edb6131d
commit 6f701cd6ef
3 changed files with 2 additions and 912 deletions

View File

@ -79,7 +79,7 @@ class GenericGap :
using LegacyGap::default_central_privacy_configuration;
using LegacyGap::state;
typedef typename LegacyGap::Address_t Address_t;
typedef typename BLEProtocol::AddressBytes_t Address_t;
typedef typename LegacyGap::PeerAddressType_t PeerAddressType_t;
typedef typename LegacyGap::ConnectionParams_t ConnectionParams_t;
typedef typename LegacyGap::Handle_t Handle_t;
@ -298,14 +298,6 @@ public:
*/
uint8_t getMaxPeriodicAdvertiserListSize_();
/**
* @see Gap::setAddress
*/
ble_error_t setAddress_(
BLEProtocol::AddressType_t type,
const BLEProtocol::AddressBytes_t address
);
/**
* @see Gap::setRandomStaticAddress
*/
@ -334,11 +326,6 @@ public:
*/
uint16_t getMaxAdvertisingInterval_() const;
/**
* @see Gap::stopAdvertising
*/
ble_error_t stopAdvertising_();
/**
* @see Gap::stopScan
*/
@ -636,8 +623,6 @@ private:
bool scan_response
);
void process_scan_timeout();
void on_advertising_timeout();
void process_advertising_timeout();

View File

@ -16,61 +16,6 @@
#include "ble/Gap.h"
namespace {
ble_error_t convert_address_type(
ble::peer_address_type_t input_type,
const BLEProtocol::AddressBytes_t address,
BLEProtocol::AddressType_t& output_type
) {
typedef ble::random_address_type_t RandomAddressType_t;
typedef ble::peer_address_type_t PeerAddressType_t;
typedef BLEProtocol::AddressType LegacyAddressType_t;
// best effort; peerAddrTypeIn should not be used when privacy is on.
switch(input_type.value()) {
case PeerAddressType_t::PUBLIC:
case PeerAddressType_t::PUBLIC_IDENTITY:
output_type = LegacyAddressType_t::PUBLIC;
break;
case PeerAddressType_t::RANDOM: {
RandomAddressType_t random_address_type(RandomAddressType_t::STATIC);
ble_error_t err = Gap::getRandomAddressType(address, &random_address_type);
if (err) {
return err;
}
switch (random_address_type.value()) {
case RandomAddressType_t::STATIC:
output_type = LegacyAddressType_t::RANDOM_STATIC;
break;
case RandomAddressType_t::NON_RESOLVABLE_PRIVATE:
output_type = LegacyAddressType_t::RANDOM_PRIVATE_NON_RESOLVABLE;
break;
case RandomAddressType_t::RESOLVABLE_PRIVATE:
output_type = LegacyAddressType_t::RANDOM_PRIVATE_RESOLVABLE;
break;
}
break;
}
case PeerAddressType_t::RANDOM_STATIC_IDENTITY:
output_type = LegacyAddressType_t::RANDOM_STATIC;
break;
}
return BLE_ERROR_NONE;
}
ble::peer_address_type_t convert_legacy_address_type(
BLEProtocol::AddressType_t legacy_address
) {
if (legacy_address == BLEProtocol::AddressType::PUBLIC) {
return ble::peer_address_type_t::PUBLIC;
} else {
return ble::peer_address_type_t::RANDOM;
}
}
} // end of anonymous namespace
namespace ble {
namespace interface {
@ -123,14 +68,6 @@ void LegacyGap<Impl>::processConnectionEvent(
connectionCallChain.call(&callbackParams);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setAddress(
BLEProtocol::AddressType_t type,
const BLEProtocol::AddressBytes_t address
) {
return impl()->setAddress_(type, address);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::getAddress(
BLEProtocol::AddressType_t *typeP,
@ -139,488 +76,6 @@ ble_error_t LegacyGap<Impl>::getAddress(
return impl()->getAddress_(typeP, address);
}
#if BLE_ROLE_BROADCASTER
template<class Impl>
ble_error_t LegacyGap<Impl>::stopAdvertising(void) {
return impl()->stopAdvertising_();
}
#endif // BLE_ROLE_BROADCASTER
#if BLE_ROLE_CENTRAL
template<class Impl>
ble_error_t LegacyGap<Impl>::connect(
const BLEProtocol::AddressBytes_t peerAddr,
PeerAddressType_t peerAddrType,
const ConnectionParams_t *connectionParams,
const GapScanningParams *scanParams
) {
return impl()->connect_(
peerAddr,
peerAddrType,
connectionParams,
scanParams
);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::connect(
const BLEProtocol::AddressBytes_t peerAddr,
BLEProtocol::AddressType_t peerAddrType,
const ConnectionParams_t *connectionParams,
const GapScanningParams *scanParams
) {
return impl()->connect_(
peerAddr,
peerAddrType,
connectionParams,
scanParams
);
}
#endif // BLE_ROLE_CENTRAL
#if BLE_FEATURE_CONNECTABLE
template<class Impl>
ble_error_t LegacyGap<Impl>::disconnect(
Handle_t connectionHandle, DisconnectionReason_t reason
) {
return impl()->disconnect_(connectionHandle, reason);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::disconnect(DisconnectionReason_t reason) {
return impl()->disconnect_(reason);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::updateConnectionParams(
Handle_t handle,
const ConnectionParams_t *params
) {
return impl()->updateConnectionParams_(handle, params);
}
#endif // BLE_FEATURE_CONNECTABLE
template<class Impl>
ble_error_t LegacyGap<Impl>::setTxPower(int8_t txPower) {
return impl()->setTxPower_(txPower);
}
template<class Impl>
void LegacyGap<Impl>::getPermittedTxPowerValues(
const int8_t **valueArrayPP, size_t *countP
) {
return impl()->getPermittedTxPowerValues_(valueArrayPP, countP);
}
#if BLE_FEATURE_WHITELIST
#if BLE_ROLE_BROADCASTER
template<class Impl>
ble_error_t LegacyGap<Impl>::setAdvertisingPolicyMode(AdvertisingPolicyMode_t mode) {
return impl()->setAdvertisingPolicyMode_(mode);
}
template<class Impl>
typename LegacyGap<Impl>::AdvertisingPolicyMode_t
LegacyGap<Impl>::getAdvertisingPolicyMode(void) const {
return impl()->getAdvertisingPolicyMode_();
}
#endif // BLE_ROLE_BROADCASTER
#if BLE_ROLE_OBSERVER
template<class Impl>
ble_error_t LegacyGap<Impl>::setScanningPolicyMode(ScanningPolicyMode_t mode) {
return impl()->setScanningPolicyMode_(mode);
}
template<class Impl>
typename LegacyGap<Impl>::ScanningPolicyMode_t
LegacyGap<Impl>::getScanningPolicyMode(void) const {
return impl()->getScanningPolicyMode_();
}
#endif // BLE_ROLE_OBSERVER
#if BLE_ROLE_CENTRAL
template<class Impl>
ble_error_t LegacyGap<Impl>::setInitiatorPolicyMode(InitiatorPolicyMode_t mode) {
return impl()->setInitiatorPolicyMode_(mode);
}
template<class Impl>
typename LegacyGap<Impl>::InitiatorPolicyMode_t
LegacyGap<Impl>::getInitiatorPolicyMode(void) const {
return impl()->getInitiatorPolicyMode_();
}
#endif // BLE_ROLE_CENTRAL
#endif // BLE_FEATURE_WHITELIST
#if BLE_ROLE_OBSERVER
template<class Impl>
ble_error_t LegacyGap<Impl>::startRadioScan(const GapScanningParams &scanningParams) {
return impl()->startRadioScan_(scanningParams);
}
#endif // BLE_ROLE_OBSERVER
template<class Impl>
ble_error_t LegacyGap<Impl>::initRadioNotification(void) {
return impl()->initRadioNotification_();
}
/* -------- deprecated template implementation -------- */
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
template<class Impl>
typename LegacyGap<Impl>::GapState_t LegacyGap<Impl>::getState(void) const
{
return state;
}
#if BLE_ROLE_BROADCASTER
template<class Impl>
void LegacyGap<Impl>::setAdvertisingType(GapAdvertisingParams::AdvertisingType_t advType)
{
_advParams.setAdvertisingType(advType);
}
template<class Impl>
void LegacyGap<Impl>::setAdvertisingInterval(uint16_t interval)
{
if (interval == 0) {
stopAdvertising();
} else if (interval < getMinAdvertisingInterval()) {
interval = getMinAdvertisingInterval();
}
_advParams.setInterval(interval);
}
template<class Impl>
void LegacyGap<Impl>::setAdvertisingTimeout(uint16_t timeout)
{
_advParams.setTimeout(timeout);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::startAdvertising(void)
{
ble_error_t rc;
if ((rc = startAdvertising(_advParams)) == BLE_ERROR_NONE) {
state.advertising = 1;
}
return rc;
}
template<class Impl>
void LegacyGap<Impl>::clearAdvertisingPayload(void)
{
_advPayload.clear();
setAdvertisingData(_advPayload, _scanResponse);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::accumulateAdvertisingPayload(uint8_t flags)
{
GapAdvertisingData advPayloadCopy = _advPayload;
ble_error_t rc;
if ((rc = advPayloadCopy.addFlags(flags)) != BLE_ERROR_NONE) {
return rc;
}
rc = setAdvertisingData(advPayloadCopy, _scanResponse);
if (rc == BLE_ERROR_NONE) {
_advPayload = advPayloadCopy;
}
return rc;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::accumulateAdvertisingPayload(GapAdvertisingData::Appearance app)
{
GapAdvertisingData advPayloadCopy = _advPayload;
ble_error_t rc;
if ((rc = advPayloadCopy.addAppearance(app)) != BLE_ERROR_NONE) {
return rc;
}
rc = setAdvertisingData(advPayloadCopy, _scanResponse);
if (rc == BLE_ERROR_NONE) {
_advPayload = advPayloadCopy;
}
return rc;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::accumulateAdvertisingPayloadTxPower(int8_t power)
{
GapAdvertisingData advPayloadCopy = _advPayload;
ble_error_t rc;
if ((rc = advPayloadCopy.addTxPower(power)) != BLE_ERROR_NONE) {
return rc;
}
rc = setAdvertisingData(advPayloadCopy, _scanResponse);
if (rc == BLE_ERROR_NONE) {
_advPayload = advPayloadCopy;
}
return rc;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::accumulateAdvertisingPayload(
GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len
) {
GapAdvertisingData advPayloadCopy = _advPayload;
ble_error_t rc;
if ((rc = advPayloadCopy.addData(type, data, len)) != BLE_ERROR_NONE) {
return rc;
}
rc = setAdvertisingData(advPayloadCopy, _scanResponse);
if (rc == BLE_ERROR_NONE) {
_advPayload = advPayloadCopy;
}
return rc;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::updateAdvertisingPayload(
GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len
) {
GapAdvertisingData advPayloadCopy = _advPayload;
ble_error_t rc;
if ((rc = advPayloadCopy.updateData(type, data, len)) != BLE_ERROR_NONE) {
return rc;
}
rc = setAdvertisingData(advPayloadCopy, _scanResponse);
if (rc == BLE_ERROR_NONE) {
_advPayload = advPayloadCopy;
}
return rc;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setAdvertisingPayload(const GapAdvertisingData &payload)
{
ble_error_t rc = setAdvertisingData(payload, _scanResponse);
if (rc == BLE_ERROR_NONE) {
_advPayload = payload;
}
return rc;
}
template<class Impl>
const GapAdvertisingData &LegacyGap<Impl>::getAdvertisingPayload(void) const
{
return _advPayload;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::accumulateScanResponse(
GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len
) {
GapAdvertisingData scanResponseCopy = _scanResponse;
ble_error_t rc;
if ((rc = scanResponseCopy.addData(type, data, len)) != BLE_ERROR_NONE) {
return rc;
}
rc = setAdvertisingData(_advPayload, scanResponseCopy);
if (rc == BLE_ERROR_NONE) {
_scanResponse = scanResponseCopy;
}
return rc;
}
template<class Impl>
void LegacyGap<Impl>::clearScanResponse(void)
{
_scanResponse.clear();
setAdvertisingData(_advPayload, _scanResponse);
}
#endif // BLE_ROLE_BROADCASTER
#if BLE_ROLE_OBSERVER
template<class Impl>
ble_error_t LegacyGap<Impl>::setScanParams(
uint16_t interval,
uint16_t window,
uint16_t timeout,
bool activeScanning
) {
ble_error_t rc;
if (((rc = _scanningParams.setInterval(interval)) == BLE_ERROR_NONE) &&
((rc = _scanningParams.setWindow(window)) == BLE_ERROR_NONE) &&
((rc = _scanningParams.setTimeout(timeout)) == BLE_ERROR_NONE)) {
_scanningParams.setActiveScanning(activeScanning);
return BLE_ERROR_NONE;
}
return rc;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setScanParams(const GapScanningParams& scanningParams) {
return setScanParams(
scanningParams.getInterval(),
scanningParams.getWindow(),
scanningParams.getTimeout(),
scanningParams.getActiveScanning()
);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setScanInterval(uint16_t interval)
{
return _scanningParams.setInterval(interval);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setScanWindow(uint16_t window)
{
ble_error_t rc;
if ((rc = _scanningParams.setWindow(window)) != BLE_ERROR_NONE) {
return rc;
}
/* If scanning is already active, propagate the new setting to the stack. */
if (scanningActive) {
return startRadioScan(_scanningParams);
}
return BLE_ERROR_NONE;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setScanTimeout(uint16_t timeout)
{
ble_error_t rc;
if ((rc = _scanningParams.setTimeout(timeout)) != BLE_ERROR_NONE) {
return rc;
}
/* If scanning is already active, propagate the new settings to the stack. */
if (scanningActive) {
return startRadioScan(_scanningParams);
}
return BLE_ERROR_NONE;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setActiveScanning(bool activeScanning)
{
_scanningParams.setActiveScanning(activeScanning);
/* If scanning is already active, propagate the new settings to the stack. */
if (scanningActive) {
return startRadioScan(_scanningParams);
}
return BLE_ERROR_NONE;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::startScan(
void (*callback)(const AdvertisementCallbackParams_t *params)
) {
ble_error_t err = BLE_ERROR_NONE;
if (callback) {
if ((err = startRadioScan(_scanningParams)) == BLE_ERROR_NONE) {
scanningActive = true;
onAdvertisementReport.attach(callback);
}
}
return err;
}
#endif // BLE_ROLE_OBSERVER
#if BLE_ROLE_BROADCASTER
template<class Impl>
GapAdvertisingParams &LegacyGap<Impl>::getAdvertisingParams(void)
{
return _advParams;
}
template<class Impl>
const GapAdvertisingParams &LegacyGap<Impl>::getAdvertisingParams(void) const
{
return _advParams;
}
template<class Impl>
void LegacyGap<Impl>::setAdvertisingParams(const GapAdvertisingParams &newParams)
{
_advParams = newParams;
}
#endif // BLE_ROLE_BROADCASTER
template<class Impl>
void LegacyGap<Impl>::onTimeout(TimeoutEventCallback_t callback)
{
timeoutCallbackChain.add(callback);
}
template<class Impl>
typename LegacyGap<Impl>::TimeoutEventCallbackChain_t& LegacyGap<Impl>::onTimeout()
{
return timeoutCallbackChain;
}
#if BLE_FEATURE_CONNECTABLE
template<class Impl>
void LegacyGap<Impl>::onConnection(ConnectionEventCallback_t callback)
{
connectionCallChain.add(callback);
}
template<class Impl>
typename LegacyGap<Impl>::ConnectionEventCallbackChain_t& LegacyGap<Impl>::onConnection()
{
return connectionCallChain;
}
template<class Impl>
void LegacyGap<Impl>::onDisconnection(DisconnectionEventCallback_t callback)
{
disconnectionCallChain.add(callback);
}
template<class Impl>
typename LegacyGap<Impl>::DisconnectionEventCallbackChain_t& LegacyGap<Impl>::onDisconnection()
{
return disconnectionCallChain;
}
#endif // BLE_FEATURE_CONNECTABLE
template<class Impl>
void LegacyGap<Impl>::onRadioNotification(void (*callback)(bool param))
{
radioNotificationCallback.attach(callback);
}
template<class Impl>
void LegacyGap<Impl>::onShutdown(const GapShutdownCallback_t& callback)
{
shutdownCallChain.add(callback);
}
template<class Impl>
typename LegacyGap<Impl>::GapShutdownCallbackChain_t& LegacyGap<Impl>::onShutdown()
{
return shutdownCallChain;
}
template<class Impl>
LegacyGap<Impl>::AdvertisementCallbackParams_t::AdvertisementCallbackParams_t() :
peerAddr(),
@ -628,9 +83,7 @@ LegacyGap<Impl>::AdvertisementCallbackParams_t::AdvertisementCallbackParams_t()
isScanResponse(),
type(),
advertisingDataLen(0),
advertisingData(NULL),
addressType(),
peerAddrType(PeerAddressType_t::PUBLIC)
advertisingData(NULL)
{
}
@ -656,36 +109,6 @@ ble_error_t LegacyGap<Impl>::getRandomAddressType(
}
}
template<class Impl>
LegacyGap<Impl>::ConnectionCallbackParams_t::ConnectionCallbackParams_t(
Handle_t handleIn,
Role_t roleIn,
BLEProtocol::AddressType_t peerAddrTypeIn,
const uint8_t *peerAddrIn,
BLEProtocol::AddressType_t ownAddrTypeIn,
const uint8_t *ownAddrIn,
const ConnectionParams_t *connectionParamsIn,
const uint8_t *peerResolvableAddrIn,
const uint8_t *localResolvableAddrIn
) : handle(handleIn),
role(roleIn),
peerAddrType(peerAddrTypeIn),
peerAddr(),
ownAddrType(ownAddrTypeIn),
ownAddr(),
connectionParams(connectionParamsIn),
peerResolvableAddr(),
localResolvableAddr(),
peerAddressType(convert_legacy_address_type(peerAddrTypeIn))
{
constructor_helper(
peerAddrIn,
ownAddrIn,
peerResolvableAddrIn,
localResolvableAddrIn
);
}
template<class Impl>
LegacyGap<Impl>::ConnectionCallbackParams_t::ConnectionCallbackParams_t(
Handle_t handleIn,
@ -699,10 +122,8 @@ LegacyGap<Impl>::ConnectionCallbackParams_t::ConnectionCallbackParams_t(
const uint8_t *localResolvableAddrIn
) : handle(handleIn),
role(roleIn),
peerAddrType(),
peerAddr(),
ownAddrType(ownAddrTypeIn),
ownAddr(),
connectionParams(connectionParamsIn),
peerResolvableAddr(),
localResolvableAddr(),
@ -714,8 +135,6 @@ LegacyGap<Impl>::ConnectionCallbackParams_t::ConnectionCallbackParams_t(
peerResolvableAddrIn,
localResolvableAddrIn
);
convert_address_type(peerAddrTypeIn, peerAddrIn, peerAddrType);
}
template <class Impl>
@ -727,97 +146,15 @@ void LegacyGap<Impl>::ConnectionCallbackParams_t::constructor_helper(
) {
memcpy(peerAddr, peerAddrIn, ADDR_LEN);
if (ownAddrIn) {
memcpy(ownAddr, ownAddrIn, ADDR_LEN);
} else {
memset(ownAddr, 0, ADDR_LEN);
}
if (peerResolvableAddrIn) {
memcpy(peerResolvableAddr, peerResolvableAddrIn, ADDR_LEN);
} else {
memset(ownAddr, 0, ADDR_LEN);
}
if (localResolvableAddrIn) {
memcpy(localResolvableAddr, localResolvableAddrIn, ADDR_LEN);
} else {
memset(ownAddr, 0, ADDR_LEN);
}
}
#if BLE_ROLE_CENTRAL
template<class Impl>
ble_error_t LegacyGap<Impl>::connect(
const BLEProtocol::AddressBytes_t peerAddr,
DeprecatedAddressType_t peerAddrType,
const ConnectionParams_t *connectionParams,
const GapScanningParams *scanParams
) {
return connect(
peerAddr,
(BLEProtocol::AddressType_t) peerAddrType,
connectionParams,
scanParams
);
}
#endif // BLE_ROLE_CENTRAL
template<class Impl>
void LegacyGap<Impl>::processConnectionEvent(
Handle_t handle,
Role_t role,
BLEProtocol::AddressType_t peerAddrType,
const BLEProtocol::AddressBytes_t peerAddr,
BLEProtocol::AddressType_t ownAddrType,
const BLEProtocol::AddressBytes_t ownAddr,
const ConnectionParams_t *connectionParams,
const uint8_t *peerResolvableAddr,
const uint8_t *localResolvableAddr
) {
/* Update Gap state */
state.advertising = 0;
state.connected = 1;
++connectionCount;
ConnectionCallbackParams_t callbackParams(
handle,
role,
peerAddrType,
peerAddr,
ownAddrType,
ownAddr,
connectionParams,
peerResolvableAddr,
localResolvableAddr
);
connectionCallChain.call(&callbackParams);
}
template<class Impl>
void LegacyGap<Impl>::processAdvertisementReport(
const BLEProtocol::AddressBytes_t peerAddr,
int8_t rssi,
bool isScanResponse,
GapAdvertisingParams::AdvertisingType_t type,
uint8_t advertisingDataLen,
const uint8_t *advertisingData,
BLEProtocol::AddressType_t addressType
) {
AdvertisementCallbackParams_t params;
memcpy(params.peerAddr, peerAddr, ADDR_LEN);
params.rssi = rssi;
params.isScanResponse = isScanResponse;
params.type = type;
params.advertisingDataLen = advertisingDataLen;
params.advertisingData = advertisingData;
params.addressType = addressType;
params.peerAddrType = convert_legacy_address_type(addressType);
onAdvertisementReport.call(&params);
}
template<class Impl>
void LegacyGap<Impl>::processAdvertisementReport(
const BLEProtocol::AddressBytes_t peerAddr,
@ -836,21 +173,10 @@ void LegacyGap<Impl>::processAdvertisementReport(
params.type = type;
params.advertisingDataLen = advertisingDataLen;
params.advertisingData = advertisingData;
params.peerAddrType = addressType;
convert_address_type(
addressType,
peerAddr,
params.addressType
);
onAdvertisementReport.call(&params);
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#if BLE_ROLE_BROADCASTER
template<class Impl>
uint16_t LegacyGap<Impl>::getMinAdvertisingInterval(void) const
@ -917,21 +243,6 @@ ble_error_t LegacyGap<Impl>::getAppearance(GapAdvertisingData::Appearance *appea
#endif // BLE_FEATURE_GATT_SERVER
#if BLE_ROLE_BROADCASTER
template<class Impl>
ble_error_t LegacyGap<Impl>::setAdvertisingData(
const GapAdvertisingData &advData,
const GapAdvertisingData &scanResponse
) {
return impl()->setAdvertisingData_(advData, scanResponse);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::startAdvertising(const GapAdvertisingParams &params) {
return impl()->startAdvertising_(params);
}
#endif // BLE_ROLE_BROADCASTER
template<class Impl>
ble_error_t LegacyGap<Impl>::reset(void)
{
@ -1062,14 +373,6 @@ ble_error_t LegacyGap<Impl>::setWhitelist_(const Whitelist_t &whitelist) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setAddress_(
BLEProtocol::AddressType_t type,
const BLEProtocol::AddressBytes_t address
) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::getAddress_(
BLEProtocol::AddressType_t *typeP,
@ -1078,107 +381,6 @@ ble_error_t LegacyGap<Impl>::getAddress_(
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::stopAdvertising_(void) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::connect_(
const BLEProtocol::AddressBytes_t peerAddr,
PeerAddressType_t peerAddrType,
const ConnectionParams_t *connectionParams,
const GapScanningParams *scanParams
) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::connect_(
const BLEProtocol::AddressBytes_t peerAddr,
BLEProtocol::AddressType_t peerAddrType,
const ConnectionParams_t *connectionParams,
const GapScanningParams *scanParams
) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::disconnect_(
Handle_t connectionHandle, DisconnectionReason_t reason
) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::disconnect_(DisconnectionReason_t reason) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::updateConnectionParams_(
Handle_t handle,
const ConnectionParams_t *params
) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setTxPower_(int8_t txPower) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
void LegacyGap<Impl>::getPermittedTxPowerValues_(
const int8_t **valueArrayPP, size_t *countP
) {
*countP = 0;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setAdvertisingPolicyMode_(AdvertisingPolicyMode_t mode) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setScanningPolicyMode_(ScanningPolicyMode_t mode) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setInitiatorPolicyMode_(InitiatorPolicyMode_t mode) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
typename LegacyGap<Impl>::AdvertisingPolicyMode_t
LegacyGap<Impl>::getAdvertisingPolicyMode_(void) const {
return LegacyGap::ADV_POLICY_IGNORE_WHITELIST;
}
template<class Impl>
typename LegacyGap<Impl>::ScanningPolicyMode_t
LegacyGap<Impl>::getScanningPolicyMode_(void) const {
return LegacyGap::SCAN_POLICY_IGNORE_WHITELIST;
}
template<class Impl>
typename LegacyGap<Impl>::InitiatorPolicyMode_t
LegacyGap<Impl>::getInitiatorPolicyMode_(void) const {
return LegacyGap::INIT_POLICY_IGNORE_WHITELIST;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::startRadioScan_(const GapScanningParams &scanningParams) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::initRadioNotification_(void) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::getPreferredConnectionParams_(ConnectionParams_t *params)
{
@ -1217,18 +419,5 @@ ble_error_t LegacyGap<Impl>::getAppearance_(GapAdvertisingData::Appearance *appe
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setAdvertisingData_(
const GapAdvertisingData &advData,
const GapAdvertisingData &scanResponse
) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
template<class Impl>
ble_error_t LegacyGap<Impl>::startAdvertising_(const GapAdvertisingParams &params) {
return BLE_ERROR_NOT_IMPLEMENTED;
}
} // namespace interface
} // namespace ble

View File

@ -469,47 +469,6 @@ bool GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
return _pal_gap.is_feature_supported(feature);
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::setAddress_(
LegacyAddressType_t type,
const uint8_t* address
)
{
switch (type) {
case LegacyAddressType::PUBLIC:
// The public address cannot be set, just set the type to public
_address_type = type;
return BLE_ERROR_NONE;
case LegacyAddressType::RANDOM_STATIC: {
if (is_random_static_address(address) == false) {
return BLE_ERROR_INVALID_PARAM;
}
ble_error_t err = _pal_gap.set_random_address(
ble::address_t(address)
);
if (err) {
return err;
}
_address_type = type;
_address = ble::address_t(address);
_random_static_identity_address = ble::address_t(address);
return BLE_ERROR_NONE;
}
case LegacyAddressType::RANDOM_PRIVATE_RESOLVABLE:
case LegacyAddressType::RANDOM_PRIVATE_NON_RESOLVABLE:
// Note: it is not allowed to set directly these addresses
// privacy management handled it for users.
return BLE_ERROR_INVALID_PARAM;
default:
return BLE_ERROR_INVALID_PARAM;
}
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::setRandomStaticAddress_(
const ble::address_t& address
@ -567,25 +526,6 @@ uint16_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventH
return GapAdvertisingParams::GAP_ADV_PARAMS_INTERVAL_MAX;
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::stopAdvertising_()
{
useVersionOneAPI();
ble_error_t err = _pal_gap.advertising_enable(false);
if (err) {
return err;
}
_advertising_timeout.detach();
state.advertising = false;
#if BLE_FEATURE_PRIVACY
// Stop address rotation if required
set_random_address_rotation(false);
#endif
return BLE_ERROR_NONE;
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::stopScan_()
{
@ -1572,7 +1512,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
);
}
BLE_DEPRECATED_API_USE_BEGIN()
LegacyGap::processConnectionEvent(
handle,
role,
@ -1584,7 +1523,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
peerResolvableAddr,
localResolvableAddr
);
BLE_DEPRECATED_API_USE_END()
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
@ -1609,12 +1547,10 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
);
}
BLE_DEPRECATED_API_USE_BEGIN()
LegacyGap::processDisconnectionEvent(
handle,
reason
);
BLE_DEPRECATED_API_USE_END()
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
@ -1656,18 +1592,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
}
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::process_scan_timeout()
{
ble_error_t err = _pal_gap.scan_enable(false, false);
if (err) {
// TODO: define the mechanism signaling the error
}
BLE_DEPRECATED_API_USE_BEGIN()
LegacyGap::processTimeoutEvent(LegacyGap::TIMEOUT_SRC_SCAN);
BLE_DEPRECATED_API_USE_END()
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::on_advertising_timeout()
{
@ -1687,9 +1611,7 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
set_random_address_rotation(false);
#endif
BLE_DEPRECATED_API_USE_BEGIN()
LegacyGap::processTimeoutEvent(LegacyGap::TIMEOUT_SRC_ADVERTISING);
BLE_DEPRECATED_API_USE_END()
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
@ -1792,7 +1714,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
);
}
BLE_DEPRECATED_API_USE_BEGIN()
LegacyGap::processAdvertisementReport(
advertising.address.data(),
advertising.rssi,
@ -1802,7 +1723,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
advertising.data.data(),
peer_address_type
);
BLE_DEPRECATED_API_USE_END()
}
}
@ -1832,9 +1752,7 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
// event
// TODO: Define events in case of connection faillure
BLE_DEPRECATED_API_USE_BEGIN()
LegacyGap::processTimeoutEvent(LegacyGap::TIMEOUT_SRC_CONN);
BLE_DEPRECATED_API_USE_END()
return;
}
@ -3019,7 +2937,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
// This handler is not supposed to be called with V1 API as the extended
// scan is not called. However the Cordio LL stack doesn't act that way
// and use extended scan with V1 API.
BLE_DEPRECATED_API_USE_BEGIN()
LegacyGap::processAdvertisementReport(
address.data(),
rssi,
@ -3029,7 +2946,6 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
data,
(peer_address_type_t::type) address_type->value()
);
BLE_DEPRECATED_API_USE_END()
}
}