summaryrefslogtreecommitdiffstats
path: root/core/btdiscovery.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-25 20:56:56 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-12 08:22:44 -0700
commit7512a6e9155196a3ede34b8a552c7c8dfb955ad3 (patch)
tree08786c2e66bf8c26fc5fcc663b60fa2d627821ab /core/btdiscovery.cpp
parentef0e76bc6958e4793b14482f6177d7058cc565ee (diff)
downloadsubsurface-7512a6e9155196a3ede34b8a552c7c8dfb955ad3.tar.gz
Bluetooth: restart scan for different device on macOS
This makes no sense, but apparently we need to start a fresh scan in order to be able to talk to a different BLE dive computer on the Mac. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/btdiscovery.cpp')
-rw-r--r--core/btdiscovery.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp
index 0bacbadda..deef322e4 100644
--- a/core/btdiscovery.cpp
+++ b/core/btdiscovery.cpp
@@ -305,6 +305,15 @@ bool BTDiscovery::checkException(const char* method, const QAndroidJniObject *ob
void BTDiscovery::discoverAddress(QString address)
{
+#if defined(Q_OS_MACOS)
+ // macOS appears to need a fresh scan if we want to switch devices
+ static QString lastAddress;
+ if (lastAddress != address) {
+ btDeviceInfo.clear();
+ discoveryAgent->stop();
+ lastAddress = address;
+ }
+#endif
if (!btDeviceInfo.keys().contains(address) && !discoveryAgent->isActive()) {
qDebug() << "restarting discovery agent";
discoveryAgent->start();