mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
2ba3eab319
commit
38cda08819
2 changed files with 18 additions and 0 deletions
|
@ -23,6 +23,9 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, Qt::WindowFlags f) :
|
||||||
timer(new QTimer(this)),
|
timer(new QTimer(this)),
|
||||||
dumpWarningShown(false),
|
dumpWarningShown(false),
|
||||||
ostcFirmwareCheck(0),
|
ostcFirmwareCheck(0),
|
||||||
|
#if defined (BT_SUPPORT)
|
||||||
|
btd(nullptr),
|
||||||
|
#endif
|
||||||
currentState(INITIAL)
|
currentState(INITIAL)
|
||||||
{
|
{
|
||||||
diveImportedModel = new DiveImportedModel(this);
|
diveImportedModel = new DiveImportedModel(this);
|
||||||
|
@ -301,6 +304,19 @@ void DownloadFromDCWidget::on_product_currentIndexChanged(const QString &)
|
||||||
updateDeviceEnabled();
|
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()
|
void DownloadFromDCWidget::on_search_clicked()
|
||||||
{
|
{
|
||||||
if (ui.vendor->currentText() == "Uemis" || ui.vendor->currentText() == "Garmin") {
|
if (ui.vendor->currentText() == "Uemis" || ui.vendor->currentText() == "Garmin") {
|
||||||
|
|
|
@ -43,6 +43,7 @@ slots:
|
||||||
void on_search_clicked();
|
void on_search_clicked();
|
||||||
void on_vendor_currentIndexChanged(const QString &vendor);
|
void on_vendor_currentIndexChanged(const QString &vendor);
|
||||||
void on_product_currentIndexChanged(const QString &product);
|
void on_product_currentIndexChanged(const QString &product);
|
||||||
|
void on_device_currentTextChanged(const QString &device);
|
||||||
|
|
||||||
void onDownloadThreadFinished();
|
void onDownloadThreadFinished();
|
||||||
void updateProgressBar();
|
void updateProgressBar();
|
||||||
|
@ -82,6 +83,7 @@ private:
|
||||||
DiveImportedModel *diveImportedModel;
|
DiveImportedModel *diveImportedModel;
|
||||||
#if defined(BT_SUPPORT)
|
#if defined(BT_SUPPORT)
|
||||||
BtDeviceSelectionDialog *btDeviceSelectionDialog;
|
BtDeviceSelectionDialog *btDeviceSelectionDialog;
|
||||||
|
BTDiscovery *btd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Reference in a new issue