diff --git a/features/FEATURE_BLE/ble/GapAdvertisingParams.h b/features/FEATURE_BLE/ble/GapAdvertisingParams.h index 898e7d24a7..8355a3818b 100644 --- a/features/FEATURE_BLE/ble/GapAdvertisingParams.h +++ b/features/FEATURE_BLE/ble/GapAdvertisingParams.h @@ -440,7 +440,7 @@ class GapExtendedAdvertisingParams { return _notifyOnScan; } - /**/ + /* helper get functions */ uint32_t getMinPrimaryInterval() const { return _minInterval; @@ -450,22 +450,34 @@ class GapExtendedAdvertisingParams { return _maxInterval; } - BLEProtocol::AddressBytes_t* getPeerAddress() { + BLEProtocol::AddressBytes_t* getPeerAddress() const { return &_peerAddress; }; - ble::peer_address_type_t getPeerAddressType() { + ble::peer_address_type_t getPeerAddressType() const { return _peerAddressType; }; - ble::phy_t getPrimaryPhy() { + ble::phy_t getPrimaryPhy() const { return _primaryPhy; } - ble::phy_t getSecondaryPhy() { + ble::phy_t getSecondaryPhy() const { return _secondaryPhy; } + bool getChannel37() const { + return _channel37; + } + + bool getChannel38() const { + return _channel37; + } + + bool getChannel39() const { + return _channel37; + } + private: ble::advertising_type_t _advType; uint32_t _minInterval; diff --git a/features/FEATURE_BLE/ble/pal/GapTypes.h b/features/FEATURE_BLE/ble/pal/GapTypes.h index fe93749ff0..488b3b6c08 100644 --- a/features/FEATURE_BLE/ble/pal/GapTypes.h +++ b/features/FEATURE_BLE/ble/pal/GapTypes.h @@ -211,6 +211,9 @@ struct advertising_channel_map_t : SafeEnum */ advertising_channel_map_t(type value) : SafeEnum(value) { } + + advertising_channel_map_t(bool ch37, bool ch38, bool ch39) { + SafeEnum(ch37 | (ch38 << 1) | (ch39 << 2)) { } }; diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index fe08467d90..7088ac6a7b 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -1619,11 +1619,10 @@ ble_error_t GenericGap::setAdvertisingParams(AdvHandle_t handle, const GapAdvert return BLE_ERROR_NONE; } - pal::advertising_event_properties_t event_properties;//TODO - ble::advertising_type_t adv_type = params->getAdvertisingType(); + pal::advertising_event_properties_t event_properties; AddressUseType_t use_type; - switch(adv_type) { + switch(params->getAdvertisingType()) { case ADV_SCANNABLE_UNDIRECTED: case ADV_NON_CONNECTABLE_UNDIRECTED: case EXT_ADV_NON_CONNECTABLE_DIRECTED: @@ -1658,7 +1657,7 @@ ble_error_t GenericGap::setAdvertisingParams(AdvHandle_t handle, const GapExtend return BLE_ERROR_INVALID_PARAM; } - pal::advertising_channel_map_t channel_map; /*TODO translate*/ + pal::advertising_channel_map_t channel_map(params->getChannel37(), params->getChannel38(), params->getChannel39()); pal::advertising_event_properties_t event_properties;//TODO //params->getAdvertisingType()