diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-09-29 14:46:47 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-30 16:40:41 -0700 |
commit | ca23147228f98ba0a97bcfbd6d22854a60b30dd9 (patch) | |
tree | b98d4f4cd535900173e12adb5d2a7d065fe59420 /core | |
parent | 3a9d895ccfe1c1acc062cc95339a77240e607cfb (diff) | |
download | subsurface-ca23147228f98ba0a97bcfbd6d22854a60b30dd9.tar.gz |
bluetooth discovery: differentiate discovered and paired devices
We call the same helper from two spots. Once when we report the already
paired BT devices on Android, and once from the deviceDescovered signal
for the discovery agent. Let's make sure we can tell where the info came
from.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/btdiscovery.cpp | 8 | ||||
-rw-r--r-- | core/btdiscovery.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index 5d7122414..31cf7fa5d 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -194,7 +194,7 @@ void BTDiscovery::BTDiscoveryReDiscover() // So behaviour is same on Linux/Bluez stack and // Android/Java stack with respect to discovery for (int i = 0; i < btPairedDevices.length(); i++) - btDeviceDiscoveredMain(btPairedDevices[i]); + btDeviceDiscoveredMain(btPairedDevices[i], true); #endif for (int i = 0; i < btPairedDevices.length(); i++) qDebug() << "Paired =" << btPairedDevices[i].name << btPairedDevices[i].address; @@ -268,10 +268,10 @@ void BTDiscovery::btDeviceDiscovered(const QBluetoothDeviceInfo &device) saveBtDeviceInfo(btDeviceAddress(&device, false), device); #endif - btDeviceDiscoveredMain(this_d); + btDeviceDiscoveredMain(this_d, false); } -void BTDiscovery::btDeviceDiscoveredMain(const btPairedDevice &device) +void BTDiscovery::btDeviceDiscoveredMain(const btPairedDevice &device, bool fromPaired) { btVendorProduct btVP; @@ -282,7 +282,7 @@ void BTDiscovery::btDeviceDiscoveredMain(const btPairedDevice &device) else newDevice = device.name; - qDebug() << "Found new device:" << newDevice << device.address; + qDebug() << (fromPaired ? "Paired device" : "Discovered new device:") << newDevice << device.address; if (newDC) { QString vendor = dc_descriptor_get_vendor(newDC); qDebug() << "this could be a " + vendor + " " + newDevice; diff --git a/core/btdiscovery.h b/core/btdiscovery.h index d3a81bf39..953e707b4 100644 --- a/core/btdiscovery.h +++ b/core/btdiscovery.h @@ -44,7 +44,7 @@ public: }; void btDeviceDiscovered(const QBluetoothDeviceInfo &device); - void btDeviceDiscoveredMain(const btPairedDevice &device); + void btDeviceDiscoveredMain(const btPairedDevice &device, bool fromPaired); bool btAvailable() const; void showNonDiveComputers(bool show); void stopAgent(); |