summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--config.tests/bluez/bluez.pro4
-rw-r--r--config.tests/bluez/main.cpp6
-rw-r--r--config.tests/winrt_bt/main.cpp42
-rw-r--r--config.tests/winrt_bt/winrt.pro3
-rw-r--r--examples/bluetooth/btfiletransfer/progress.h1
-rw-r--r--examples/bluetooth/btscanner/device.h1
-rw-r--r--examples/bluetooth/btscanner/service.h1
-rw-r--r--examples/bluetooth/heartrate-game/devicehandler.cpp7
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp1
-rw-r--r--examples/bluetooth/lowenergyscanner/device.h1
-rw-r--r--examples/nfc/annotatedurl/annotatedurl.h1
-rw-r--r--examples/nfc/ndefeditor/mainwindow.h2
-rw-r--r--examples/nfc/ndefeditor/mimeimagerecordeditor.h2
-rw-r--r--src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java6
-rw-r--r--src/bluetooth/android/jni_android.cpp2
-rw-r--r--src/bluetooth/android/lowenergynotificationhub.cpp5
-rw-r--r--src/bluetooth/bluetooth.pro26
-rw-r--r--src/bluetooth/bluez/adapter1_bluez5.cpp4
-rw-r--r--src/bluetooth/bluez/adapter1_bluez5_p.h23
-rw-r--r--src/bluetooth/bluez/bluez5_helper.cpp1
-rw-r--r--src/bluetooth/bluez/bluez5_helper_p.h2
-rw-r--r--src/bluetooth/bluez/device1_bluez5.cpp3
-rw-r--r--src/bluetooth/bluez/device1_bluez5_p.h38
-rwxr-xr-xsrc/bluetooth/bluez/generate14
-rw-r--r--src/bluetooth/bluez/objectmanager_p.h4
-rw-r--r--src/bluetooth/bluez/org.bluez.Adapter1.xml4
-rw-r--r--src/bluetooth/bluez/org.bluez.Device1.xml10
-rw-r--r--src/bluetooth/configure.json13
-rw-r--r--src/bluetooth/osx/osxbtcentralmanager.mm2
-rw-r--r--src/bluetooth/osx/osxbtutility_p.h19
-rw-r--r--src/bluetooth/qbluetooth.h2
-rw-r--r--src/bluetooth/qbluetoothaddress.h2
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent.cpp8
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent.h2
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp2
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp66
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_p.h2
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp10
-rw-r--r--src/bluetooth/qbluetoothdeviceinfo.h3
-rw-r--r--src/bluetooth/qbluetoothhostinfo.h2
-rw-r--r--src/bluetooth/qbluetoothlocaldevice.h2
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_bluez.cpp8
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_p.h2
-rw-r--r--src/bluetooth/qbluetoothserver.h2
-rw-r--r--src/bluetooth/qbluetoothserver_winrt.cpp12
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.h2
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp3
-rw-r--r--src/bluetooth/qbluetoothserviceinfo.h2
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_winrt.cpp3
-rw-r--r--src/bluetooth/qbluetoothsocket.cpp8
-rw-r--r--src/bluetooth/qbluetoothsocket.h3
-rw-r--r--src/bluetooth/qbluetoothsocket_bluez.cpp4
-rw-r--r--src/bluetooth/qbluetoothsocket_osx.mm6
-rw-r--r--src/bluetooth/qbluetoothsocket_winrt.cpp8
-rw-r--r--src/bluetooth/qbluetoothtransfermanager.h2
-rw-r--r--src/bluetooth/qbluetoothtransferrequest.h2
-rw-r--r--src/bluetooth/qbluetoothtransferrequest_p.h2
-rw-r--r--src/bluetooth/qbluetoothutils_win.cpp94
-rw-r--r--src/bluetooth/qbluetoothuuid.h2
-rw-r--r--src/bluetooth/qlowenergyadvertisingdata.h2
-rw-r--r--src/bluetooth/qlowenergyadvertisingparameters.h2
-rw-r--r--src/bluetooth/qlowenergycharacteristic.h2
-rw-r--r--src/bluetooth/qlowenergyconnectionparameters.h2
-rw-r--r--src/bluetooth/qlowenergycontroller.cpp5
-rw-r--r--src/bluetooth/qlowenergycontroller.h1
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp10
-rw-r--r--src/bluetooth/qlowenergycontroller_p.h5
-rw-r--r--src/bluetooth/qlowenergycontroller_winrt.cpp8
-rw-r--r--src/bluetooth/qlowenergydescriptor.h2
-rw-r--r--src/bluetooth/qlowenergyservice.cpp2
-rw-r--r--src/bluetooth/qlowenergyservicedata.h2
-rw-r--r--src/bluetooth/qtbluetoothglobal.h (renamed from src/bluetooth/qbluetoothglobal.h)2
-rw-r--r--src/bluetooth/qtbluetoothglobal_p.h59
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h2
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothsocket.cpp1
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothsocket_p.h1
-rw-r--r--src/nfc/nfc.pro3
-rw-r--r--src/nfc/qllcpserver_p.h2
-rw-r--r--src/nfc/qllcpserver_p_p.h2
-rw-r--r--src/nfc/qllcpsocket_p.h2
-rw-r--r--src/nfc/qllcpsocket_p_p.h2
-rw-r--r--src/nfc/qndeffilter.h2
-rw-r--r--src/nfc/qndefmessage.h2
-rw-r--r--src/nfc/qndefnfcsmartposterrecord.h2
-rw-r--r--src/nfc/qndefnfctextrecord.h2
-rw-r--r--src/nfc/qndefnfcurirecord.h2
-rw-r--r--src/nfc/qndefrecord.h2
-rw-r--r--src/nfc/qndefrecord_p.h2
-rw-r--r--src/nfc/qnearfieldmanager.h2
-rw-r--r--src/nfc/qnearfieldmanager_p.h2
-rw-r--r--src/nfc/qnearfieldsharemanager.h2
-rw-r--r--src/nfc/qnearfieldtarget.h2
-rw-r--r--src/nfc/qnearfieldtarget_p.h2
-rw-r--r--src/nfc/qnfc.cpp2
-rw-r--r--src/nfc/qtlv_p.h2
-rw-r--r--src/nfc/qtnfcglobal.h (renamed from src/nfc/qnfcglobal.h)2
-rw-r--r--src/nfc/qtnfcglobal_p.h59
-rw-r--r--src/nfc/targetemulator_p.h2
-rw-r--r--sync.profile8
-rw-r--r--tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp5
-rw-r--r--tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro2
-rw-r--r--tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp10
-rw-r--r--tests/auto/qbluetoothserver/qbluetoothserver.pro2
-rw-r--r--tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp3
-rw-r--r--tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp4
-rw-r--r--tests/auto/qlowenergycontroller/qlowenergycontroller.pro2
-rw-r--r--tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp23
108 files changed, 629 insertions, 156 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 2108ac6f..138038d5 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,3 @@
load(qt_build_config)
-MODULE_VERSION = 5.9.3
+MODULE_VERSION = 5.10.0
diff --git a/config.tests/bluez/bluez.pro b/config.tests/bluez/bluez.pro
index 28dcadcb..8bbff78a 100644
--- a/config.tests/bluez/bluez.pro
+++ b/config.tests/bluez/bluez.pro
@@ -1 +1,5 @@
SOURCES += main.cpp
+
+# test checks existence of certain bluez defines whose
+# usage is known to violate the permissive test
+QMAKE_CXXFLAGS += -fpermissive
diff --git a/config.tests/bluez/main.cpp b/config.tests/bluez/main.cpp
index 0b9235aa..3fe5ee09 100644
--- a/config.tests/bluez/main.cpp
+++ b/config.tests/bluez/main.cpp
@@ -30,5 +30,11 @@
int main()
{
+#ifdef BDADDR_NONE
+ bacmp(BDADDR_ANY, BDADDR_NONE);
+#else
+ bacmp(BDADDR_ANY, BDADDR_LOCAL);
+#endif
+
return 0;
}
diff --git a/config.tests/winrt_bt/main.cpp b/config.tests/winrt_bt/main.cpp
new file mode 100644
index 00000000..2e0eb276
--- /dev/null
+++ b/config.tests/winrt_bt/main.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtConnectivity module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <wrl.h>
+#include <windows.devices.enumeration.h>
+#include <windows.devices.bluetooth.h>
+
+int main()
+{
+ Microsoft::WRL::ComPtr<ABI::Windows::Devices::Enumeration::IDeviceInformationStatics> deviceInformationStatics;
+ ABI::Windows::Foundation::GetActivationFactory(Microsoft::WRL::Wrappers::HString::MakeReference
+ (RuntimeClass_Windows_Devices_Enumeration_DeviceInformation).Get(), &deviceInformationStatics);
+
+ (void)Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::IBluetoothDevice>().Get();
+ (void)Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::IBluetoothLEDevice>().Get();
+ return 0;
+}
diff --git a/config.tests/winrt_bt/winrt.pro b/config.tests/winrt_bt/winrt.pro
new file mode 100644
index 00000000..d60fd242
--- /dev/null
+++ b/config.tests/winrt_bt/winrt.pro
@@ -0,0 +1,3 @@
+SOURCES += main.cpp
+
+!winrt: LIBS += runtimeobject.lib
diff --git a/examples/bluetooth/btfiletransfer/progress.h b/examples/bluetooth/btfiletransfer/progress.h
index b71009b7..8a30ff94 100644
--- a/examples/bluetooth/btfiletransfer/progress.h
+++ b/examples/bluetooth/btfiletransfer/progress.h
@@ -42,7 +42,6 @@
#define PROGRESS_H
#include <QDialog>
-#include <qbluetoothglobal.h>
#include <QTime>
QT_FORWARD_DECLARE_CLASS(QBluetoothTransferReply)
diff --git a/examples/bluetooth/btscanner/device.h b/examples/bluetooth/btscanner/device.h
index 9e5c59f6..f5b3a715 100644
--- a/examples/bluetooth/btscanner/device.h
+++ b/examples/bluetooth/btscanner/device.h
@@ -43,7 +43,6 @@
#include "ui_device.h"
-#include <qbluetoothglobal.h>
#include <qbluetoothlocaldevice.h>
#include <QDialog>
diff --git a/examples/bluetooth/btscanner/service.h b/examples/bluetooth/btscanner/service.h
index 5b47d11a..871d975b 100644
--- a/examples/bluetooth/btscanner/service.h
+++ b/examples/bluetooth/btscanner/service.h
@@ -43,7 +43,6 @@
#include "ui_service.h"
-#include <qbluetoothglobal.h>
#include <QDialog>
QT_FORWARD_DECLARE_CLASS(QBluetoothAddress)
diff --git a/examples/bluetooth/heartrate-game/devicehandler.cpp b/examples/bluetooth/heartrate-game/devicehandler.cpp
index dfc514b5..b9fe69c6 100644
--- a/examples/bluetooth/heartrate-game/devicehandler.cpp
+++ b/examples/bluetooth/heartrate-game/devicehandler.cpp
@@ -42,6 +42,7 @@
#include "devicehandler.h"
#include "deviceinfo.h"
#include <QtEndian>
+#include <QRandomGenerator>
DeviceHandler::DeviceHandler(QObject *parent) :
BluetoothBaseClass(parent),
@@ -248,11 +249,11 @@ void DeviceHandler::updateDemoHR()
{
int randomValue = 0;
if (m_currentValue < 30) { // Initial value
- randomValue = 55 + qrand()%30;
+ randomValue = 55 + QRandomGenerator::bounded(30);
} else if (!m_measuring) { // Value when relax
- randomValue = qBound(55, m_currentValue - 2 + qrand()%5, 75);
+ randomValue = qBound(55, m_currentValue - 2 + QRandomGenerator::bounded(5), 75);
} else { // Measuring
- randomValue = m_currentValue + qrand()%10 - 2;
+ randomValue = m_currentValue + QRandomGenerator::bounded(10) - 2;
}
addMeasurement(randomValue);
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 0275c435..765a0d1c 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "device.h"
+
#include <qbluetoothaddress.h>
#include <qbluetoothdevicediscoveryagent.h>
#include <qbluetoothlocaldevice.h>
diff --git a/examples/bluetooth/lowenergyscanner/device.h b/examples/bluetooth/lowenergyscanner/device.h
index 331d4458..1dc10300 100644
--- a/examples/bluetooth/lowenergyscanner/device.h
+++ b/examples/bluetooth/lowenergyscanner/device.h
@@ -41,7 +41,6 @@
#ifndef DEVICE_H
#define DEVICE_H
-#include <qbluetoothglobal.h>
#include <qbluetoothlocaldevice.h>
#include <QObject>
#include <QVariant>
diff --git a/examples/nfc/annotatedurl/annotatedurl.h b/examples/nfc/annotatedurl/annotatedurl.h
index 08e5b38e..853bdd7f 100644
--- a/examples/nfc/annotatedurl/annotatedurl.h
+++ b/examples/nfc/annotatedurl/annotatedurl.h
@@ -41,7 +41,6 @@
#ifndef ANNOTATEDURL_H
#define ANNOTATEDURL_H
-#include <qnfcglobal.h>
#include <QNdefMessage>
#include <QtCore/QObject>
diff --git a/examples/nfc/ndefeditor/mainwindow.h b/examples/nfc/ndefeditor/mainwindow.h
index 374b2ee3..69eeee30 100644
--- a/examples/nfc/ndefeditor/mainwindow.h
+++ b/examples/nfc/ndefeditor/mainwindow.h
@@ -43,8 +43,6 @@
#include <QMainWindow>
-#include <qnfcglobal.h>
-
#include <qnearfieldtarget.h>
QT_BEGIN_NAMESPACE
diff --git a/examples/nfc/ndefeditor/mimeimagerecordeditor.h b/examples/nfc/ndefeditor/mimeimagerecordeditor.h
index 996cabc3..ef6506f3 100644
--- a/examples/nfc/ndefeditor/mimeimagerecordeditor.h
+++ b/examples/nfc/ndefeditor/mimeimagerecordeditor.h
@@ -42,8 +42,6 @@
#ifndef MIMEIMAGERECORDEDITOR_H
#define MIMEIMAGERECORDEDITOR_H
-#include <qnfcglobal.h>
-
#include <QWidget>
#include <qndefrecord.h>
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 0f419ad7..1b527ae3 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
@@ -206,6 +206,12 @@ public class QtBluetoothLE {
case 22: // BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION
Log.w(TAG, "Connection Error: Try to delay connect() call after previous activity");
errorCode = 5; break; //QLowEnergyController::ConnectionError
+ case 19: // BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION
+ case 20: // BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES
+ case 21: // BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF
+ Log.w(TAG, "The remote host closed the connection");
+ errorCode = 7; //QLowEnergyController::RemoteHostClosedError
+ break;
default:
Log.w(TAG, "Unhandled error code on connectionStateChanged: " + status + " " + newState);
errorCode = status; break; //TODO deal with all errors
diff --git a/src/bluetooth/android/jni_android.cpp b/src/bluetooth/android/jni_android.cpp
index 68e291e5..176416c8 100644
--- a/src/bluetooth/android/jni_android.cpp
+++ b/src/bluetooth/android/jni_android.cpp
@@ -41,7 +41,7 @@
#include <jni.h>
#include <android/log.h>
#include <QtCore/QLoggingCategory>
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include "android/jni_android_p.h"
#include "android/androidbroadcastreceiver_p.h"
#include "android/serveracceptancethread_p.h"
diff --git a/src/bluetooth/android/lowenergynotificationhub.cpp b/src/bluetooth/android/lowenergynotificationhub.cpp
index 53f2d6cc..9f90e3de 100644
--- a/src/bluetooth/android/lowenergynotificationhub.cpp
+++ b/src/bluetooth/android/lowenergynotificationhub.cpp
@@ -41,7 +41,7 @@
#include <QtCore/QHash>
#include <QtCore/QLoggingCategory>
-#include <QtCore/QTime>
+#include <QtCore/QRandomGenerator>
#include <QtAndroidExtras/QAndroidJniEnvironment>
QT_BEGIN_NAMESPACE
@@ -81,11 +81,10 @@ LowEnergyNotificationHub::LowEnergyNotificationHub(const QBluetoothAddress &remo
}
// register C++ class pointer in Java
- qsrand(QTime::currentTime().msec());
lock.lockForWrite();
while (true) {
- javaToCtoken = qrand();
+ javaToCtoken = QRandomGenerator::get32();
if (!hubMap()->contains(javaToCtoken))
break;
}
diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro
index 40b14a84..b45da961 100644
--- a/src/bluetooth/bluetooth.pro
+++ b/src/bluetooth/bluetooth.pro
@@ -6,7 +6,7 @@ QMAKE_DOCS = $$PWD/doc/qtbluetooth.qdocconf
OTHER_FILES += doc/src/*.qdoc # show .qdoc files in Qt Creator
PUBLIC_HEADERS += \
- qbluetoothglobal.h \
+ qtbluetoothglobal.h \
qbluetoothaddress.h\
qbluetoothhostinfo.h \
qbluetoothuuid.h\
@@ -33,6 +33,7 @@ PUBLIC_HEADERS += \
qlowenergycontroller.h
PRIVATE_HEADERS += \
+ qtbluetoothglobal_p.h \
qbluetoothaddress_p.h\
qbluetoothhostinfo_p.h \
qbluetoothdeviceinfo_p.h\
@@ -77,6 +78,11 @@ SOURCES += \
qlowenergycontroller.cpp \
qlowenergyserviceprivate.cpp
+win32 {
+ WINDOWS_SDK_VERSION_STRING = $$(WindowsSDKVersion)
+ WINDOWS_SDK_VERSION = $$member($$list($$split(WINDOWS_SDK_VERSION_STRING, .)), 2)
+}
+
qtConfig(bluez) {
QT_PRIVATE = concurrent
QT_FOR_PRIVATE += dbus
@@ -183,15 +189,19 @@ qtConfig(bluez) {
qbluetoothserviceinfo_p.cpp \
qbluetoothservicediscoveryagent_p.cpp \
qbluetoothsocket_p.cpp \
- qbluetoothserver_p.cpp \
- qlowenergycontroller_p.cpp
+ qbluetoothserver_p.cpp
SOURCES -= qbluetoothdevicediscoveryagent.cpp
- SOURCES -= qlowenergycontroller_p.cpp
SOURCES -= qlowenergyservice.cpp
SOURCES -= qlowenergycontroller.cpp
-} else:winrt {
+} else: qtConfig(winrt_bt) {
DEFINES += QT_WINRT_BLUETOOTH
+ !winrt {
+ SOURCES += qbluetoothutils_win.cpp
+ DEFINES += CLASSIC_APP_BUILD
+ LIBS += runtimeobject.lib user32.lib
+ }
+
QT += core-private
SOURCES += \
@@ -203,11 +213,9 @@ qtConfig(bluez) {
qbluetoothsocket_winrt.cpp \
qlowenergycontroller_winrt.cpp
- WINRT_SDK_VERSION_STRING = $$(UCRTVersion)
- WINRT_SDK_VERSION = $$member($$list($$split(WINRT_SDK_VERSION_STRING, .)), 2)
- lessThan(WINRT_SDK_VERSION, 14393) {
+ lessThan(WINDOWS_SDK_VERSION, 14393) {
DEFINES += QT_WINRT_LIMITED_SERVICEDISCOVERY
- DEFINES += QT_UCRTVERSION=$$WINRT_SDK_VERSION
+ DEFINES += QT_UCRTVERSION=$$WINDOWS_SDK_VERSION
}
} else {
message("Unsupported Bluetooth platform, will not build a working QtBluetooth library.")
diff --git a/src/bluetooth/bluez/adapter1_bluez5.cpp b/src/bluetooth/bluez/adapter1_bluez5.cpp
index 0f1e0acd..b1aefc8d 100644
--- a/src/bluetooth/bluez/adapter1_bluez5.cpp
+++ b/src/bluetooth/bluez/adapter1_bluez5.cpp
@@ -1,8 +1,8 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
- * Command line was: qdbusxml2cpp -p adapter1 -v org.bluez.Adapter1.xml
+ * Command line was: qdbusxml2cpp -p adapter1_bluez5_p.h:adapter1_bluez5.cpp org.bluez.Adapter1.xml
*
- * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
+ * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
diff --git a/src/bluetooth/bluez/adapter1_bluez5_p.h b/src/bluetooth/bluez/adapter1_bluez5_p.h
index 5568da4c..ce108ad0 100644
--- a/src/bluetooth/bluez/adapter1_bluez5_p.h
+++ b/src/bluetooth/bluez/adapter1_bluez5_p.h
@@ -1,15 +1,15 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
- * Command line was: qdbusxml2cpp -p adapter1 -v org.bluez.Adapter1.xml
+ * Command line was: qdbusxml2cpp -p adapter1_bluez5_p.h:adapter1_bluez5.cpp org.bluez.Adapter1.xml
*
- * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
+ * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
-#ifndef ADAPTER1_H_1396951555
-#define ADAPTER1_H_1396951555
+#ifndef ADAPTER1_BLUEZ5_P_H
+#define ADAPTER1_BLUEZ5_P_H
#include <QtCore/QObject>
#include <QtCore/QByteArray>
@@ -31,7 +31,7 @@ public:
{ return "org.bluez.Adapter1"; }
public:
- OrgBluezAdapter1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+ OrgBluezAdapter1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
~OrgBluezAdapter1Interface();
@@ -100,19 +100,26 @@ public Q_SLOTS: // METHODS
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(device);
- return asyncCallWithArgumentList(QLatin1String("RemoveDevice"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("RemoveDevice"), argumentList);
+ }
+
+ inline QDBusPendingReply<> SetDiscoveryFilter(const QVariantMap &properties)
+ {
+ QList<QVariant> argumentList;
+ argumentList << QVariant::fromValue(properties);
+ return asyncCallWithArgumentList(QStringLiteral("SetDiscoveryFilter"), argumentList);
}
inline QDBusPendingReply<> StartDiscovery()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("StartDiscovery"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("StartDiscovery"), argumentList);
}
inline QDBusPendingReply<> StopDiscovery()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("StopDiscovery"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("StopDiscovery"), argumentList);
}
Q_SIGNALS: // SIGNALS
diff --git a/src/bluetooth/bluez/bluez5_helper.cpp b/src/bluetooth/bluez/bluez5_helper.cpp
index 8871a872..de41003f 100644
--- a/src/bluetooth/bluez/bluez5_helper.cpp
+++ b/src/bluetooth/bluez/bluez5_helper.cpp
@@ -69,6 +69,7 @@ bool isBluez5()
qDBusRegisterMetaType<InterfaceList>();
qDBusRegisterMetaType<ManagedObjectList>();
+ qDBusRegisterMetaType<ManufacturerDataList>();
QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
reply.waitForFinished();
diff --git a/src/bluetooth/bluez/bluez5_helper_p.h b/src/bluetooth/bluez/bluez5_helper_p.h
index a46810fc..2d72caf1 100644
--- a/src/bluetooth/bluez/bluez5_helper_p.h
+++ b/src/bluetooth/bluez/bluez5_helper_p.h
@@ -57,8 +57,10 @@
typedef QMap<QString, QVariantMap> InterfaceList;
typedef QMap<QDBusObjectPath, InterfaceList> ManagedObjectList;
+typedef QMap<quint16, QDBusVariant> ManufacturerDataList;
Q_DECLARE_METATYPE(InterfaceList)
+Q_DECLARE_METATYPE(ManufacturerDataList)
Q_DECLARE_METATYPE(ManagedObjectList)
QT_BEGIN_NAMESPACE
diff --git a/src/bluetooth/bluez/device1_bluez5.cpp b/src/bluetooth/bluez/device1_bluez5.cpp
index a4c01d3f..491a365d 100644
--- a/src/bluetooth/bluez/device1_bluez5.cpp
+++ b/src/bluetooth/bluez/device1_bluez5.cpp
@@ -1,8 +1,7 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
- * Command line was: qdbusxml2cpp -p device1_bluez5 -v org.bluez.Device1.xml
*
- * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
+ * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
diff --git a/src/bluetooth/bluez/device1_bluez5_p.h b/src/bluetooth/bluez/device1_bluez5_p.h
index d6181b34..4feb5318 100644
--- a/src/bluetooth/bluez/device1_bluez5_p.h
+++ b/src/bluetooth/bluez/device1_bluez5_p.h
@@ -1,15 +1,14 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
- * Command line was: qdbusxml2cpp -p device1_bluez5 -v org.bluez.Device1.xml
*
- * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
+ * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
-#ifndef DEVICE1_BLUEZ5_H_1396951960
-#define DEVICE1_BLUEZ5_H_1396951960
+#ifndef DEVICE1_BLUEZ5_P_H
+#define DEVICE1_BLUEZ5_P_H
#include <QtCore/QObject>
#include <QtCore/QByteArray>
@@ -19,6 +18,7 @@
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
+#include "bluez5_helper_p.h"
/*
* Proxy class for interface org.bluez.Device1
@@ -31,7 +31,7 @@ public:
{ return "org.bluez.Device1"; }
public:
- OrgBluezDevice1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+ OrgBluezDevice1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
~OrgBluezDevice1Interface();
@@ -75,6 +75,10 @@ public:
inline bool legacyPairing() const
{ return qvariant_cast< bool >(property("LegacyPairing")); }
+ Q_PROPERTY(ManufacturerDataList ManufacturerData READ manufacturerData)
+ inline ManufacturerDataList manufacturerData() const
+ { return qvariant_cast< ManufacturerDataList >(property("ManufacturerData")); }
+
Q_PROPERTY(QString Modalias READ modalias)
inline QString modalias() const
{ return qvariant_cast< QString >(property("Modalias")); }
@@ -91,12 +95,24 @@ public:
inline short rSSI() const
{ return qvariant_cast< short >(property("RSSI")); }
+ Q_PROPERTY(QVariantMap ServiceData READ serviceData)
+ inline QVariantMap serviceData() const
+ { return qvariant_cast< QVariantMap >(property("ServiceData")); }
+
+ Q_PROPERTY(bool ServicesResolved READ servicesResolved)
+ inline bool servicesResolved() const
+ { return qvariant_cast< bool >(property("ServicesResolved")); }
+
Q_PROPERTY(bool Trusted READ trusted WRITE setTrusted)
inline bool trusted() const
{ return qvariant_cast< bool >(property("Trusted")); }
inline void setTrusted(bool value)
{ setProperty("Trusted", QVariant::fromValue(value)); }
+ Q_PROPERTY(short TxPower READ txPower)
+ inline short txPower() const
+ { return qvariant_cast< short >(property("TxPower")); }
+
Q_PROPERTY(QStringList UUIDs READ uUIDs)
inline QStringList uUIDs() const
{ return qvariant_cast< QStringList >(property("UUIDs")); }
@@ -105,39 +121,39 @@ public Q_SLOTS: // METHODS
inline QDBusPendingReply<> CancelPairing()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("CancelPairing"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("CancelPairing"), argumentList);
}
inline QDBusPendingReply<> Connect()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("Connect"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("Connect"), argumentList);
}
inline QDBusPendingReply<> ConnectProfile(const QString &UUID)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(UUID);
- return asyncCallWithArgumentList(QLatin1String("ConnectProfile"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("ConnectProfile"), argumentList);
}
inline QDBusPendingReply<> Disconnect()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("Disconnect"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("Disconnect"), argumentList);
}
inline QDBusPendingReply<> DisconnectProfile(const QString &UUID)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(UUID);
- return asyncCallWithArgumentList(QLatin1String("DisconnectProfile"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("DisconnectProfile"), argumentList);
}
inline QDBusPendingReply<> Pair()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("Pair"), argumentList);
+ return asyncCallWithArgumentList(QStringLiteral("Pair"), argumentList);
}
Q_SIGNALS: // SIGNALS
diff --git a/src/bluetooth/bluez/generate b/src/bluetooth/bluez/generate
index 14bcaea8..cdba18c4 100755
--- a/src/bluetooth/bluez/generate
+++ b/src/bluetooth/bluez/generate
@@ -1,5 +1,6 @@
#!/bin/sh
+#Bluez 4
qdbusxml2cpp -p manager_p.h:manager.cpp org.bluez.Manager.xml org.bluez.Manager
qdbusxml2cpp -p adapter_p.h:adapter.cpp org.bluez.all.xml org.bluez.Adapter
qdbusxml2cpp -i servicemap_p.h -p device_p.h:device.cpp org.bluez.Device.xml org.bluez.Device
@@ -9,8 +10,13 @@ qdbusxml2cpp -p obex_manager_p.h:obex_manager.cpp org.openobex.all.xml org.openo
qdbusxml2cpp -p obex_client_p.h:obex_client.cpp org.openobex.client.xml org.openobex.Client
qdbusxml2cpp -p obex_transfer_p.h:obex_transfer.cpp org.openobex.transfer.xml org.openobex.Transfer
qdbusxml2cpp -a obex_agent_p.h:obex_agent.cpp org.openobex.agent.xml org.openobex.Agent
-#qdbusxml2cpp -p serialproxymanager_p.h:serialproxymanager.cpp org.bluez.all.xml org.bluez.SerialProxyManager
-#qdbusxml2cpp -p networkpeer_p.h:networkpeer.cpp org.bluez.all.xml org.bluez.NetworkPeer
-#qdbusxml2cpp -p networkhub_p.h:networkhub.cpp org.bluez.all.xml org.bluez.NetworkHub
-#qdbusxml2cpp -p networkrouter_p.h:networkrouter.cpp org.bluez.all.xml org.bluez.NetworkRouter
+#Bluez 5
+qdbusxml2cpp -p adapter1_bluez5_p.h:adapter1_bluez5.cpp org.bluez.Adapter1.xml
+qdbusxml2cpp -p device1_bluez5_p.h:device1_bluez5.cpp org.bluez.Device1.xml
+qdbusxml2cpp -p profile1_p.h:profile1.cpp org.bluez.ProfileManager1.xml
+qdbusxml2cpp -p objectmanager_p.h:objectmanager.cpp org.freedesktop.dbus.objectmanager.xml
+qdbusxml2cpp -p properties_p.h:properties.cpp org.freedesktop.dbus.properties.xml
+qdbusxml2cpp -p obex_client1_bluez5_p.h:obex_client1_bluez5_p.h org.bluez.Client1.xml
+qdbusxml2cpp -p obex_objectpush1_bluez5_p.h:obex_objectpush1_bluez5.cpp org.bluez.obex.ObjectPush1.xml
+qdbusxml2cpp -p obex_transfer1_bluez5_p.h:obex_transfer1_bluez5_p.h org.bluez.obex.Transfer1.xml
diff --git a/src/bluetooth/bluez/objectmanager_p.h b/src/bluetooth/bluez/objectmanager_p.h
index 823badeb..74f5ab43 100644
--- a/src/bluetooth/bluez/objectmanager_p.h
+++ b/src/bluetooth/bluez/objectmanager_p.h
@@ -20,10 +20,6 @@
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
-/* Temporary hack to merge branches until Bluez headers are removed
- * from bluez5_helpers_p.h.
- */
-#define NO_BLUEZ_INCLUDES
#include "bluez5_helper_p.h"
/*
diff --git a/src/bluetooth/bluez/org.bluez.Adapter1.xml b/src/bluetooth/bluez/org.bluez.Adapter1.xml
index a1e6babe..121c277e 100644
--- a/src/bluetooth/bluez/org.bluez.Adapter1.xml
+++ b/src/bluetooth/bluez/org.bluez.Adapter1.xml
@@ -7,6 +7,10 @@
<method name="RemoveDevice">
<arg name="device" type="o" direction="in"/>
</method>
+ <method name="SetDiscoveryFilter">
+ <arg name="properties" type="a{sv}" direction="in"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+ </method>
<property name="Address" type="s" access="read"></property>
<property name="Name" type="s" access="read"></property>
<property name="Alias" type="s" access="readwrite"></property>
diff --git a/src/bluetooth/bluez/org.bluez.Device1.xml b/src/bluetooth/bluez/org.bluez.Device1.xml
index 1f8fd2c1..554d0b53 100644
--- a/src/bluetooth/bluez/org.bluez.Device1.xml
+++ b/src/bluetooth/bluez/org.bluez.Device1.xml
@@ -27,5 +27,15 @@
<property name="UUIDs" type="as" access="read"></property>
<property name="Modalias" type="s" access="read"></property>
<property name="Adapter" type="o" access="read"></property>
+ <!-- ManufacturerData & ServiceData introduced by Bluez 5.31 -->
+ <property name="ManufacturerData" type="a{qv}" access="read">
+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="ManufacturerDataList"/>
+ </property>
+ <property name="ServiceData" type="a{sv}" access="read">
+ <annotation name="org.qtproject.QtDBus.QtTypeName" value="QVariantMap"/>
+ </property>
+ <!-- TxPower and ServicesResolved introduced by Bluez 5.42 -->
+ <property name="TxPower" type="n" access="read"></property>
+ <property name="ServicesResolved" type="b" access="read"></property>
</interface>
</node>
diff --git a/src/bluetooth/configure.json b/src/bluetooth/configure.json
index a1e65000..3153aca6 100644
--- a/src/bluetooth/configure.json
+++ b/src/bluetooth/configure.json
@@ -23,6 +23,11 @@
"label": "Linux Crypto API",
"type": "compile",
"test": "linux_crypto_api"
+ },
+ "winrt_bt": {
+ "label": "WinRT Bluetooth API",
+ "type": "compile",
+ "test": "winrt_bt"
}
},
@@ -41,6 +46,11 @@
"label": "Linux Crypto API",
"condition": "features.bluez_le && tests.linux_crypto_api",
"output": [ "privateFeature" ]
+ },
+ "winrt_bt": {
+ "label": "WinRT Bluetooth API (desktop & UWP)",
+ "condition": "config.win32 && tests.winrt_bt",
+ "output": [ "privateFeature" ]
}
},
@@ -64,7 +74,8 @@ Only classic Bluetooth will be available."
"entries": [
"bluez",
"bluez_le",
- "linux_crypto_api"
+ "linux_crypto_api",
+ "winrt_bt"
]
}
]
diff --git a/src/bluetooth/osx/osxbtcentralmanager.mm b/src/bluetooth/osx/osxbtcentralmanager.mm
index ec046d1b..70473f1f 100644
--- a/src/bluetooth/osx/osxbtcentralmanager.mm
+++ b/src/bluetooth/osx/osxbtcentralmanager.mm
@@ -48,8 +48,6 @@
#include <algorithm>
#include <limits>
-Q_DECLARE_METATYPE(QLowEnergyCharacteristic)
-Q_DECLARE_METATYPE(QLowEnergyDescriptor)
Q_DECLARE_METATYPE(QLowEnergyHandle)
QT_BEGIN_NAMESPACE
diff --git a/src/bluetooth/osx/osxbtutility_p.h b/src/bluetooth/osx/osxbtutility_p.h
index 5ded5e7f..3312af12 100644
--- a/src/bluetooth/osx/osxbtutility_p.h
+++ b/src/bluetooth/osx/osxbtutility_p.h
@@ -314,4 +314,23 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_OSX)
QT_END_NAMESPACE
+#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) && QT_MACOS_DEPLOYMENT_TARGET_BELOW(101300)
+
+ // In the macOS 10.13 SDK, the identifier property was moved from the CBPeripheral
+ // and CBCentral classes to a new CBPeer base class. Because CBPeer is only available
+ // on macOS 10.13 and above, the same is true for -[CBPeer identifier]. However,
+ // since we know that the derived classes have always had this property,
+ // we'll explicitly mark its availability here. This will not adversely affect
+ // using the identifier through the CBPeer base class, which will still require macOS 10.13.
+
+@interface CBPeripheral (UnguardedWorkaround)
+@property (readonly, nonatomic) NSUUID *identifier NS_AVAILABLE(10_7, 5_0);
+@end
+
+@interface CBCentral (UnguardedWorkaround)
+@property (readonly, nonatomic) NSUUID *identifier NS_AVAILABLE(10_7, 5_0);
+@end
+
+#endif
+
#endif
diff --git a/src/bluetooth/qbluetooth.h b/src/bluetooth/qbluetooth.h
index 82136eca..df763147 100644
--- a/src/bluetooth/qbluetooth.h
+++ b/src/bluetooth/qbluetooth.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTH_H
#define QBLUETOOTH_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/bluetooth/qbluetoothaddress.h b/src/bluetooth/qbluetoothaddress.h
index de2d4240..e3750d21 100644
--- a/src/bluetooth/qbluetoothaddress.h
+++ b/src/bluetooth/qbluetoothaddress.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHADDRESS_H
#define QBLUETOOTHADDRESS_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/QByteArray>
#include <QtCore/QString>
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
index 02ea30d1..5f142f1a 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent.cpp
@@ -333,13 +333,19 @@ void QBluetoothDeviceDiscoveryAgent::start()
}
/*!
- Start Bluetooth device discovery, if it is not already started and the provided
+ Starts Bluetooth device discovery, if it is not already started and the provided
\a methods are supported.
The discovery \a methods limit the scope of the device search.
For example, if the target service or device is a Bluetooth Low Energy device,
this function could be used to limit the search to Bluetooth Low Energy devices and
thereby reduces the discovery time significantly.
+ \note \a methods only determines the type of discovery and does not imply
+ the filtering of the results. For example, the search may still contain classic bluetooth devices
+ despite \a methods being set to \l {QBluetoothDeviceDiscoveryAgent::LowEnergyMethod}
+ {LowEnergyMethod} only. This may happen due to previously cached search results
+ which may be incorporated into the search results.
+
\since 5.8
*/
void QBluetoothDeviceDiscoveryAgent::start(DiscoveryMethods methods)
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.h b/src/bluetooth/qbluetoothdevicediscoveryagent.h
index 17827656..62050282 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent.h
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHDEVICEDISCOVERYAGENT_H
#define QBLUETOOTHDEVICEDISCOVERYAGENT_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/QObject>
#include <QtBluetooth/QBluetoothDeviceInfo>
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
index 7e8e4236..303dd67f 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
@@ -165,7 +165,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
{
qCWarning(QT_BT_ANDROID) << "Search not possible due to missing permission (ACCESS_COARSE_LOCATION)";
lastError = QBluetoothDeviceDiscoveryAgent::UnknownError;
- errorString = QBluetoothDeviceDiscoveryAgent::tr("Missing Location permission. Search is not possible");
+ errorString = QBluetoothDeviceDiscoveryAgent::tr("Missing Location permission. Search is not possible.");
emit q->error(lastError);
return;
}
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
index 5c70f1c1..3cc3354a 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_bluez.cpp
@@ -125,7 +125,7 @@ QBluetoothDeviceDiscoveryAgent::DiscoveryMethods QBluetoothDeviceDiscoveryAgent:
return (ClassicMethod | LowEnergyMethod);
}
-void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods /*methods*/)
+void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods methods)
{
// Currently both BlueZ backends do not distinguish discovery methods.
// The DBus API's always return both device types. Therefore we ignore
@@ -139,7 +139,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
discoveredDevices.clear();
if (managerBluez5) {
- startBluez5();
+ startBluez5(methods);
return;
}
@@ -228,11 +228,10 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
}
}
-void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5()
+void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods methods)
{
Q_Q(QBluetoothDeviceDiscoveryAgent);
-
bool ok = false;
const QString adapterPath = findAdapterForAddress(m_adapterAddress, &ok);
if (!ok || adapterPath.isEmpty()) {
@@ -257,6 +256,33 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startBluez5()
return;
}
+ QVariantMap map;
+ if (methods == (QBluetoothDeviceDiscoveryAgent::LowEnergyMethod|QBluetoothDeviceDiscoveryAgent::ClassicMethod))
+ map.insert(QStringLiteral("Transport"), QStringLiteral("auto"));
+ else if (methods & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod)
+ map.insert(QStringLiteral("Transport"), QStringLiteral("le"));
+ else
+ map.insert(QStringLiteral("Transport"), QStringLiteral("bredr"));
+
+ // older BlueZ 5.x versions don't have this function
+ // filterReply returns UnknownMethod which we ignore
+ QDBusPendingReply<> filterReply = adapterBluez5->SetDiscoveryFilter(map);
+ filterReply.waitForFinished();
+ if (filterReply.isError()) {
+ if (filterReply.error().type() == QDBusError::Other
+ && filterReply.error().name() == QStringLiteral("org.bluez.Error.Failed")) {
+ qCDebug(QT_BT_BLUEZ) << "Discovery method" << methods << "not supported";
+ lastError = QBluetoothDeviceDiscoveryAgent::UnsupportedDiscoveryMethod;
+ errorString = QBluetoothDeviceDiscoveryAgent::tr("One or more device discovery methods "
+ "are not supported on this platform");
+ delete adapterBluez5;
+ adapterBluez5 = 0;
+ emit q->error(lastError);
+ return;
+ } else if (filterReply.error().type() != QDBusError::UnknownMethod) {
+ qCDebug(QT_BT_BLUEZ) << "SetDiscoveryFilter failed:" << filterReply.error();
+ }
+ }
QtBluezDiscoveryManager::instance()->registerDiscoveryInterest(adapterBluez5->path());
QObject::connect(QtBluezDiscoveryManager::instance(), SIGNAL(discoveryInterrupted(QString)),
@@ -403,18 +429,34 @@ void QBluetoothDeviceDiscoveryAgentPrivate::deviceFoundBluez5(const QString& dev
// read information
QBluetoothDeviceInfo deviceInfo(btAddress, btName, btClass);
-
- if (!btClass)
- deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::LowEnergyCoreConfiguration);
- else
- deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateCoreConfiguration);
-
deviceInfo.setRssi(device.rSSI());
+
QList<QBluetoothUuid> uuids;
- foreach (const QString &u, device.uUIDs())
- uuids.append(QBluetoothUuid(u));
+ bool foundLikelyLowEnergyUuid = false;
+ for (const auto &u: device.uUIDs()) {
+ const QBluetoothUuid id(u);
+ if (id.isNull())
+ continue;
+
+ if (!foundLikelyLowEnergyUuid) {
+ //once we found one BTLE service we are done
+ bool ok = false;
+ quint16 shortId = id.toUInt16(&ok);
+ if (ok && ((shortId & QBluetoothUuid::GenericAccess) == QBluetoothUuid::GenericAccess))
+ foundLikelyLowEnergyUuid = true;
+ }
+ uuids.append(id);
+ }
deviceInfo.setServiceUuids(uuids, QBluetoothDeviceInfo::DataIncomplete);
+ if (!btClass) {
+ deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::LowEnergyCoreConfiguration);
+ } else {
+ deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateCoreConfiguration);
+ if (foundLikelyLowEnergyUuid)
+ deviceInfo.setCoreConfigurations(QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration);
+ }
+
for (int i = 0; i < discoveredDevices.size(); i++) {
if (discoveredDevices[i].address() == deviceInfo.address()) {
if (discoveredDevices[i] == deviceInfo && lowEnergySearchTimeout > 0) {
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
index 44834024..243d7fd2 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
@@ -153,7 +153,7 @@ private:
QList<OrgFreedesktopDBusPropertiesInterface *> propertyMonitors;
void deviceFoundBluez5(const QString& devicePath);
- void startBluez5();
+ void startBluez5(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods methods);
bool useExtendedDiscovery;
QTimer extendedDiscoveryTimer;
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
index 17726660..6786ac54 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
@@ -41,6 +41,10 @@
#include "qbluetoothdevicediscoveryagent_p.h"
#include "qbluetoothaddress.h"
#include "qbluetoothuuid.h"
+
+#ifdef CLASSIC_APP_BUILD
+#define Q_OS_WINRT
+#endif
#include "qfunctions_winrt.h"
#include <QtCore/QLoggingCategory>
@@ -129,6 +133,9 @@ QWinRTBluetoothDeviceDiscoveryWorker::QWinRTBluetoothDeviceDiscoveryWorker(QBlue
{
qRegisterMetaType<QBluetoothDeviceInfo>();
+#ifdef CLASSIC_APP_BUILD
+ CoInitialize(NULL);
+#endif
HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Bluetooth_BluetoothDevice).Get(), &m_deviceStatics);
Q_ASSERT_SUCCEEDED(hr);
hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Bluetooth_BluetoothLEDevice).Get(), &m_leDeviceStatics);
@@ -138,6 +145,9 @@ QWinRTBluetoothDeviceDiscoveryWorker::QWinRTBluetoothDeviceDiscoveryWorker(QBlue
QWinRTBluetoothDeviceDiscoveryWorker::~QWinRTBluetoothDeviceDiscoveryWorker()
{
stop();
+#ifdef CLASSIC_APP_BUILD
+ CoUninitialize();
+#endif
}
void QWinRTBluetoothDeviceDiscoveryWorker::start()
diff --git a/src/bluetooth/qbluetoothdeviceinfo.h b/src/bluetooth/qbluetoothdeviceinfo.h
index 751c8384..33cd40b7 100644
--- a/src/bluetooth/qbluetoothdeviceinfo.h
+++ b/src/bluetooth/qbluetoothdeviceinfo.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHDEVICEINFO_H
#define QBLUETOOTHDEVICEINFO_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/qstring.h>
#include <QtCore/qmetatype.h>
@@ -189,6 +189,7 @@ public:
};
Q_DECLARE_FLAGS(ServiceClasses, ServiceClass)
+ //TODO Qt6 Remove DataCompleteness -> it serves no purpose
enum DataCompleteness {
DataComplete,
DataIncomplete,
diff --git a/src/bluetooth/qbluetoothhostinfo.h b/src/bluetooth/qbluetoothhostinfo.h
index e92bdb5c..42dfcaab 100644
--- a/src/bluetooth/qbluetoothhostinfo.h
+++ b/src/bluetooth/qbluetoothhostinfo.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHHOSTINFO_H
#define QBLUETOOTHHOSTINFO_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtBluetooth/QBluetoothAddress>
QT_BEGIN_NAMESPACE
diff --git a/src/bluetooth/qbluetoothlocaldevice.h b/src/bluetooth/qbluetoothlocaldevice.h
index 49de25ae..9363a116 100644
--- a/src/bluetooth/qbluetoothlocaldevice.h
+++ b/src/bluetooth/qbluetoothlocaldevice.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHLOCALDEVICE_H
#define QBLUETOOTHLOCALDEVICE_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/QObject>
#include <QtCore/QList>
diff --git a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
index c8c5ffbf..0982573e 100644
--- a/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_bluez.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include <QtCore/QLoggingCategory>
+#include <QtCore/QRandomGenerator>
#include <QtDBus/QDBusContext>
#include "qbluetoothlocaldevice.h"
@@ -798,9 +799,8 @@ void QBluetoothLocalDevicePrivate::initializeAdapter()
connect(adapter, SIGNAL(PropertyChanged(QString, QDBusVariant)),
SLOT(PropertyChanged(QString, QDBusVariant)));
- qsrand(QTime::currentTime().msec());
agent_path = agentPath;
- agent_path.append(QString::fromLatin1("/%1").arg(qrand()));
+ agent_path.append(QString::fromLatin1("/%1").arg(QRandomGenerator::get32()));
}
}
@@ -1164,7 +1164,7 @@ QString QBluetoothLocalDevicePrivate::RequestPinCode(const QDBusObjectPath &in0)
Q_Q(QBluetoothLocalDevice);
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO << in0.path();
// seeded in constructor, 6 digit pin
- QString pin = QString::fromLatin1("%1").arg(qrand() % 1000000);
+ QString pin = QString::fromLatin1("%1").arg(QRandomGenerator::bounded(1000000));
pin = QString::fromLatin1("%1").arg(pin, 6, QLatin1Char('0'));
emit q->pairingDisplayPinCode(address, pin);
@@ -1276,7 +1276,7 @@ uint QBluetoothLocalDevicePrivate::RequestPasskey(const QDBusObjectPath &in0)
{
Q_UNUSED(in0);
qCDebug(QT_BT_BLUEZ) << Q_FUNC_INFO;
- return (qrand() % 1000000);
+ return (QRandomGenerator::bounded(1000000));
}
// Bluez 4
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h
index acd88083..a52b683c 100644
--- a/src/bluetooth/qbluetoothlocaldevice_p.h
+++ b/src/bluetooth/qbluetoothlocaldevice_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include "qbluetoothlocaldevice.h"
diff --git a/src/bluetooth/qbluetoothserver.h b/src/bluetooth/qbluetoothserver.h
index 568ca3d9..e6e4a68f 100644
--- a/src/bluetooth/qbluetoothserver.h
+++ b/src/bluetooth/qbluetoothserver.h
@@ -41,7 +41,7 @@
#ifndef QBLUETOOTHSERVER_H
#define QBLUETOOTHSERVER_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/QObject>
diff --git a/src/bluetooth/qbluetoothserver_winrt.cpp b/src/bluetooth/qbluetoothserver_winrt.cpp
index ddd71c21..08aa45b4 100644
--- a/src/bluetooth/qbluetoothserver_winrt.cpp
+++ b/src/bluetooth/qbluetoothserver_winrt.cpp
@@ -44,6 +44,9 @@
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qeventdispatcher_winrt_p.h>
+#ifdef CLASSIC_APP_BUILD
+#define Q_OS_WINRT
+#endif
#include <qfunctions_winrt.h>
#include <windows.networking.h>
@@ -70,6 +73,9 @@ QHash<QBluetoothServerPrivate *, int> __fakeServerPorts;
QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol sType)
: maxPendingConnections(1), serverType(sType), m_lastError(QBluetoothServer::NoError), socket(0)
{
+#ifdef CLASSIC_APP_BUILD
+ CoInitialize(NULL);
+#endif
socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
}
@@ -79,6 +85,12 @@ QBluetoothServerPrivate::~QBluetoothServerPrivate()
__fakeServerPorts.remove(this);
if (socket)
delete socket;
+#ifdef CLASSIC_APP_BUILD
+ // If we do not reset that pointer, socketListener will go out of scope after CoUninitialize was
+ // called, which will lead to a crash.
+ socketListener = nullptr;
+ CoUninitialize();
+#endif
}
bool QBluetoothServerPrivate::isListening() const
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.h b/src/bluetooth/qbluetoothservicediscoveryagent.h
index ba0b91b8..12df37a8 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.h
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHSERVICEDISCOVERYAGENT_H
#define QBLUETOOTHSERVICEDISCOVERYAGENT_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/QObject>
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
index 29ccb290..77310d01 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
@@ -40,6 +40,9 @@
#include "qbluetoothservicediscoveryagent.h"
#include "qbluetoothservicediscoveryagent_p.h"
+#ifdef CLASSIC_APP_BUILD
+#define Q_OS_WINRT
+#endif
#include <qfunctions_winrt.h>
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qeventdispatcher_winrt_p.h>
diff --git a/src/bluetooth/qbluetoothserviceinfo.h b/src/bluetooth/qbluetoothserviceinfo.h
index 38cddfb6..cc4041e2 100644
--- a/src/bluetooth/qbluetoothserviceinfo.h
+++ b/src/bluetooth/qbluetoothserviceinfo.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHSERVICEINFO_H
#define QBLUETOOTHSERVICEINFO_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtBluetooth/QBluetoothUuid>
#include <QtBluetooth/QBluetoothAddress>
diff --git a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
index d72056b7..975a3f4a 100644
--- a/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
+++ b/src/bluetooth/qbluetoothserviceinfo_winrt.cpp
@@ -42,6 +42,9 @@
#include "qbluetoothserver_p.h"
#include <QtCore/QLoggingCategory>
+#ifdef CLASSIC_APP_BUILD
+#define Q_OS_WINRT
+#endif
#include <qfunctions_winrt.h>
#include <wrl.h>
diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp
index 2f38ed04..a35863b4 100644
--- a/src/bluetooth/qbluetoothsocket.cpp
+++ b/src/bluetooth/qbluetoothsocket.cpp
@@ -112,6 +112,8 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT)
supported on this platform.
\value OperationError An operation was attempted while the socket was in a state
that did not permit it.
+ \value RemoteHostClosedError The remote host closed the connection. This value was
+ introduced by Qt 5.10.
*/
/*!
@@ -854,12 +856,18 @@ QDebug operator<<(QDebug debug, QBluetoothSocket::SocketError error)
case QBluetoothSocket::HostNotFoundError:
debug << "QBluetoothSocket::HostNotFoundError";
break;
+ case QBluetoothSocket::RemoteHostClosedError:
+ debug << "QBluetoothSocket::RemoteHostClosedError";
+ break;
case QBluetoothSocket::ServiceNotFoundError:
debug << "QBluetoothSocket::ServiceNotFoundError";
break;
case QBluetoothSocket::NetworkError:
debug << "QBluetoothSocket::NetworkError";
break;
+ case QBluetoothSocket::UnsupportedProtocolError:
+ debug << "QBluetoothSocket::UnsupportedProtocolError";
+ break;
default:
debug << "QBluetoothSocket::SocketError(" << (int)error << ")";
}
diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h
index 97b6685b..bbcecbf4 100644
--- a/src/bluetooth/qbluetoothsocket.h
+++ b/src/bluetooth/qbluetoothsocket.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHSOCKET_H
#define QBLUETOOTHSOCKET_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtBluetooth/qbluetooth.h>
#include <QtBluetooth/qbluetoothaddress.h>
@@ -79,6 +79,7 @@ public:
enum SocketError {
NoSocketError = -2,
UnknownSocketError = QAbstractSocket::UnknownSocketError, //-1
+ RemoteHostClosedError = QAbstractSocket::RemoteHostClosedError, //1
HostNotFoundError = QAbstractSocket::HostNotFoundError, //2
ServiceNotFoundError = QAbstractSocket::SocketAddressNotAvailableError, //9
NetworkError = QAbstractSocket::NetworkError, //7
diff --git a/src/bluetooth/qbluetoothsocket_bluez.cpp b/src/bluetooth/qbluetoothsocket_bluez.cpp
index 6aef811a..17b8e738 100644
--- a/src/bluetooth/qbluetoothsocket_bluez.cpp
+++ b/src/bluetooth/qbluetoothsocket_bluez.cpp
@@ -290,7 +290,9 @@ void QBluetoothSocketPrivate::_q_readNotify()
qCWarning(QT_BT_BLUEZ) << Q_FUNC_INFO << socket << "error:" << readFromDevice << errorString;
if (errsv == EHOSTDOWN)
q->setSocketError(QBluetoothSocket::HostNotFoundError);
- else if (errsv != ECONNRESET) // The other side closing the connection is not an error.
+ else if (errsv == ECONNRESET)
+ q->setSocketError(QBluetoothSocket::RemoteHostClosedError);
+ else
q->setSocketError(QBluetoothSocket::UnknownSocketError);
q->disconnectFromService();
diff --git a/src/bluetooth/qbluetoothsocket_osx.mm b/src/bluetooth/qbluetoothsocket_osx.mm
index 59fb66f2..1bbc660e 100644
--- a/src/bluetooth/qbluetoothsocket_osx.mm
+++ b/src/bluetooth/qbluetoothsocket_osx.mm
@@ -769,12 +769,18 @@ QDebug operator<<(QDebug debug, QBluetoothSocket::SocketError error)
case QBluetoothSocket::HostNotFoundError:
debug << "QBluetoothSocket::HostNotFoundError";
break;
+ case QBluetoothSocket::RemoteHostClosedError:
+ debug << "QBluetoothSocket::RemoteHostClosedError";
+ break;
case QBluetoothSocket::ServiceNotFoundError:
debug << "QBluetoothSocket::ServiceNotFoundError";
break;
case QBluetoothSocket::NetworkError:
debug << "QBluetoothSocket::NetworkError";
break;
+ case QBluetoothSocket::UnsupportedProtocolError:
+ debug << "QBluetoothSocket::UnsupportedProtocolError";
+ break;
default:
debug << "QBluetoothSocket::SocketError(" << (int)error << ")";
}
diff --git a/src/bluetooth/qbluetoothsocket_winrt.cpp b/src/bluetooth/qbluetoothsocket_winrt.cpp
index 501ffd74..ec511974 100644
--- a/src/bluetooth/qbluetoothsocket_winrt.cpp
+++ b/src/bluetooth/qbluetoothsocket_winrt.cpp
@@ -40,6 +40,9 @@
#include "qbluetoothsocket.h"
#include "qbluetoothsocket_p.h"
+#ifdef CLASSIC_APP_BUILD
+#define Q_OS_WINRT
+#endif
#include <qfunctions_winrt.h>
#include <private/qeventdispatcher_winrt_p.h>
@@ -223,7 +226,7 @@ public:
// the closing of the socket won't be communicated to the caller. So only the error is set. The
// actual socket close happens inside of read.
if (!bufferLength) {
- emit socketErrorOccured(QBluetoothSocket::NetworkError);
+ emit socketErrorOccured(QBluetoothSocket::RemoteHostClosedError);
return S_OK;
}
@@ -609,6 +612,9 @@ void QBluetoothSocketPrivate::handleError(QBluetoothSocket::SocketError error)
case QBluetoothSocket::NetworkError:
errorString = QBluetoothSocket::tr("Network error");
break;
+ case QBluetoothSocket::RemoteHostClosedError:
+ errorString = QBluetoothSocket::tr("Remote host closed connection");
+ break;
default:
errorString = QBluetoothSocket::tr("Unknown socket error");
}
diff --git a/src/bluetooth/qbluetoothtransfermanager.h b/src/bluetooth/qbluetoothtransfermanager.h
index d1171588..756fe54f 100644
--- a/src/bluetooth/qbluetoothtransfermanager.h
+++ b/src/bluetooth/qbluetoothtransfermanager.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHTRANSFERMANAGER_H
#define QBLUETOOTHTRANSFERMANAGER_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtBluetooth/QBluetoothAddress>
#include <QtCore/QObject>
diff --git a/src/bluetooth/qbluetoothtransferrequest.h b/src/bluetooth/qbluetoothtransferrequest.h
index 006f1ced..5485a0d9 100644
--- a/src/bluetooth/qbluetoothtransferrequest.h
+++ b/src/bluetooth/qbluetoothtransferrequest.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHTRANSFERREQUEST_H
#define QBLUETOOTHTRANSFERREQUEST_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtBluetooth/QBluetoothAddress>
#include <QtCore/QtGlobal>
diff --git a/src/bluetooth/qbluetoothtransferrequest_p.h b/src/bluetooth/qbluetoothtransferrequest_p.h
index d8b2e55d..410a9709 100644
--- a/src/bluetooth/qbluetoothtransferrequest_p.h
+++ b/src/bluetooth/qbluetoothtransferrequest_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include "qbluetoothtransferrequest.h"
QT_BEGIN_NAMESPACE
diff --git a/src/bluetooth/qbluetoothutils_win.cpp b/src/bluetooth/qbluetoothutils_win.cpp
new file mode 100644
index 00000000..fa3127cb
--- /dev/null
+++ b/src/bluetooth/qbluetoothutils_win.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtBluetooth module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/private/qeventdispatcher_winrt_p.h>
+
+#define Q_OS_WINRT
+#include <QtCore/qfunctions_winrt.h>
+
+#include <wrl.h>
+#include <windows.devices.bluetooth.h>
+
+using namespace Microsoft::WRL;
+using namespace Microsoft::WRL::Wrappers;
+using namespace ABI::Windows::Devices::Bluetooth;
+using namespace ABI::Windows::Foundation;
+
+QT_BEGIN_NAMESPACE
+
+#pragma warning (push)
+#pragma warning (disable: 4273)
+HRESULT QEventDispatcherWinRT::runOnXamlThread(const std::function<HRESULT()> &delegate, bool waitForRun)
+{
+ Q_UNUSED(waitForRun)
+ return delegate();
+}
+#pragma warning (pop)
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID)
+{
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH: {
+ // Check if we are running on a recent enough Windows
+ HRESULT hr = OleInitialize(NULL);
+ if (FAILED(hr)) {
+ MessageBox(NULL, (LPCWSTR)L"OleInitialize failed.", (LPCWSTR)L"Error", MB_OK | MB_ICONERROR | MB_APPLMODAL);
+ exit(-1);
+ }
+ ComPtr<IBluetoothDeviceStatics> deviceStatics;
+ hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Devices_Bluetooth_BluetoothDevice).Get(), &deviceStatics);
+ if (hr == REGDB_E_CLASSNOTREG) {
+ QString error ("This Windows version (" + QSysInfo::kernelVersion() + ") does not "
+ "support the required Bluetooth API. Consider updating to a more recent Windows "
+ "(10.0.10586 or above).");
+ MessageBox(NULL, (LPCWSTR)error.constData(), (LPCWSTR)L"Error", MB_OK | MB_ICONERROR | MB_APPLMODAL);
+ CoUninitialize();
+ exit(-1);
+ }
+ break;
+ }
+ case DLL_PROCESS_DETACH:
+ CoUninitialize();
+ }
+
+ return TRUE;
+}
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qbluetoothuuid.h b/src/bluetooth/qbluetoothuuid.h
index fb301c37..2a2ce138 100644
--- a/src/bluetooth/qbluetoothuuid.h
+++ b/src/bluetooth/qbluetoothuuid.h
@@ -40,7 +40,7 @@
#ifndef QBLUETOOTHUUID_H
#define QBLUETOOTHUUID_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/QtGlobal>
#include <QtCore/QMetaType>
diff --git a/src/bluetooth/qlowenergyadvertisingdata.h b/src/bluetooth/qlowenergyadvertisingdata.h
index 904c5c2b..0fc55adb 100644
--- a/src/bluetooth/qlowenergyadvertisingdata.h
+++ b/src/bluetooth/qlowenergyadvertisingdata.h
@@ -40,7 +40,7 @@
#ifndef QLOWENERGYADVERTISINGDATA_H
#define QLOWENERGYADVERTISINGDATA_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtBluetooth/qbluetoothuuid.h>
#include <QtCore/qshareddata.h>
diff --git a/src/bluetooth/qlowenergyadvertisingparameters.h b/src/bluetooth/qlowenergyadvertisingparameters.h
index 547e5798..055026e6 100644
--- a/src/bluetooth/qlowenergyadvertisingparameters.h
+++ b/src/bluetooth/qlowenergyadvertisingparameters.h
@@ -40,7 +40,7 @@
#ifndef QLOWENERGYADVERTISINGPARAMETERS_H
#define QLOWENERGYADVERTISINGPARAMETERS_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtBluetooth/qbluetoothaddress.h>
#include <QtBluetooth/qlowenergycontroller.h>
#include <QtCore/qlist.h>
diff --git a/src/bluetooth/qlowenergycharacteristic.h b/src/bluetooth/qlowenergycharacteristic.h
index b991e9a2..154c9936 100644
--- a/src/bluetooth/qlowenergycharacteristic.h
+++ b/src/bluetooth/qlowenergycharacteristic.h
@@ -107,4 +107,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QLowEnergyCharacteristic::PropertyTypes)
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QLowEnergyCharacteristic)
+
#endif // QLOWENERGYCHARACTERISTIC_H
diff --git a/src/bluetooth/qlowenergyconnectionparameters.h b/src/bluetooth/qlowenergyconnectionparameters.h
index 9a3896c3..c765763f 100644
--- a/src/bluetooth/qlowenergyconnectionparameters.h
+++ b/src/bluetooth/qlowenergyconnectionparameters.h
@@ -40,7 +40,7 @@
#ifndef QLOWENERGYCONNECTIONPARAMETERS_H
#define QLOWENERGYCONNECTIONPARAMETERS_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qshareddata.h>
diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp
index 053ca980..004ee3be 100644
--- a/src/bluetooth/qlowenergycontroller.cpp
+++ b/src/bluetooth/qlowenergycontroller.cpp
@@ -138,6 +138,8 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT)
This value was introduced by Qt 5.5.
\value AdvertisingError The attempt to start advertising failed.
This value was introduced by Qt 5.7.
+ \value RemoteHostClosedError The remote device closed the connection.
+ This value was introduced by Qt 5.10.
*/
/*!
@@ -299,6 +301,9 @@ void QLowEnergyControllerPrivate::setError(
case QLowEnergyController::AdvertisingError:
errorString = QLowEnergyController::tr("Error occurred trying to start advertising");
break;
+ case QLowEnergyController::RemoteHostClosedError:
+ errorString = QLowEnergyController::tr("Remote device closed the connection");
+ break;
case QLowEnergyController::NoError:
return;
default:
diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h
index 1c4fa83f..1a84b05b 100644
--- a/src/bluetooth/qlowenergycontroller.h
+++ b/src/bluetooth/qlowenergycontroller.h
@@ -66,6 +66,7 @@ public:
InvalidBluetoothAdapterError,
ConnectionError,
AdvertisingError,
+ RemoteHostClosedError
};
Q_ENUM(Error)
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp
index 0744bcc4..ca3f7760 100644
--- a/src/bluetooth/qlowenergycontroller_bluez.cpp
+++ b/src/bluetooth/qlowenergycontroller_bluez.cpp
@@ -648,9 +648,9 @@ void QLowEnergyControllerPrivate::establishL2cpClientSocket()
void QLowEnergyControllerPrivate::createServicesForCentralIfRequired()
{
- //only enable when requested
- //for now we use env variable to activate the feature
- if (Q_LIKELY(!qEnvironmentVariableIsSet("QT_DEFAULT_CENTRAL_SERVICES")))
+ bool ok = false;
+ int value = qEnvironmentVariableIntValue("QT_DEFAULT_CENTRAL_SERVICES", &ok);
+ if (Q_UNLIKELY(ok && value == 0))
return; //nothing to do
//do not add the services each time we start a connection
@@ -753,6 +753,10 @@ void QLowEnergyControllerPrivate::l2cpErrorChanged(QBluetoothSocket::SocketError
setError(QLowEnergyController::NetworkError);
qCDebug(QT_BT_BLUEZ) << "Network IO error while talking to LE device";
break;
+ case QBluetoothSocket::RemoteHostClosedError:
+ setError(QLowEnergyController::RemoteHostClosedError);
+ qCDebug(QT_BT_BLUEZ) << "Remote host closed the connection";
+ break;
case QBluetoothSocket::UnknownSocketError:
case QBluetoothSocket::UnsupportedProtocolError:
case QBluetoothSocket::OperationError:
diff --git a/src/bluetooth/qlowenergycontroller_p.h b/src/bluetooth/qlowenergycontroller_p.h
index b92716e9..6e866144 100644
--- a/src/bluetooth/qlowenergycontroller_p.h
+++ b/src/bluetooth/qlowenergycontroller_p.h
@@ -497,11 +497,6 @@ Q_DECLARE_TYPEINFO(QLowEnergyControllerPrivate::Attribute, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
-#ifdef QT_WINRT_BLUETOOTH
-Q_DECLARE_METATYPE(QLowEnergyCharacteristic)
-Q_DECLARE_METATYPE(QLowEnergyDescriptor)
-#endif // QT_WINRT_BLUETOOTH
-
#endif // QT_OSX_BLUETOOTH || QT_IOS_BLUETOOTH
#endif // QLOWENERGYCONTROLLERPRIVATE_P_H
diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp
index d6fc4952..62b8a9d3 100644
--- a/src/bluetooth/qlowenergycontroller_winrt.cpp
+++ b/src/bluetooth/qlowenergycontroller_winrt.cpp
@@ -39,6 +39,9 @@
#include "qlowenergycontroller_p.h"
+#ifdef CLASSIC_APP_BUILD
+#define Q_OS_WINRT
+#endif
#include <QtCore/qfunctions_winrt.h>
#include <QtCore/QLoggingCategory>
#include <private/qeventdispatcher_winrt_p.h>
@@ -338,6 +341,7 @@ void QLowEnergyControllerPrivate::connectToDevice()
emit q->connected();
} else if (state == QLowEnergyController::ConnectedState
&& status == BluetoothConnectionStatus::BluetoothConnectionStatus_Disconnected) {
+ setError(QLowEnergyController::RemoteHostClosedError);
setState(QLowEnergyController::UnconnectedState);
emit q->disconnected();
}
@@ -419,6 +423,10 @@ void QLowEnergyControllerPrivate::disconnectFromDevice()
Q_Q(QLowEnergyController);
setState(QLowEnergyController::UnconnectedState);
emit q->disconnected();
+ if (mDevice && mStatusChangedToken.value) {
+ mDevice->remove_ConnectionStatusChanged(mStatusChangedToken);
+ mStatusChangedToken.value = 0;
+ }
}
ComPtr<IGattDeviceService> QLowEnergyControllerPrivate::getNativeService(const QBluetoothUuid &serviceUuid)
diff --git a/src/bluetooth/qlowenergydescriptor.h b/src/bluetooth/qlowenergydescriptor.h
index 1dfe1c35..9e71fc56 100644
--- a/src/bluetooth/qlowenergydescriptor.h
+++ b/src/bluetooth/qlowenergydescriptor.h
@@ -89,4 +89,6 @@ protected:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QLowEnergyDescriptor)
+
#endif // QLOWENERGYDESCRIPTOR_H
diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp
index 6e33c565..9d3129fd 100644
--- a/src/bluetooth/qlowenergyservice.cpp
+++ b/src/bluetooth/qlowenergyservice.cpp
@@ -380,6 +380,8 @@ QLowEnergyService::QLowEnergyService(QSharedPointer<QLowEnergyServicePrivate> p,
qRegisterMetaType<QLowEnergyService::ServiceError>();
qRegisterMetaType<QLowEnergyService::ServiceType>();
qRegisterMetaType<QLowEnergyService::WriteMode>();
+ qRegisterMetaType<QLowEnergyCharacteristic>();
+ qRegisterMetaType<QLowEnergyDescriptor>();
connect(p.data(), SIGNAL(error(QLowEnergyService::ServiceError)),
this, SIGNAL(error(QLowEnergyService::ServiceError)));
diff --git a/src/bluetooth/qlowenergyservicedata.h b/src/bluetooth/qlowenergyservicedata.h
index 48f7fe89..4d553267 100644
--- a/src/bluetooth/qlowenergyservicedata.h
+++ b/src/bluetooth/qlowenergyservicedata.h
@@ -40,7 +40,7 @@
#ifndef QLOWENERGYSERVICEDATA_H
#define QLOWENERGYSERVICEDATA_H
-#include <QtBluetooth/qbluetoothglobal.h>
+#include <QtBluetooth/qtbluetoothglobal.h>
#include <QtCore/qshareddata.h>
QT_BEGIN_NAMESPACE
diff --git a/src/bluetooth/qbluetoothglobal.h b/src/bluetooth/qtbluetoothglobal.h
index 45867e94..40b6d3d2 100644
--- a/src/bluetooth/qbluetoothglobal.h
+++ b/src/bluetooth/qtbluetoothglobal.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtBluetooth module of the Qt Toolkit.
diff --git a/src/bluetooth/qtbluetoothglobal_p.h b/src/bluetooth/qtbluetoothglobal_p.h
new file mode 100644
index 00000000..ffbfc4fe
--- /dev/null
+++ b/src/bluetooth/qtbluetoothglobal_p.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWidgets module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTBLUETOOTHGLOBAL_P_H
+#define QTBLUETOOTHGLOBAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qglobal_p.h>
+
+#include <QtBluetooth/qtbluetoothglobal.h>
+#include <QtBluetooth/private/qtbluetooth-config_p.h>
+
+#endif // QTBLUETOOTHGLOBAL_P_H
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
index a3cfdcf2..0aa134f5 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
@@ -60,7 +60,7 @@
#include <qbluetoothservicediscoveryagent.h>
#include <qbluetoothdevicediscoveryagent.h>
-#include <qbluetoothglobal.h>
+#include <qtbluetoothglobal.h>
#include "qdeclarativebluetoothservice_p.h"
diff --git a/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp b/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp
index 7dbb1556..0d5a5eae 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp
+++ b/src/imports/bluetooth/qdeclarativebluetoothsocket.cpp
@@ -244,6 +244,7 @@ void QDeclarativeBluetoothSocket::setConnected(bool connected)
\li \c{ServiceNotFoundError}
\li \c{NetworkError}
\li \c{UnsupportedProtocolError}
+ \li \c{RemoteHostClosedError}
\endlist
The errors are derived from \l QBluetoothSocket::SocketError. This property is read-only.
diff --git a/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h b/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h
index faa2c29c..e5092d2c 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h
+++ b/src/imports/bluetooth/qdeclarativebluetoothsocket_p.h
@@ -78,6 +78,7 @@ public:
enum Error {
NoError = QBluetoothSocket::NoSocketError,
UnknownSocketError = QBluetoothSocket::UnknownSocketError,
+ RemoteHostClosedError = QBluetoothSocket::RemoteHostClosedError,
HostNotFoundError = QBluetoothSocket::HostNotFoundError,
ServiceNotFoundError = QBluetoothSocket::ServiceNotFoundError,
NetworkError = QBluetoothSocket::NetworkError,
diff --git a/src/nfc/nfc.pro b/src/nfc/nfc.pro
index d3053115..5282170e 100644
--- a/src/nfc/nfc.pro
+++ b/src/nfc/nfc.pro
@@ -5,7 +5,7 @@ QMAKE_DOCS = $$PWD/doc/qtnfc.qdocconf
OTHER_FILES += doc/src/*.qdoc # show .qdoc files in Qt Creator
PUBLIC_HEADERS += \
- qnfcglobal.h \
+ qtnfcglobal.h \
qnearfieldmanager.h \
qnearfieldtarget.h \
qndefrecord.h \
@@ -19,6 +19,7 @@ PUBLIC_HEADERS += \
qnearfieldsharetarget.h
PRIVATE_HEADERS += \
+ qtnfcglobal_p.h \
qllcpsocket_p.h \
qllcpserver_p.h \
qndefrecord_p.h \
diff --git a/src/nfc/qllcpserver_p.h b/src/nfc/qllcpserver_p.h
index 5ff7b760..33ab6f1b 100644
--- a/src/nfc/qllcpserver_p.h
+++ b/src/nfc/qllcpserver_p.h
@@ -52,7 +52,7 @@
//
#include <QtCore/QObject>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
#include "qllcpsocket_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/nfc/qllcpserver_p_p.h b/src/nfc/qllcpserver_p_p.h
index bd354d2b..62cfa953 100644
--- a/src/nfc/qllcpserver_p_p.h
+++ b/src/nfc/qllcpserver_p_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qnfcglobal.h"
+#include "qtnfcglobal.h"
#include "qllcpserver_p.h"
diff --git a/src/nfc/qllcpsocket_p.h b/src/nfc/qllcpsocket_p.h
index 18c3bf17..442367c6 100644
--- a/src/nfc/qllcpsocket_p.h
+++ b/src/nfc/qllcpsocket_p.h
@@ -53,7 +53,7 @@
#include <QtCore/QIODevice>
#include <QtNetwork/QAbstractSocket>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/nfc/qllcpsocket_p_p.h b/src/nfc/qllcpsocket_p_p.h
index a15adcfe..9a747502 100644
--- a/src/nfc/qllcpsocket_p_p.h
+++ b/src/nfc/qllcpsocket_p_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qnfcglobal.h"
+#include "qtnfcglobal.h"
#include "qllcpsocket_p.h"
diff --git a/src/nfc/qndeffilter.h b/src/nfc/qndeffilter.h
index c1eaafd5..26327067 100644
--- a/src/nfc/qndeffilter.h
+++ b/src/nfc/qndeffilter.h
@@ -41,7 +41,7 @@
#define QNDEFFILTER_H
#include <QtCore/QSharedDataPointer>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
#include <QtNfc/QNdefRecord>
QT_BEGIN_NAMESPACE
diff --git a/src/nfc/qndefmessage.h b/src/nfc/qndefmessage.h
index 9bd4485b..59dedaa8 100644
--- a/src/nfc/qndefmessage.h
+++ b/src/nfc/qndefmessage.h
@@ -44,7 +44,7 @@
#include <QtCore/QSet>
#include <QtCore/QList>
#include <QtCore/QMetaType>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
#include <QtNfc/QNdefRecord>
QT_BEGIN_NAMESPACE
diff --git a/src/nfc/qndefnfcsmartposterrecord.h b/src/nfc/qndefnfcsmartposterrecord.h
index cf1bc623..9b714d5d 100644
--- a/src/nfc/qndefnfcsmartposterrecord.h
+++ b/src/nfc/qndefnfcsmartposterrecord.h
@@ -41,7 +41,7 @@
#define QNDEFNFCSMARTPOSTERRECORD_H
#include <QtCore/QList>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
#include <QtNfc/QNdefRecord>
#include <QtNfc/qndefnfctextrecord.h>
#include <QtNfc/qndefnfcurirecord.h>
diff --git a/src/nfc/qndefnfctextrecord.h b/src/nfc/qndefnfctextrecord.h
index a7a3df42..72fc4878 100644
--- a/src/nfc/qndefnfctextrecord.h
+++ b/src/nfc/qndefnfctextrecord.h
@@ -40,7 +40,7 @@
#ifndef QNDEFNFCTEXTRECORD_H
#define QNDEFNFCTEXTRECORD_H
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
#include <QtNfc/QNdefRecord>
QT_BEGIN_NAMESPACE
diff --git a/src/nfc/qndefnfcurirecord.h b/src/nfc/qndefnfcurirecord.h
index 600f0f29..90a199a3 100644
--- a/src/nfc/qndefnfcurirecord.h
+++ b/src/nfc/qndefnfcurirecord.h
@@ -40,7 +40,7 @@
#ifndef QNDEFNFCURIRECORD_H
#define QNDEFNFCURIRECORD_H
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
#include <QtNfc/QNdefRecord>
QT_FORWARD_DECLARE_CLASS(QUrl)
diff --git a/src/nfc/qndefrecord.h b/src/nfc/qndefrecord.h
index 2fd997d6..6cb6ac8c 100644
--- a/src/nfc/qndefrecord.h
+++ b/src/nfc/qndefrecord.h
@@ -42,7 +42,7 @@
#include <QtCore/QSharedDataPointer>
#include <QtCore/QByteArray>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/nfc/qndefrecord_p.h b/src/nfc/qndefrecord_p.h
index 0a3d762d..89ce5d99 100644
--- a/src/nfc/qndefrecord_p.h
+++ b/src/nfc/qndefrecord_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qnfcglobal.h"
+#include "qtnfcglobal.h"
#include <QtCore/QSharedData>
#include <QtCore/QByteArray>
diff --git a/src/nfc/qnearfieldmanager.h b/src/nfc/qnearfieldmanager.h
index 2cf69823..8b0d92fa 100644
--- a/src/nfc/qnearfieldmanager.h
+++ b/src/nfc/qnearfieldmanager.h
@@ -41,7 +41,7 @@
#define QNEARFIELDMANAGER_H
#include <QtCore/QObject>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
#include <QtNfc/QNearFieldTarget>
#include <QtNfc/QNdefRecord>
#include <QtNfc/QNdefFilter>
diff --git a/src/nfc/qnearfieldmanager_p.h b/src/nfc/qnearfieldmanager_p.h
index 4cff375c..7e461da8 100644
--- a/src/nfc/qnearfieldmanager_p.h
+++ b/src/nfc/qnearfieldmanager_p.h
@@ -55,7 +55,7 @@
#include "qnearfieldtarget.h"
#include "qndefrecord.h"
-#include "qnfcglobal.h"
+#include "qtnfcglobal.h"
#include <QtCore/QObject>
diff --git a/src/nfc/qnearfieldsharemanager.h b/src/nfc/qnearfieldsharemanager.h
index 5b76b84b..45778df0 100644
--- a/src/nfc/qnearfieldsharemanager.h
+++ b/src/nfc/qnearfieldsharemanager.h
@@ -41,7 +41,7 @@
#define QNEARFIELDSHAREMANAGER_H
#include <QtCore/QObject>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/nfc/qnearfieldtarget.h b/src/nfc/qnearfieldtarget.h
index 641645c3..330164f5 100644
--- a/src/nfc/qnearfieldtarget.h
+++ b/src/nfc/qnearfieldtarget.h
@@ -45,7 +45,7 @@
#include <QtCore/QMetaType>
#include <QtCore/QObject>
#include <QtCore/QSharedDataPointer>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
QT_BEGIN_NAMESPACE
class QString;
diff --git a/src/nfc/qnearfieldtarget_p.h b/src/nfc/qnearfieldtarget_p.h
index 9cef2f55..9c1a2954 100644
--- a/src/nfc/qnearfieldtarget_p.h
+++ b/src/nfc/qnearfieldtarget_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qnfcglobal.h"
+#include "qtnfcglobal.h"
#include "qnearfieldtarget.h"
diff --git a/src/nfc/qnfc.cpp b/src/nfc/qnfc.cpp
index b754b8d7..56a4f4f3 100644
--- a/src/nfc/qnfc.cpp
+++ b/src/nfc/qnfc.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include <QtCore/QLoggingCategory>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
QT_BEGIN_NAMESPACE
diff --git a/src/nfc/qtlv_p.h b/src/nfc/qtlv_p.h
index 43e78c5c..1a4c6def 100644
--- a/src/nfc/qtlv_p.h
+++ b/src/nfc/qtlv_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include "qnfcglobal.h"
+#include "qtnfcglobal.h"
#include "qnearfieldtarget.h"
diff --git a/src/nfc/qnfcglobal.h b/src/nfc/qtnfcglobal.h
index 80a8cfa4..2a1e40b4 100644
--- a/src/nfc/qnfcglobal.h
+++ b/src/nfc/qtnfcglobal.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtNfc module of the Qt Toolkit.
diff --git a/src/nfc/qtnfcglobal_p.h b/src/nfc/qtnfcglobal_p.h
new file mode 100644
index 00000000..2f40d464
--- /dev/null
+++ b/src/nfc/qtnfcglobal_p.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWidgets module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTNFCGLOBAL_P_H
+#define QTNFCGLOBAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qglobal_p.h>
+
+#include <QtNfc/qtnfcglobal.h>
+#include <QtNfc/private/qtnfc-config_p.h>
+
+#endif // QTNFCGLOBAL_P_H
diff --git a/src/nfc/targetemulator_p.h b/src/nfc/targetemulator_p.h
index 1233207f..1f682704 100644
--- a/src/nfc/targetemulator_p.h
+++ b/src/nfc/targetemulator_p.h
@@ -53,7 +53,7 @@
#include <QtCore/QtGlobal>
#include <QtCore/QByteArray>
-#include <QtNfc/qnfcglobal.h>
+#include <QtNfc/qtnfcglobal.h>
QT_FORWARD_DECLARE_CLASS(QSettings)
diff --git a/sync.profile b/sync.profile
index 64dac6e3..77a4cb6c 100644
--- a/sync.profile
+++ b/sync.profile
@@ -4,6 +4,14 @@
);
%moduleheaders = ( # restrict the module headers to those found in relative path
);
+%deprecatedheaders = (
+ "QtBluetooth" => {
+ "qbluetoothglobal.h" => "QtBluetooth/qtbluetoothglobal.h"
+ },
+ "QtNfc" => {
+ "qnfcglobal.h" => "QtNfc/qtnfcglobal.h"
+ }
+);
@ignore_for_include_check = (
diff --git a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
index c75004d6..cbce5042 100644
--- a/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
+++ b/tests/auto/qbluetoothdevicediscoveryagent/tst_qbluetoothdevicediscoveryagent.cpp
@@ -33,6 +33,7 @@
#include <QList>
#include <QLoggingCategory>
+#include <private/qtbluetoothglobal_p.h>
#include <qbluetoothaddress.h>
#include <qbluetoothdevicediscoveryagent.h>
#include <qbluetoothlocaldevice.h>
@@ -471,7 +472,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_deviceDiscovery()
}
}
}
-#if defined(Q_OS_IOS) || defined(Q_OS_WINRT)
+#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) || QT_CONFIG(winrt_bt)
//On iOS/WinRT, we do not have access to the local device/adapter, numberOfAdapters is 0,
//so we skip this test at all.
QSKIP("iOS/WinRT: no local Bluetooth device available. Skipping remaining part of test.");
@@ -489,7 +490,7 @@ void tst_QBluetoothDeviceDiscoveryAgent::tst_discoveryTimeout()
QBluetoothDeviceDiscoveryAgent agent;
// check default values
-#if defined(Q_OS_OSX) || defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_WINRT)
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || QT_CONFIG(winrt_bt)
QCOMPARE(agent.lowEnergyDiscoveryTimeout(), 25000);
agent.setLowEnergyDiscoveryTimeout(-1); // negative ignored
QCOMPARE(agent.lowEnergyDiscoveryTimeout(), 25000);
diff --git a/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro b/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro
index 20739987..1c4da732 100644
--- a/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro
+++ b/tests/auto/qbluetoothlocaldevice/qbluetoothlocaldevice.pro
@@ -2,5 +2,5 @@ SOURCES += tst_qbluetoothlocaldevice.cpp
TARGET=tst_qbluetoothlocaldevice
CONFIG += testcase
-QT = core concurrent bluetooth testlib
+QT = core concurrent bluetooth-private testlib
osx:QT += widgets
diff --git a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
index fcba4c3a..ea1abef2 100644
--- a/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
+++ b/tests/auto/qbluetoothlocaldevice/tst_qbluetoothlocaldevice.cpp
@@ -31,6 +31,7 @@
#include <QDebug>
#include <QVariant>
+#include <private/qtbluetoothglobal_p.h>
#include <qbluetoothaddress.h>
#include <qbluetoothlocaldevice.h>
@@ -236,7 +237,7 @@ void tst_QBluetoothLocalDevice::tst_name()
}
void tst_QBluetoothLocalDevice::tst_isValid()
{
-#ifdef Q_OS_OSX
+#if defined(Q_OS_MACOS) || QT_CONFIG(winrt_bt)
// On OS X we can have a valid device (device.isValid() == true),
// that has neither a name nor a valid address - this happens
// if a Bluetooth adapter is OFF.
@@ -270,7 +271,7 @@ void tst_QBluetoothLocalDevice::tst_isValid()
QVERIFY(!invalidLocalDevice.isValid());
QCOMPARE(invalidLocalDevice.address(), QBluetoothAddress());
QCOMPARE(invalidLocalDevice.name(), QString());
-#ifndef Q_OS_WINRT
+#if !QT_CONFIG(winrt_bt)
QCOMPARE(invalidLocalDevice.pairingStatus(QBluetoothAddress()), QBluetoothLocalDevice::Unpaired );
QCOMPARE(invalidLocalDevice.hostMode(), QBluetoothLocalDevice::HostPoweredOff);
#else
@@ -393,7 +394,7 @@ void tst_QBluetoothLocalDevice::tst_pairingStatus_data()
QTest::addColumn<QBluetoothAddress>("deviceAddress");
QTest::addColumn<QBluetoothLocalDevice::Pairing>("pairingExpected");
-#ifndef Q_OS_WINRT
+#if !QT_CONFIG(winrt_bt)
QTest::newRow("UnPaired Device: DUMMY") << QBluetoothAddress("11:00:00:00:00:00")
<< QBluetoothLocalDevice::Unpaired;
QTest::newRow("Invalid device") << QBluetoothAddress() << QBluetoothLocalDevice::Unpaired;
@@ -411,6 +412,9 @@ void tst_QBluetoothLocalDevice::tst_pairingStatus()
QFETCH(QBluetoothAddress, deviceAddress);
QFETCH(QBluetoothLocalDevice::Pairing, pairingExpected);
+ if (!QBluetoothLocalDevice::allDevices().count())
+ QSKIP("Skipping test due to missing Bluetooth device");
+
QBluetoothLocalDevice localDevice;
QCOMPARE(pairingExpected, localDevice.pairingStatus(deviceAddress));
}
diff --git a/tests/auto/qbluetoothserver/qbluetoothserver.pro b/tests/auto/qbluetoothserver/qbluetoothserver.pro
index f1baed01..7d7eb66b 100644
--- a/tests/auto/qbluetoothserver/qbluetoothserver.pro
+++ b/tests/auto/qbluetoothserver/qbluetoothserver.pro
@@ -2,7 +2,7 @@ SOURCES += tst_qbluetoothserver.cpp
TARGET = tst_qbluetoothserver
CONFIG += testcase
-QT = core concurrent bluetooth testlib
+QT = core concurrent bluetooth-private testlib
osx:QT += widgets
OTHER_FILES += \
diff --git a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
index 2cb86fb4..acc498cc 100644
--- a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
+++ b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp
@@ -30,6 +30,7 @@
#include <QDebug>
+#include <private/qtbluetoothglobal_p.h>
#include <qbluetoothserver.h>
#include <qbluetoothsocket.h>
#include <qbluetoothlocaldevice.h>
@@ -217,7 +218,7 @@ void tst_QBluetoothServer::tst_receive()
QVERIFY(result);
-#ifndef Q_OS_WINRT
+#if !QT_CONFIG(winrt_bt)
QVERIFY(QBluetoothLocalDevice::allDevices().count());
#endif
QCOMPARE(server.error(), QBluetoothServer::NoError);
diff --git a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp
index 3df27d92..e01457eb 100644
--- a/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp
+++ b/tests/auto/qlowenergycontroller-gattserver/test/tst_qlowenergycontroller-gattserver.cpp
@@ -243,10 +243,6 @@ void TestQLowEnergyControllerGattServer::advertisedData()
QVERIFY(m_serverInfo.serviceUuids().contains(QBluetoothUuid(quint16(0x2000))));
}
-// TODO: Why on earth is this not in the library???
-Q_DECLARE_METATYPE(QLowEnergyCharacteristic)
-Q_DECLARE_METATYPE(QLowEnergyDescriptor)
-
void TestQLowEnergyControllerGattServer::serverCommunication()
{
qRegisterMetaType<QLowEnergyCharacteristic>();
diff --git a/tests/auto/qlowenergycontroller/qlowenergycontroller.pro b/tests/auto/qlowenergycontroller/qlowenergycontroller.pro
index 24178b6e..7a67e8e4 100644
--- a/tests/auto/qlowenergycontroller/qlowenergycontroller.pro
+++ b/tests/auto/qlowenergycontroller/qlowenergycontroller.pro
@@ -1,4 +1,4 @@
-QT = core bluetooth testlib
+QT = core bluetooth-private testlib
# Android requires GUI application when running test
android: QT += widgets
diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
index 7b02dbcd..aa779f47 100644
--- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
+++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp
@@ -27,6 +27,8 @@
****************************************************************************/
#include <QtTest/QtTest>
+
+#include <private/qtbluetoothglobal_p.h>
#include <QBluetoothAddress>
#include <QBluetoothLocalDevice>
#include <QBluetoothDeviceDiscoveryAgent>
@@ -91,9 +93,6 @@ private:
QList<QBluetoothUuid> foundServices;
};
-Q_DECLARE_METATYPE(QLowEnergyCharacteristic)
-Q_DECLARE_METATYPE(QLowEnergyDescriptor)
-
tst_QLowEnergyController::tst_QLowEnergyController()
{
qRegisterMetaType<QLowEnergyCharacteristic>();
@@ -122,7 +121,7 @@ void tst_QLowEnergyController::initTestCase()
{
#if !defined(Q_OS_MAC)
if (remoteDevice.isNull()
-#ifndef Q_OS_WINRT
+#if !QT_CONFIG(winrt_bt)
|| QBluetoothLocalDevice::allDevices().isEmpty()) {
#else
) {
@@ -248,7 +247,7 @@ void tst_QLowEnergyController::tst_connect()
{
QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
-#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) || defined(Q_OS_WINRT)
+#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) || QT_CONFIG(winrt_bt)
if (!remoteDeviceInfo.isValid())
#else
if (localAdapters.isEmpty() || !remoteDeviceInfo.isValid())
@@ -265,7 +264,7 @@ void tst_QLowEnergyController::tst_connect()
else
QCOMPARE(control.remoteName(), remoteDeviceInfo.name());
-#if !defined(Q_OS_IOS) && !defined(Q_OS_TVOS) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_IOS) && !defined(Q_OS_TVOS) && !QT_CONFIG(winrt_bt)
const QBluetoothAddress localAdapter = localAdapters.at(0).address();
QCOMPARE(control.localAddress(), localAdapter);
QVERIFY(!control.localAddress().isNull());
@@ -408,7 +407,7 @@ void tst_QLowEnergyController::tst_connect()
void tst_QLowEnergyController::tst_concurrentDiscovery()
{
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_MACOS) && !QT_CONFIG(winrt_bt)
QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
if (localAdapters.isEmpty())
QSKIP("No local Bluetooth device found. Skipping test.");
@@ -445,7 +444,7 @@ void tst_QLowEnergyController::tst_concurrentDiscovery()
30000);
}
-#if defined(Q_OS_ANDROID) || defined(Q_OS_WINRT)
+#if defined(Q_OS_ANDROID) || QT_CONFIG(winrt_bt)
QCOMPARE(control.state(), QLowEnergyController::ConnectedState);
QCOMPARE(control2.state(), QLowEnergyController::ConnectedState);
control2.disconnectFromDevice();
@@ -1647,7 +1646,7 @@ void tst_QLowEnergyController::tst_defaultBehavior()
void tst_QLowEnergyController::tst_writeCharacteristic()
{
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_MACOS) && !QT_CONFIG(winrt_bt)
QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
if (localAdapters.isEmpty())
QSKIP("No local Bluetooth device found. Skipping test.");
@@ -1821,7 +1820,7 @@ void tst_QLowEnergyController::tst_writeCharacteristic()
void tst_QLowEnergyController::tst_readWriteDescriptor()
{
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_MACOS) && !QT_CONFIG(winrt_bt)
QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
if (localAdapters.isEmpty())
QSKIP("No local Bluetooth device found. Skipping test.");
@@ -2244,7 +2243,7 @@ void tst_QLowEnergyController::tst_customProgrammableDevice()
*/
void tst_QLowEnergyController::tst_errorCases()
{
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_MACOS) && !QT_CONFIG(winrt_bt)
QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
if (localAdapters.isEmpty())
QSKIP("No local Bluetooth device found. Skipping test.");
@@ -2466,7 +2465,7 @@ void tst_QLowEnergyController::tst_errorCases()
*/
void tst_QLowEnergyController::tst_writeCharacteristicNoResponse()
{
-#if !defined(Q_OS_MAC) && !defined(Q_OS_WINRT)
+#if !defined(Q_OS_MACOS) && !QT_CONFIG(winrt_bt)
QList<QBluetoothHostInfo> localAdapters = QBluetoothLocalDevice::allDevices();
if (localAdapters.isEmpty())
QSKIP("No local Bluetooth device found. Skipping test.");