diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-12-21 14:52:02 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-01-22 12:57:26 +1300 |
commit | 0f350bef98a49949865bf898396dde7f4a58d1ee (patch) | |
tree | 9c6b7f62ed94a29a44ed89e8b805a82f191b92a8 | |
parent | f7a4327cd479a873df91a0df3190166b3aefcfc7 (diff) | |
download | subsurface-0f350bef98a49949865bf898396dde7f4a58d1ee.tar.gz |
Mobile: add helper function to fill in the BT name
For some devices the BT device name is different from the product name.
Make sure that name is available to the mobile UI. This helper fills it
in from the scan data (based on the device address).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 11 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 8ce1a4616..8abfd3b51 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1637,6 +1637,17 @@ void QMLManager::setStatusbarColor(QColor) #endif +void QMLManager::retrieveBluetoothName() +{ + QString name = DC_devName(); + QList<BTDiscovery::btVendorProduct> btDCs = BTDiscovery::instance()->getBtDcs(); + foreach (BTDiscovery::btVendorProduct btDC, btDCs) { + qDebug() << "compare" <<name << btDC.btpdi.address; + if (name.contains(btDC.btpdi.address)) + DC_setDevBluetoothName(btDC.btpdi.name); + } +} + QString QMLManager::DC_vendor() const { return m_device_data->vendor(); diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 98282425d..87972413d 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -62,6 +62,8 @@ public: QString DC_devName() const; void DC_setDevName(const QString& devName); + Q_INVOKABLE void retrieveBluetoothName(); + QString DC_devBluetoothName() const; void DC_setDevBluetoothName(const QString& devBluetoothName); |