mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
iOS BLE support: no localBtDevice, go straight to discovery
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f940104a33
commit
526da269cc
1 changed files with 8 additions and 1 deletions
|
@ -100,14 +100,19 @@ BTDiscovery::BTDiscovery(QObject *parent)
|
||||||
}
|
}
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
#if defined(BT_SUPPORT)
|
#if defined(BT_SUPPORT)
|
||||||
|
#if !defined(Q_OS_IOS)
|
||||||
if (localBtDevice.isValid() &&
|
if (localBtDevice.isValid() &&
|
||||||
localBtDevice.hostMode() == QBluetoothLocalDevice::HostConnectable) {
|
localBtDevice.hostMode() == QBluetoothLocalDevice::HostConnectable) {
|
||||||
btPairedDevices.clear();
|
btPairedDevices.clear();
|
||||||
qDebug() << "localDevice " + localBtDevice.name() + " is valid, starting discovery";
|
qDebug() << "localDevice " + localBtDevice.name() + " is valid, starting discovery";
|
||||||
m_btValid = true;
|
m_btValid = true;
|
||||||
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
#else
|
||||||
|
m_btValid = false;
|
||||||
|
#endif
|
||||||
|
#if defined(Q_OS_IOS) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||||
discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
|
discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
|
||||||
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BTDiscovery::btDeviceDiscovered);
|
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BTDiscovery::btDeviceDiscovered);
|
||||||
|
qDebug() << "starting BLE discovery";
|
||||||
discoveryAgent->start();
|
discoveryAgent->start();
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_ANDROID) && defined(BT_SUPPORT)
|
#if defined(Q_OS_ANDROID) && defined(BT_SUPPORT)
|
||||||
|
@ -126,11 +131,13 @@ BTDiscovery::BTDiscovery(QObject *parent)
|
||||||
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
|
||||||
discoveryAgent->stop();
|
discoveryAgent->stop();
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(Q_OS_IOS)
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "localBtDevice isn't valid";
|
qDebug() << "localBtDevice isn't valid";
|
||||||
m_btValid = false;
|
m_btValid = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BTDiscovery::~BTDiscovery()
|
BTDiscovery::~BTDiscovery()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue