summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-10-13 17:18:15 +0300
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2015-10-14 08:26:40 +0000
commitc18927e87e65eefccd8cda9e6671d234e95d387c (patch)
treeb10d59ca000e674257927a548a5e378c08f2f1de /src/bluetooth/qbluetoothdevicediscoveryagent_p.h
parent797624ac0c5f0a7ee3dd0a938454d55cb8786373 (diff)
Windows: Refactor code related to discovering of a remote devices
* There is no need to do parallel scan for LE and Classic devices. It is enough to do it one after another by using one QFutureWatcher instead of two QFutureWatchers. * Now the qwinclassicbluetooth(h).cpp files are deleted from the 'windows' directory, and its related code is moved into QBluetoothDeviceDiscoveryAgentPrivate. Change-Id: I2acf102c3a8d313d078b351e9a2ce54ebca79dee Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_p.h')
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_p.h48
1 files changed, 11 insertions, 37 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
index 0d220ef9..d7da8e98 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
@@ -75,8 +75,6 @@ QT_END_NAMESPACE
#ifdef Q_OS_WIN32
#include <QtConcurrent>
-#include "windows/qwinclassicbluetooth_p.h"
-#include "windows/qwinlowenergybluetooth_p.h"
#endif
QT_BEGIN_NAMESPACE
@@ -157,47 +155,23 @@ private:
#endif
#ifdef Q_OS_WIN32
+public:
+ typedef void* SearchHandle;
+ static QString discoveredLeDeviceSystemPath(const QBluetoothAddress &deviceAddress);
+
private slots:
- void classicDeviceDiscovered();
- void lowEnergyDeviceDiscovered();
+ void taskFinished();
private:
- void initialize(const QBluetoothAddress &deviceAdapter);
-
- bool isClassicAdapterValid(const QBluetoothAddress &deviceAdapter);
- void startDiscoveryForFirstClassicDevice();
- void startDiscoveryForNextClassicDevice(HBLUETOOTH_DEVICE_FIND hSearch);
- void completeClassicDiscovery(HBLUETOOTH_DEVICE_FIND hSearch);
- void acceptDiscoveredClassicDevice(const BLUETOOTH_DEVICE_INFO &device);
-
- bool isLowEnergyAdapterValid(const QBluetoothAddress &deviceAdapter);
- void startDiscoveryForLowEnergyDevices();
- void completeLowEnergyDiscovery();
- void acceptDiscoveredLowEnergyDevice(const WinLowEnergyBluetooth::DeviceInfo &device);
-
- void processDuplicates(const QBluetoothDeviceInfo &foundDevice);
-
- void setError(DWORD error, const QString &str = QString());
-
- bool isDiscoveredSuccessfully(int systemError) const;
-
- bool canBeCanceled() const;
- void cancel();
-
- bool canBePendingStarted() const;
- void prepareToPendingStart();
-
- void finalize();
- void drop(int systemError);
+ void processDiscoveredDevice(const QBluetoothDeviceInfo &foundDevice);
- QFutureWatcher<WinClassicBluetooth::RemoteDeviceDiscoveryResult> *classicDiscoveryWatcher;
- QFutureWatcher<WinLowEnergyBluetooth::DeviceDiscoveryResult> *lowEnergyDiscoveryWatcher;
+ QBluetoothAddress adapterAddress;
bool pendingCancel;
bool pendingStart;
- bool isClassicActive;
- bool isClassicValid;
- bool isLowEnergyActive;
- bool isLowEnergyValid;
+ QFutureWatcher<QBluetoothDeviceInfo> *scanWatcher;
+ bool active;
+ int systemErrorCode;
+ SearchHandle searchHandle;
#endif
QBluetoothDeviceDiscoveryAgent *q_ptr;