diff options
author | Sven Gothel <[email protected]> | 2021-09-25 02:41:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-09-25 02:41:28 +0200 |
commit | 80e667635815c7faaaca74279dde75519f36c904 (patch) | |
tree | ae9587d1a5a6722f4e2cdc4dfbdb7dc07fb3d6fe | |
parent | 73ca617a55dbd3af4b66246d211895bbbf377a03 (diff) |
BTAdapter::stopDiscovery(): Resolves checkDiscoveryState error message @ HCI command failure.
-rw-r--r-- | src/direct_bt/BTAdapter.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp index 8cbc59e0..2a72bb52 100644 --- a/src/direct_bt/BTAdapter.cpp +++ b/src/direct_bt/BTAdapter.cpp @@ -927,8 +927,14 @@ HCIStatusCode BTAdapter::stopDiscovery() noexcept { } exit: + if( HCIStatusCode::SUCCESS != status ) { + // Sync nativeDiscoveryState with currentMetaScanType, + // the latter git set to NONE via mgmtEvDeviceDiscoveringHCI(..) below. + // Resolves checkDiscoveryState error message @ HCI command failure. + hci.setCurrentScanType( ScanType::NONE ); + } if( le_scan_temp_disabled || HCIStatusCode::SUCCESS != status ) { - // In case of discoveryTempDisabled, power-off, le_enable_scane failure + // In case of discoveryTempDisabled, power-off, le_enable_scan failure // or already closed HCIHandler, send the event directly. const MgmtEvtDiscovering e(dev_id, ScanType::LE, false); mgmtEvDeviceDiscoveringHCI( e ); |