summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-30 17:48:58 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-31 10:14:24 -0700
commitbe271e7d4860a360081162edeafb76c3fd40d3da (patch)
treea3f03c6ec06a09f286588b1f95c9309db2b1de62
parente0771e50f1dda6897336b528a1d05a7c64cab611 (diff)
downloadsubsurface-be271e7d4860a360081162edeafb76c3fd40d3da.tar.gz
QML UI: add getBtAddress function
This allows us to get the BT address of the first dive computer that we found. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qmlmanager.cpp12
-rw-r--r--mobile-widgets/qmlmanager.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index d9ec7c1c8..491c16825 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -249,6 +249,18 @@ int QMLManager::getProductIndex()
return -1;
}
+QString QMLManager::getBtAddress()
+{
+#if BT_SUPPORT
+ if (!btDCs.isEmpty()) {
+ QString btAddr = btDCs.first().btdi.address().toString();
+ qDebug() << "getBtAddress" << btAddr;
+ return btAddr;
+ }
+ return QString();
+#endif
+}
+
void QMLManager::finishSetup()
{
// Initialize cloud credentials.
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 0d7f2aaa0..7e1c3b78b 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -121,6 +121,7 @@ public:
Q_INVOKABLE QStringList getDCListFromVendor(const QString& vendor);
Q_INVOKABLE int getVendorIndex();
Q_INVOKABLE int getProductIndex();
+ Q_INVOKABLE QString getBtAddress();
#if BT_SUPPORT
void btDeviceDiscovered(const QBluetoothDeviceInfo &device);
#endif