summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@theqtcompany.com>2016-01-14 14:37:58 +0100
committerOliver Wolff <oliver.wolff@qt.io>2016-05-26 05:37:23 +0000
commit9d20d6093e4b037c1038ebb569494065dfd22d7f (patch)
tree57b148061b1f93673d5020aecefe84266e4f6a16
parent44b56a00335ff283bcef32f1624d6c389c2d6839 (diff)
Detection of bluetooth (LE) devices has to happen in Xaml thread
Change-Id: Ibfc1b272664b989e9836e02674691f24a53a5231 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r--src/bluetooth/bluetooth.pro1
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp8
2 files changed, 7 insertions, 2 deletions
diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro
index 68001f5f..e30931e4 100644
--- a/src/bluetooth/bluetooth.pro
+++ b/src/bluetooth/bluetooth.pro
@@ -200,6 +200,7 @@ config_bluez:qtHaveModule(dbus) {
SOURCES -= qlowenergycontroller.cpp
} else:winphone {
DEFINES += QT_WINRT_BLUETOOTH
+ QT += core-private
# remove dummy warning once platform port is complete
include(dummy/dummy.pri)
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
index a0d024e9..f8a5fca1 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_winrt.cpp
@@ -38,6 +38,7 @@
#include "qfunctions_winrt.h"
#include <QtCore/QLoggingCategory>
+#include <QtCore/private/qeventdispatcher_winrt_p.h>
#include <wrl.h>
#include <windows.devices.enumeration.h>
@@ -165,9 +166,12 @@ public:
void start()
{
- startDeviceDiscovery(BT);
+ QEventDispatcherWinRT::runOnXamlThread([this]() {
+ startDeviceDiscovery(BT);
- startDeviceDiscovery(BTLE);
+ startDeviceDiscovery(BTLE);
+ return S_OK;
+ });
qCDebug(QT_BT_WINRT) << "Worker started";
}