BLE: move GapAdvertisingParameters to ble::AdvertisingParameters

pull/8738/head
Vincent Coubard 2018-11-14 16:46:02 +00:00
parent 1324116377
commit f0cbd9f434
4 changed files with 15 additions and 11 deletions

View File

@ -1735,7 +1735,7 @@ public:
*/ */
virtual ble_error_t createAdvertisingSet( virtual ble_error_t createAdvertisingSet(
AdvHandle_t *handle, AdvHandle_t *handle,
const GapAdvertisingParameters &parameters const ble::AdvertisingParameters &parameters
) )
{ {
(void) handle; (void) handle;
@ -1765,7 +1765,7 @@ public:
*/ */
virtual ble_error_t setAdvertisingParams( virtual ble_error_t setAdvertisingParams(
AdvHandle_t handle, AdvHandle_t handle,
const GapAdvertisingParameters &params const ble::AdvertisingParameters &params
) { ) {
(void) handle; (void) handle;
(void) params; (void) params;

View File

@ -29,6 +29,8 @@
* @{ * @{
*/ */
namespace ble {
/** /**
* Parameters defining the advertising process. * Parameters defining the advertising process.
* *
@ -42,7 +44,7 @@
* - Duration of the advertising process. As others, it can be set at * - Duration of the advertising process. As others, it can be set at
* construction time, modified by setTimeout() and retrieved by getTimeout(). * construction time, modified by setTimeout() and retrieved by getTimeout().
*/ */
class GapAdvertisingParameters { class AdvertisingParameters {
public: public:
/** /**
@ -99,7 +101,7 @@ public:
* *
* @note If value in input are out of range, they will be normalized. * @note If value in input are out of range, they will be normalized.
*/ */
GapAdvertisingParameters( AdvertisingParameters(
ble::advertising_type_t advType = ble::ADV_CONNECTABLE_UNDIRECTED, ble::advertising_type_t advType = ble::ADV_CONNECTABLE_UNDIRECTED,
uint32_t minInterval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON, uint32_t minInterval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON,
uint32_t maxInterval = GAP_ADV_PARAMS_INTERVAL_MAX, uint32_t maxInterval = GAP_ADV_PARAMS_INTERVAL_MAX,
@ -691,6 +693,8 @@ private:
uint8_t _includeHeaderTxPower:1; uint8_t _includeHeaderTxPower:1;
}; };
} // namespace ble
/** /**
* @} * @}
* @} * @}

View File

@ -82,14 +82,14 @@ public:
ble_error_t createAdvertisingSet( ble_error_t createAdvertisingSet(
AdvHandle_t *handle, AdvHandle_t *handle,
const GapAdvertisingParameters &parameters const AdvertisingParameters &parameters
); );
ble_error_t destroyAdvertisingSet(AdvHandle_t handle); ble_error_t destroyAdvertisingSet(AdvHandle_t handle);
ble_error_t setAdvertisingParams( ble_error_t setAdvertisingParams(
AdvHandle_t handle, AdvHandle_t handle,
const GapAdvertisingParameters &params const AdvertisingParameters &params
); );
ble_error_t setAdvertisingPayload( ble_error_t setAdvertisingPayload(
@ -670,7 +670,7 @@ private:
private: private:
ble_error_t setExtendedAdvertisingParameters( ble_error_t setExtendedAdvertisingParameters(
AdvHandle_t handle, AdvHandle_t handle,
const GapAdvertisingParameters &parameters const AdvertisingParameters &parameters
); );
bool is_extended_advertising_available(); bool is_extended_advertising_available();

View File

@ -435,7 +435,7 @@ GenericGap::GenericGap(
if (is_extended_advertising_available()) { if (is_extended_advertising_available()) {
setExtendedAdvertisingParameters( setExtendedAdvertisingParameters(
LEGACY_ADVERTISING_HANDLE, LEGACY_ADVERTISING_HANDLE,
GapAdvertisingParameters() AdvertisingParameters()
); );
} }
} }
@ -1658,7 +1658,7 @@ uint8_t GenericGap::getMaxAdvertisingDataLength()
ble_error_t GenericGap::createAdvertisingSet( ble_error_t GenericGap::createAdvertisingSet(
AdvHandle_t *handle, AdvHandle_t *handle,
const GapAdvertisingParameters &parameters const AdvertisingParameters &parameters
) )
{ {
if (is_extended_advertising_available()) { if (is_extended_advertising_available()) {
@ -1724,7 +1724,7 @@ ble_error_t GenericGap::destroyAdvertisingSet(AdvHandle_t handle) {
ble_error_t GenericGap::setAdvertisingParams( ble_error_t GenericGap::setAdvertisingParams(
AdvHandle_t handle, AdvHandle_t handle,
const GapAdvertisingParameters &params const AdvertisingParameters &params
) { ) {
if (handle >= getMaxAdvertisingSetNumber()) { if (handle >= getMaxAdvertisingSetNumber()) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
@ -1762,7 +1762,7 @@ ble_error_t GenericGap::setAdvertisingParams(
ble_error_t GenericGap::setExtendedAdvertisingParameters( ble_error_t GenericGap::setExtendedAdvertisingParameters(
AdvHandle_t handle, AdvHandle_t handle,
const GapAdvertisingParameters &params const AdvertisingParameters &params
) )
{ {
if (handle >= getMaxAdvertisingSetNumber()) { if (handle >= getMaxAdvertisingSetNumber()) {