diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-09-24 17:31:33 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-12 08:22:44 -0700 |
commit | 38cda08819842d6dcfdedde0dbf9720958d8c075 (patch) | |
tree | 91f1d82d44166d23847468d6e9e9c7cfb18a17a4 | |
parent | 2ba3eab31978b6dd5956f0af7749549ba724e300 (diff) | |
download | subsurface-38cda08819842d6dcfdedde0dbf9720958d8c075.tar.gz |
Bluetooth: run a discovery agent for BT/BLE dive computers on macOS
This way the scan time will be shorter (which on macOS can be 25+ seconds).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.cpp | 16 | ||||
-rw-r--r-- | desktop-widgets/downloadfromdivecomputer.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index de0dd0626..509d3b402 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -23,6 +23,9 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) : timer(new QTimer(this)), dumpWarningShown(false), ostcFirmwareCheck(0), +#if defined (BT_SUPPORT) + btd(nullptr), +#endif currentState(INITIAL) { diveImportedModel = new DiveImportedModel(this); @@ -301,6 +304,19 @@ void DownloadFromDCWidget::on_product_currentIndexChanged(const QString &) updateDeviceEnabled(); } +void DownloadFromDCWidget::on_device_currentTextChanged(const QString &device) +{ +#if defined(Q_OS_MACOS) + if (isBluetoothAddress(device)) { + // ensure we have a discovery running + if (btd == nullptr) + btd = BTDiscovery::instance(); + } +#else + Q_UNUSED(device) +#endif +} + void DownloadFromDCWidget::on_search_clicked() { if (ui.vendor->currentText() == "Uemis" || ui.vendor->currentText() == "Garmin") { diff --git a/desktop-widgets/downloadfromdivecomputer.h b/desktop-widgets/downloadfromdivecomputer.h index bdaa3057a..4d1a912e9 100644 --- a/desktop-widgets/downloadfromdivecomputer.h +++ b/desktop-widgets/downloadfromdivecomputer.h @@ -43,6 +43,7 @@ slots: void on_search_clicked(); void on_vendor_currentIndexChanged(const QString &vendor); void on_product_currentIndexChanged(const QString &product); + void on_device_currentTextChanged(const QString &device); void onDownloadThreadFinished(); void updateProgressBar(); @@ -82,6 +83,7 @@ private: DiveImportedModel *diveImportedModel; #if defined(BT_SUPPORT) BtDeviceSelectionDialog *btDeviceSelectionDialog; + BTDiscovery *btd; #endif public: |