diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-09-23 15:05:08 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-10-14 04:32:50 -0700 |
commit | dd14e2782008df427704173e5eaf9a75fcbc0d2d (patch) | |
tree | f4c2b9d460bdd9b274d79ea36414d6365a6bea4b /core | |
parent | 38243be44d50a1763f84a9b2331b5aec62a32632 (diff) | |
download | subsurface-dd14e2782008df427704173e5eaf9a75fcbc0d2d.tar.gz |
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>
Diffstat (limited to 'core')
-rw-r--r-- | core/btdiscovery.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index 281e3b314..731c4ca4f 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -71,17 +71,20 @@ void BTDiscovery::BTDiscoveryReDiscover() localBtDevice.hostMode() == QBluetoothLocalDevice::HostConnectable) { btPairedDevices.clear(); qDebug() << "localDevice " + localBtDevice.name() + " is valid, starting discovery"; - m_btValid = true; #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 + m_btValid = true; #if defined(Q_OS_IOS) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this); connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BTDiscovery::btDeviceDiscovered); qDebug() << "starting BLE discovery"; discoveryAgent->start(); #endif -#if defined(Q_OS_ANDROID) && defined(BT_SUPPORT) +#if defined(Q_OS_ANDROID) getBluetoothDevices(); // and add the paired devices to the internal data // So behaviour is same on Linux/Bluez stack and @@ -100,12 +103,10 @@ void BTDiscovery::BTDiscoveryReDiscover() connect(&timer, &QTimer::timeout, discoveryAgent, &QBluetoothDeviceDiscoveryAgent::stop); timer.start(3000); #endif -#if !defined(Q_OS_IOS) } else { - qDebug() << "localBtDevice isn't valid"; + qDebug() << "localBtDevice isn't valid or not connectable"; m_btValid = false; } -#endif } BTDiscovery::~BTDiscovery() |