BLE: improve scan state bookkeeping

pull/13759/head
Vincent Coubard 2020-09-10 14:59:03 +01:00
parent 9df7fc9b7e
commit 9eac36879a
1 changed files with 5 additions and 12 deletions

View File

@ -1076,27 +1076,20 @@ Gap::GapShutdownCallbackChain_t &Gap::onShutdown()
void Gap::on_scan_started(bool success)
{
if (success) {
_scan_pending = false;
_scan_enabled = true;
} else {
_scan_pending = false;
_scan_enabled = true;
}
_scan_pending = false;
_scan_enabled = success;
}
void Gap::on_scan_stopped(bool success)
{
_scan_pending = false;
_scan_enabled = false;
if (!success) {
_scan_pending = false;
_scan_enabled = false;
_scan_address_refresh = false;
return;
}
_scan_pending = false;
_scan_enabled = false;
// The address is refreshed only if there's no other pending request to refresh
// the main address