diff options
-rw-r--r-- | core/btdiscovery.cpp | 7 | ||||
-rw-r--r-- | core/btdiscovery.h | 1 | ||||
-rw-r--r-- | desktop-widgets/btdeviceselectiondialog.cpp | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index 578264b48..51cf61b20 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -82,7 +82,12 @@ static dc_descriptor_t *getDeviceType(QString btName) if (!vendor.isEmpty() && !product.isEmpty()) return descriptorLookup.value(vendor + product); - return NULL; + return nullptr; +} + +bool matchesKnownDiveComputerNames(QString btName) +{ + return getDeviceType(btName) != nullptr; } BTDiscovery::BTDiscovery(QObject*) : m_btValid(false), diff --git a/core/btdiscovery.h b/core/btdiscovery.h index 679e0cae6..060f2c705 100644 --- a/core/btdiscovery.h +++ b/core/btdiscovery.h @@ -18,6 +18,7 @@ void saveBtDeviceInfo(const QString &devaddr, QBluetoothDeviceInfo deviceInfo); bool isBluetoothAddress(const QString &address); +bool matchesKnownDiveComputerNames(QString btName); QString extractBluetoothAddress(const QString &address); QString extractBluetoothNameAddress(const QString &address, QString &name); QBluetoothDeviceInfo getBtDeviceInfo(const QString &devaddr); diff --git a/desktop-widgets/btdeviceselectiondialog.cpp b/desktop-widgets/btdeviceselectiondialog.cpp index 23e965dab..bf56005d3 100644 --- a/desktop-widgets/btdeviceselectiondialog.cpp +++ b/desktop-widgets/btdeviceselectiondialog.cpp @@ -172,6 +172,9 @@ void BtDeviceSelectionDialog::hostModeStateChanged(QBluetoothLocalDevice::HostMo void BtDeviceSelectionDialog::addRemoteDevice(const QBluetoothDeviceInfo &remoteDeviceInfo) { + // are we supposed to show all devices or just dive computers? + if (!ui->showNonDivecomputers->isChecked() && !matchesKnownDiveComputerNames(remoteDeviceInfo.name())) + return; #if defined(Q_OS_WIN) // On Windows we cannot obtain the pairing status so we set only the name and the address of the device QString deviceLabel = QString("%1 (%2)").arg(remoteDeviceInfo.name(), |