Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions connectivity/FEATURE_BLE/source/generic/GapImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -3562,6 +3563,8 @@ ble_error_t Gap::setScanParameters(const ScanParameters &params)
params.getCodedPhyConfiguration().getWindow().value()
};

_scan_parameters_set = true;

return _pal_gap.set_extended_scan_parameters(
params.getOwnAddressType(),
params.getFilter(),
Expand All @@ -3581,6 +3584,8 @@ ble_error_t Gap::setScanParameters(const ScanParameters &params)
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(),
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions connectivity/FEATURE_BLE/source/generic/GapImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,10 @@ class Gap :


bool _user_manage_connection_parameter_requests : 1;
#if BLE_ROLE_OBSERVER
bool _scan_parameters_set : 1 = false;
#endif // BLE_ROLE_OBSERVER

};

} // namespace impl
Expand Down