aboutsummaryrefslogtreecommitdiffstats
path: root/src/direct_bt/BTAdapter.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-09-15 16:08:40 +0200
committerSven Gothel <[email protected]>2022-09-15 16:08:40 +0200
commit8dfa27ad2841aecb85200a15c834a8c770cc5dc6 (patch)
tree76121475b3560b67bbec7133499f842b63635ce4 /src/direct_bt/BTAdapter.cpp
parentd7017ae58eae5e3d832f853354c17bda73a60efc (diff)
BTAdapter: Align hasDevicesPausingDiscovery() -> getDevicesPausingDiscoveryCount() w/ getConnectedDeviceCount(), both return nsize_t
Diffstat (limited to 'src/direct_bt/BTAdapter.cpp')
-rw-r--r--src/direct_bt/BTAdapter.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp
index be7789f8..f7905045 100644
--- a/src/direct_bt/BTAdapter.cpp
+++ b/src/direct_bt/BTAdapter.cpp
@@ -185,9 +185,9 @@ void BTAdapter::clearDevicesPausingDiscovery() noexcept {
pausing_discovery_devices.clear();
}
-bool BTAdapter::hasDevicesPausingDiscovery() noexcept {
+jau::nsize_t BTAdapter::getDevicesPausingDiscoveryCount() noexcept {
const std::lock_guard<std::mutex> lock(mtx_pausingDiscoveryDevices); // RAII-style acquire and relinquish via destructor
- return pausing_discovery_devices.size() > 0;
+ return pausing_discovery_devices.size();
}
bool BTAdapter::addConnectedDevice(const BTDeviceRef & device) noexcept {
@@ -232,7 +232,7 @@ BTDeviceRef BTAdapter::findConnectedDevice (const EUI48 & address, const BDAddre
return findDevice(connectedDevices, address, addressType);
}
-int BTAdapter::getConnectedDeviceCount() const noexcept {
+jau::nsize_t BTAdapter::getConnectedDeviceCount() const noexcept {
jau::sc_atomic_critical sync(sync_data); // SC-DRF via atomic acquire & release
return connectedDevices.size();
}
@@ -1133,7 +1133,7 @@ void BTAdapter::discoveryServerWork(jau::service_runner& sr) noexcept {
if( !is_set(currentNativeScanType, ScanType::LE) &&
DiscoveryPolicy::AUTO_OFF != discovery_policy &&
- !hasDevicesPausingDiscovery() ) // still required to start discovery ???
+ 0 == getDevicesPausingDiscoveryCount() ) // still required to start discovery ???
{
// if le_enable_scan(..) is successful, it will issue 'mgmtEvDeviceDiscoveringHCI(..)' immediately, which updates currentMetaScanType.
DBG_PRINT("BTAdapter::startDiscoveryBackground[%u/%u]: Policy %s, currentScanType[native %s, meta %s] ... %s",
@@ -1447,7 +1447,7 @@ HCIStatusCode BTAdapter::startAdvertising(DBGattServerRef gattServerData_,
WARN_PRINT("Not allowed (scan enabled): %s", toString(true).c_str());
return HCIStatusCode::COMMAND_DISALLOWED;
}
- const int connCount = getConnectedDeviceCount();
+ const jau::nsize_t connCount = getConnectedDeviceCount();
if( 0 < connCount ) { // FIXME: May shall not be a restriction
WARN_PRINT("Not allowed (%d connections open/pending): %s", connCount, toString(true).c_str());
return HCIStatusCode::COMMAND_DISALLOWED;
@@ -1706,7 +1706,7 @@ bool BTAdapter::mgmtEvDeviceDiscoveringAny(const ScanType eventScanType, const b
if( !is_set(currentNativeScanType, ScanType::LE) &&
DiscoveryPolicy::AUTO_OFF != discovery_policy &&
- !hasDevicesPausingDiscovery() )
+ 0 == getDevicesPausingDiscoveryCount() )
{
discovery_service.start();
}