diff options
-rw-r--r-- | core/btdiscovery.cpp | 7 | ||||
-rw-r--r-- | core/btdiscovery.h | 1 | ||||
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index e4c17902e..c3f6c9b36 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -301,6 +301,13 @@ bool BTDiscovery::checkException(const char* method, const QAndroidJniObject *ob } #endif // Q_OS_ANDROID +void BTDiscovery::discoverAddress(QString address) +{ + if (!btDeviceInfo.keys().contains(address) && !discoveryAgent->isActive()) { + qDebug() << "restarting discovery agent"; + discoveryAgent->start(); + } +} bool isBluetoothAddress(const QString &address) { diff --git a/core/btdiscovery.h b/core/btdiscovery.h index beabdf122..17790e30c 100644 --- a/core/btdiscovery.h +++ b/core/btdiscovery.h @@ -49,6 +49,7 @@ public: QList<btVendorProduct> getBtDcs(); QBluetoothLocalDevice localBtDevice; void BTDiscoveryReDiscover(); + void discoverAddress(QString address); private: static BTDiscovery *m_instance; diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 509d3b402..b0687bb3a 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -311,6 +311,7 @@ void DownloadFromDCWidget::on_device_currentTextChanged(const QString &device) // ensure we have a discovery running if (btd == nullptr) btd = BTDiscovery::instance(); + btd->discoverAddress(device); } #else Q_UNUSED(device) |