diff options
-rw-r--r-- | core/qt-ble.cpp | 6 | ||||
-rw-r--r-- | desktop-widgets/btdeviceselectiondialog.cpp | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp index 9867528c8..eca615fbe 100644 --- a/core/qt-ble.cpp +++ b/core/qt-ble.cpp @@ -16,6 +16,7 @@ #include "libdivecomputer.h" #include "core/qt-ble.h" +#include "core/btdiscovery.h" #if defined(SSRF_CUSTOM_IO) @@ -287,12 +288,11 @@ dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *d if (!strncmp(devaddr, "LE:", 3)) devaddr += 3; - QBluetoothAddress remoteDeviceAddress(devaddr); - // HACK ALERT! Qt 5.9 needs this for proper Bluez operation qputenv("QT_DEFAULT_CENTRAL_SERVICES", "1"); - QLowEnergyController *controller = new QLowEnergyController(remoteDeviceAddress); + QBluetoothDeviceInfo remoteDevice = getBtDeviceInfo(devaddr); + QLowEnergyController *controller = QLowEnergyController::createCentral(remoteDevice); qDebug() << "qt_ble_open(" << devaddr << ")"; diff --git a/desktop-widgets/btdeviceselectiondialog.cpp b/desktop-widgets/btdeviceselectiondialog.cpp index eb05c4f42..cf70daa3f 100644 --- a/desktop-widgets/btdeviceselectiondialog.cpp +++ b/desktop-widgets/btdeviceselectiondialog.cpp @@ -152,7 +152,9 @@ void BtDeviceSelectionDialog::on_save_clicked() // Save the selected device selectedRemoteDeviceInfo = QSharedPointer<QBluetoothDeviceInfo>(new QBluetoothDeviceInfo(remoteDeviceInfo)); - + QString address = remoteDeviceInfo.address().isNull() ? remoteDeviceInfo.deviceUuid().toString() : + remoteDeviceInfo.address().toString(); + saveBtDeviceInfo(address.toUtf8().constData(), remoteDeviceInfo); if (remoteDeviceDiscoveryAgent->isActive()) { // Stop the SDP agent if the clear button is pressed and enable the Scan button remoteDeviceDiscoveryAgent->stop(); |