summaryrefslogtreecommitdiffstats
path: root/core/btdiscovery.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-27 15:04:50 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-27 16:02:17 -0700
commite9fd4cb7dca13c01f85ad63b667100ee15d7dc6d (patch)
treefd7a1a1490144d07c873334ac8597dad7c84508f /core/btdiscovery.cpp
parentddd5ec7f56e9b573eb5c5a9c4ea4e7afd7301d55 (diff)
downloadsubsurface-e9fd4cb7dca13c01f85ad63b667100ee15d7dc6d.tar.gz
Android: correctly detect the different BT device types
The previous code would not add the non-LE address for dual stack devices. Unfortunately, even with this fix we still don't get the correct result for the dual stack Shearwater Petrel 2 that I have for testing as Android incorrectly reports it as a BLE-only device. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/btdiscovery.cpp')
-rw-r--r--core/btdiscovery.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp
index 5fa6a7c80..1848b8442 100644
--- a/core/btdiscovery.cpp
+++ b/core/btdiscovery.cpp
@@ -247,15 +247,16 @@ void BTDiscovery::getBluetoothDevices()
continue;
}
jint btType = dev.callMethod<jint>("getType", "()I");
+ // 1 means Classic. 2 means BLE, 3 means dual stack
result.address = dev.callObjectMethod("getAddress","()Ljava/lang/String;").toString();
- if (btType == 2) // DEVICE_TYPE_LE
- result.address = QString("LE:%1").arg(result.address);
result.name = dev.callObjectMethod("getName", "()Ljava/lang/String;").toString();
- qDebug() << "paired Device type" << btType << "with address" << result.address;
- btPairedDevices.append(result);
- if (btType == 3) { // DEVICE_TYPE_DUAL
+ if (btType & 1) { // DEVICE_TYPE_CLASSIC
+ qDebug() << "paired BT classic device type" << btType << "with address" << result.address;
+ btPairedDevices.append(result);
+ }
+ if (btType & 2) { // DEVICE_TYPE_LE
result.address = QString("LE:%1").arg(result.address);
- qDebug() << "paired Device type" << btType << "with address" << result.address;
+ qDebug() << "paired BLE device type" << btType << "with address" << result.address;
btPairedDevices.append(result);
}
}