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>
This commit is contained in:
Dirk Hohndel 2018-09-24 17:31:33 -07:00
parent 2ba3eab319
commit 38cda08819
2 changed files with 18 additions and 0 deletions

View file

@ -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") {

View file

@ -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: