mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
BLE: try to enable on iOS
We can't use the localBtDevice on iOS, so hack around that and go straight to discovery. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
38243be44d
commit
dd14e27820
2 changed files with 8 additions and 7 deletions
|
@ -71,17 +71,20 @@ void BTDiscovery::BTDiscoveryReDiscover()
|
||||||
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;
|
|
||||||
#else
|
#else
|
||||||
m_btValid = false;
|
// for iOS we can't use the localBtDevice as iOS is BLE only
|
||||||
|
// we need to find some other way to test if Bluetooth is enabled, though
|
||||||
|
// for now just hard-code it
|
||||||
|
if (1) {
|
||||||
#endif
|
#endif
|
||||||
|
m_btValid = true;
|
||||||
#if defined(Q_OS_IOS) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
#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";
|
qDebug() << "starting BLE discovery";
|
||||||
discoveryAgent->start();
|
discoveryAgent->start();
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_ANDROID) && defined(BT_SUPPORT)
|
#if defined(Q_OS_ANDROID)
|
||||||
getBluetoothDevices();
|
getBluetoothDevices();
|
||||||
// and add the paired devices to the internal data
|
// and add the paired devices to the internal data
|
||||||
// So behaviour is same on Linux/Bluez stack and
|
// So behaviour is same on Linux/Bluez stack and
|
||||||
|
@ -100,12 +103,10 @@ void BTDiscovery::BTDiscoveryReDiscover()
|
||||||
connect(&timer, &QTimer::timeout, discoveryAgent, &QBluetoothDeviceDiscoveryAgent::stop);
|
connect(&timer, &QTimer::timeout, discoveryAgent, &QBluetoothDeviceDiscoveryAgent::stop);
|
||||||
timer.start(3000);
|
timer.start(3000);
|
||||||
#endif
|
#endif
|
||||||
#if !defined(Q_OS_IOS)
|
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "localBtDevice isn't valid";
|
qDebug() << "localBtDevice isn't valid or not connectable";
|
||||||
m_btValid = false;
|
m_btValid = false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BTDiscovery::~BTDiscovery()
|
BTDiscovery::~BTDiscovery()
|
||||||
|
|
|
@ -59,7 +59,7 @@ void run_ui()
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
KirigamiPlugin::getInstance().registerTypes();
|
KirigamiPlugin::getInstance().registerTypes();
|
||||||
#if __APPLE__
|
#if defined(__APPLE__) && !defined(Q_OS_IOS)
|
||||||
// when running the QML UI on a Mac the deployment of the QML Components seems
|
// when running the QML UI on a Mac the deployment of the QML Components seems
|
||||||
// to fail and the search path for the components is rather odd - simply the
|
// to fail and the search path for the components is rather odd - simply the
|
||||||
// same directory the executable was started from <bundle>/Contents/MacOS/
|
// same directory the executable was started from <bundle>/Contents/MacOS/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue