mirror of https://github.com/ARMmbed/mbed-os.git
BLE: rework ScanParameters::phy_configuration_t
parent
4db8ddfb90
commit
e130bec6a0
|
@ -32,10 +32,21 @@ namespace ble {
|
||||||
|
|
||||||
class ScanParameters {
|
class ScanParameters {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scan configuration of a physical channel.
|
||||||
|
*/
|
||||||
struct phy_configuration_t {
|
struct phy_configuration_t {
|
||||||
|
/**
|
||||||
|
* Construct a phy_configuration_t.
|
||||||
|
* @param scan_interval The scan interval.
|
||||||
|
* @param scan_window The scan window
|
||||||
|
* @param active_scanning True if scan request should be sent and false
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
phy_configuration_t(
|
phy_configuration_t(
|
||||||
scan_window_t scan_interval = scan_interval_t::min(),
|
scan_interval_t scan_interval = scan_interval_t::min(),
|
||||||
scan_interval_t scan_window = scan_window_t::min(),
|
scan_window_t scan_window = scan_window_t::min(),
|
||||||
bool active_scanning = false
|
bool active_scanning = false
|
||||||
) :
|
) :
|
||||||
interval(scan_interval),
|
interval(scan_interval),
|
||||||
|
@ -47,6 +58,31 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the scan interval.
|
||||||
|
*/
|
||||||
|
const scan_window_t &getInterval() const
|
||||||
|
{
|
||||||
|
return interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the scan window.
|
||||||
|
*/
|
||||||
|
const scan_interval_t &getWindow() const
|
||||||
|
{
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if active scanning is set.
|
||||||
|
*/
|
||||||
|
bool isActiveScanningSet() const
|
||||||
|
{
|
||||||
|
return active_scanning;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
scan_window_t interval;
|
scan_window_t interval;
|
||||||
scan_interval_t window;
|
scan_interval_t window;
|
||||||
bool active_scanning;
|
bool active_scanning;
|
||||||
|
|
|
@ -2570,18 +2570,18 @@ ble_error_t GenericGap::setScanParameters(const ScanParameters ¶ms)
|
||||||
|
|
||||||
if (is_extended_advertising_available()) {
|
if (is_extended_advertising_available()) {
|
||||||
bool active_scanning[] = {
|
bool active_scanning[] = {
|
||||||
params.get1mPhyConfiguration().active_scanning,
|
params.get1mPhyConfiguration().isActiveScanningSet(),
|
||||||
params.getCodedPhyConfiguration().active_scanning
|
params.getCodedPhyConfiguration().isActiveScanningSet()
|
||||||
};
|
};
|
||||||
|
|
||||||
uint16_t scan_interval[] = {
|
uint16_t scan_interval[] = {
|
||||||
params.get1mPhyConfiguration().interval.value(),
|
params.get1mPhyConfiguration().getInterval().value(),
|
||||||
params.getCodedPhyConfiguration().interval.value()
|
params.getCodedPhyConfiguration().getInterval().value()
|
||||||
};
|
};
|
||||||
|
|
||||||
uint16_t scan_window[] = {
|
uint16_t scan_window[] = {
|
||||||
params.get1mPhyConfiguration().window.value(),
|
params.get1mPhyConfiguration().getWindow().value(),
|
||||||
params.getCodedPhyConfiguration().window.value()
|
params.getCodedPhyConfiguration().getWindow().value()
|
||||||
};
|
};
|
||||||
|
|
||||||
return _pal_gap.set_extended_scan_parameters(
|
return _pal_gap.set_extended_scan_parameters(
|
||||||
|
@ -2601,9 +2601,9 @@ ble_error_t GenericGap::setScanParameters(const ScanParameters ¶ms)
|
||||||
params.get1mPhyConfiguration();
|
params.get1mPhyConfiguration();
|
||||||
|
|
||||||
return _pal_gap.set_scan_parameters(
|
return _pal_gap.set_scan_parameters(
|
||||||
legacy_configuration.active_scanning,
|
legacy_configuration.isActiveScanningSet(),
|
||||||
legacy_configuration.interval.value(),
|
legacy_configuration.getInterval().value(),
|
||||||
legacy_configuration.window.value(),
|
legacy_configuration.getWindow().value(),
|
||||||
params.getOwnAddressType(),
|
params.getOwnAddressType(),
|
||||||
params.getFilter()
|
params.getFilter()
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue