diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-07-17 12:40:30 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-18 00:49:31 -0700 |
commit | 8f0621f7335ac911ddfa6a7b03e8ee1c85af7928 (patch) | |
tree | 215274719bcef9ddea3c5dfdb5d946f2dd313f8d /core/btdiscovery.cpp | |
parent | bb3387f234991f0779e683951b3f74cf00782570 (diff) | |
download | subsurface-8f0621f7335ac911ddfa6a7b03e8ee1c85af7928.tar.gz |
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>
Diffstat (limited to 'core/btdiscovery.cpp')
-rw-r--r-- | core/btdiscovery.cpp | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index e52b8a050..cacb0ac9a 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -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"; } |