mirror of https://github.com/ARMmbed/mbed-os.git
BLE - Cleanup conditional directives in Gap.
- Remove conditional directives for member variables. - Remove conditional directive for processXXX functions that are exclusively used by implementation. - Remove conditional directives on types exported by the class.pull/9790/head
parent
126a7a966e
commit
c9d719a8ca
|
@ -409,7 +409,6 @@ public:
|
|||
CENTRAL = 0x2,
|
||||
};
|
||||
|
||||
#if BLE_ROLE_OBSERVER
|
||||
/**
|
||||
* Representation of a scanned advertising packet.
|
||||
*
|
||||
|
@ -484,9 +483,7 @@ public:
|
|||
*/
|
||||
typedef FunctionPointerWithContext<const AdvertisementCallbackParams_t *>
|
||||
AdvertisementReportCallback_t;
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
/**
|
||||
* Connection events.
|
||||
*
|
||||
|
@ -678,21 +675,15 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#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.
|
||||
|
@ -728,7 +719,7 @@ public:
|
|||
*/
|
||||
typedef CallChainOfFunctionPointersWithContext<TimeoutSource_t>
|
||||
TimeoutEventCallbackChain_t;
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
|
||||
/**
|
||||
* Connection event handler.
|
||||
*
|
||||
|
@ -760,7 +751,7 @@ public:
|
|||
*/
|
||||
typedef CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t *>
|
||||
DisconnectionEventCallbackChain_t;
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
|
||||
/**
|
||||
* Radio notification event handler.
|
||||
*
|
||||
|
@ -2267,7 +2258,6 @@ protected:
|
|||
|
||||
/* Entry points for the underlying stack to report events back to the user. */
|
||||
public:
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
/**
|
||||
* Notify all registered connection event handlers of a connection event.
|
||||
*
|
||||
|
@ -2362,8 +2352,7 @@ public:
|
|||
"Use EventHandler::onDisconnectionComplete() instead"
|
||||
)
|
||||
void processDisconnectionEvent(Handle_t handle, DisconnectionReason_t reason);
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
#if BLE_ROLE_OBSERVER
|
||||
|
||||
/**
|
||||
* Forward a received advertising packet to all registered event handlers
|
||||
* listening for scanned packet events.
|
||||
|
@ -2433,7 +2422,7 @@ public:
|
|||
const uint8_t *advertisingData,
|
||||
BLEProtocol::AddressType_t addressType = BLEProtocol::AddressType::RANDOM_STATIC
|
||||
);
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
|
||||
/**
|
||||
* Notify the occurrence of a timeout event to all registered timeout events
|
||||
* handler.
|
||||
|
@ -2454,7 +2443,6 @@ public:
|
|||
void processTimeoutEvent(TimeoutSource_t source);
|
||||
|
||||
protected:
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
/**
|
||||
* Current advertising parameters.
|
||||
*/
|
||||
|
@ -2464,36 +2452,31 @@ protected:
|
|||
* Current advertising data.
|
||||
*/
|
||||
GapAdvertisingData _advPayload;
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
#if BLE_ROLE_OBSERVER
|
||||
|
||||
/**
|
||||
* Current scanning parameters.
|
||||
*/
|
||||
GapScanningParams _scanningParams;
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
|
||||
/**
|
||||
* Current scan response.
|
||||
*/
|
||||
GapAdvertisingData _scanResponse;
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
|
||||
/**
|
||||
* Number of open connections.
|
||||
*/
|
||||
uint8_t connectionCount;
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
|
||||
/**
|
||||
* Current GAP state.
|
||||
*/
|
||||
GapState_t state;
|
||||
#if BLE_ROLE_OBSERVER
|
||||
|
||||
/**
|
||||
* Active scanning flag.
|
||||
*/
|
||||
bool scanningActive;
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -2507,14 +2490,12 @@ protected:
|
|||
*/
|
||||
RadioNotificationEventCallback_t radioNotificationCallback;
|
||||
|
||||
#if BLE_ROLE_OBSERVER
|
||||
/**
|
||||
* The registered callback handler for scanned advertisement packet
|
||||
* notifications.
|
||||
*/
|
||||
AdvertisementReportCallback_t onAdvertisementReport;
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
|
||||
/**
|
||||
* Callchain containing all registered callback handlers for connection
|
||||
* events.
|
||||
|
@ -2526,7 +2507,7 @@ protected:
|
|||
* events.
|
||||
*/
|
||||
DisconnectionEventCallbackChain_t disconnectionCallChain;
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
|
||||
private:
|
||||
/**
|
||||
* Callchain containing all registered callback handlers for shutdown
|
||||
|
|
|
@ -91,7 +91,6 @@ ble_error_t LegacyGap<Impl>::setWhitelist(const Whitelist_t &whitelist) {
|
|||
}
|
||||
#endif // BLE_FEATURE_WHITELIST
|
||||
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
template<class Impl>
|
||||
void LegacyGap<Impl>::processConnectionEvent(
|
||||
Handle_t handle,
|
||||
|
@ -123,7 +122,6 @@ void LegacyGap<Impl>::processConnectionEvent(
|
|||
|
||||
connectionCallChain.call(&callbackParams);
|
||||
}
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t LegacyGap<Impl>::setAddress(
|
||||
|
@ -626,7 +624,6 @@ typename LegacyGap<Impl>::GapShutdownCallbackChain_t& LegacyGap<Impl>::onShutdow
|
|||
return shutdownCallChain;
|
||||
}
|
||||
|
||||
#if BLE_ROLE_OBSERVER
|
||||
template<class Impl>
|
||||
LegacyGap<Impl>::AdvertisementCallbackParams_t::AdvertisementCallbackParams_t() :
|
||||
peerAddr(),
|
||||
|
@ -639,7 +636,6 @@ LegacyGap<Impl>::AdvertisementCallbackParams_t::AdvertisementCallbackParams_t()
|
|||
peerAddrType(PeerAddressType_t::PUBLIC)
|
||||
{
|
||||
}
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
|
||||
template<class Impl>
|
||||
ble_error_t LegacyGap<Impl>::getRandomAddressType(
|
||||
|
@ -663,7 +659,6 @@ ble_error_t LegacyGap<Impl>::getRandomAddressType(
|
|||
}
|
||||
}
|
||||
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
template<class Impl>
|
||||
LegacyGap<Impl>::ConnectionCallbackParams_t::ConnectionCallbackParams_t(
|
||||
Handle_t handleIn,
|
||||
|
@ -753,7 +748,6 @@ void LegacyGap<Impl>::ConnectionCallbackParams_t::constructor_helper(
|
|||
memset(ownAddr, 0, ADDR_LEN);
|
||||
}
|
||||
}
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
|
||||
#if BLE_ROLE_CENTRAL
|
||||
template<class Impl>
|
||||
|
@ -772,7 +766,6 @@ ble_error_t LegacyGap<Impl>::connect(
|
|||
}
|
||||
#endif // BLE_ROLE_CENTRAL
|
||||
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
template<class Impl>
|
||||
void LegacyGap<Impl>::processConnectionEvent(
|
||||
Handle_t handle,
|
||||
|
@ -804,9 +797,7 @@ 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,
|
||||
|
@ -858,7 +849,6 @@ void LegacyGap<Impl>::processAdvertisementReport(
|
|||
|
||||
onAdvertisementReport.call(¶ms);
|
||||
}
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
|
||||
#if defined(__GNUC__) && !defined(__CC_ARM)
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -943,32 +933,18 @@ ble_error_t LegacyGap<Impl>::reset(void)
|
|||
|
||||
template<class Impl>
|
||||
LegacyGap<Impl>::LegacyGap() :
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
_advParams(),
|
||||
_advPayload(),
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
#if BLE_ROLE_OBSERVER
|
||||
_scanningParams(),
|
||||
#endif
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
_scanResponse(),
|
||||
#endif
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
connectionCount(0),
|
||||
#endif
|
||||
state(),
|
||||
#if BLE_ROLE_OBSERVER
|
||||
scanningActive(false),
|
||||
#endif
|
||||
timeoutCallbackChain(),
|
||||
radioNotificationCallback()
|
||||
#if BLE_ROLE_OBSERVER
|
||||
, onAdvertisementReport()
|
||||
#endif
|
||||
#if BLE_FEATURE_CONNECTABLE
|
||||
, connectionCallChain()
|
||||
, disconnectionCallChain()
|
||||
#endif // BLE_FEATURE_CONNECTABLE
|
||||
radioNotificationCallback(),
|
||||
onAdvertisementReport(),
|
||||
connectionCallChain(),
|
||||
disconnectionCallChain()
|
||||
{
|
||||
#if BLE_ROLE_BROADCASTER
|
||||
_advPayload.clear();
|
||||
|
|
Loading…
Reference in New Issue