@@ -1605,21 +1605,38 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
1605
1605
return ;
1606
1606
}
1607
1607
1608
+ _scan_enabled = false ;
1609
+
1608
1610
/* if timeout happened on a 4.2 chip we need to stop the scan manually */
1609
1611
if (!is_extended_advertising_available ()) {
1610
- _pal_gap.scan_enable (false , false );
1611
- #if BLE_FEATURE_PRIVACY
1612
- set_random_address_rotation (false );
1613
- #endif
1612
+ _event_queue.post (
1613
+ mbed::callback (
1614
+ this ,
1615
+ &GenericGap<
1616
+ PalGapImpl,
1617
+ PalSecurityManager,
1618
+ ConnectionEventMonitorEventHandler
1619
+ >::process_legacy_scan_timeout
1620
+ )
1621
+ );
1622
+ } else {
1623
+ if (_eventHandler) {
1624
+ _eventHandler->onScanTimeout (ScanTimeoutEvent ());
1625
+ }
1614
1626
}
1627
+ }
1615
1628
1616
- _scan_enabled = false ;
1629
+ template <template <class > class PalGapImpl , class PalSecurityManager , class ConnectionEventMonitorEventHandler >
1630
+ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::process_legacy_scan_timeout ()
1631
+ {
1632
+ _pal_gap.scan_enable (false , false );
1633
+ #if BLE_FEATURE_PRIVACY
1634
+ set_random_address_rotation (false );
1635
+ #endif
1617
1636
1618
- if (! _eventHandler) {
1619
- return ;
1637
+ if (_eventHandler) {
1638
+ _eventHandler-> onScanTimeout ( ScanTimeoutEvent ()) ;
1620
1639
}
1621
-
1622
- _eventHandler->onScanTimeout (ScanTimeoutEvent ());
1623
1640
}
1624
1641
1625
1642
template <template <class > class PalGapImpl , class PalSecurityManager , class ConnectionEventMonitorEventHandler >
@@ -3263,6 +3280,7 @@ ble_error_t GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEve
3263
3280
3264
3281
_scan_timeout.detach ();
3265
3282
if (duration.value ()) {
3283
+ /* */
3266
3284
_scan_timeout.attach_us (
3267
3285
mbed::callback (this , &GenericGap::on_scan_timeout_),
3268
3286
microsecond_t (duration).value ()
0 commit comments