summaryrefslogtreecommitdiffstats
path: root/core/btdiscovery.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-16 21:49:11 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-16 21:53:44 -0700
commita4f045abaa625db4780f915ab57ed3edc89bf000 (patch)
tree71e9887620f1f7aea946077ae191eb472b271ded /core/btdiscovery.cpp
parentc21845aa016786fb92a08c5d01029218ad1e10fb (diff)
downloadsubsurface-a4f045abaa625db4780f915ab57ed3edc89bf000.tar.gz
Add the connections that we find to the model
So far this only deals with BT addresses. We also need to add other connections that we detect. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/btdiscovery.cpp')
-rw-r--r--core/btdiscovery.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp
index a9f8c861a..8a9bedc73 100644
--- a/core/btdiscovery.cpp
+++ b/core/btdiscovery.cpp
@@ -192,25 +192,28 @@ void BTDiscovery::btDeviceDiscoveredMain(const btPairedDevice &device)
dc_descriptor_t *newDC = getDeviceType(device.name);
if (newDC)
newDevice = dc_descriptor_get_product(newDC);
- else
+ else
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 + ")");
- return;
+ 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;
+ }
}
- }
+ connectionListModel.addAddress(device.address);
qDebug() << "Not recognized as dive computer";
}