From d3ace86011d4e34eeafa795270ac027afd54f857 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 19 Sep 2019 13:24:43 +0200 Subject: Doc: Replace WinRT with UWP in Qt Bluetooth module docs Task-number: QTBUG-61884 Change-Id: Idd8e3287f06f3f30102ae8e644dadec1eb8769f4 Reviewed-by: Maurice Kalinowski Reviewed-by: Paul Wicking Reviewed-by: Alex Blasche --- src/bluetooth/doc/src/bluetooth-index.qdoc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bluetooth/doc/src/bluetooth-index.qdoc b/src/bluetooth/doc/src/bluetooth-index.qdoc index a0e2a048..08c57e40 100644 --- a/src/bluetooth/doc/src/bluetooth-index.qdoc +++ b/src/bluetooth/doc/src/bluetooth-index.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -42,7 +42,7 @@ Currently, the API is supported on the following platforms: \li \l {Qt for iOS}{iOS} \li \l {Qt for Linux/X11}{Linux (BlueZ 4.x/5.x)} \li \l \macos - \li \l {Qt for WinRT}{WinRT} + \li \l {Qt for UWP}{UWP (Universal Windows Platform)} \li \l {Qt for Windows}{Win32} \row \li Classic Bluetooth @@ -78,8 +78,8 @@ Currently, the API is supported on the following platforms: \li \endtable -Despite there not being a Win32 port yet, the WinRT backend is automatically used -if the win32 target platform supports the required WinRT APIs. Minimal requirement is Windows 10 version 1507 +Despite there not being a Win32 port yet, the UWP backend is automatically used +if the win32 target platform supports the required UWP APIs. Minimal requirement is Windows 10 version 1507 with slightly improved service discovery since Windows 10 version 1607. Therefore Windows 7 and 8.x targets are excluded. @@ -166,7 +166,8 @@ The \l QtBluetooth module exports the following \li Enables logging of the QtBluetooth QML implementation \row \li qt.bluetooth.winrt - \li Enables logging of the \l {Qt for WinRT} {WinRT} implementation + \li Enables logging of the \l {Qt for UWP}{UWP (Universal Windows Platform)} + implementation \endtable Logging categories can be used to enable additional warning and debug output -- cgit v1.2.3 From 7390de230e3c86049824bef756e4af623a547d61 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 27 Sep 2019 09:40:48 +0200 Subject: Add descriptor even if the read fails during service discovery leDescriptorRead() serves two pruposes. Firstly, it informs Qt of the value/result of the read operation. During service discovery it is also used to inform Qt that a descriptor was found. This info is used to build up the internal data structure representing the service, its characteristics and its descriptors. If we have a non-readable descriptor the read failed (as expected) and Qt was never informed about the existence of the descriptor. During service discovery the primary purpose is to inform about the existence of a descriptor though. This patch ensures the notification comes through and we accept the fact that the passed value is not known. Fixes: QTBUG-78201 Change-Id: Id73a27c90905cb769f1cd168b48299d580587594 Reviewed-by: Timur Pocheptsov --- .../org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java index 6c548f84..5e8bf484 100644 --- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java +++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java @@ -403,8 +403,15 @@ public class QtBluetoothLE { descriptor.getUuid().toString(), descriptor.getValue()); } else { if (isServiceDiscoveryRun) { - //ignore - Log.w(TAG, "onDescriptorcRead during discovery error: " + status); + // Cannot read but still advertise the fact that we found a descriptor + // The value will be empty. + Log.w(TAG, "onDescriptorRead during discovery error: " + status); + Log.d(TAG, "Non-readable descriptor " + descriptor.getUuid() + + " for characteristic " + descriptor.getCharacteristic().getUuid() + + " for service " + descriptor.getCharacteristic().getService().getUuid()); + leDescriptorRead(qtObject, descriptor.getCharacteristic().getService().getUuid().toString(), + descriptor.getCharacteristic().getUuid().toString(), foundHandle + 1, + descriptor.getUuid().toString(), descriptor.getValue()); } else { // This must be in sync with QLowEnergyService::DescriptorReadError final int descriptorReadError = 6; -- cgit v1.2.3 From 245f19122c2a6a112a35ee65556bcf00b6545d87 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 10 Oct 2019 15:15:53 +0200 Subject: qbluetoothdevicediscoveryagent_winrt: Decrement device count in case of failure It is possible that obtaining a paired device inside the callback fails, if the device was paired to another than the currently active bluetooth adapter. If we do not decrement the to be detected device count, the scan will never finish. Change-Id: I86140d082891482c759f33888b2483f3f5821253 Reviewed-by: Alex Blasche --- src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp index ae8e9184..30aa3fcc 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp @@ -440,8 +440,11 @@ void QWinRTBluetoothDeviceDiscoveryWorker::classicBluetoothInfoFromDeviceIdAsync hr = deviceFromIdOperation->put_Completed(Callback> ([thisPointer](IAsyncOperation *op, AsyncStatus status) { - if (status == Completed && thisPointer) - thisPointer->onPairedClassicBluetoothDeviceFoundAsync(op, status); + if (thisPointer) { + if (status == Completed) + thisPointer->onPairedClassicBluetoothDeviceFoundAsync(op, status); + --thisPointer->m_pendingPairedDevices; + } return S_OK; }).Get()); if (FAILED(hr)) { @@ -474,8 +477,11 @@ void QWinRTBluetoothDeviceDiscoveryWorker::leBluetoothInfoFromDeviceIdAsync(HSTR hr = deviceFromIdOperation->put_Completed(Callback> ([thisPointer] (IAsyncOperation *op, AsyncStatus status) { - if (status == Completed && thisPointer) - thisPointer->onPairedBluetoothLEDeviceFoundAsync(op, status); + if (thisPointer) { + if (status == Completed) + thisPointer->onPairedBluetoothLEDeviceFoundAsync(op, status); + --thisPointer->m_pendingPairedDevices; + } return S_OK; }).Get()); if (FAILED(hr)) { -- cgit v1.2.3