BLE: remove inner V2 typedef in Gap class.

pull/8738/head
Vincent Coubard 2018-11-15 20:55:39 +00:00
parent d3c26f4283
commit fa4aa8f068
3 changed files with 49 additions and 72 deletions

View File

@ -495,10 +495,6 @@ public:
unsigned connected : 1; unsigned connected : 1;
}; };
/** Enumeration of controller supported features.
*/
typedef ble::controller_supported_features_t ControllerSupportedFeatures_t;
/** /**
* Opaque value type representing a connection handle. * Opaque value type representing a connection handle.
* *
@ -519,16 +515,6 @@ public:
*/ */
typedef ble::peer_address_type_t PeerAddressType_t; typedef ble::peer_address_type_t PeerAddressType_t;
/**
* Enumeration of own address types
*/
typedef ble::own_address_type_t OwnAddressType_t;
/**
* Enumeration of peer address types
*/
typedef ble::target_peer_address_type_t TargetPeerAddressType_t;
/** /**
* Enumeration of BLE PHY * Enumeration of BLE PHY
*/ */
@ -1082,15 +1068,6 @@ public:
typedef CallChainOfFunctionPointersWithContext<const Gap *> typedef CallChainOfFunctionPointersWithContext<const Gap *>
GapShutdownCallbackChain_t; GapShutdownCallbackChain_t;
/** Advertising handle used to identify advertising sets. */
typedef ble::advertising_handle_t AdvHandle_t;
/** Advertising handle used to identify periodic advertising sets. */
typedef ble::periodic_sync_handle_t PeriodicSyncHandle_t;
/** Type of advertisement scanned. */
typedef ble::advertising_event_t AdvertisingEventType_t;
/** /**
* Definition of the general handler of Gap related events. * Definition of the general handler of Gap related events.
*/ */
@ -1447,7 +1424,7 @@ public:
* a connection event. * a connection event.
*/ */
virtual ble_error_t connect( virtual ble_error_t connect(
TargetPeerAddressType_t peerAddressType, ble::target_peer_address_type_t peerAddressType,
const ble::address_t &peerAddress, const ble::address_t &peerAddress,
const ble::ConnectionParameters &connectionParams const ble::ConnectionParameters &connectionParams
) { ) {
@ -1685,7 +1662,7 @@ public:
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t createAdvertisingSet( virtual ble_error_t createAdvertisingSet(
AdvHandle_t *handle, ble::advertising_handle_t *handle,
const ble::AdvertisingParameters &parameters const ble::AdvertisingParameters &parameters
) )
{ {
@ -1702,7 +1679,7 @@ public:
* @param handle Advertising set handle. * @param handle Advertising set handle.
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t destroyAdvertisingSet(AdvHandle_t handle) { virtual ble_error_t destroyAdvertisingSet(ble::advertising_handle_t handle) {
(void) handle; (void) handle;
/* Requesting action from porter(s): override this API if this capability is supported. */ /* Requesting action from porter(s): override this API if this capability is supported. */
return BLE_ERROR_NOT_IMPLEMENTED; return BLE_ERROR_NOT_IMPLEMENTED;
@ -1715,7 +1692,7 @@ public:
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t setAdvertisingParameters( virtual ble_error_t setAdvertisingParameters(
AdvHandle_t handle, ble::advertising_handle_t handle,
const ble::AdvertisingParameters &params const ble::AdvertisingParameters &params
) { ) {
(void) handle; (void) handle;
@ -1732,7 +1709,7 @@ public:
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t setAdvertisingPayload( virtual ble_error_t setAdvertisingPayload(
AdvHandle_t handle, ble::advertising_handle_t handle,
mbed::Span<uint8_t> payload, mbed::Span<uint8_t> payload,
bool minimiseFragmentation = false bool minimiseFragmentation = false
) )
@ -1752,7 +1729,7 @@ public:
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t setAdvertisingScanResponse( virtual ble_error_t setAdvertisingScanResponse(
AdvHandle_t handle, ble::advertising_handle_t handle,
mbed::Span<uint8_t> response, mbed::Span<uint8_t> response,
bool minimiseFragmentation = false bool minimiseFragmentation = false
) )
@ -1772,7 +1749,7 @@ public:
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t startAdvertising( virtual ble_error_t startAdvertising(
AdvHandle_t handle, ble::advertising_handle_t handle,
ble::adv_duration_t maxDuration = ble::adv_duration_t(0), ble::adv_duration_t maxDuration = ble::adv_duration_t(0),
uint8_t maxEvents = 0 uint8_t maxEvents = 0
) )
@ -1789,7 +1766,7 @@ public:
* @param handle Advertising set handle. * @param handle Advertising set handle.
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t stopAdvertising(AdvHandle_t handle) { virtual ble_error_t stopAdvertising(ble::advertising_handle_t handle) {
(void) handle; (void) handle;
/* Requesting action from porter(s): override this API if this capability is supported. */ /* Requesting action from porter(s): override this API if this capability is supported. */
return BLE_ERROR_NOT_IMPLEMENTED; return BLE_ERROR_NOT_IMPLEMENTED;
@ -1800,7 +1777,7 @@ public:
* @param handle Advertising set handle. * @param handle Advertising set handle.
* @return True if advertising is active on this set. * @return True if advertising is active on this set.
*/ */
virtual bool isAdvertisingActive(AdvHandle_t handle) { virtual bool isAdvertisingActive(ble::advertising_handle_t handle) {
return false; return false;
} }
@ -1813,7 +1790,7 @@ public:
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t setPeriodicAdvertisingParameters( virtual ble_error_t setPeriodicAdvertisingParameters(
AdvHandle_t handle, ble::advertising_handle_t handle,
ble::periodic_interval_t periodicAdvertisingIntervalMin, ble::periodic_interval_t periodicAdvertisingIntervalMin,
ble::periodic_interval_t periodicAdvertisingIntervalMax, ble::periodic_interval_t periodicAdvertisingIntervalMax,
bool advertiseTxPower = true bool advertiseTxPower = true
@ -1833,7 +1810,7 @@ public:
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t setPeriodicAdvertisingPayload( virtual ble_error_t setPeriodicAdvertisingPayload(
AdvHandle_t handle, ble::advertising_handle_t handle,
mbed::Span<uint8_t> payload mbed::Span<uint8_t> payload
) { ) {
(void) handle; (void) handle;
@ -1848,7 +1825,7 @@ public:
* @param handle Advertising set handle. * @param handle Advertising set handle.
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t startPeriodicAdvertising(AdvHandle_t handle) virtual ble_error_t startPeriodicAdvertising(ble::advertising_handle_t handle)
{ {
(void) handle; (void) handle;
/* Requesting action from porter(s): override this API if this capability is supported. */ /* Requesting action from porter(s): override this API if this capability is supported. */
@ -1860,7 +1837,7 @@ public:
* @param handle Advertising set handle. * @param handle Advertising set handle.
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t stopPeriodicAdvertising(AdvHandle_t handle) virtual ble_error_t stopPeriodicAdvertising(ble::advertising_handle_t handle)
{ {
(void) handle; (void) handle;
/* Requesting action from porter(s): override this API if this capability is supported. */ /* Requesting action from porter(s): override this API if this capability is supported. */
@ -1872,7 +1849,7 @@ public:
* @param handle Advertising set handle. * @param handle Advertising set handle.
* @return True if periodic advertising is active on this set. * @return True if periodic advertising is active on this set.
*/ */
virtual bool isPeriodicAdvertisingActive(AdvHandle_t handle) virtual bool isPeriodicAdvertisingActive(ble::advertising_handle_t handle)
{ {
(void) handle; (void) handle;
/* Requesting action from porter(s): override this API if this capability is supported. */ /* Requesting action from porter(s): override this API if this capability is supported. */
@ -1973,7 +1950,7 @@ public:
* @return BLE_ERROR_NONE on success. * @return BLE_ERROR_NONE on success.
*/ */
virtual ble_error_t terminateSync( virtual ble_error_t terminateSync(
PeriodicSyncHandle_t handle ble::periodic_sync_handle_t handle
) { ) {
/* Requesting action from porter(s): override this API if this capability is supported. */ /* Requesting action from porter(s): override this API if this capability is supported. */
return BLE_ERROR_NOT_IMPLEMENTED; return BLE_ERROR_NOT_IMPLEMENTED;

View File

@ -93,25 +93,25 @@ public:
/** @copydoc Gap::createAdvertisingSet /** @copydoc Gap::createAdvertisingSet
*/ */
ble_error_t createAdvertisingSet( ble_error_t createAdvertisingSet(
AdvHandle_t *handle, advertising_handle_t *handle,
const AdvertisingParameters &parameters const AdvertisingParameters &parameters
); );
/** @copydoc Gap::destroyAdvertisingSet /** @copydoc Gap::destroyAdvertisingSet
*/ */
ble_error_t destroyAdvertisingSet(AdvHandle_t handle); ble_error_t destroyAdvertisingSet(advertising_handle_t handle);
/** @copydoc Gap::setAdvertisingParams /** @copydoc Gap::setAdvertisingParams
*/ */
ble_error_t setAdvertisingParameters( ble_error_t setAdvertisingParameters(
AdvHandle_t handle, advertising_handle_t handle,
const AdvertisingParameters &params const AdvertisingParameters &params
); );
/** @copydoc Gap::setAdvertisingPayload /** @copydoc Gap::setAdvertisingPayload
*/ */
ble_error_t setAdvertisingPayload( ble_error_t setAdvertisingPayload(
AdvHandle_t handle, advertising_handle_t handle,
mbed::Span<uint8_t> payload, mbed::Span<uint8_t> payload,
bool minimiseFragmentation bool minimiseFragmentation
); );
@ -119,7 +119,7 @@ public:
/** @copydoc Gap::setAdvertisingScanResponse /** @copydoc Gap::setAdvertisingScanResponse
*/ */
ble_error_t setAdvertisingScanResponse( ble_error_t setAdvertisingScanResponse(
AdvHandle_t handle, advertising_handle_t handle,
mbed::Span<uint8_t> response, mbed::Span<uint8_t> response,
bool minimiseFragmentation bool minimiseFragmentation
); );
@ -127,23 +127,23 @@ public:
/** @copydoc Gap::startAdvertising /** @copydoc Gap::startAdvertising
*/ */
ble_error_t startAdvertising( ble_error_t startAdvertising(
AdvHandle_t handle, advertising_handle_t handle,
adv_duration_t maxDuration, adv_duration_t maxDuration,
uint8_t maxEvents uint8_t maxEvents
); );
/** @copydoc Gap::stopAdvertising /** @copydoc Gap::stopAdvertising
*/ */
ble_error_t stopAdvertising(AdvHandle_t handle); ble_error_t stopAdvertising(advertising_handle_t handle);
/** @copydoc Gap::isAdvertisingActive /** @copydoc Gap::isAdvertisingActive
*/ */
bool isAdvertisingActive(AdvHandle_t handle); bool isAdvertisingActive(advertising_handle_t handle);
/** @copydoc Gap::setPeriodicAdvertisingParameters /** @copydoc Gap::setPeriodicAdvertisingParameters
*/ */
virtual ble_error_t setPeriodicAdvertisingParameters( virtual ble_error_t setPeriodicAdvertisingParameters(
AdvHandle_t handle, advertising_handle_t handle,
periodic_interval_t periodicAdvertisingIntervalMin, periodic_interval_t periodicAdvertisingIntervalMin,
periodic_interval_t periodicAdvertisingIntervalMax, periodic_interval_t periodicAdvertisingIntervalMax,
bool advertiseTxPower bool advertiseTxPower
@ -152,21 +152,21 @@ public:
/** @copydoc Gap::setPeriodicAdvertisingPayload /** @copydoc Gap::setPeriodicAdvertisingPayload
*/ */
virtual ble_error_t setPeriodicAdvertisingPayload( virtual ble_error_t setPeriodicAdvertisingPayload(
AdvHandle_t handle, advertising_handle_t handle,
mbed::Span<uint8_t> payload mbed::Span<uint8_t> payload
); );
/** @copydoc Gap::startPeriodicAdvertising /** @copydoc Gap::startPeriodicAdvertising
*/ */
virtual ble_error_t startPeriodicAdvertising(AdvHandle_t handle); virtual ble_error_t startPeriodicAdvertising(advertising_handle_t handle);
/** @copydoc Gap::stopPeriodicAdvertising /** @copydoc Gap::stopPeriodicAdvertising
*/ */
virtual ble_error_t stopPeriodicAdvertising(AdvHandle_t handle); virtual ble_error_t stopPeriodicAdvertising(advertising_handle_t handle);
/** @copydoc Gap::isPeriodicAdvertisingActive /** @copydoc Gap::isPeriodicAdvertisingActive
*/ */
virtual bool isPeriodicAdvertisingActive(AdvHandle_t handle); virtual bool isPeriodicAdvertisingActive(advertising_handle_t handle);
/** @copydoc Gap::setScanParameters /** @copydoc Gap::setScanParameters
*/ */
@ -203,7 +203,7 @@ public:
/** @copydoc Gap::terminateSync /** @copydoc Gap::terminateSync
*/ */
virtual ble_error_t terminateSync(PeriodicSyncHandle_t handle); virtual ble_error_t terminateSync(periodic_sync_handle_t handle);
/** @copydoc Gap::addDeviceToPeriodicAdvertiserList /** @copydoc Gap::addDeviceToPeriodicAdvertiserList
*/ */
@ -518,7 +518,7 @@ public:
private: private:
ble_error_t setAdvertisingData( ble_error_t setAdvertisingData(
AdvHandle_t handle, advertising_handle_t handle,
mbed::Span<uint8_t> payload, mbed::Span<uint8_t> payload,
bool minimiseFragmentation, bool minimiseFragmentation,
bool scan_response bool scan_response
@ -725,7 +725,7 @@ private:
private: private:
ble_error_t setExtendedAdvertisingParameters( ble_error_t setExtendedAdvertisingParameters(
AdvHandle_t handle, advertising_handle_t handle,
const AdvertisingParameters &parameters const AdvertisingParameters &parameters
); );

View File

@ -1588,7 +1588,7 @@ void GenericGap::update_random_address()
/* ignore the error, if it fails to cycle because it's connectable */ /* ignore the error, if it fails to cycle because it's connectable */
_pal_gap.set_advertising_set_random_address( _pal_gap.set_advertising_set_random_address(
(AdvHandle_t)i, (advertising_handle_t)i,
address address
); );
} }
@ -1670,7 +1670,7 @@ uint8_t GenericGap::getMaxAdvertisingDataLength()
} }
ble_error_t GenericGap::createAdvertisingSet( ble_error_t GenericGap::createAdvertisingSet(
AdvHandle_t *handle, advertising_handle_t *handle,
const AdvertisingParameters &parameters const AdvertisingParameters &parameters
) )
{ {
@ -1701,7 +1701,7 @@ ble_error_t GenericGap::createAdvertisingSet(
return BLE_ERROR_NO_MEM; return BLE_ERROR_NO_MEM;
} }
ble_error_t GenericGap::destroyAdvertisingSet(AdvHandle_t handle) { ble_error_t GenericGap::destroyAdvertisingSet(advertising_handle_t handle) {
if (is_extended_advertising_available()) { if (is_extended_advertising_available()) {
return BLE_ERROR_OPERATION_NOT_PERMITTED; return BLE_ERROR_OPERATION_NOT_PERMITTED;
} }
@ -1736,7 +1736,7 @@ ble_error_t GenericGap::destroyAdvertisingSet(AdvHandle_t handle) {
} }
ble_error_t GenericGap::setAdvertisingParameters( ble_error_t GenericGap::setAdvertisingParameters(
AdvHandle_t handle, advertising_handle_t handle,
const AdvertisingParameters &params const AdvertisingParameters &params
) { ) {
if (handle >= getMaxAdvertisingSetNumber()) { if (handle >= getMaxAdvertisingSetNumber()) {
@ -1774,7 +1774,7 @@ ble_error_t GenericGap::setAdvertisingParameters(
} }
ble_error_t GenericGap::setExtendedAdvertisingParameters( ble_error_t GenericGap::setExtendedAdvertisingParameters(
AdvHandle_t handle, advertising_handle_t handle,
const AdvertisingParameters &params const AdvertisingParameters &params
) )
{ {
@ -1813,7 +1813,7 @@ ble_error_t GenericGap::setExtendedAdvertisingParameters(
} }
ble_error_t GenericGap::setAdvertisingPayload( ble_error_t GenericGap::setAdvertisingPayload(
AdvHandle_t handle, advertising_handle_t handle,
mbed::Span<uint8_t> payload, mbed::Span<uint8_t> payload,
bool minimiseFragmentation bool minimiseFragmentation
) { ) {
@ -1821,7 +1821,7 @@ ble_error_t GenericGap::setAdvertisingPayload(
} }
ble_error_t GenericGap::setAdvertisingScanResponse( ble_error_t GenericGap::setAdvertisingScanResponse(
AdvHandle_t handle, advertising_handle_t handle,
mbed::Span<uint8_t> response, mbed::Span<uint8_t> response,
bool minimiseFragmentation bool minimiseFragmentation
) { ) {
@ -1829,7 +1829,7 @@ ble_error_t GenericGap::setAdvertisingScanResponse(
} }
ble_error_t GenericGap::setAdvertisingData( ble_error_t GenericGap::setAdvertisingData(
AdvHandle_t handle, advertising_handle_t handle,
mbed::Span<uint8_t> payload, mbed::Span<uint8_t> payload,
bool minimiseFragmentation, bool minimiseFragmentation,
bool scan_response bool scan_response
@ -1862,7 +1862,7 @@ ble_error_t GenericGap::setAdvertisingData(
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
if (payload.size() > LEGACY_ADVERTISING_MAX_SIZE) { if (payload.size() > GAP_ADVERTISING_DATA_MAX_PAYLOAD) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
@ -1924,7 +1924,7 @@ ble_error_t GenericGap::setAdvertisingData(
} }
ble_error_t GenericGap::startAdvertising( ble_error_t GenericGap::startAdvertising(
AdvHandle_t handle, advertising_handle_t handle,
adv_duration_t maxDuration, adv_duration_t maxDuration,
uint8_t maxEvents uint8_t maxEvents
) { ) {
@ -1989,7 +1989,7 @@ ble_error_t GenericGap::startAdvertising(
return error; return error;
} }
ble_error_t GenericGap::stopAdvertising(AdvHandle_t handle) { ble_error_t GenericGap::stopAdvertising(advertising_handle_t handle) {
if (handle >= getMaxAdvertisingSetNumber()) { if (handle >= getMaxAdvertisingSetNumber()) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
@ -2019,7 +2019,7 @@ ble_error_t GenericGap::stopAdvertising(AdvHandle_t handle) {
); );
} }
bool GenericGap::isAdvertisingActive(AdvHandle_t handle) { bool GenericGap::isAdvertisingActive(advertising_handle_t handle) {
if (handle >= getMaxAdvertisingSetNumber()) { if (handle >= getMaxAdvertisingSetNumber()) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
@ -2028,7 +2028,7 @@ bool GenericGap::isAdvertisingActive(AdvHandle_t handle) {
} }
ble_error_t GenericGap::setPeriodicAdvertisingParameters( ble_error_t GenericGap::setPeriodicAdvertisingParameters(
Gap::AdvHandle_t handle, advertising_handle_t handle,
periodic_interval_t periodicAdvertisingIntervalMin, periodic_interval_t periodicAdvertisingIntervalMin,
periodic_interval_t periodicAdvertisingIntervalMax, periodic_interval_t periodicAdvertisingIntervalMax,
bool advertiseTxPower bool advertiseTxPower
@ -2059,7 +2059,7 @@ ble_error_t GenericGap::setPeriodicAdvertisingParameters(
} }
ble_error_t GenericGap::setPeriodicAdvertisingPayload( ble_error_t GenericGap::setPeriodicAdvertisingPayload(
Gap::AdvHandle_t handle, advertising_handle_t handle,
mbed::Span<uint8_t> payload mbed::Span<uint8_t> payload
) )
{ {
@ -2116,7 +2116,7 @@ ble_error_t GenericGap::setPeriodicAdvertisingPayload(
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} }
ble_error_t GenericGap::startPeriodicAdvertising(Gap::AdvHandle_t handle) ble_error_t GenericGap::startPeriodicAdvertising(advertising_handle_t handle)
{ {
if (handle == LEGACY_ADVERTISING_HANDLE) { if (handle == LEGACY_ADVERTISING_HANDLE) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
@ -2147,7 +2147,7 @@ ble_error_t GenericGap::startPeriodicAdvertising(Gap::AdvHandle_t handle)
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} }
ble_error_t GenericGap::stopPeriodicAdvertising(Gap::AdvHandle_t handle) ble_error_t GenericGap::stopPeriodicAdvertising(advertising_handle_t handle)
{ {
if (handle == LEGACY_ADVERTISING_HANDLE) { if (handle == LEGACY_ADVERTISING_HANDLE) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
@ -2175,7 +2175,7 @@ ble_error_t GenericGap::stopPeriodicAdvertising(Gap::AdvHandle_t handle)
return BLE_ERROR_NONE; return BLE_ERROR_NONE;
} }
bool GenericGap::isPeriodicAdvertisingActive(Gap::AdvHandle_t handle) bool GenericGap::isPeriodicAdvertisingActive(advertising_handle_t handle)
{ {
if (handle >= getMaxAdvertisingSetNumber()) { if (handle >= getMaxAdvertisingSetNumber()) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
@ -2516,7 +2516,7 @@ ble_error_t GenericGap::cancelCreateSync()
return _pal_gap.cancel_periodic_advertising_create_sync(); return _pal_gap.cancel_periodic_advertising_create_sync();
} }
ble_error_t GenericGap::terminateSync(Gap::PeriodicSyncHandle_t handle) ble_error_t GenericGap::terminateSync(periodic_sync_handle_t handle)
{ {
if (is_extended_advertising_available() == false) { if (is_extended_advertising_available() == false) {
return BLE_ERROR_NOT_IMPLEMENTED; return BLE_ERROR_NOT_IMPLEMENTED;