summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothservicediscoveryagent_p.h
diff options
context:
space:
mode:
authorLubomir I. Ivanov (VMware) <neolit123@gmail.com>2018-05-30 00:49:58 +0200
committerLubomir I. Ivanov <neolit123@gmail.com>2018-06-18 12:41:07 +0000
commit3a90cf6d46dc6f34ccedb7f02515573d1db4704a (patch)
tree8014f72f78431008923cbbd8a39dca203f5a8d9a /src/bluetooth/qbluetoothservicediscoveryagent_p.h
parent515c20f5f20dfb4e665e635a30485d7931ff12df (diff)
win32: remove usage of QFuture in qbluetoothservicediscoveryagent
Introduce usage of QThread for service discovery instead of QFuture. Details: - Make _q_nextSdpScan() accept arguments. - Make QBluetoothServiceDiscoveryAgentPrivate inherit QObject for QT_WIN_BLUETOOTH. - Remove usage of the member variables 'systemError', 'hSearch'. Pass values around, instead. - Add the helper structs 'FindServiceArguments' and 'FindServiceResult'. Change-Id: I4e2178b2a7b333c30a235a02807dd64526db4685 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent_p.h')
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent_p.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_p.h b/src/bluetooth/qbluetoothservicediscoveryagent_p.h
index 3805ea44..cbaab458 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_p.h
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_p.h
@@ -73,7 +73,22 @@ QT_END_NAMESPACE
#endif
#ifdef QT_WIN_BLUETOOTH
-#include <QFutureWatcher>
+#include <QtCore/QVariant>
+
+QT_BEGIN_NAMESPACE
+class QThread;
+
+class ThreadWorkerFind : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE void findFirst(const QVariant data);
+ Q_INVOKABLE void findNext(const QVariant data);
+signals:
+ void findFinished(QVariant result);
+};
+QT_END_NAMESPACE
+
#elif defined(QT_WINRT_BLUETOOTH)
#include <QtCore/QPointer>
#endif
@@ -93,7 +108,7 @@ class QWinRTBluetoothServiceDiscoveryWorker;
#endif
class QBluetoothServiceDiscoveryAgentPrivate
-#if defined QT_WINRT_BLUETOOTH
+#if defined QT_WINRT_BLUETOOTH || defined QT_WIN_BLUETOOTH
: public QObject
{
Q_OBJECT
@@ -152,7 +167,7 @@ public:
void _q_hostModeStateChanged(QBluetoothLocalDevice::HostMode state);
#endif
#ifdef QT_WIN_BLUETOOTH
- void _q_nextSdpScan();
+ void _q_nextSdpScan(QVariant input);
#endif
private:
@@ -207,13 +222,11 @@ private:
#ifdef QT_WIN_BLUETOOTH
private:
- int systemError;
bool pendingStop;
bool pendingFinish;
- QFutureWatcher<QBluetoothServiceInfo> *searchWatcher;
-
- Qt::HANDLE hSearch;
+ QThread *threadFind = nullptr;
+ ThreadWorkerFind *threadWorkerFind = nullptr;
#endif
#ifdef QT_WINRT_BLUETOOTH