diff options
author | Sven Gothel <[email protected]> | 2020-10-23 07:14:37 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-23 07:14:37 +0200 |
commit | 39de6a7097abb12d1f60fdc9142b79d2a3ba456e (patch) | |
tree | 199f8a9dae713971442db9167482cc33b4fdeaf4 /src | |
parent | 0a71109c4105d2b9f3880a83252c39f8720eb832 (diff) |
DBTAdapter: Resolve uninitialized nextMetaScanType and refine with hasScanType(eventScanType, ScanType::LE)
Note: '-Wmaybe-uninitialized' didn't trigger this when building in DEBUG mode using g++ 10
Diffstat (limited to 'src')
-rw-r--r-- | src/direct_bt/DBTAdapter.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp index 0a20736f..bd7101c5 100644 --- a/src/direct_bt/DBTAdapter.cpp +++ b/src/direct_bt/DBTAdapter.cpp @@ -714,9 +714,16 @@ bool DBTAdapter::mgmtEvDeviceDiscoveringAny(std::shared_ptr<MgmtEvent> e, const ScanType nextMetaScanType; if( eventEnabled ) { + // enabled eventScanType nextMetaScanType = changeScanType(currentMetaScanType, eventScanType, true); - } else if( !keep_le_scan_alive ) { - nextMetaScanType = changeScanType(currentMetaScanType, eventScanType, false); + } else { + // disabled eventScanType + if( hasScanType(eventScanType, ScanType::LE) && keep_le_scan_alive ) { + // Unchanged meta for disabled-LE && keep_le_scan_alive + nextMetaScanType = currentMetaScanType; + } else { + nextMetaScanType = changeScanType(currentMetaScanType, eventScanType, false); + } } if( !hciSourced ) { |