diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-05-20 19:31:41 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-05-20 19:31:41 +0200 |
commit | 9406019386448452982ef4dacdbe1d910e903cd1 (patch) | |
tree | 8044eef537043b4fd9e4efc5f2709e540a77d3f3 | |
parent | 266fdc0839eda6e6ba66d7e81aceaea32160bdee (diff) | |
parent | 5b548aa2ffe648810c487ecb895631da2be12a33 (diff) |
Merge 5.7 into 5.7.0
Change-Id: I5406c601fa05e347a7c7558e42fb05029799ff27
-rw-r--r-- | dist/changes-5.6.1 | 60 | ||||
-rw-r--r-- | src/bluetooth/doc/qtbluetooth.qdocconf | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothtransfermanager.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qleadvertiser_bluez.cpp | 10 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluez.cpp | 15 | ||||
-rw-r--r-- | src/nfc/doc/qtnfc.qdocconf | 2 | ||||
-rw-r--r-- | tests/auto/qlowenergycontroller-gattserver/server/qlowenergycontroller-gattserver.cpp | 13 | ||||
-rw-r--r-- | tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp | 45 |
9 files changed, 134 insertions, 17 deletions
diff --git a/dist/changes-5.6.1 b/dist/changes-5.6.1 new file mode 100644 index 00000000..6535ae40 --- /dev/null +++ b/dist/changes-5.6.1 @@ -0,0 +1,60 @@ +Qt 5.6.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.6.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.6/ + +The Qt version 5.6 series is binary compatible with the 5.5.x series. +Applications compiled for 5.5 will continue to run with 5.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + +QtBluetooth +----------- + + - Fixed various documentation issues. + - Improved QBluetoothServiceInfo QDebug operator. + +QtNfc +----- + + - [QTBUG-51860] Fixed crash related to incorrect QML import statement + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Android +------- + + - [QTBUG-52530] Added ACCESS_COURSE_LOCATION permission to QtBluetooth. + Android 6.0+ requires this type of permission for device discovery. + - [QTBUG-52154] Fixed Annotated URL example on Android. This Qt Nfc example + was not working due to missing Ndef message handler registration. The registration + is still not implemented but the example does not require it to properly work. + +iOS/OS X +-------- + + - [QTBUG-52324] Fixed details discovery of included/secondary BTLE services + on iOS and OS X + +Linux/Bluez +----------- + + - [QTBUG-47593] Improved QBluetoothSocket's service discovery on Bluez 5. This + happened if the targeted serial service did not advertise a custom uuid and a minimal + service discovery was used to identify the serial port service. In such cases + QBluetoothSocket never found the remote service. diff --git a/src/bluetooth/doc/qtbluetooth.qdocconf b/src/bluetooth/doc/qtbluetooth.qdocconf index a4b86e95..52061d7e 100644 --- a/src/bluetooth/doc/qtbluetooth.qdocconf +++ b/src/bluetooth/doc/qtbluetooth.qdocconf @@ -4,7 +4,7 @@ project = QtBluetooth description = Qt Bluetooth Reference Documentation version = $QT_VERSION -examplesinstallpath = qtconnectivity/bluetooth +examplesinstallpath = bluetooth qhp.projects = QtBluetooth diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp index d83731c2..b1cbdae5 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp @@ -279,7 +279,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startLowEnergyScan() if (!leScanTimeout) { leScanTimeout = new QTimer(this); leScanTimeout->setSingleShot(true); - leScanTimeout->setInterval(10000); + leScanTimeout->setInterval(25000); connect(leScanTimeout, &QTimer::timeout, this, &QBluetoothDeviceDiscoveryAgentPrivate::stopLowEnergyScan); } diff --git a/src/bluetooth/qbluetoothtransfermanager.cpp b/src/bluetooth/qbluetoothtransfermanager.cpp index f4720564..7206dce6 100644 --- a/src/bluetooth/qbluetoothtransfermanager.cpp +++ b/src/bluetooth/qbluetoothtransfermanager.cpp @@ -45,8 +45,10 @@ #elif QT_OSX_BLUETOOTH #include "qbluetoothtransferreply_osx_p.h" #else +#if !defined(QT_ANDROID_BLUETOOTH) && !defined(QT_IOS_BLUETOOTH) #include "dummy/dummy_helper_p.h" #endif +#endif QT_BEGIN_NAMESPACE diff --git a/src/bluetooth/qleadvertiser_bluez.cpp b/src/bluetooth/qleadvertiser_bluez.cpp index 52f4dd73..ff00b2b1 100644 --- a/src/bluetooth/qleadvertiser_bluez.cpp +++ b/src/bluetooth/qleadvertiser_bluez.cpp @@ -162,6 +162,8 @@ void QLeAdvertiserBluez::setAdvertisingParams() // Spec v4.2, Vol 2, Part E, 7.8.5 AdvParams params; static_assert(sizeof params == 15, "unexpected struct size"); + using namespace std; + memset(¶ms, 0, sizeof params); setAdvertisingInterval(params); params.type = parameters().mode(); params.filterPolicy = parameters().filterPolicy(); @@ -283,7 +285,13 @@ void QLeAdvertiserBluez::setServicesData(const QLowEnergyAdvertisingData &src, A services32 << service32; continue; } - services128 << service.toUInt128(); + + // QBluetoothUuid::toUInt128() is always Big-Endian + // convert it to host order + quint128 hostOrder; + quint128 qtUuidOrder = service.toUInt128(); + ntoh128(&qtUuidOrder, &hostOrder); + services128 << hostOrder; } addServicesData(dest, services16); addServicesData(dest, services32); diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index adac55fc..d4fe0232 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -235,10 +235,14 @@ template<typename T> static void putDataAndIncrement(const T &src, char *&dst) template<> void putDataAndIncrement(const QBluetoothUuid &uuid, char *&dst) { const int uuidSize = getUuidSize(uuid); - if (uuidSize == 2) + if (uuidSize == 2) { putBtData(uuid.toUInt16(), dst); - else - putBtData(uuid.toUInt128(), dst); + } else { + quint128 hostOrder; + quint128 qtUuidOrder = uuid.toUInt128(); + ntoh128(&qtUuidOrder, &hostOrder); + putBtData(hostOrder, dst); + } dst += uuidSize; } template<> void putDataAndIncrement(const QByteArray &value, char *&dst) @@ -2925,7 +2929,10 @@ static QByteArray uuidToByteArray(const QBluetoothUuid &uuid) putBtData(uuid.toUInt16(), ba.data()); } else { ba.resize(16); - putBtData(uuid.toUInt128(), ba.data()); + quint128 hostOrder; + quint128 qtUuidOrder = uuid.toUInt128(); + ntoh128(&qtUuidOrder, &hostOrder); + putBtData(hostOrder, ba.data()); } return ba; } diff --git a/src/nfc/doc/qtnfc.qdocconf b/src/nfc/doc/qtnfc.qdocconf index 8b0ba092..61ed15b6 100644 --- a/src/nfc/doc/qtnfc.qdocconf +++ b/src/nfc/doc/qtnfc.qdocconf @@ -4,7 +4,7 @@ project = QtNfc description = Qt NFC Reference Documentation version = $QT_VERSION -examplesinstallpath = qtconnectivity/nfc +examplesinstallpath = nfc qhp.projects = QtNfc diff --git a/tests/auto/qlowenergycontroller-gattserver/server/qlowenergycontroller-gattserver.cpp b/tests/auto/qlowenergycontroller-gattserver/server/qlowenergycontroller-gattserver.cpp index 6fa9b023..1275aa65 100644 --- a/tests/auto/qlowenergycontroller-gattserver/server/qlowenergycontroller-gattserver.cpp +++ b/tests/auto/qlowenergycontroller-gattserver/server/qlowenergycontroller-gattserver.cpp @@ -145,6 +145,19 @@ void addCustomService() serviceData.addCharacteristic(charData); addService(serviceData); + + // service with full 128 bit custom uuids + QLowEnergyServiceData serviceData128; + serviceData128.setUuid(QBluetoothUuid(QString("c47774c7-f237-4523-8968-e4ae75431daf"))); + serviceData128.setType(QLowEnergyServiceData::ServiceTypePrimary); + + QLowEnergyCharacteristicData charData128; + charData128.setUuid(QBluetoothUuid(QString("c0ad61b1-79e7-42f9-ace0-0a9aa0d0a4f8"))); + charData128.setProperties(QLowEnergyCharacteristic::Read); + charData128.setValue(QByteArray(15, 'a')); + serviceData128.addCharacteristic(charData128); + + addService(serviceData128); } void startAdvertising() diff --git a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp index 937b9b5c..3df27d92 100644 --- a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp +++ b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp @@ -39,6 +39,7 @@ #include <QtBluetooth/qlowenergyservicedata.h> #include <QtCore/qendian.h> #include <QtCore/qscopedpointer.h> +//#include <QtCore/qloggingcategory.h> #include <QtTest/qsignalspy.h> #include <QtTest/QtTest> @@ -80,6 +81,7 @@ private: void TestQLowEnergyControllerGattServer::initTestCase() { + //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true")); const QString serverAddress = qgetenv("QT_BT_GATTSERVER_TEST_ADDRESS"); if (serverAddress.isEmpty()) return; @@ -235,7 +237,7 @@ void TestQLowEnergyControllerGattServer::advertisedData() // name is seen on the scanning machine. // QCOMPARE(m_serverInfo.name(), QString("Qt GATT server")); - QCOMPARE(m_serverInfo.serviceUuids().count(), 3); + QVERIFY(m_serverInfo.serviceUuids().count() >= 3); QVERIFY(m_serverInfo.serviceUuids().contains(QBluetoothUuid::GenericAccess)); QVERIFY(m_serverInfo.serviceUuids().contains(QBluetoothUuid::RunningSpeedAndCadence)); QVERIFY(m_serverInfo.serviceUuids().contains(QBluetoothUuid(quint16(0x2000)))); @@ -262,10 +264,11 @@ void TestQLowEnergyControllerGattServer::serverCommunication() spy.reset(new QSignalSpy(m_leController.data(), &QLowEnergyController::discoveryFinished)); QVERIFY(spy->wait(30000)); const QList<QBluetoothUuid> serviceUuids = m_leController->services(); - QCOMPARE(serviceUuids.count(), 3); + QCOMPARE(serviceUuids.count(), 4); QVERIFY(serviceUuids.contains(QBluetoothUuid::GenericAccess)); QVERIFY(serviceUuids.contains(QBluetoothUuid::RunningSpeedAndCadence)); QVERIFY(serviceUuids.contains(QBluetoothUuid(quint16(0x2000)))); + QVERIFY(serviceUuids.contains(QBluetoothUuid(QString("c47774c7-f237-4523-8968-e4ae75431daf")))); const QScopedPointer<QLowEnergyService> genericAccessService( m_leController->createServiceObject(QBluetoothUuid::GenericAccess)); @@ -324,6 +327,26 @@ void TestQLowEnergyControllerGattServer::serverCommunication() featureChar.value().constData())); QCOMPARE(value, quint16(1 << 2)); + // 128 bit custom uuid service + QBluetoothUuid serviceUuid128(QString("c47774c7-f237-4523-8968-e4ae75431daf")); + QBluetoothUuid charUuid128(QString("c0ad61b1-79e7-42f9-ace0-0a9aa0d0a4f8")); + QScopedPointer<QLowEnergyService> customService128( + m_leController->createServiceObject(serviceUuid128)); + QVERIFY(!customService128.isNull()); + customService128->discoverDetails(); + while (customService128->state() != QLowEnergyService::ServiceDiscovered) { + spy.reset(new QSignalSpy(customService128.data(), &QLowEnergyService::stateChanged)); + QVERIFY(spy->wait(5000)); + } + QCOMPARE(customService128->serviceUuid(), serviceUuid128); + QCOMPARE(customService128->includedServices().count(), 0); + QCOMPARE(customService128->characteristics().count(), 1); + QLowEnergyCharacteristic customChar128 + = customService128->characteristic(charUuid128); + QVERIFY(customChar128.isValid()); + QCOMPARE(customChar128.descriptors().count(), 0); + QCOMPARE(customChar128.value(), QByteArray(15, 'a')); + QScopedPointer<QLowEnergyService> customService( m_leController->createServiceObject(QBluetoothUuid(quint16(0x2000)))); QVERIFY(!customService.isNull()); @@ -380,11 +403,14 @@ void TestQLowEnergyControllerGattServer::serverCommunication() QVERIFY(spy->wait(3000)); QCOMPARE(customService->error(), QLowEnergyService::CharacteristicWriteError); - const bool isBonded = QBluetoothLocalDevice().pairingStatus(m_serverAddress) - != QBluetoothLocalDevice::Unpaired; - + spy.reset(new QSignalSpy(customService.data(), static_cast<void (QLowEnergyService::*) + (QLowEnergyService::ServiceError)>(&QLowEnergyService::error))); customService->writeCharacteristic(customChar5, "1", QLowEnergyService::WriteSigned); - if (isBonded) { + + // error might happen immediately or once event loop comes back + bool wasError = ((spy->count() > 0) || spy->wait(3000)); // + + if (!wasError) { // Signed write is done twice to test the sign counter stuff. // Note: We assume here that the link is not encrypted, as this information is not exported. customService->readCharacteristic(customChar5); @@ -397,9 +423,6 @@ void TestQLowEnergyControllerGattServer::serverCommunication() QVERIFY(spy->wait(3000)); QCOMPARE(customChar5.value(), QByteArray("2")); } else { - spy.reset(new QSignalSpy(customService.data(), static_cast<void (QLowEnergyService::*) - (QLowEnergyService::ServiceError)>(&QLowEnergyService::error))); - QVERIFY(spy->wait(3000)); QCOMPARE(customService->error(), QLowEnergyService::CharacteristicWriteError); } @@ -424,6 +447,7 @@ void TestQLowEnergyControllerGattServer::serverCommunication() QCOMPARE(customChar3.value().constData(), "indicated"); QCOMPARE(customChar4.value().constData(), "notified"); + // signal requires root privileges on Linux spy.reset(new QSignalSpy(m_leController.data(), &QLowEnergyController::connectionUpdated)); QVERIFY(spy->wait(5000)); @@ -464,6 +488,9 @@ void TestQLowEnergyControllerGattServer::serverCommunication() QVERIFY(cc3ClientConfig.isValid()); cc4ClientConfig = customChar4.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); QVERIFY(cc4ClientConfig.isValid()); + + const bool isBonded = QBluetoothLocalDevice().pairingStatus(m_serverAddress) + != QBluetoothLocalDevice::Unpaired; if (isBonded) { QCOMPARE(cc3ClientConfig.value(), indicateValue); QCOMPARE(cc4ClientConfig.value(), notifyValue); |