mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
ae209a3d9f
commit
753c00a493
1 changed files with 9 additions and 1 deletions
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue