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>
This commit is contained in:
Dirk Hohndel 2018-09-25 20:56:56 -07:00
parent ef0e76bc69
commit 7512a6e915

View file

@ -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();