mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #10219 from paul-szczepanek-arm/fix-legacy-scan-timeout
BLE: fix scan timeout being called from interruptpull/9995/head
commit
4cdc3b7cb8
|
@ -782,7 +782,7 @@ private:
|
||||||
);
|
);
|
||||||
|
|
||||||
void on_scan_timeout_();
|
void on_scan_timeout_();
|
||||||
|
void process_legacy_scan_timeout();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pal::EventQueue &_event_queue;
|
pal::EventQueue &_event_queue;
|
||||||
|
|
|
@ -1605,21 +1605,36 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if timeout happened on a 4.2 chip we need to stop the scan manually */
|
|
||||||
if (!is_extended_advertising_available()) {
|
|
||||||
_pal_gap.scan_enable(false, false);
|
|
||||||
#if BLE_FEATURE_PRIVACY
|
|
||||||
set_random_address_rotation(false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
_scan_enabled = false;
|
_scan_enabled = false;
|
||||||
|
|
||||||
if (!_eventHandler) {
|
if (!is_extended_advertising_available()) {
|
||||||
return;
|
/* if timeout happened on a 4.2 chip this means legacy scanning and a timer timeout
|
||||||
|
* but we need to handle the event from user context - use the event queue to handle it */
|
||||||
|
_event_queue.post(
|
||||||
|
mbed::callback(
|
||||||
|
this,
|
||||||
|
&GenericGap::process_legacy_scan_timeout
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (_eventHandler) {
|
||||||
|
_eventHandler->onScanTimeout(ScanTimeoutEvent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_eventHandler->onScanTimeout(ScanTimeoutEvent());
|
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||||
|
void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::process_legacy_scan_timeout()
|
||||||
|
{
|
||||||
|
/* legacy scanning timed out is based on timer so we need to stop the scan manually */
|
||||||
|
_pal_gap.scan_enable(false, false);
|
||||||
|
#if BLE_FEATURE_PRIVACY
|
||||||
|
set_random_address_rotation(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (_eventHandler) {
|
||||||
|
_eventHandler->onScanTimeout(ScanTimeoutEvent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
|
||||||
|
|
Loading…
Reference in New Issue