Fix Bluetooth Discovery on Android again

pull/651/head
Michael Zanetti 2021-08-20 12:49:44 +02:00
parent e5f76e7c74
commit 985f4fdb40
1 changed files with 14 additions and 4 deletions

View File

@ -178,12 +178,22 @@ void BluetoothDiscovery::onBluetoothHostModeChanged(const QBluetoothLocalDevice:
void BluetoothDiscovery::deviceDiscovered(const QBluetoothDeviceInfo &deviceInfo)
{
qCDebug(dcBtWiFiSetup()) << "BluetoothDiscovery: Device discovered:" << deviceInfo.address().toString() << deviceInfo.deviceUuid();
qCDebug(dcBtWiFiSetup()) << "BluetoothDiscovery: Device discovered:" << deviceInfo.name() << deviceInfo.address().toString() << deviceInfo.deviceUuid();
foreach (BluetoothDeviceInfo *di, m_deviceInfos->deviceInfos()) {
// Some platforms only provide device UUID (e.g. Apple) and MAC address is 00:00:00:00:00
// Others provide only a MAC address and the UUID is null.
// If we have a UUID, use that, otherwise use the MAC for comparison
if (!deviceInfo.deviceUuid().isNull()) {
if (di->bluetoothDeviceInfo().deviceUuid() == deviceInfo.deviceUuid()) {
di->setBluetoothDeviceInfo(deviceInfo);
return;
}
} else {
if (di->bluetoothDeviceInfo().address() == deviceInfo.address()) {
di->setBluetoothDeviceInfo(deviceInfo);
return;
}
}
}
BluetoothDeviceInfo *deviceInformation = new BluetoothDeviceInfo(deviceInfo);