BLE: fix name of functions in ble::ScanParameters.

pull/8738/head
Vincent Coubard 2018-11-24 21:46:55 +00:00
parent 936f1c550a
commit 4db8ddfb90
2 changed files with 23 additions and 36 deletions

View File

@ -67,19 +67,6 @@ public:
{ {
} }
ScanParameters(
phy_configuration_t phy_1m_configuration,
own_address_type_t own_address_type = own_address_type_t::PUBLIC,
scanning_filter_policy_t scanning_filter_policy = scanning_filter_policy_t::NO_FILTER
) :
own_address_type(own_address_type),
scanning_filter_policy(scanning_filter_policy_t::NO_FILTER),
phys(phy_set_t::PHY_SET_1M),
phy_1m_configuration(phy_1m_configuration),
phy_coded_configuration()
{
}
ScanParameters( ScanParameters(
phy_configuration_t phy_1m_configuration, phy_configuration_t phy_1m_configuration,
phy_configuration_t phy_coded_configuration, phy_configuration_t phy_coded_configuration,
@ -94,41 +81,41 @@ public:
{ {
} }
ScanParameters &set_own_address_type(own_address_type_t address) ScanParameters &setOwnAddressType(own_address_type_t address)
{ {
own_address_type = address; own_address_type = address;
return *this; return *this;
} }
own_address_type_t get_own_address_type() const own_address_type_t getOwnAddressType() const
{ {
return own_address_type; return own_address_type;
} }
ScanParameters &set_scanning_filter_policy(scanning_filter_policy_t filter_policy) ScanParameters &setFilter(scanning_filter_policy_t filter_policy)
{ {
scanning_filter_policy = filter_policy; scanning_filter_policy = filter_policy;
return *this; return *this;
} }
scanning_filter_policy_t get_scanning_filter_policy() const scanning_filter_policy_t getFilter() const
{ {
return scanning_filter_policy; return scanning_filter_policy;
} }
ScanParameters &set_scanning_phys(bool enable_1m, bool enable_coded) ScanParameters &setPhys(bool enable_1m, bool enable_coded)
{ {
phys.set_1m(enable_1m); phys.set_1m(enable_1m);
phys.set_coded(enable_coded); phys.set_coded(enable_coded);
return *this; return *this;
} }
phy_set_t get_scanning_phys() const phy_set_t getPhys() const
{ {
return phys; return phys;
} }
ScanParameters &set_1m_phy_configuration( ScanParameters &set1mPhyConfiguration(
scan_interval_t interval, scan_interval_t interval,
scan_window_t window, scan_window_t window,
bool active_scanning bool active_scanning
@ -141,12 +128,12 @@ public:
return *this; return *this;
} }
phy_configuration_t get_1m_configuration() const phy_configuration_t get1mPhyConfiguration() const
{ {
return phy_1m_configuration; return phy_1m_configuration;
} }
ScanParameters &set_coded_phy_configuration( ScanParameters &setCodedPhyConfiguration(
scan_interval_t interval, scan_interval_t interval,
scan_window_t window, scan_window_t window,
bool active_scanning bool active_scanning
@ -159,7 +146,7 @@ public:
return *this; return *this;
} }
phy_configuration_t get_coded_configuration() const phy_configuration_t getCodedPhyConfiguration() const
{ {
return phy_1m_configuration; return phy_1m_configuration;
} }

View File

@ -2570,42 +2570,42 @@ ble_error_t GenericGap::setScanParameters(const ScanParameters &params)
if (is_extended_advertising_available()) { if (is_extended_advertising_available()) {
bool active_scanning[] = { bool active_scanning[] = {
params.get_1m_configuration().active_scanning, params.get1mPhyConfiguration().active_scanning,
params.get_coded_configuration().active_scanning params.getCodedPhyConfiguration().active_scanning
}; };
uint16_t scan_interval[] = { uint16_t scan_interval[] = {
params.get_1m_configuration().interval.value(), params.get1mPhyConfiguration().interval.value(),
params.get_coded_configuration().interval.value() params.getCodedPhyConfiguration().interval.value()
}; };
uint16_t scan_window[] = { uint16_t scan_window[] = {
params.get_1m_configuration().window.value(), params.get1mPhyConfiguration().window.value(),
params.get_coded_configuration().window.value() params.getCodedPhyConfiguration().window.value()
}; };
return _pal_gap.set_extended_scan_parameters( return _pal_gap.set_extended_scan_parameters(
params.get_own_address_type(), params.getOwnAddressType(),
params.get_scanning_filter_policy(), params.getFilter(),
params.get_scanning_phys(), params.getPhys(),
active_scanning, active_scanning,
scan_interval, scan_interval,
scan_window scan_window
); );
} else { } else {
if (params.get_scanning_phys().get_coded()) { if (params.getPhys().get_coded()) {
return BLE_ERROR_INVALID_PARAM; return BLE_ERROR_INVALID_PARAM;
} }
ScanParameters::phy_configuration_t legacy_configuration = ScanParameters::phy_configuration_t legacy_configuration =
params.get_1m_configuration(); params.get1mPhyConfiguration();
return _pal_gap.set_scan_parameters( return _pal_gap.set_scan_parameters(
legacy_configuration.active_scanning, legacy_configuration.active_scanning,
legacy_configuration.interval.value(), legacy_configuration.interval.value(),
legacy_configuration.window.value(), legacy_configuration.window.value(),
params.get_own_address_type(), params.getOwnAddressType(),
params.get_scanning_filter_policy() params.getFilter()
); );
} }
} }