summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.tests/winrt_bt/main.cpp42
-rw-r--r--config.tests/winrt_bt/winrt.pro3
-rw-r--r--src/bluetooth/bluetooth.pro19
-rw-r--r--src/bluetooth/configure.json13
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp4
-rw-r--r--src/bluetooth/qbluetoothserver_winrt.cpp3
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp3
-rw-r--r--src/bluetooth/qbluetoothserviceinfo_winrt.cpp3
-rw-r--r--src/bluetooth/qbluetoothsocket_winrt.cpp3
-rw-r--r--src/bluetooth/qbluetoothutils_win.cpp56
-rw-r--r--src/bluetooth/qlowenergycontroller_winrt.cpp3
11 files changed, 146 insertions, 6 deletions
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/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro
index 233cdb3b..b0e78d39 100644
--- a/src/bluetooth/bluetooth.pro
+++ b/src/bluetooth/bluetooth.pro
@@ -77,6 +77,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
@@ -188,8 +193,14 @@ qtConfig(bluez) {
SOURCES -= qbluetoothdevicediscoveryagent.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
+ }
+
QT += core-private
SOURCES += \
@@ -201,11 +212,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/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/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
index 1aaaf0a4..363bc438 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>
diff --git a/src/bluetooth/qbluetoothserver_winrt.cpp b/src/bluetooth/qbluetoothserver_winrt.cpp
index ddd71c21..f478dc93 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>
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_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_winrt.cpp b/src/bluetooth/qbluetoothsocket_winrt.cpp
index 365fe046..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>
diff --git a/src/bluetooth/qbluetoothutils_win.cpp b/src/bluetooth/qbluetoothutils_win.cpp
new file mode 100644
index 00000000..d561dcef
--- /dev/null
+++ b/src/bluetooth/qbluetoothutils_win.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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>
+
+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)
+
+QT_END_NAMESPACE
diff --git a/src/bluetooth/qlowenergycontroller_winrt.cpp b/src/bluetooth/qlowenergycontroller_winrt.cpp
index 8d3d85d8..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>