diff --git a/features/FEATURE_BLE/ble/generic/GenericGap.h b/features/FEATURE_BLE/ble/generic/GenericGap.h index 4a8961f691..91a5e698bf 100644 --- a/features/FEATURE_BLE/ble/generic/GenericGap.h +++ b/features/FEATURE_BLE/ble/generic/GenericGap.h @@ -782,7 +782,7 @@ private: ); void on_scan_timeout_(); - + void process_legacy_scan_timeout(); private: pal::EventQueue &_event_queue; diff --git a/features/FEATURE_BLE/source/generic/GenericGap.tpp b/features/FEATURE_BLE/source/generic/GenericGap.tpp index 33e23f4175..0d0e4005cc 100644 --- a/features/FEATURE_BLE/source/generic/GenericGap.tpp +++ b/features/FEATURE_BLE/source/generic/GenericGap.tpp @@ -1605,21 +1605,36 @@ void GenericGaponScanTimeout(ScanTimeoutEvent()); + } } +} - _eventHandler->onScanTimeout(ScanTimeoutEvent()); +template class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler> +void GenericGap::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 class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>