mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
ddd5ec7f56
commit
e9fd4cb7dc
1 changed files with 7 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue