From b98326150daad05d0bf090c48f70b02f62aa6f06 Mon Sep 17 00:00:00 2001 From: paul-szczepanek-arm <33840200+paul-szczepanek-arm@users.noreply.github.com> Date: Sun, 11 Nov 2018 21:25:52 +0000 Subject: [PATCH] fix names --- features/FEATURE_BLE/ble/Gap.h | 2 +- .../ble/gap/ExtendedConnectParameters.h | 20 +++++++++---------- features/FEATURE_BLE/ble/generic/GenericGap.h | 2 +- .../FEATURE_BLE/source/generic/GenericGap.cpp | 6 ++++-- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/features/FEATURE_BLE/ble/Gap.h b/features/FEATURE_BLE/ble/Gap.h index f98b75bac4..6c70531c15 100644 --- a/features/FEATURE_BLE/ble/Gap.h +++ b/features/FEATURE_BLE/ble/Gap.h @@ -1517,7 +1517,7 @@ public: virtual ble_error_t connect( TargetPeerAddressType_t peerAddressType, const BLEProtocol::AddressBytes_t &peerAddress, - const ExtendedConnectParameters_t &connectionParams + const GapExtendedConnectParameters_t &connectionParams ) { (void)peerAddressType; (void)peerAddress; diff --git a/features/FEATURE_BLE/ble/gap/ExtendedConnectParameters.h b/features/FEATURE_BLE/ble/gap/ExtendedConnectParameters.h index b20e280584..f423e6b38e 100644 --- a/features/FEATURE_BLE/ble/gap/ExtendedConnectParameters.h +++ b/features/FEATURE_BLE/ble/gap/ExtendedConnectParameters.h @@ -24,10 +24,10 @@ * @{ */ -class ExtendedConnectParameters_t { +class GapExtendedConnectParameters_t { static const uint8_t MAX_PARAM_PHYS = 3; public: - ExtendedConnectParameters_t() : + GapExtendedConnectParameters_t() : _filterPolicy(ble::SCAN_POLICY_FILTER_ALL_ADV), _ownAddressType(ble::own_address_type_t::PUBLIC) { @@ -46,7 +46,7 @@ public: /* setters */ - ExtendedConnectParameters_t& setScanParamteres( + GapExtendedConnectParameters_t& setScanParameters( uint32_t scanInterval_us, uint32_t scanWindow_us, ble::phy_t phy = ble::phy_t::LE_1M @@ -59,7 +59,7 @@ public: return *this; } - ExtendedConnectParameters_t& setConnectionParamteres( + GapExtendedConnectParameters_t& setConnectionParameters( uint16_t minConnectionInterval_ms, uint16_t maxConnectionInterval_ms, uint16_t slaveLatency, @@ -80,7 +80,7 @@ public: return *this; } - ExtendedConnectParameters_t& setScanParamteres( + GapExtendedConnectParameters_t& setScanParamteres( ble::own_address_type_t ownAddress ) { _ownAddressType = ownAddress; @@ -88,7 +88,7 @@ public: return *this; } - ExtendedConnectParameters_t& setScanParamteres( + GapExtendedConnectParameters_t& setScanParamteres( ble::scanning_policy_mode_t filterPolicy ) { _filterPolicy = filterPolicy; @@ -96,7 +96,7 @@ public: return *this; } - ExtendedConnectParameters_t& togglePhy( + GapExtendedConnectParameters_t& togglePhy( bool phy1M, bool phy2M, bool phyCoded @@ -108,7 +108,7 @@ public: return *this; } - ExtendedConnectParameters_t& disablePhy( + GapExtendedConnectParameters_t& disablePhy( ble::phy_t phy = ble::phy_t::LE_1M ) { handlePhyToggle(phy, false); @@ -116,7 +116,7 @@ public: return *this; } - ExtendedConnectParameters_t& enablePhy( + GapExtendedConnectParameters_t& enablePhy( ble::phy_t phy = ble::phy_t::LE_1M ) { handlePhyToggle(phy, true); @@ -134,7 +134,7 @@ public: return _filterPolicy; } - uint8_t getNumberOfEnabledPhys() { + uint8_t getNumberOfEnabledPhys() const { return (_enabledPhy[ble::phy_t::LE_1M] * 1 + _enabledPhy[ble::phy_t::LE_2M] * 1 + _enabledPhy[ble::phy_t::LE_CODED] * 1); diff --git a/features/FEATURE_BLE/ble/generic/GenericGap.h b/features/FEATURE_BLE/ble/generic/GenericGap.h index ca1b0bf7bf..349e915c00 100644 --- a/features/FEATURE_BLE/ble/generic/GenericGap.h +++ b/features/FEATURE_BLE/ble/generic/GenericGap.h @@ -237,7 +237,7 @@ public: virtual ble_error_t connect( ble::target_peer_address_type_t peerAddressType, const BLEProtocol::AddressBytes_t &peerAddress, - const ExtendedConnectParameters_t &connectionParams + const GapExtendedConnectParameters_t &connectionParams ); /** diff --git a/features/FEATURE_BLE/source/generic/GenericGap.cpp b/features/FEATURE_BLE/source/generic/GenericGap.cpp index 5f6effa534..cafd6c1453 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.cpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.cpp @@ -605,9 +605,11 @@ ble_error_t GenericGap::connect( ble_error_t GenericGap::connect( ble::target_peer_address_type_t peerAddressType, const BLEProtocol::AddressBytes_t &peerAddress, - const ExtendedConnectParameters_t &connectionParams + const GapExtendedConnectParameters_t &connectionParams ) { - + if (!connectionParams.getNumberOfEnabledPhys()) { + return BLE_ERROR_INVALID_PARAM; + } return _pal_gap.extended_create_connection( (ble::pal::initiator_policy_t::type)connectionParams.getFilterPolicy(), (ble::pal::own_address_type_t::type)connectionParams.getOwnAddressType().value(),