summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/CMakeLists.txt5
-rw-r--r--core/btdiscovery.h12
-rw-r--r--core/downloadfromdcthread.h4
-rw-r--r--mobile-widgets/qmlmanager.h2
4 files changed, 9 insertions, 14 deletions
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index b4b6d76db..03a8c4fc4 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -21,17 +21,16 @@ endif()
if(BTSUPPORT)
add_definitions(-DBT_SUPPORT)
set(BT_SRC_FILES desktop-widgets/btdeviceselectiondialog.cpp)
- set(BT_CORE_SRC_FILES qtserialbluetooth.cpp)
+ set(BT_CORE_SRC_FILES qtserialbluetooth.cpp btdiscovery.cpp)
endif()
if(BLESUPPORT)
add_definitions(-DBLE_SUPPORT)
- set(BT_CORE_SRC_FILES qt-ble.cpp)
+ set(BT_CORE_SRC_FILES ${BT_CORE_SRC_FILES} qt-ble.cpp)
endif()
# compile the core library, in C.
set(SUBSURFACE_CORE_LIB_SRCS
- btdiscovery.cpp
cochran.c
datatrak.c
deco.c
diff --git a/core/btdiscovery.h b/core/btdiscovery.h
index 5697c8d0f..61d03f49b 100644
--- a/core/btdiscovery.h
+++ b/core/btdiscovery.h
@@ -6,13 +6,11 @@
#include <QString>
#include <QLoggingCategory>
#include <QAbstractListModel>
-#if defined(BT_SUPPORT)
#include <QBluetoothLocalDevice>
#include <QBluetoothDeviceDiscoveryAgent>
#include <QBluetoothUuid>
#include "core/libdivecomputer.h"
-#endif
#if defined(Q_OS_ANDROID)
#include <QAndroidJniObject>
#include <QAndroidJniEnvironment>
@@ -29,7 +27,6 @@ public:
~BTDiscovery();
static BTDiscovery *instance();
-#if defined(BT_SUPPORT)
struct btPairedDevice {
QString address;
QString name;
@@ -49,28 +46,25 @@ public:
void getBluetoothDevices();
#endif
QList<btVendorProduct> getBtDcs();
-#endif
+
private:
static BTDiscovery *m_instance;
bool m_btValid;
-#if defined(BT_SUPPORT)
+
QList<struct btVendorProduct> btDCs; // recognized DCs
QList<struct btVendorProduct> btAllDevices; // all paired BT stuff
-#endif
+
#if defined(Q_OS_ANDROID)
bool checkException(const char* method, const QAndroidJniObject* obj);
#endif
-#if defined(BT_SUPPORT)
QList<struct btPairedDevice> btPairedDevices;
QBluetoothLocalDevice localBtDevice;
QBluetoothDeviceDiscoveryAgent *discoveryAgent;
-#endif
signals:
void dcVendorChanged();
void dcProductChanged();
void dcBtChanged();
};
-
#endif // BTDISCOVERY_H
diff --git a/core/downloadfromdcthread.h b/core/downloadfromdcthread.h
index f1b450865..ff4b8f39c 100644
--- a/core/downloadfromdcthread.h
+++ b/core/downloadfromdcthread.h
@@ -9,8 +9,9 @@
#include "dive.h"
#include "libdivecomputer.h"
#include "connectionlistmodel.h"
+#if BT_SUPPORT
#include "core/btdiscovery.h"
-
+#endif
/* Helper object for access of Device Data in QML */
class DCDeviceData : public QObject {
Q_OBJECT
@@ -100,5 +101,4 @@ extern QStringList vendorList;
extern QHash<QString, QStringList> productList;
extern QMap<QString, dc_descriptor_t *> descriptorLookup;
extern ConnectionListModel connectionListModel;
-
#endif
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 87668d92e..1da147c9f 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -9,7 +9,9 @@
#include <QElapsedTimer>
#include <QColor>
+#if BT_SUPPORT
#include "core/btdiscovery.h"
+#endif
#include "core/gpslocation.h"
#include "core/downloadfromdcthread.h"
#include "qt-models/divelistmodel.h"