broadcaster role cordio pass

pull/9790/head
paul-szczepanek-arm 2019-02-22 16:09:01 +00:00 committed by Vincent Coubard
parent c198603c63
commit eb16fb6053
14 changed files with 203 additions and 111 deletions

View File

@ -676,17 +676,22 @@ public:
{
}
};
#endif // BLE_FEATURE_CONNECTABLE
#endif // BLE_FEATURE_CONNECTABLE
#if BLE_FEATURE_PRIVACY
#if BLE_ROLE_PERIPHERAL
/**
* @copydoc ble::peripheral_privacy_configuration_t
*/
typedef ble::peripheral_privacy_configuration_t PeripheralPrivacyConfiguration_t;
#endif // BLE_ROLE_PERIPHERAL
#if BLE_ROLE_CENTRAL
/**
* @copydoc ble::central_privay_configuration_t
*/
typedef ble::central_privay_configuration_t CentralPrivacyConfiguration_t;
#endif // BLE_ROLE_CENTRAL
#endif // BLE_FEATURE_PRIVACY
/**
* Number of microseconds in 1.25 milliseconds.
@ -722,7 +727,7 @@ public:
*/
typedef CallChainOfFunctionPointersWithContext<TimeoutSource_t>
TimeoutEventCallbackChain_t;
#if BLE_FEATURE_CONNECTABLE
/**
* Connection event handler.
*
@ -754,7 +759,7 @@ public:
*/
typedef CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t *>
DisconnectionEventCallbackChain_t;
#endif // BLE_FEATURE_CONNECTABLE
/**
* Radio notification event handler.
*

View File

@ -511,6 +511,7 @@ public:
)
{
}
#endif // BLE_FEATURE_PHY_MANAGEMENT
/**
* Function invoked when the connections changes the maximum number of octets
@ -531,7 +532,6 @@ public:
)
{
}
#endif // BLE_FEATURE_PHY_MANAGEMENT
protected:
/**
* Prevent polymorphic deletion and avoid unnecessary virtual destructor

View File

@ -126,8 +126,10 @@ public:
*/
GenericGap(
pal::EventQueue &event_queue,
PalGap &pal_gap,
pal::GenericAccessService &generic_access_service
PalGap &pal_gap
#if BLE_FEATURE_GATT_SERVER
, pal::GenericAccessService &generic_access_service
#endif
#if BLE_FEATURE_SECURITY
PalSecurityManager &pal_sm
#endif
@ -553,6 +555,8 @@ public:
*/
ble_error_t enablePrivacy_(bool enable);
#if BLE_FEATURE_PRIVACY
#if BLE_ROLE_BROADCASTER
/**
* @see Gap::setPeripheralPrivacyConfiguration
*/
@ -566,7 +570,8 @@ public:
ble_error_t getPeripheralPrivacyConfiguration_(
PeripheralPrivacyConfiguration_t *configuration
);
#endif // BLE_ROLE_BROADCASTER
#if BLE_ROLE_OBSERVER
/**
* @see Gap::setCentralPrivacyConfiguration
*/
@ -580,6 +585,8 @@ public:
ble_error_t getCentralPrivacyConfiguration_(
CentralPrivacyConfiguration_t *configuration
);
#endif // BLE_ROLE_OBSERVER
#endif // BLE_FEATURE_PRIVACY
/**
* @see Gap::setAdvertisingData

View File

@ -1,75 +1,75 @@
{
"name": "ble",
"config": {
"ble-role-observer": {
"help": "Include observer BLE role support (scanning for and processing advertising packets).",
"value": true,
"macro_name": "BLE_ROLE_OBSERVER"
},
"ble-role-broadcaster": {
"help": "Include broadcaster BLE role support (sending advertising packets).",
"value": true,
"macro_name": "BLE_ROLE_BROADCASTER"
},
"ble-role-central": {
"help": "Include central BLE role support (initiates connections), depends on observer role.",
"value": true,
"macro_name": "BLE_ROLE_CENTRAL"
},
"ble-role-peripheral": {
"help": "Include peripheral BLE role support (accepts connections), depends on broadcaster role.",
"value": true,
"macro_name": "BLE_ROLE_PERIPHERAL"
},
"ble-feature-gatt-client": {
"help": "Include Gatt Client BLE role support (requests remote operations on attributes), depends on peripheral and central role.",
"value": true,
"macro_name": "BLE_FEATURE_GATT_CLIENT"
},
"ble-feature-gatt-server": {
"help": "Include Gatt Server BLE role support (executes operations on stored attributes), depends on peripheral or central role.",
"value": true,
"macro_name": "BLE_FEATURE_GATT_SERVER"
},
"ble-feature-security": {
"help": "Include security support (key management), depends on peripheral or central role.",
"value": true,
"macro_name": "BLE_FEATURE_SECURITY"
},
"ble-feature-secure-connections": {
"help": "Include secure connections support, depends on the security feature.",
"value": true,
"macro_name": "BLE_FEATURE_SECURE_CONNECTIONS"
},
"ble-feature-signing": {
"help": "Include signing support (signed attribute writes), depends on the security feature.",
"value": true,
"macro_name": "BLE_FEATURE_SIGNING"
},
"ble-feature-whitelist": {
"help": "Include whitelist support (peer filtering), depends on the security feature.",
"value": true,
"macro_name": "BLE_FEATURE_WHITELIST"
},
"ble-feature-privacy": {
"help": "Include privacy support (random resolvable addresses), depends on the security feature.",
"value": true,
"macro_name": "BLE_FEATURE_PRIVACY"
},
"ble-feature-phy-management": {
"help": "Additional PHY support (2M and Coded)",
"value": true,
"macro_name": "BLE_FEATURE_PHY_MANAGEMENT"
},
"ble-feature-extended-advertising": {
"help": "Include extended advertising support (advertising sets, secondary channels), depends on the phy management feature.",
"value": true,
"macro_name": "BLE_FEATURE_EXTENDED_ADVERTISING"
},
"ble-feature-periodic-advertising": {
"help": "Include periodic advertising support, depends on the extended advertising feature.",
"value": true,
"macro_name": "BLE_FEATURE_PERIODIC_ADVERTISING"
}
}
"config": {
"ble-feature-observer": {
"help": "Include observer BLE role support, allows listening for and processing advertising packets.",
"value": false,
"macro_name": "BLE_ROLE_OBSERVER"
},
"ble-role-broadcaster": {
"help": "Include broadcaster BLE role support, allows sending advertising packets.",
"value": true,
"macro_name": "BLE_ROLE_BROADCASTER"
},
"ble-role-peripheral": {
"help": "Include peripheral BLE role support, depends on observer role.",
"value": false,
"macro_name": "BLE_ROLE_PERIPHERAL"
},
"ble-role-central": {
"help": "Include central BLE role support, depends on broadcaster role.",
"value": false,
"macro_name": "BLE_ROLE_CENTRAL"
},
"ble-feature-security": {
"help": "Include security BLE role support, depends on peripheral or central role.",
"value": false,
"macro_name": "BLE_FEATURE_SECURITY"
},
"ble-feature-secure-connections": {
"help": "Include secure connections support, depends on the security feature.",
"value": false,
"macro_name": "BLE_FEATURE_SECURE_CONNECTIONS"
},
"ble-feature-signing": {
"help": "Include signing support, depends on the security feature.",
"value": false,
"macro_name": "BLE_FEATURE_SIGNING"
},
"ble-feature-whitelist": {
"help": "Include whitelist support, depends on the security feature.",
"value": false,
"macro_name": "BLE_FEATURE_WHITELIST"
},
"ble-feature-privacy": {
"help": "Include privacy support, depends on the security feature.",
"value": false,
"macro_name": "BLE_FEATURE_PRIVACY"
},
"ble-feature-phy-management": {
"help": "Include additional PHY support.",
"value": false,
"macro_name": "BLE_FEATURE_PHY_MANAGEMENT"
},
"ble-feature-extended-advertising": {
"help": "Include extended advertising support, depends on the phy management feature.",
"value": false,
"macro_name": "BLE_FEATURE_EXTENDED_ADVERTISING"
},
"ble-feature-periodic-advertising": {
"help": "Include periodic advertising support, depends on the extended advertising feature.",
"value": false,
"macro_name": "BLE_FEATURE_PERIODIC_ADVERTISING"
},
"ble-feature-gatt-client": {
"help": "Include Gatt Client BLE role support, depends on peripheral and central role.",
"value": false,
"macro_name": "BLE_FEATURE_GATT_CLIENT"
},
"ble-feature-gatt-server": {
"help": "Include Gatt Server BLE role support, depends on peripheral or central role.",
"value": false,
"macro_name": "BLE_FEATURE_GATT_SERVER"
}
}
}

View File

@ -369,6 +369,7 @@ ble_error_t BLE::setAddress(
return gap().setAddress(type, address);
}
#if BLE_ROLE_CENTRAL
ble_error_t BLE::connect(
const BLEProtocol::AddressBytes_t peerAddr,
BLEProtocol::AddressType_t peerAddrType,
@ -377,15 +378,19 @@ ble_error_t BLE::connect(
) {
return gap().connect(peerAddr, peerAddrType, connectionParams, scanParams);
}
#endif // BLE_ROLE_CENTRAL
#if BLE_FEATURE_CONNECTABLE
ble_error_t BLE::disconnect(Gap::DisconnectionReason_t reason) {
return gap().disconnect(reason);
}
#endif // BLE_FEATURE_CONNECTABLE
Gap::GapState_t BLE::getGapState(void) const {
return gap().getState();
}
#if BLE_ROLE_BROADCASTER
void BLE::setAdvertisingType(GapAdvertisingParams::AdvertisingType advType) {
gap().setAdvertisingType(advType);
}
@ -453,7 +458,9 @@ ble_error_t BLE::startAdvertising(void) {
ble_error_t BLE::stopAdvertising(void) {
return gap().stopAdvertising();
}
#endif // BLE_ROLE_BROADCASTER
#if BLE_ROLE_OBSERVER
ble_error_t BLE::setScanParams(uint16_t interval,
uint16_t window,
uint16_t timeout,
@ -480,7 +487,9 @@ void BLE::setActiveScan(bool activeScanning) {
ble_error_t BLE::startScan(void (*callback)(const Gap::AdvertisementCallbackParams_t *params)) {
return gap().startScan(callback);
}
#endif // BLE_ROLE_OBSERVER
#if BLE_FEATURE_CONNECTABLE
ble_error_t BLE::disconnect(Gap::Handle_t connectionHandle, Gap::DisconnectionReason_t reason) {
return gap().disconnect(connectionHandle, reason);
}
@ -488,6 +497,7 @@ ble_error_t BLE::disconnect(Gap::Handle_t connectionHandle, Gap::DisconnectionRe
ble_error_t BLE::updateConnectionParams(Gap::Handle_t handle, const Gap::ConnectionParams_t *params) {
return gap().updateConnectionParams(handle, params);
}
#endif // BLE_FEATURE_CONNECTABLE
ble_error_t BLE::setTxPower(int8_t txPower) {
return gap().setTxPower(txPower);
@ -501,9 +511,11 @@ void BLE::onTimeout(Gap::TimeoutEventCallback_t timeoutCallback) {
gap().onTimeout(timeoutCallback);
}
#if BLE_FEATURE_CONNECTABLE
void BLE::onDisconnection(Gap::DisconnectionEventCallback_t disconnectionCallback) {
gap().onDisconnection(disconnectionCallback);
}
#endif // BLE_FEATURE_CONNECTABLE
void BLE::onRadioNotification(void (*callback)(bool)) {
gap().onRadioNotification(callback);

View File

@ -14,6 +14,10 @@
* limitations under the License.
*/
#include "BLERoles.h"
#if BLE_ROLE_OBSERVER
#include "ble/Gap.h"
#include "ble/GapScanningParams.h"
@ -73,3 +77,5 @@ GapScanningParams::setActiveScanning(bool activeScanning)
{
_activeScanning = activeScanning;
}
#endif

View File

@ -74,6 +74,7 @@ ble::peer_address_type_t convert_legacy_address_type(
namespace ble {
namespace interface {
#if BLE_FEATURE_WHITELIST
template<class Impl>
uint8_t LegacyGap<Impl>::getMaxWhitelistSize(void) const {
return impl()->getMaxWhitelistSize_();
@ -88,7 +89,9 @@ template<class Impl>
ble_error_t LegacyGap<Impl>::setWhitelist(const Whitelist_t &whitelist) {
return impl()->setWhitelist_(whitelist);
}
#endif // BLE_FEATURE_WHITELIST
#if BLE_FEATURE_CONNECTABLE
template<class Impl>
void LegacyGap<Impl>::processConnectionEvent(
Handle_t handle,
@ -120,6 +123,7 @@ void LegacyGap<Impl>::processConnectionEvent(
connectionCallChain.call(&callbackParams);
}
#endif // BLE_FEATURE_CONNECTABLE
template<class Impl>
ble_error_t LegacyGap<Impl>::setAddress(
@ -137,11 +141,14 @@ 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,
@ -171,7 +178,9 @@ ble_error_t LegacyGap<Impl>::connect(
scanParams
);
}
#endif // BLE_ROLE_CENTRAL
#if BLE_FEATURE_CONNECTABLE
template<class Impl>
ble_error_t LegacyGap<Impl>::disconnect(
Handle_t connectionHandle, DisconnectionReason_t reason
@ -191,7 +200,7 @@ ble_error_t LegacyGap<Impl>::updateConnectionParams(
) {
return impl()->updateConnectionParams_(handle, params);
}
#endif // BLE_FEATURE_CONNECTABLE
template<class Impl>
ble_error_t LegacyGap<Impl>::setTxPower(int8_t txPower) {
@ -205,43 +214,53 @@ void LegacyGap<Impl>::getPermittedTxPowerValues(
return impl()->getPermittedTxPowerValues_(valueArrayPP, countP);
}
#if BLE_FEATEURE_WHITELIST
#if BLE_ROLE_BROADCASTER
template<class Impl>
ble_error_t LegacyGap<Impl>::setAdvertisingPolicyMode(AdvertisingPolicyMode_t mode) {
return impl()->setAdvertisingPolicyMode_(mode);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setScanningPolicyMode(ScanningPolicyMode_t mode) {
return impl()->setScanningPolicyMode_(mode);
}
template<class Impl>
ble_error_t LegacyGap<Impl>::setInitiatorPolicyMode(InitiatorPolicyMode_t mode) {
return impl()->setInitiatorPolicyMode_(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_FEATEURE_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) {
@ -264,6 +283,7 @@ 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)
{
@ -432,7 +452,9 @@ 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,
@ -526,7 +548,9 @@ ble_error_t LegacyGap<Impl>::startScan(
return err;
}
#endif // BLE_ROLE_OBSERVER
#if BLE_ROLE_BROADCASTER
template<class Impl>
GapAdvertisingParams &LegacyGap<Impl>::getAdvertisingParams(void)
{
@ -544,6 +568,7 @@ void LegacyGap<Impl>::setAdvertisingParams(const GapAdvertisingParams &newParams
{
_advParams = newParams;
}
#endif // BLE_ROLE_BROADCASTER
template<class Impl>
void LegacyGap<Impl>::onTimeout(TimeoutEventCallback_t callback)
@ -557,6 +582,7 @@ typename LegacyGap<Impl>::TimeoutEventCallbackChain_t& LegacyGap<Impl>::onTimeou
return timeoutCallbackChain;
}
#if BLE_FEATURE_CONNECTION
template<class Impl>
void LegacyGap<Impl>::onConnection(ConnectionEventCallback_t callback)
{
@ -574,6 +600,7 @@ void LegacyGap<Impl>::onDisconnection(DisconnectionEventCallback_t callback)
{
disconnectionCallChain.add(callback);
}
#endif // BLE_FEATURE_CONNECTION
template<class Impl>
typename LegacyGap<Impl>::DisconnectionEventCallbackChain_t& LegacyGap<Impl>::onDisconnection()
@ -599,6 +626,7 @@ typename LegacyGap<Impl>::GapShutdownCallbackChain_t& LegacyGap<Impl>::onShutdow
return shutdownCallChain;
}
#if BLE_ROLE_OBSERVER
template<class Impl>
LegacyGap<Impl>::AdvertisementCallbackParams_t::AdvertisementCallbackParams_t() :
peerAddr(),
@ -611,6 +639,7 @@ LegacyGap<Impl>::AdvertisementCallbackParams_t::AdvertisementCallbackParams_t()
peerAddrType(PeerAddressType_t::PUBLIC)
{
}
#endif // BLE_ROLE_OBSERVER
template<class Impl>
ble_error_t LegacyGap<Impl>::getRandomAddressType(
@ -634,6 +663,7 @@ ble_error_t LegacyGap<Impl>::getRandomAddressType(
}
}
#if BLE_FEATURE_CONNECTABLE
template<class Impl>
LegacyGap<Impl>::ConnectionCallbackParams_t::ConnectionCallbackParams_t(
Handle_t handleIn,
@ -723,7 +753,9 @@ void LegacyGap<Impl>::ConnectionCallbackParams_t::constructor_helper(
memset(ownAddr, 0, ADDR_LEN);
}
}
#endif // BLE_FEATURE_CONNECTABLE
#if BLE_ROLE_CENTRAL
template<class Impl>
ble_error_t LegacyGap<Impl>::connect(
const BLEProtocol::AddressBytes_t peerAddr,
@ -738,7 +770,9 @@ ble_error_t LegacyGap<Impl>::connect(
scanParams
);
}
#endif // BLE_ROLE_CENTRAL
#if BLE_FEATURE_CONNECTABLE
template<class Impl>
void LegacyGap<Impl>::processConnectionEvent(
Handle_t handle,
@ -770,7 +804,9 @@ void LegacyGap<Impl>::processConnectionEvent(
connectionCallChain.call(&callbackParams);
}
#endif // BLE_FEATURE_CONNECTABLE
#if BLE_ROLE_OBSERVER
template<class Impl>
void LegacyGap<Impl>::processAdvertisementReport(
const BLEProtocol::AddressBytes_t peerAddr,
@ -822,6 +858,7 @@ void LegacyGap<Impl>::processAdvertisementReport(
onAdvertisementReport.call(&params);
}
#endif // BLE_ROLE_OBSERVER
#if defined(__GNUC__) && !defined(__CC_ARM)
#pragma GCC diagnostic pop
@ -995,7 +1032,6 @@ ble_error_t LegacyGap<Impl>::reset_(void)
connectionCount = 0;
#endif
/* Clear scanning state */
#if BLE_ROLE_OBSERVER
scanningActive = false;
@ -1014,8 +1050,10 @@ ble_error_t LegacyGap<Impl>::reset_(void)
disconnectionCallChain.clear();
#endif // BLE_FEATURE_CONNECTABLE
radioNotificationCallback = NULL;
#if BLE_ROLE_OBSERVER
onAdvertisementReport = NULL;
ble::interface::Gap<Impl>::_eventHandler = NULL;
#endif
_eventHandler = NULL;
return BLE_ERROR_NONE;
}

View File

@ -49,6 +49,7 @@ uint16_t Gap<Impl>::getMaxActiveSetAdvertisingDataLength()
return impl()->getMaxActiveSetAdvertisingDataLength_();
}
#if BLE_FEATURE_EXTENDED_ADVERTISING
template<class Impl>
ble_error_t Gap<Impl>::createAdvertisingSet(
advertising_handle_t *handle,
@ -63,6 +64,7 @@ ble_error_t Gap<Impl>::destroyAdvertisingSet(advertising_handle_t handle)
{
return impl()->destroyAdvertisingSet_(handle);
}
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
template<class Impl>
ble_error_t Gap<Impl>::setAdvertisingParameters(
@ -406,6 +408,7 @@ Gap<Impl>::Gap() : _eventHandler(NULL)
/* -------------------- Future deprecation ------------------------- */
#if BLE_FEATURE_PRIVACY
template<class Impl>
const peripheral_privacy_configuration_t Gap<Impl>::default_peripheral_privacy_configuration = {
/* use_non_resolvable_random_address */ false,
@ -417,6 +420,7 @@ const central_privay_configuration_t Gap<Impl>::default_central_privacy_configur
/* use_non_resolvable_random_address */ false,
/* resolution_strategy */ central_privay_configuration_t::RESOLVE_AND_FORWARD
};
#endif // BLE_FEATURE_PRIVACY
#if BLE_FEATURE_PRIVACY
template<class Impl>

View File

@ -482,9 +482,8 @@ GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::
);
}
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
_existing_sets.set(LEGACY_ADVERTISING_HANDLE);
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
}
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
@ -1204,7 +1203,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
return BLE_ERROR_NONE;
}
#endif // BLE_FEATURE_WHITELIST
#if BLE_ROLE_BROADCASTER
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
@ -1271,6 +1269,7 @@ typename GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventH
return (InitiatorPolicyMode_t) _initiator_policy_mode.value();
}
#endif // BLE_ROLE_CENTRAL
#endif // BLE_FEATURE_WHITELIST
#if BLE_ROLE_OBSERVER
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
@ -1548,9 +1547,9 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
AdvertisingParameters()
);
}
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
_existing_sets.set(LEGACY_ADVERTISING_HANDLE);
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
return BLE_ERROR_NONE;
}
@ -2600,7 +2599,7 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
)
{
useVersionTwoAPI();
#if BLE_FEATURE_EXTENDED_ADVERTISING
ble_error_t error = BLE_ERROR_NONE;
if (handle >= getMaxAdvertisingSetNumber()) {
@ -2616,7 +2615,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
return BLE_ERROR_INVALID_STATE;
}
#if BLE_FEATURE_EXTENDED_ADVERTISING
if (is_extended_advertising_available()) {
error = _pal_gap.extended_advertising_enable(
/* enable */ true,
@ -2660,6 +2658,9 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
{
useVersionTwoAPI();
ble_error_t status;
#if BLE_FEATURE_EXTENDED_ADVERTISING
if (handle >= getMaxAdvertisingSetNumber()) {
return BLE_ERROR_INVALID_PARAM;
}
@ -2672,9 +2673,6 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
return BLE_ERROR_INVALID_STATE;
}
ble_error_t status;
#if BLE_FEATURE_EXTENDED_ADVERTISING
if (is_extended_advertising_available()) {
status = _pal_gap.extended_advertising_enable(
/*enable ? */ false,
@ -2936,7 +2934,7 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
}
#endif // BLE_FEATURE_CONNECTABLE
#if BLE_ROLE_BROADCASTER
#if BLE_ROLE_OBSERVER
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::on_extended_advertising_report_(
advertising_event_t event_type,
@ -2977,7 +2975,7 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
)
);
}
#endif // BLE_ROLE_BROADCASTER
#endif // BLE_ROLE_OBSERVER
#if BLE_FEATURE_PERIODIC_ADVERTISING
#if BLE_ROLE_OBSERVER

View File

@ -14,6 +14,10 @@
* limitations under the License.
*/
#include "BLERoles.h"
#if BLE_FEATURE_GATT_SERVER
#ifdef TARGET_NRF51822 /* DFU only supported on nrf51 platforms */
#include "ble/services/DFUService.h"
@ -42,3 +46,5 @@ const uint8_t DFUServicePacketCharacteristicUUID[] = {
DFUService::ResetPrepare_t DFUService::handoverCallback = NULL;
#endif /* #ifdef TARGET_NRF51822 */
#endif // BLE_FEATURE_GATT_SERVER

View File

@ -14,6 +14,10 @@
* limitations under the License.
*/
#include "BLERoles.h"
#if BLE_FEATURE_GATT_SERVER
#include "ble/services/UARTService.h"
const uint8_t UARTServiceBaseUUID[UUID::LENGTH_OF_LONG_UUID] = {
@ -40,3 +44,4 @@ const uint8_t UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID] = {
0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
};
#endif // BLE_FEATURE_GATT_SERVER

View File

@ -14,6 +14,10 @@
* limitations under the License.
*/
#include "BLERoles.h"
#if BLE_FEATURE_GATT_SERVER
#include "ble/services/URIBeaconConfigService.h"
#define UUID_URI_BEACON(FIRST, SECOND) { \
@ -33,3 +37,5 @@ const uint8_t UUID_BEACON_PERIOD_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_B
const uint8_t UUID_RESET_CHAR[UUID::LENGTH_OF_LONG_UUID] = UUID_URI_BEACON(0x20, 0x89);
const uint8_t BEACON_UUID[sizeof(UUID::ShortUUIDBytes_t)] = {0xD8, 0xFE};
#endif // BLE_FEATURE_GATT_SERVER

View File

@ -182,8 +182,10 @@ impl::GenericGapImpl& BLE::getGap()
static pal::vendor::cordio::GenericAccessService cordio_gap_service;
static impl::GenericGapImpl gap(
_event_queue,
impl::PalGapImpl::get_gap(),
cordio_gap_service
impl::PalGapImpl::get_gap()
#if BLE_FEATURE_GATT_SERVER
, cordio_gap_service
#endif
#if BLE_FEATURE_SECURITY
, impl::PalSecurityManagerImpl::get_security_manager()
#endif
@ -509,10 +511,11 @@ void BLE::stack_setup()
#if BLE_FEATURE_ATT
AttConnRegister(BLE::connection_handler);
#if BLE_FEATURE_GATT_CLIENT
AttRegister((attCback_t) ble::pal::vendor::cordio::CordioAttClient::att_client_handler);
#if !(BLE_FEATURE_GATT_CLIENT)
#else
AttRegister((attCback_t) ble::vendor::cordio::GattServer::att_cb);
#endif // !(BLE_FEATURE_GATT_CLIENT)
#endif // BLE_FEATURE_GATT_CLIENT
#endif
}

View File

@ -14,6 +14,10 @@
* limitations under the License.
*/
#include "BLERoles.h"
#if BLE_FEATURE_SECURITY
#include <string.h>
#include "CordioPalSecurityManager.h"
@ -40,9 +44,6 @@ CordioSecurityManager<EventHandler>::CordioSecurityManager() :
, _peer_csrks()
#endif
{
#if !(BLE_FEATURE_SECURITY)
#error "Security Manager feature disabledin the config file"
#endif
}
template <class EventHandler>
@ -1026,3 +1027,4 @@ void CordioSecurityManager<EventHandler>::cleanup_peer_csrks() {
} // pal
} // ble
#endif // BLE_FEATURE_SECURITY