aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-02-12 07:35:35 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-02-14 09:05:58 -0800
commitf35a0f3b09197b56a7ecdd63a6689d8b69b36ce8 (patch)
treea352616244386eebc10086e0081aee3554598fdb /core
parent7b0cfb17728fec752bf14079b0fdd5888a2f044c (diff)
downloadsubsurface-f35a0f3b09197b56a7ecdd63a6689d8b69b36ce8.tar.gz
Desktop: only show dive computers in the Bluetooth device list
By default we'll only show devices that we believe to be dive computers, but the user can override that with the recently introduced check box. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/btdiscovery.cpp7
-rw-r--r--core/btdiscovery.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp
index 578264b48..51cf61b20 100644
--- a/core/btdiscovery.cpp
+++ b/core/btdiscovery.cpp
@@ -82,7 +82,12 @@ static dc_descriptor_t *getDeviceType(QString btName)
if (!vendor.isEmpty() && !product.isEmpty())
return descriptorLookup.value(vendor + product);
- return NULL;
+ return nullptr;
+}
+
+bool matchesKnownDiveComputerNames(QString btName)
+{
+ return getDeviceType(btName) != nullptr;
}
BTDiscovery::BTDiscovery(QObject*) : m_btValid(false),
diff --git a/core/btdiscovery.h b/core/btdiscovery.h
index 679e0cae6..060f2c705 100644
--- a/core/btdiscovery.h
+++ b/core/btdiscovery.h
@@ -18,6 +18,7 @@
void saveBtDeviceInfo(const QString &devaddr, QBluetoothDeviceInfo deviceInfo);
bool isBluetoothAddress(const QString &address);
+bool matchesKnownDiveComputerNames(QString btName);
QString extractBluetoothAddress(const QString &address);
QString extractBluetoothNameAddress(const QString &address, QString &name);
QBluetoothDeviceInfo getBtDeviceInfo(const QString &devaddr);