mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
ef0e76bc69
commit
7512a6e915
1 changed files with 9 additions and 0 deletions
|
@ -305,6 +305,15 @@ bool BTDiscovery::checkException(const char* method, const QAndroidJniObject *ob
|
||||||
|
|
||||||
void BTDiscovery::discoverAddress(QString address)
|
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()) {
|
if (!btDeviceInfo.keys().contains(address) && !discoveryAgent->isActive()) {
|
||||||
qDebug() << "restarting discovery agent";
|
qDebug() << "restarting discovery agent";
|
||||||
discoveryAgent->start();
|
discoveryAgent->start();
|
||||||
|
|
Loading…
Add table
Reference in a new issue