diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-18 18:00:44 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-18 21:24:44 +0100 |
commit | b274a83bf4f44d0e2642a8e3bd6bada4ccdbf83c (patch) | |
tree | 4c9e0c783d7698c3673cc5fc8c5c283f3bb80eb5 | |
parent | e0ef4fbc2e70622c25692262972b0dc2396af4ef (diff) | |
parent | 8cece5f6e09010de4bebd1a2ef524e2ca55d8a5b (diff) | |
download | qtconnectivity-b274a83bf4f44d0e2642a8e3bd6bada4ccdbf83c.tar.gz |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
.qmake.conf
Change-Id: I6d2140aa8692bc7ce56f4366275fd02d008900f0
-rw-r--r-- | dist/changes-5.9.4 | 31 | ||||
-rw-r--r-- | examples/bluetooth/heartrate-game/connectionhandler.cpp | 3 | ||||
-rw-r--r-- | examples/bluetooth/heartrate-server/heartrate-server.pro | 2 | ||||
-rw-r--r-- | src/bluetooth/bluetooth.pro | 2 | ||||
-rw-r--r-- | src/bluetooth/osx/osxbt.pri | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluez.cpp | 14 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_winrt.cpp | 23 |
7 files changed, 65 insertions, 12 deletions
diff --git a/dist/changes-5.9.4 b/dist/changes-5.9.4 new file mode 100644 index 00000000..746c43dd --- /dev/null +++ b/dist/changes-5.9.4 @@ -0,0 +1,31 @@ +Qt 5.9.4 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.9.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.9 series is binary compatible with the 5.8.x series. +Applications compiled for 5.8 will continue to run with 5.9. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.9.4 Changes * +**************************************************************************** + +QtBLuetooth +----------- + + - [QTBUG-64669] Fixed hanging service discovery state when remote device + does not respond to ATT read requests. + - [QTBUG-64597] Fixed compilation of heartrate server example with disabled + gui module. + - Added minor improvements to Windows UWP builds. diff --git a/examples/bluetooth/heartrate-game/connectionhandler.cpp b/examples/bluetooth/heartrate-game/connectionhandler.cpp index 5ab85c85..3388c0a8 100644 --- a/examples/bluetooth/heartrate-game/connectionhandler.cpp +++ b/examples/bluetooth/heartrate-game/connectionhandler.cpp @@ -51,6 +51,7 @@ #include "heartrate-global.h" #include "connectionhandler.h" #include <QtBluetooth/qtbluetooth-config.h> +#include <QtCore/qsystemdetection.h> ConnectionHandler::ConnectionHandler(QObject *parent) : QObject(parent) { @@ -60,7 +61,7 @@ ConnectionHandler::ConnectionHandler(QObject *parent) : QObject(parent) bool ConnectionHandler::alive() const { -#ifdef SIMULATOR +#if defined(SIMULATOR) || defined(QT_PLATFORM_UIKIT) return true; #else return m_localDevice.isValid() && m_localDevice.hostMode() != QBluetoothLocalDevice::HostPoweredOff; diff --git a/examples/bluetooth/heartrate-server/heartrate-server.pro b/examples/bluetooth/heartrate-server/heartrate-server.pro index 4ccf486c..edd011b9 100644 --- a/examples/bluetooth/heartrate-server/heartrate-server.pro +++ b/examples/bluetooth/heartrate-server/heartrate-server.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = heartrate-server -QT += bluetooth +QT = core bluetooth CONFIG += c++11 SOURCES += main.cpp diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro index a917eefc..84919f98 100644 --- a/src/bluetooth/bluetooth.pro +++ b/src/bluetooth/bluetooth.pro @@ -230,7 +230,7 @@ qtConfig(bluez) { qlowenergycontroller_p.cpp } -winrt-*-msvc2015 { +winrt { MODULE_WINRT_CAPABILITIES_DEVICE += \ bluetooth.genericAttributeProfile \ bluetooth.rfcomm diff --git a/src/bluetooth/osx/osxbt.pri b/src/bluetooth/osx/osxbt.pri index 13187e4f..0f293107 100644 --- a/src/bluetooth/osx/osxbt.pri +++ b/src/bluetooth/osx/osxbt.pri @@ -1,6 +1,6 @@ SOURCES += osx/uistrings.cpp osx/osxbtnotifier.cpp PRIVATE_HEADERS += osx/uistrings_p.h -//QMAKE_CXXFLAGS_WARN_ON += -Wno-nullability-completeness +#QMAKE_CXXFLAGS_WARN_ON += -Wno-nullability-completeness CONFIG(osx) { PRIVATE_HEADERS += osx/osxbtutility_p.h \ diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index 003aff38..d038a8e8 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -346,8 +346,8 @@ void QLowEnergyControllerPrivate::handleGattRequestTimeout() } if (!openRequests.isEmpty() && requestPending) { - requestPending = false; // reset pending flag const Request currentRequest = openRequests.dequeue(); + requestPending = false; // reset pending flag qCWarning(QT_BT_BLUEZ).nospace() << "****** Request type 0x" << hex << currentRequest.command << " to server/peripheral timed out"; @@ -372,7 +372,6 @@ void QLowEnergyControllerPrivate::handleGattRequestTimeout() case ATT_OP_EXCHANGE_MTU_REQUEST: // MTU change request // never received reply to MTU request // it is safe to skip and go to next request - sendNextPendingRequest(); break; case ATT_OP_READ_BY_GROUP_REQUEST: // primary or secondary service discovery case ATT_OP_READ_BY_TYPE_REQUEST: // characteristic or included service discovery @@ -406,8 +405,13 @@ void QLowEnergyControllerPrivate::handleGattRequestTimeout() break; default: // not a command used by central role implementation - return; + qCWarning(QT_BT_BLUEZ) << "Missing response for ATT peripheral command: " + << hex << command; + break; } + + // spin openRequest queue further + sendNextPendingRequest(); } } @@ -1244,9 +1248,9 @@ void QLowEnergyControllerPrivate::processReply( } else if (!isServiceDiscoveryRun) { // not encryption problem -> abort readCharacteristic()/readDescriptor() run if (!descriptorHandle) - emit service->error(QLowEnergyService::CharacteristicReadError); + service->setError(QLowEnergyService::CharacteristicReadError); else - emit service->error(QLowEnergyService::DescriptorReadError); + service->setError(QLowEnergyService::DescriptorReadError); } } else { if (!descriptorHandle) diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp index 3e7c8b20..c9c30b44 100644 --- a/src/bluetooth/qlowenergycontroller_winrt.cpp +++ b/src/bluetooth/qlowenergycontroller_winrt.cpp @@ -404,7 +404,17 @@ void QLowEnergyControllerPrivate::connectToDevice() Q_ASSERT_SUCCEEDED(hr); ComPtr<IGattReadResult> result; hr = QWinRTFunctions::await(op, result.GetAddressOf()); - Q_ASSERT_SUCCEEDED(hr); + if (hr == E_INVALIDARG) { + // E_INVALIDARG happens when user tries to connect to a device that was paired + // before but is not available. + qCDebug(QT_BT_WINRT) << "Could not obtain characteristic read result that triggers" + "device connection. Is the device reachable?"; + setError(QLowEnergyController::ConnectionError); + setState(QLowEnergyController::UnconnectedState); + return; + } else { + Q_ASSERT_SUCCEEDED(hr); + } ComPtr<ABI::Windows::Storage::Streams::IBuffer> buffer; hr = result->get_Value(&buffer); Q_ASSERT_SUCCEEDED(hr); @@ -497,7 +507,9 @@ void QLowEnergyControllerPrivate::obtainIncludedServices(QSharedPointer<QLowEner Q_ASSERT_SUCCEEDED(hr); ComPtr<IVectorView<GattDeviceService *>> includedServices; hr = service2->GetAllIncludedServices(&includedServices); - Q_ASSERT_SUCCEEDED(hr); + // Some devices return ERROR_ACCESS_DISABLED_BY_POLICY + if (FAILED(hr)) + return; uint count; hr = includedServices->get_Size(&count); @@ -596,7 +608,12 @@ void QLowEnergyControllerPrivate::discoverServiceDetails(const QBluetoothUuid &s Q_ASSERT_SUCCEEDED(hr); ComPtr<IVectorView<GattDeviceService *>> deviceServices; hr = deviceService2->GetAllIncludedServices(&deviceServices); - Q_ASSERT_SUCCEEDED(hr); + if (FAILED(hr)) { // ERROR_ACCESS_DISABLED_BY_POLICY + qCDebug(QT_BT_WINRT) << "Could not obtain included services list for" << service; + pointer->setError(QLowEnergyService::UnknownError); + pointer->setState(QLowEnergyService::InvalidService); + return; + } uint serviceCount; hr = deviceServices->get_Size(&serviceCount); Q_ASSERT_SUCCEEDED(hr); |