summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-11-19 20:01:15 +0300
committerTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-12-01 15:17:22 +0100
commit11095f3504515f0ec2a754f64f97719340247505 (patch)
tree74c64183fbb5cd6457bd956da574585c35b8ab9e /src/bluetooth/qbluetoothdevicediscoveryagent_p.h
parenta3c295297a4ee1365619cc49f504a9f35b4f7785 (diff)
Refactor of code for "classic" part on Windows
The previous code is based on the assumption where we can use each of local radio separatelly to discovery of remote devices. Windows API allows to use a handle of separately local bluetooth adapter to operate with its power, to start/stop detection of remote devices through it and so on. But in this API there is no opportunity to enumerate services and attributes of the given remote device via the concrete local adapter. Therefore now to discovery of remote devices are used all local bluetooth adapters in system. Also, the power and the host modes management now are belongs to all local adapters at once. Tested on Windows 8 with the USB CSR8510 A10 adapter Change-Id: I949b112158a575f5b563a78163c1e3990c952ada Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_p.h')
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_p.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
index f224fe41..096f013c 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h
@@ -78,20 +78,16 @@ QT_END_NAMESPACE
#ifdef Q_OS_WIN32
#include <QtConcurrent>
-#include "qbluetoothlocaldevice_p.h"
-#include <bluetoothapis.h>
+#include "windows/qwinclassicbluetooth_p.h"
#endif
QT_BEGIN_NAMESPACE
class QBluetoothDeviceDiscoveryAgentPrivate
-#if defined(QT_QNX_BLUETOOTH) || defined(QT_ANDROID_BLUETOOTH)
+#if defined(QT_QNX_BLUETOOTH) || defined(QT_ANDROID_BLUETOOTH) || defined(Q_OS_WIN32)
: public QObject
{
Q_OBJECT
-#elif defined(Q_OS_WIN32)
- : public QBluetoothLocalDevicePrivateData
-{
#else
{
#endif
@@ -119,10 +115,6 @@ public:
void _q_extendedDeviceDiscoveryTimeout();
#endif
-#ifdef Q_OS_WIN32
- void _q_handleFindResult();
-#endif
-
private:
QList<QBluetoothDeviceInfo> discoveredDevices;
QBluetoothDeviceDiscoveryAgent::InquiryType inquiryType;
@@ -191,17 +183,25 @@ private:
#endif
#ifdef Q_OS_WIN32
- void processDiscoveredDevices(const BLUETOOTH_DEVICE_INFO &info);
- void handleErrors(DWORD errorCode);
- bool isRunning() const;
+private slots:
+ void classicDeviceDiscovered();
+
+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);
- static QVariant findFirstDevice(HANDLE radioHandle);
- static QVariant findNextDevice(HBLUETOOTH_DEVICE_FIND findHandle);
- static void findClose(HBLUETOOTH_DEVICE_FIND findHandle);
+ void setError(DWORD error, const QString &str = QString());
- QFutureWatcher<QVariant> *findWatcher;
+ QFutureWatcher<WinClassicBluetooth::RemoteDeviceDiscoveryResult> *classicDiscoveryWatcher;
bool pendingCancel;
bool pendingStart;
+ bool isClassicActive;
+ bool isClassicValid;
#endif
QBluetoothDeviceDiscoveryAgent *q_ptr;