summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-09-14 14:47:58 +0200
committerSven Gothel <[email protected]>2022-09-14 14:47:58 +0200
commit04c6ea1c68a027072fb935d26f281ae924acf8a4 (patch)
tree4273966301b3456a2b42f92d4045c961340fa999 /src
parente7e6847dc32d6f95bfea5f3bdef396231f2cbbb6 (diff)
BTAdapter::mgmtEvDeviceDiscoveringAny(): Drop 'off_thread' argument, which is always used with value 'true'
Hence BTAdapter::startDiscoveryBackground() is always started off-thread.
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/BTAdapter.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp
index 82ea2745..831eb734 100644
--- a/src/direct_bt/BTAdapter.cpp
+++ b/src/direct_bt/BTAdapter.cpp
@@ -142,7 +142,7 @@ bool BTAdapter::addDevicePausingDiscovery(const BTDeviceRef & device) noexcept {
}
if( added_first ) {
if constexpr ( SCAN_DISABLED_POST_CONNECT ) {
- updateDeviceDiscoveringState(ScanType::LE, false /* eventEnabled */, true /* off_thread */);
+ updateDeviceDiscoveringState(ScanType::LE, false /* eventEnabled */);
} else {
std::thread bg(&BTAdapter::stopDiscoveryImpl, this, false /* forceDiscoveringEvent */, true /* temporary */); // @suppress("Invalid arguments")
bg.detach();
@@ -1638,20 +1638,20 @@ bool BTAdapter::mgmtEvHCIAnyHCI(const MgmtEvent& e) noexcept {
bool BTAdapter::mgmtEvDeviceDiscoveringHCI(const MgmtEvent& e) noexcept {
const MgmtEvtDiscovering &event = *static_cast<const MgmtEvtDiscovering *>(&e);
- return mgmtEvDeviceDiscoveringAny(event.getScanType(), event.getEnabled(), event.getTimestamp(), true /* hciSourced */, true /* off_thread */);
+ return mgmtEvDeviceDiscoveringAny(event.getScanType(), event.getEnabled(), event.getTimestamp(), true /* hciSourced */);
}
bool BTAdapter::mgmtEvDeviceDiscoveringMgmt(const MgmtEvent& e) noexcept {
const MgmtEvtDiscovering &event = *static_cast<const MgmtEvtDiscovering *>(&e);
- return mgmtEvDeviceDiscoveringAny(event.getScanType(), event.getEnabled(), event.getTimestamp(), false /* hciSourced */, true /* off_thread */);
+ return mgmtEvDeviceDiscoveringAny(event.getScanType(), event.getEnabled(), event.getTimestamp(), false /* hciSourced */);
}
-void BTAdapter::updateDeviceDiscoveringState(const ScanType eventScanType, const bool eventEnabled, const bool off_thread) noexcept {
- mgmtEvDeviceDiscoveringAny(eventScanType, eventEnabled, jau::getCurrentMilliseconds(), false /* hciSourced */, off_thread);
+void BTAdapter::updateDeviceDiscoveringState(const ScanType eventScanType, const bool eventEnabled) noexcept {
+ mgmtEvDeviceDiscoveringAny(eventScanType, eventEnabled, jau::getCurrentMilliseconds(), false /* hciSourced */);
}
bool BTAdapter::mgmtEvDeviceDiscoveringAny(const ScanType eventScanType, const bool eventEnabled, const uint64_t eventTimestamp,
- const bool hciSourced, const bool off_thread) noexcept {
+ const bool hciSourced) noexcept {
const std::string srctkn = hciSourced ? "hci" : "mgmt";
ScanType currentNativeScanType = hci.getCurrentScanType();
@@ -1712,12 +1712,8 @@ bool BTAdapter::mgmtEvDeviceDiscoveringAny(const ScanType eventScanType, const b
DiscoveryPolicy::AUTO_OFF != discovery_policy &&
!hasDevicesPausingDiscovery() )
{
- if( off_thread ) {
- std::thread bg(&BTAdapter::startDiscoveryBackground, this); // @suppress("Invalid arguments")
- bg.detach();
- } else {
- startDiscoveryBackground();
- }
+ std::thread bg(&BTAdapter::startDiscoveryBackground, this); // @suppress("Invalid arguments")
+ bg.detach();
}
return true;
}
@@ -2081,14 +2077,14 @@ bool BTAdapter::mgmtEvHCILERemoteUserFeaturesHCI(const MgmtEvent& e) noexcept {
const DiscoveryPolicy policy = discovery_policy;
if( DiscoveryPolicy::AUTO_OFF == policy ) {
if constexpr ( SCAN_DISABLED_POST_CONNECT ) {
- updateDeviceDiscoveringState(ScanType::LE, false /* eventEnabled */, true /* off_thread */);
+ updateDeviceDiscoveringState(ScanType::LE, false /* eventEnabled */);
} else {
std::thread bg(&BTAdapter::stopDiscoveryImpl, this, false /* forceDiscoveringEvent */, true /* temporary */); // @suppress("Invalid arguments")
bg.detach();
}
} else if( DiscoveryPolicy::ALWAYS_ON == policy ) {
if constexpr ( SCAN_DISABLED_POST_CONNECT ) {
- updateDeviceDiscoveringState(ScanType::LE, false /* eventEnabled */, true /* off_thread */);
+ updateDeviceDiscoveringState(ScanType::LE, false /* eventEnabled */);
} else {
std::thread bg(&BTAdapter::startDiscoveryBackground, this); // @suppress("Invalid arguments")
bg.detach();