summaryrefslogtreecommitdiffstats
path: root/qt-ui/btdeviceselectiondialog.h
diff options
context:
space:
mode:
authorGravatar Claudiu Olteanu <olteanu.claudiu@ymail.com>2015-08-18 20:51:10 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-20 22:45:20 -0700
commit7488f5500ed82047b66368b62d14595a166078e1 (patch)
tree1eb1a7f9cefe27d6b8f680d6bd49231a5c60a5d7 /qt-ui/btdeviceselectiondialog.h
parent2aa6ffe0c8a1d60cc1eda20a67838f41aa057396 (diff)
downloadsubsurface-7488f5500ed82047b66368b62d14595a166078e1.tar.gz
Add skeleton for Bluetooth custom serial implementation on Windows platforms
Add a skeleton which will be used to develop the Bluetooth custom serial implementation for Windows platforms. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/btdeviceselectiondialog.h')
-rw-r--r--qt-ui/btdeviceselectiondialog.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/qt-ui/btdeviceselectiondialog.h b/qt-ui/btdeviceselectiondialog.h
index b6c34e8b8..3d72db418 100644
--- a/qt-ui/btdeviceselectiondialog.h
+++ b/qt-ui/btdeviceselectiondialog.h
@@ -8,7 +8,23 @@
#include <QtBluetooth/qbluetoothglobal.h>
#include <QtBluetooth/QBluetoothDeviceDiscoveryAgent>
-#if QT_VERSION < 0x050500
+#if defined(Q_OS_WIN)
+ #include <QThread>
+ #include <winsock2.h>
+ #include <ws2bth.h>
+
+ #define SUCCESS 0
+ #define BTH_ADDR_STR_LEN 40
+
+ #undef ERROR // this is already declared in our headers
+ #undef IGNORE // this is already declared in our headers
+ #undef DC_VERSION // this is already declared in libdivecomputer header
+#endif
+
+#if defined(Q_OS_WIN)
+Q_DECLARE_METATYPE(QBluetoothDeviceInfo)
+Q_DECLARE_METATYPE(QBluetoothDeviceDiscoveryAgent::Error)
+#elif QT_VERSION < 0x050500
Q_DECLARE_METATYPE(QBluetoothDeviceInfo)
#endif
@@ -16,6 +32,30 @@ namespace Ui {
class BtDeviceSelectionDialog;
}
+#if defined(Q_OS_WIN)
+class WinBluetoothDeviceDiscoveryAgent : public QThread {
+ Q_OBJECT
+signals:
+ void deviceDiscovered(const QBluetoothDeviceInfo &info);
+ void error(QBluetoothDeviceDiscoveryAgent::Error error);
+
+public:
+ WinBluetoothDeviceDiscoveryAgent(QObject *parent);
+ ~WinBluetoothDeviceDiscoveryAgent();
+ bool isActive() const;
+ QString errorToString() const;
+ QBluetoothDeviceDiscoveryAgent::Error error() const;
+ virtual void run();
+ virtual void stop();
+
+private:
+ bool running;
+ bool stopped;
+ QString lastErrorToString;
+ QBluetoothDeviceDiscoveryAgent::Error lastError;
+};
+#endif
+
class BtDeviceSelectionDialog : public QDialog {
Q_OBJECT
@@ -42,8 +82,12 @@ private slots:
private:
Ui::BtDeviceSelectionDialog *ui;
+#if defined(Q_OS_WIN)
+ WinBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent;
+#else
QBluetoothLocalDevice *localDevice;
QBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent;
+#endif
QSharedPointer<QBluetoothDeviceInfo> selectedRemoteDeviceInfo;
void updateLocalDeviceInformation();