diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-09-17 16:31:07 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-17 16:31:07 -0700 |
commit | 753c00a4936f5cc741bdf7dbeb3db83903a95e9d (patch) | |
tree | bae2cfd326f0ec2c7931935c2759551a5b8719a7 | |
parent | ae209a3d9f8ed36e2228834d421ff4a6ac345ad9 (diff) | |
download | subsurface-753c00a4936f5cc741bdf7dbeb3db83903a95e9d.tar.gz |
BLE on non-Apple OSs: switch back to using BT address
While this interface is deprecated, too much in our existing code depends
on being able to create the QLowEnergyController with just the address.
Additionally, createCentral() is new in Qt 5.7 and therefor this broke
builds on Linux distros that are still on 5.6.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | core/qt-ble.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp index 92a78ae65..01597d4b8 100644 --- a/core/qt-ble.cpp +++ b/core/qt-ble.cpp @@ -291,9 +291,17 @@ dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *d // HACK ALERT! Qt 5.9 needs this for proper Bluez operation qputenv("QT_DEFAULT_CENTRAL_SERVICES", "1"); +#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) QBluetoothDeviceInfo remoteDevice = getBtDeviceInfo(devaddr); QLowEnergyController *controller = QLowEnergyController::createCentral(remoteDevice); - +#else + // this is deprecated but given that we don't use Qt to scan for + // devices on Android, we don't have QBluetoothDeviceInfo for the + // paired devices and therefore cannot use the newer interfaces + // that are preferred starting with Qt 5.7 + QBluetoothAddress remoteDeviceAddress(devaddr); + QLowEnergyController *controller = new QLowEnergyController(remoteDeviceAddress); +#endif qDebug() << "qt_ble_open(" << devaddr << ")"; if (IS_SHEARWATER(io->user_device)) |