Mobile: only show dive computers in the Bluetooth connection list

And offer an option to show all devices in the settings. This is intentionally
not stored in the preferences as this should never be needed. We don't support
BT or BLE dive computers that we don't recognize. This is a last resort in case
a new firmware were to change the name or some other weird issue causes us not
to recognize a dive computer - and that should be fixed instead of worked
around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-02-13 22:48:50 -08:00
parent f35a0f3b09
commit 9d582c5512
5 changed files with 60 additions and 2 deletions

View file

@ -91,6 +91,7 @@ bool matchesKnownDiveComputerNames(QString btName)
}
BTDiscovery::BTDiscovery(QObject*) : m_btValid(false),
m_showNonDiveComputers(false),
discoveryAgent(nullptr)
{
if (m_instance) {
@ -104,6 +105,11 @@ BTDiscovery::BTDiscovery(QObject*) : m_btValid(false),
#endif
}
void BTDiscovery::showNonDiveComputers(bool show)
{
m_showNonDiveComputers = show;
}
void BTDiscovery::BTDiscoveryReDiscover()
{
#if !defined(Q_OS_IOS)
@ -232,7 +238,9 @@ void BTDiscovery::btDeviceDiscoveredMain(const btPairedDevice &device)
connectionListModel.addAddress(newDevice + " " + device.address);
return;
}
connectionListModel.addAddress(device.address);
// Do we want only devices we recognize as dive computers?
if (m_showNonDiveComputers)
connectionListModel.addAddress(device.address);
qDebug() << "Not recognized as dive computer";
}