mirror of https://github.com/ARMmbed/mbed-os.git
remember if BLE scan paremeters are set
parent
84e5f1e03e
commit
f34d31f350
|
@ -1221,6 +1221,7 @@ ble_error_t Gap::reset()
|
|||
#endif // BLE_FEATURE_PRIVACY
|
||||
|
||||
#if BLE_ROLE_OBSERVER
|
||||
_scan_parameters_set = false;
|
||||
_scan_timeout.detach();
|
||||
#endif
|
||||
|
||||
|
@ -3562,6 +3563,8 @@ ble_error_t Gap::setScanParameters(const ScanParameters ¶ms)
|
|||
params.getCodedPhyConfiguration().getWindow().value()
|
||||
};
|
||||
|
||||
_scan_parameters_set = true;
|
||||
|
||||
return _pal_gap.set_extended_scan_parameters(
|
||||
params.getOwnAddressType(),
|
||||
params.getFilter(),
|
||||
|
@ -3581,6 +3584,8 @@ ble_error_t Gap::setScanParameters(const ScanParameters ¶ms)
|
|||
ScanParameters::phy_configuration_t legacy_configuration =
|
||||
params.get1mPhyConfiguration();
|
||||
|
||||
_scan_parameters_set = true;
|
||||
|
||||
return _pal_gap.set_scan_parameters(
|
||||
legacy_configuration.isActiveScanningSet(),
|
||||
legacy_configuration.getInterval().value(),
|
||||
|
@ -3613,6 +3618,11 @@ ble_error_t Gap::startScan(
|
|||
return BLE_STACK_BUSY;
|
||||
}
|
||||
|
||||
if (!_scan_parameters_set) {
|
||||
tr_error("Scan parameters not set.");
|
||||
return BLE_ERROR_OPERATION_NOT_PERMITTED;
|
||||
}
|
||||
|
||||
_scan_requested_duration = duration;
|
||||
_scan_requested_filtering = filtering;
|
||||
_scan_requested_period = period;
|
||||
|
|
|
@ -991,6 +991,10 @@ private:
|
|||
|
||||
|
||||
bool _user_manage_connection_parameter_requests : 1;
|
||||
#if BLE_ROLE_OBSERVER
|
||||
bool _scan_parameters_set : 1 = false;
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
|
Loading…
Reference in New Issue