diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-02-27 18:41:03 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-02-27 18:41:03 +0100 |
commit | a65fcda75768efa0daab0492952fbefce9da4441 (patch) | |
tree | c74eab841377bfb6427216a388b5bbc835de1347 | |
parent | b87affb8b2353af57ed5e736d82d67eb56ea1235 (diff) | |
parent | 7f18a765d6e31bd3bd666eb965a8a36c021a8216 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: If83016d10eeeee0101f8653bd78934f13181e94c
25 files changed, 193 insertions, 163 deletions
diff --git a/dist/changes-5.10.1 b/dist/changes-5.10.1 new file mode 100644 index 00000000..3754c07c --- /dev/null +++ b/dist/changes-5.10.1 @@ -0,0 +1,39 @@ +Qt 5.10.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.10.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.10 series is binary compatible with the 5.9.x series. +Applications compiled for 5.9 will continue to run with 5.10. + +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. + +This release contains all fixes included in the Qt 5.9.4 release. + +**************************************************************************** +* Qt 5.10.1 Changes * +**************************************************************************** + +QtBluetooth +----------- + + - Fixed missing QML version bump. The QML import statement for QtBluetooth + was still 5.9. + - Added various documentation improvements, e.g. special handling for iOS + use cases. + +QtNfc +----- + + - Fixed missing QML version bump. The QML import statement for QtNfc + was still 5.9. + - Added various improvements to all NFC examples. diff --git a/examples/bluetooth/lowenergyscanner/assets/Services.qml b/examples/bluetooth/lowenergyscanner/assets/Services.qml index e22d1db3..68d7d447 100644 --- a/examples/bluetooth/lowenergyscanner/assets/Services.qml +++ b/examples/bluetooth/lowenergyscanner/assets/Services.qml @@ -115,8 +115,8 @@ Rectangle { MouseArea { anchors.fill: parent onClicked: { - device.connectToService(modelData.serviceUuid); pageLoader.source = "Characteristics.qml"; + device.connectToService(modelData.serviceUuid); } } diff --git a/examples/nfc/annotatedurl/annotatedurl.cpp b/examples/nfc/annotatedurl/annotatedurl.cpp index 7f63f44b..5c4a0527 100644 --- a/examples/nfc/annotatedurl/annotatedurl.cpp +++ b/examples/nfc/annotatedurl/annotatedurl.cpp @@ -47,24 +47,22 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include "annotatedurl.h" -#include <qnearfieldmanager.h> -#include <qnearfieldtarget.h> -#include <qndefmessage.h> -#include <qndefrecord.h> -#include <qndefnfctextrecord.h> -#include <qndefnfcurirecord.h> - -#include <QtCore/QUrl> +#include <QtNfc/qnearfieldmanager.h> +#include <QtNfc/qnearfieldtarget.h> +#include <QtNfc/qndefmessage.h> +#include <QtNfc/qndefrecord.h> +#include <QtNfc/qndefnfctextrecord.h> +#include <QtNfc/qndefnfcurirecord.h> + +#include <QtWidgets/QGridLayout> +#include <QtWidgets/QLabel> +#include <QtGui/QMouseEvent> +#include <QtGui/QDesktopServices> +#include <QtCore/QDebug> #include <QtCore/QLocale> - -#include <QGridLayout> -#include <QLabel> -#include <QMouseEvent> -#include <QDesktopServices> -#include <QDebug> +#include <QtCore/QUrl> AnnotatedUrl::AnnotatedUrl(QObject *parent) : QObject(parent) @@ -91,10 +89,10 @@ AnnotatedUrl::AnnotatedUrl(QObject *parent) qWarning() << "Platform does not support NDEF message handler registration"; manager->startTargetDetection(); - connect(manager, SIGNAL(targetDetected(QNearFieldTarget*)), - this, SLOT(targetDetected(QNearFieldTarget*))); - connect(manager, SIGNAL(targetLost(QNearFieldTarget*)), - this, SLOT(targetLost(QNearFieldTarget*))); + connect(manager, &QNearFieldManager::targetDetected, + this, &AnnotatedUrl::targetDetected); + connect(manager, &QNearFieldManager::targetLost, + this, &AnnotatedUrl::targetLost); } AnnotatedUrl::~AnnotatedUrl() @@ -107,8 +105,8 @@ void AnnotatedUrl::targetDetected(QNearFieldTarget *target) if (!target) return; - connect(target, SIGNAL(ndefMessageRead(QNdefMessage)), - this, SLOT(handlePolledNdefMessage(QNdefMessage))); + connect(target, &QNearFieldTarget::ndefMessageRead, + this, &AnnotatedUrl::handlePolledNdefMessage); target->readNdefMessages(); } diff --git a/examples/nfc/annotatedurl/annotatedurl.h b/examples/nfc/annotatedurl/annotatedurl.h index f4fe2ab9..e62b9d08 100644 --- a/examples/nfc/annotatedurl/annotatedurl.h +++ b/examples/nfc/annotatedurl/annotatedurl.h @@ -51,7 +51,7 @@ #ifndef ANNOTATEDURL_H #define ANNOTATEDURL_H -#include <QNdefMessage> +#include <QtNfc/QNdefMessage> #include <QtCore/QObject> @@ -60,8 +60,6 @@ QT_FORWARD_DECLARE_CLASS(QPixmap) QT_FORWARD_DECLARE_CLASS(QNearFieldManager) QT_FORWARD_DECLARE_CLASS(QNearFieldTarget) -QT_USE_NAMESPACE - class AnnotatedUrl : public QObject { Q_OBJECT diff --git a/examples/nfc/annotatedurl/main.cpp b/examples/nfc/annotatedurl/main.cpp index 109fb3b7..9ce6c1b9 100644 --- a/examples/nfc/annotatedurl/main.cpp +++ b/examples/nfc/annotatedurl/main.cpp @@ -51,26 +51,21 @@ #include "annotatedurl.h" #include "mainwindow.h" -#include <qnearfieldmanager.h> -#include <qndefnfctextrecord.h> -#include <qndefnfcurirecord.h> - -#include <QtCore/QLocale> - -#include <QApplication> +#include <QtNfc/qnearfieldmanager.h> +#include <QtNfc/qndefnfctextrecord.h> +#include <QtNfc/qndefnfcurirecord.h> +#include <QtWidgets/QApplication> int main(int argc, char *argv[]) { - //QLocale::setDefault(QLocale(QLocale::Japanese)); - QApplication a(argc, argv); MainWindow mainWindow; AnnotatedUrl annotatedUrl; - QObject::connect(&annotatedUrl, SIGNAL(annotatedUrl(QUrl,QString,QPixmap)), - &mainWindow, SLOT(displayAnnotatedUrl(QUrl,QString,QPixmap))); + QObject::connect(&annotatedUrl, &AnnotatedUrl::annotatedUrl, + &mainWindow, &MainWindow::displayAnnotatedUrl); mainWindow.show(); diff --git a/examples/nfc/annotatedurl/mainwindow.cpp b/examples/nfc/annotatedurl/mainwindow.cpp index 2220d747..707c03eb 100644 --- a/examples/nfc/annotatedurl/mainwindow.cpp +++ b/examples/nfc/annotatedurl/mainwindow.cpp @@ -51,9 +51,9 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -#include <QtCore/QUrl> -#include <QtGui/QMouseEvent> #include <QtGui/QDesktopServices> +#include <QtGui/QMouseEvent> +#include <QtCore/QUrl> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) diff --git a/examples/nfc/annotatedurl/mainwindow.h b/examples/nfc/annotatedurl/mainwindow.h index e56ba521..9cfb6e7f 100644 --- a/examples/nfc/annotatedurl/mainwindow.h +++ b/examples/nfc/annotatedurl/mainwindow.h @@ -51,9 +51,13 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include <QMainWindow> +#include <QtWidgets/QMainWindow> +QT_FORWARD_DECLARE_CLASS(QMouseEvent) QT_FORWARD_DECLARE_CLASS(QUrl) +QT_FORWARD_DECLARE_CLASS(QPixmap) +QT_FORWARD_DECLARE_CLASS(QString) +QT_FORWARD_DECLARE_CLASS(QWidget) QT_BEGIN_NAMESPACE namespace Ui { diff --git a/examples/nfc/corkboard/Mode.qml b/examples/nfc/corkboard/Mode.qml index b06b22a5..0d427cf5 100644 --- a/examples/nfc/corkboard/Mode.qml +++ b/examples/nfc/corkboard/Mode.qml @@ -66,7 +66,8 @@ Item { Text { anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 10} text: name; - font.pixelSize: 30; font.bold: true; color: "white" + font { pixelSize: 30; bold: true } + color: "white" style: Text.Outline; styleColor: "black" } @@ -75,8 +76,8 @@ Item { Item { id: stickyPage - x: Math.random() * (listView.width-listView.width*0.30) + listView.width*0.10 - y: Math.random() * (listView.height-listView.height*0.30) + listView.height*0.10 + x: ListView.width * (0.7 * Math.random() + 0.1) + y: ListView.height * (0.7 * Math.random() + 0.1) rotation: -listView.horizontalVelocity / 200; Behavior on rotation { diff --git a/examples/nfc/corkboard/corkboards.qml b/examples/nfc/corkboard/corkboards.qml index a1d9bee1..92cb6616 100644 --- a/examples/nfc/corkboard/corkboards.qml +++ b/examples/nfc/corkboard/corkboards.qml @@ -110,15 +110,14 @@ Rectangle { ListElement { name: "Work" notes: [ - //ListElement { noteText: "To write a tag, click the red flag of a note and then touch a tag" }, - ListElement { noteText: "https://www.qt.io" } + ListElement { noteText: "https://www.qt.io" }, + ListElement { noteText: "To write a tag, click the red flag of a note and then touch a tag" } ] } } ListView { id: listView - anchors.fill: parent orientation: ListView.Horizontal snapMode: ListView.SnapOneItem diff --git a/examples/nfc/ndefeditor/mainwindow.cpp b/examples/nfc/ndefeditor/mainwindow.cpp index 02a969ae..41077c2d 100644 --- a/examples/nfc/ndefeditor/mainwindow.cpp +++ b/examples/nfc/ndefeditor/mainwindow.cpp @@ -55,21 +55,18 @@ #include "urirecordeditor.h" #include "mimeimagerecordeditor.h" -#include <QtCore/QTime> -#include <QMenu> -#include <QVBoxLayout> -#include <QFrame> -#include <QLabel> -#include <QFileDialog> - -#include <qnearfieldmanager.h> -#include <qnearfieldtarget.h> -#include <qndefrecord.h> -#include <qndefnfctextrecord.h> -#include <qndefnfcurirecord.h> -#include <qndefmessage.h> - -#include <QtCore/QDebug> +#include <QtNfc/qndefnfcurirecord.h> +#include <QtNfc/qndefnfctextrecord.h> +#include <QtNfc/qndefrecord.h> +#include <QtNfc/qndefmessage.h> +#include <QtNfc/qnearfieldmanager.h> +#include <QtNfc/qnearfieldtarget.h> + +#include <QtWidgets/QMenu> +#include <QtWidgets/QVBoxLayout> +#include <QtWidgets/QFrame> +#include <QtWidgets/QLabel> +#include <QtWidgets/QFileDialog> class EmptyRecordLabel : public QLabel { @@ -239,19 +236,16 @@ void MainWindow::targetDetected(QNearFieldTarget *target) case NoAction: break; case ReadNdef: - connect(target, SIGNAL(ndefMessageRead(QNdefMessage)), - this, SLOT(ndefMessageRead(QNdefMessage))); - connect(target, SIGNAL(error(QNearFieldTarget::Error,QNearFieldTarget::RequestId)), - this, SLOT(targetError(QNearFieldTarget::Error,QNearFieldTarget::RequestId))); + connect(target, &QNearFieldTarget::ndefMessageRead, this, &MainWindow::ndefMessageRead); + connect(target, &QNearFieldTarget::error, this, &MainWindow::targetError); m_request = target->readNdefMessages(); if (!m_request.isValid()) // cannot read messages targetError(QNearFieldTarget::NdefReadError, m_request); break; case WriteNdef: - connect(target, SIGNAL(ndefMessagesWritten()), this, SLOT(ndefMessageWritten())); - connect(target, SIGNAL(error(QNearFieldTarget::Error,QNearFieldTarget::RequestId)), - this, SLOT(targetError(QNearFieldTarget::Error,QNearFieldTarget::RequestId))); + connect(target, &QNearFieldTarget::ndefMessagesWritten, this, &MainWindow::ndefMessageWritten); + connect(target, &QNearFieldTarget::error, this, &MainWindow::targetError); m_request = target->writeNdefMessages(QList<QNdefMessage>() << ndefMessage()); if (!m_request.isValid()) // cannot write messages diff --git a/examples/nfc/ndefeditor/mainwindow.h b/examples/nfc/ndefeditor/mainwindow.h index ebdb24f0..9018cbfb 100644 --- a/examples/nfc/ndefeditor/mainwindow.h +++ b/examples/nfc/ndefeditor/mainwindow.h @@ -51,16 +51,12 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include <QMainWindow> +#include <QtNfc/qnearfieldtarget.h> -#include <qnearfieldtarget.h> +#include <QtWidgets/QMainWindow> -QT_BEGIN_NAMESPACE -class QNearFieldManager; -class QNdefMessage; -QT_END_NAMESPACE - -QT_USE_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QNearFieldManager) +QT_FORWARD_DECLARE_CLASS(QNdefMessage) QT_BEGIN_NAMESPACE namespace Ui { diff --git a/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp b/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp index ef8cf1fd..8044e8a6 100644 --- a/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp +++ b/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp @@ -51,9 +51,9 @@ #include "mimeimagerecordeditor.h" #include "ui_mimeimagerecordeditor.h" -#include <QBuffer> -#include <QFileDialog> -#include <QImageReader> +#include <QtGui/QImageReader> +#include <QtWidgets/QFileDialog> +#include <QtCore/QBuffer> static QString imageFormatToMimeType(const QByteArray &format) { diff --git a/examples/nfc/ndefeditor/mimeimagerecordeditor.h b/examples/nfc/ndefeditor/mimeimagerecordeditor.h index f6089d43..1e810f64 100644 --- a/examples/nfc/ndefeditor/mimeimagerecordeditor.h +++ b/examples/nfc/ndefeditor/mimeimagerecordeditor.h @@ -52,9 +52,9 @@ #ifndef MIMEIMAGERECORDEDITOR_H #define MIMEIMAGERECORDEDITOR_H -#include <QWidget> +#include <QtNfc/qndefrecord.h> -#include <qndefrecord.h> +#include <QtWidgets/QWidget> QT_USE_NAMESPACE diff --git a/examples/nfc/ndefeditor/textrecordeditor.cpp b/examples/nfc/ndefeditor/textrecordeditor.cpp index 390674ad..381ff88f 100644 --- a/examples/nfc/ndefeditor/textrecordeditor.cpp +++ b/examples/nfc/ndefeditor/textrecordeditor.cpp @@ -51,8 +51,6 @@ #include "textrecordeditor.h" #include "ui_textrecordeditor.h" -#include <QtCore/QDebug> - TextRecordEditor::TextRecordEditor(QWidget *parent) : QWidget(parent), ui(new Ui::TextRecordEditor) diff --git a/examples/nfc/ndefeditor/textrecordeditor.h b/examples/nfc/ndefeditor/textrecordeditor.h index 65e33fb7..d7bf4d2e 100644 --- a/examples/nfc/ndefeditor/textrecordeditor.h +++ b/examples/nfc/ndefeditor/textrecordeditor.h @@ -51,9 +51,9 @@ #ifndef TEXTRECORDEDITOR_H #define TEXTRECORDEDITOR_H -#include <QWidget> +#include <QtNfc/qndefnfctextrecord.h> -#include <qndefnfctextrecord.h> +#include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE namespace Ui { diff --git a/examples/nfc/ndefeditor/urirecordeditor.h b/examples/nfc/ndefeditor/urirecordeditor.h index ef75065a..7eee55eb 100644 --- a/examples/nfc/ndefeditor/urirecordeditor.h +++ b/examples/nfc/ndefeditor/urirecordeditor.h @@ -48,13 +48,12 @@ ** ****************************************************************************/ - #ifndef URIRECORDEDITOR_H #define URIRECORDEDITOR_H -#include <QWidget> +#include <QtNfc/qndefnfcurirecord.h> -#include <qndefnfcurirecord.h> +#include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE namespace Ui { diff --git a/examples/nfc/poster/poster.qml b/examples/nfc/poster/poster.qml index 3127d44e..3e2a1eda 100644 --- a/examples/nfc/poster/poster.qml +++ b/examples/nfc/poster/poster.qml @@ -128,11 +128,9 @@ Rectangle { Text { id: touchText - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter + anchors { horizontalCenter: parent.horizontalCenter; horizontalCenterOffset: parent.verticalCenter } text: "Touch an NFC tag with at least one Text and one URI record." - font.bold: true - font.pointSize: 18 + font { italic: true; pointSize: 18 } wrapMode: Text.WordWrap width: root.width*0.75 horizontalAlignment: Text.AlignHCenter @@ -150,27 +148,22 @@ Rectangle { Text { id: posterText - anchors.horizontalCenter: parent.right - anchors.horizontalCenterOffset: - parent.width / 4 y: -height - font.bold: true - font.pointSize: 18 + anchors { horizontalCenter: parent.right; horizontalCenterOffset: - parent.width / 4 } + font { italic: true; pointSize: 18 } } Text { id: posterUrl - anchors.horizontalCenter: parent.right - anchors.horizontalCenterOffset: - parent.width / 4 y: parent.height - font.italic: true - font.pointSize: 14 + anchors { horizontalCenter: parent.right; horizontalCenterOffset: - parent.width / 4 } + font { italic: true; pointSize: 14 } } MouseArea { id: openMouseArea anchors.fill: parent enabled: root.state == "show" - onClicked: Qt.openUrlExternally(posterUrl.text) Rectangle { @@ -179,14 +172,10 @@ Rectangle { height: 50 color: "lightsteelblue" opacity: 0.3 - anchors.top: parent.top - anchors.right: close.left - anchors.rightMargin: 10 - + anchors { top: parent.top; right: close.left; rightMargin: 10 } MouseArea { id: touchMouseArea anchors.fill: parent - onClicked: { if (root.state == "") { root.state = "show"; @@ -204,34 +193,26 @@ Rectangle { color: "black" radius: 0 opacity: 0.3 - anchors.top: parent.top - anchors.topMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - + anchors { top: parent.top; topMargin: 0; right: parent.right; rightMargin: 0 } MouseArea { id: closeMouseArea anchors.fill: parent - onClicked: Qt.quit(); } } } - states: [ - State { - name: "show" - PropertyChanges { target: posterText; y: root.height / 3 } - PropertyChanges { target: posterUrl; y: 2 * root.height / 3 } - PropertyChanges { target: posterImage; x: root.width / 20 } - PropertyChanges { target: touchText; opacity: 0 } - } - ] + states: State { + name: "show" + PropertyChanges { target: posterText; y: root.height / 3 } + PropertyChanges { target: posterUrl; y: 2 * root.height / 3 } + PropertyChanges { target: posterImage; x: root.width / 20 } + PropertyChanges { target: touchText; opacity: 0 } + } - transitions: [ - Transition { - PropertyAnimation { easing.type: Easing.OutQuad; properties: "x,y" } - PropertyAnimation { property: "opacity"; duration: 125 } - } - ] + + transitions: Transition { + PropertyAnimation { easing.type: Easing.OutQuad; properties: "x,y" } + PropertyAnimation { property: "opacity"; duration: 125 } + } } diff --git a/examples/nfc/poster/qmlposter.cpp b/examples/nfc/poster/qmlposter.cpp index 5bf5f352..a4f98de3 100644 --- a/examples/nfc/poster/qmlposter.cpp +++ b/examples/nfc/poster/qmlposter.cpp @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) view.setResizeMode(QQuickView::SizeRootObjectToView); // Qt.quit() called in embedded .qml by default only emits // quit() signal, so do this (optionally use Qt.exit()). - QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit())); + QObject::connect(view.engine(), &QQmlEngine::quit, qApp, &QGuiApplication::quit); view.setGeometry(QRect(100, 100, 640, 360)); view.show(); return application.exec(); diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp index 6786ac54..309804a8 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp @@ -92,7 +92,7 @@ private: QBluetoothDeviceDiscoveryAgent::DiscoveryMethod mode); void gatherDeviceInformation(IDeviceInformation *deviceInfo, QBluetoothDeviceDiscoveryAgent::DiscoveryMethod mode); - void gatherMultipleDeviceInformation(IVectorView<DeviceInformation *> *devices, + void gatherMultipleDeviceInformation(quint32 deviceCount, IVectorView<DeviceInformation *> *devices, QBluetoothDeviceDiscoveryAgent::DiscoveryMethod mode); void setupLEDeviceWatcher(); void classicBluetoothInfoFromDeviceIdAsync(HSTRING deviceId); @@ -207,7 +207,20 @@ void QWinRTBluetoothDeviceDiscoveryWorker::onDeviceDiscoveryFinished(IAsyncOpera HRESULT hr; hr = op->GetResults(&devices); Q_ASSERT_SUCCEEDED(hr); - gatherMultipleDeviceInformation(devices.Get(), mode); + quint32 deviceCount; + hr = devices->get_Size(&deviceCount); + Q_ASSERT_SUCCEEDED(hr); + + // For classic discovery only paired devices will be found. If we only do classic disovery and + // no device is found, the scan is finished. + if (requestedModes == QBluetoothDeviceDiscoveryAgent::ClassicMethod && + deviceCount == 0) { + finishDiscovery(); + return; + } + + m_pendingPairedDevices += deviceCount; + gatherMultipleDeviceInformation(deviceCount, devices.Get(), mode); } void QWinRTBluetoothDeviceDiscoveryWorker::gatherDeviceInformation(IDeviceInformation *deviceInfo, QBluetoothDeviceDiscoveryAgent::DiscoveryMethod mode) @@ -222,15 +235,11 @@ void QWinRTBluetoothDeviceDiscoveryWorker::gatherDeviceInformation(IDeviceInform classicBluetoothInfoFromDeviceIdAsync(deviceId.Get()); } -void QWinRTBluetoothDeviceDiscoveryWorker::gatherMultipleDeviceInformation(IVectorView<DeviceInformation *> *devices, QBluetoothDeviceDiscoveryAgent::DiscoveryMethod mode) +void QWinRTBluetoothDeviceDiscoveryWorker::gatherMultipleDeviceInformation(quint32 deviceCount, IVectorView<DeviceInformation *> *devices, QBluetoothDeviceDiscoveryAgent::DiscoveryMethod mode) { - quint32 deviceCount; - HRESULT hr = devices->get_Size(&deviceCount); - Q_ASSERT_SUCCEEDED(hr); - m_pendingPairedDevices += deviceCount; for (quint32 i = 0; i < deviceCount; ++i) { ComPtr<IDeviceInformation> device; - hr = devices->GetAt(i, &device); + HRESULT hr = devices->GetAt(i, &device); Q_ASSERT_SUCCEEDED(hr); gatherDeviceInformation(device.Get(), mode); } @@ -374,34 +383,39 @@ HRESULT QWinRTBluetoothDeviceDiscoveryWorker::onPairedClassicBluetoothDeviceFoun Q_ASSERT_SUCCEEDED(hr); IVectorView <Rfcomm::RfcommDeviceService *> *deviceServices; hr = device->get_RfcommServices(&deviceServices); - Q_ASSERT_SUCCEEDED(hr); - uint serviceCount; - hr = deviceServices->get_Size(&serviceCount); - Q_ASSERT_SUCCEEDED(hr); - QList<QBluetoothUuid> uuids; - for (uint i = 0; i < serviceCount; ++i) { - ComPtr<Rfcomm::IRfcommDeviceService> service; - hr = deviceServices->GetAt(i, &service); - Q_ASSERT_SUCCEEDED(hr); - ComPtr<Rfcomm::IRfcommServiceId> id; - hr = service->get_ServiceId(&id); + if (hr == E_ACCESSDENIED) { + qCWarning(QT_BT_WINRT) << "Could not obtain device services. Please check you have " + "permission to access the device."; + } else { Q_ASSERT_SUCCEEDED(hr); - GUID uuid; - hr = id->get_Uuid(&uuid); + uint serviceCount; + hr = deviceServices->get_Size(&serviceCount); Q_ASSERT_SUCCEEDED(hr); - uuids.append(QBluetoothUuid(uuid)); - } + QList<QBluetoothUuid> uuids; + for (uint i = 0; i < serviceCount; ++i) { + ComPtr<Rfcomm::IRfcommDeviceService> service; + hr = deviceServices->GetAt(i, &service); + Q_ASSERT_SUCCEEDED(hr); + ComPtr<Rfcomm::IRfcommServiceId> id; + hr = service->get_ServiceId(&id); + Q_ASSERT_SUCCEEDED(hr); + GUID uuid; + hr = id->get_Uuid(&uuid); + Q_ASSERT_SUCCEEDED(hr); + uuids.append(QBluetoothUuid(uuid)); + } - qCDebug(QT_BT_WINRT) << "Discovered BT device: " << QString::number(address) << btName - << "Num UUIDs" << uuids.count(); + qCDebug(QT_BT_WINRT) << "Discovered BT device: " << QString::number(address) << btName + << "Num UUIDs" << uuids.count(); - QBluetoothDeviceInfo info(QBluetoothAddress(address), btName, classOfDeviceInt); - info.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateCoreConfiguration); - info.setServiceUuids(uuids, QBluetoothDeviceInfo::DataIncomplete); - info.setCached(true); + QBluetoothDeviceInfo info(QBluetoothAddress(address), btName, classOfDeviceInt); + info.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateCoreConfiguration); + info.setServiceUuids(uuids, QBluetoothDeviceInfo::DataIncomplete); + info.setCached(true); - QMetaObject::invokeMethod(this, "deviceFound", Qt::AutoConnection, - Q_ARG(QBluetoothDeviceInfo, info)); + QMetaObject::invokeMethod(this, "deviceFound", Qt::AutoConnection, + Q_ARG(QBluetoothDeviceInfo, info)); + } if (!m_pendingPairedDevices && !(requestedModes & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod)) finishDiscovery(); return S_OK; diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp index 40d86ae3..e52dd88f 100644 --- a/src/bluetooth/qbluetoothlocaldevice.cpp +++ b/src/bluetooth/qbluetoothlocaldevice.cpp @@ -270,9 +270,9 @@ bool QBluetoothLocalDevice::isValid() const */ /*! - \fn QBluetoothLocalDevice::pairingConfirmation(bool accept) + \fn QBluetoothLocalDevice::pairingConfirmation(bool confirmation) - To be called after getting a pairingDisplayConfirmation(). The \a accept parameter either + To be called after getting a pairingDisplayConfirmation(). The \a confirmation parameter either accepts the pairing or rejects it. Accepting a pairing always refers to the last pairing request issued via \l requestPairing(). diff --git a/src/bluetooth/qbluetoothserver.cpp b/src/bluetooth/qbluetoothserver.cpp index 90c3ff19..d9e42adf 100644 --- a/src/bluetooth/qbluetoothserver.cpp +++ b/src/bluetooth/qbluetoothserver.cpp @@ -189,7 +189,7 @@ QBluetoothServer::~QBluetoothServer() required to call \l QBluetoothServiceInfo::unregisterService() and \l close() on this server object. - Returns a registered QBluetoothServiceInfo instance if sucessful otherwise an + Returns a registered QBluetoothServiceInfo instance if successful otherwise an invalid QBluetoothServiceInfo. This function always assumes that the default Bluetooth adapter should be used. diff --git a/src/bluetooth/qbluetoothsocket_p.cpp b/src/bluetooth/qbluetoothsocket_p.cpp index 39d483d6..4c716005 100644 --- a/src/bluetooth/qbluetoothsocket_p.cpp +++ b/src/bluetooth/qbluetoothsocket_p.cpp @@ -50,6 +50,7 @@ QBluetoothSocketPrivate::QBluetoothSocketPrivate() socketType(QBluetoothServiceInfo::UnknownProtocol), state(QBluetoothSocket::UnconnectedState), socketError(QBluetoothSocket::NoSocketError), + discoveryAgent(0), secFlags(QBluetooth::NoSecurity) { #ifndef QT_IOS_BLUETOOTH diff --git a/src/bluetooth/qbluetoothsocket_winrt.cpp b/src/bluetooth/qbluetoothsocket_winrt.cpp index ec511974..670235fa 100644 --- a/src/bluetooth/qbluetoothsocket_winrt.cpp +++ b/src/bluetooth/qbluetoothsocket_winrt.cpp @@ -129,7 +129,12 @@ public: ~SocketWorker() { + } + void close() + { + m_shuttingDown = true; if (Q_UNLIKELY(m_initialReadOp)) { + onReadyRead(m_initialReadOp.Get(), Canceled); ComPtr<IAsyncInfo> info; HRESULT hr = m_initialReadOp.As(&info); Q_ASSERT_SUCCEEDED(hr); @@ -139,9 +144,11 @@ public: hr = info->Close(); Q_ASSERT_SUCCEEDED(hr); } + m_initialReadOp.Reset(); } if (m_readOp) { + onReadyRead(m_readOp.Get(), Canceled); ComPtr<IAsyncInfo> info; HRESULT hr = m_readOp.As(&info); Q_ASSERT_SUCCEEDED(hr); @@ -151,6 +158,7 @@ public: hr = info->Close(); Q_ASSERT_SUCCEEDED(hr); } + m_readOp.Reset(); } } @@ -190,6 +198,9 @@ public: HRESULT onReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status) { + if (m_shuttingDown) + return S_OK; + if (asyncInfo == m_initialReadOp.Get()) { m_initialReadOp.Reset(); } else if (asyncInfo == m_readOp.Get()) { @@ -299,6 +310,7 @@ public: private: ComPtr<IStreamSocket> m_socket; QVector<QByteArray> m_pendingData; + bool m_shuttingDown = false; // Protects pendingData/pendingDatagrams which are accessed from native callbacks QMutex m_mutex; @@ -312,6 +324,7 @@ QBluetoothSocketPrivate::QBluetoothSocketPrivate() socketType(QBluetoothServiceInfo::UnknownProtocol), state(QBluetoothSocket::UnconnectedState), socketError(QBluetoothSocket::NoSocketError), + discoveryAgent(0), secFlags(QBluetooth::NoSecurity), m_worker(new SocketWorker()) { @@ -404,6 +417,7 @@ void QBluetoothSocketPrivate::abort() this, &QBluetoothSocketPrivate::handleNewData); disconnect(m_worker, &SocketWorker::socketErrorOccured, this, &QBluetoothSocketPrivate::handleError); + m_worker->close(); m_worker->deleteLater(); if (socket != -1) { diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp index 39de9d01..357d3901 100644 --- a/src/bluetooth/qlowenergyservice.cpp +++ b/src/bluetooth/qlowenergyservice.cpp @@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE \image peripheral-structure.png Structure of a generic peripheral - A characteristic is the principle information carrier. It has a + A characteristic is the principal information carrier. It has a \l {QLowEnergyCharacteristic::value()}{value()} and \l {QLowEnergyCharacteristic::value()}{properties()} describing the access permissions for the value. The general purpose diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h index f413e7f7..9de65a84 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h @@ -47,7 +47,6 @@ QT_BEGIN_NAMESPACE class QLowEnergyServicePrivate; -class QLowEnergyControllerPrivateCommon; class Q_BLUETOOTH_EXPORT QLowEnergyService : public QObject { Q_OBJECT |