QML UI: correctly match BT names with products

And remove the remaining references to the "Paired Bluetooth
Devices".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-07-17 12:40:30 -07:00
parent bb3387f234
commit 8f0621f733
2 changed files with 11 additions and 20 deletions

View file

@ -197,23 +197,17 @@ void BTDiscovery::btDeviceDiscoveredMain(const btPairedDevice &device)
newDevice = device.name;
qDebug() << "Found new device:" << newDevice << device.address;
QString vendor;
if (newDC)
foreach (vendor, productList.keys()) {
if (productList[vendor].contains(newDevice)) {
qDebug() << "this could be a " + vendor + " " +
(newDevice == "OSTC 3" ? "OSTC family" : newDevice);
btVP.btpdi = device;
btVP.dcDescriptor = newDC;
btVP.vendorIdx = vendorList.indexOf(vendor);
btVP.productIdx = productList[vendor].indexOf(newDevice);
qDebug() << "adding new btDCs entry (detected DC)" << newDevice << btVP.vendorIdx << btVP.productIdx << btVP.btpdi.address;;
btDCs << btVP;
productList[QObject::tr("Paired Bluetooth Devices")].append(device.name + " (" + device.address + ")");
connectionListModel.addAddress(device.address + " (" + device.name + ")");
return;
}
}
if (newDC) {
QString vendor = dc_descriptor_get_vendor(newDC);
qDebug() << "this could be a " + vendor + " " + newDevice;
btVP.btpdi = device;
btVP.dcDescriptor = newDC;
btVP.vendorIdx = vendorList.indexOf(vendor);
btVP.productIdx = productList[vendor].indexOf(newDevice);
btDCs << btVP;
connectionListModel.addAddress(device.address + " (" + newDevice + ")");
return;
}
connectionListModel.addAddress(device.address);
qDebug() << "Not recognized as dive computer";
}

View file

@ -161,9 +161,6 @@ void fill_computer_list()
#endif
qSort(vendorList);
#if defined(SUBSURFACE_MOBILE) && defined(BT_SUPPORT)
vendorList.append(QObject::tr("Paired Bluetooth Devices"));
#endif
}
DCDeviceData *DCDeviceData::m_instance = NULL;