summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-19 18:42:43 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-24 09:51:37 -0700
commit5a19437311231aed114de8da75e19f94ac04f5aa (patch)
treeed73c87e92e39188e91c03918c01498ee2b3c5b8
parent8c65558b5c432c1d0e9c6af5939faa56ffecf51a (diff)
downloadsubsurface-5a19437311231aed114de8da75e19f94ac04f5aa.tar.gz
cleanup: remove dc_user_device_t
The same structure was defined as "struct dc_user_device_t" and typedefed as "device_data_t". Unify this. Since there are much more of the latter, remove the former. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/libdivecomputer.h3
-rw-r--r--core/qt-ble.cpp6
-rw-r--r--core/qt-ble.h6
-rw-r--r--core/qtserialbluetooth.cpp2
4 files changed, 8 insertions, 9 deletions
diff --git a/core/libdivecomputer.h b/core/libdivecomputer.h
index 50a151be0..9e3fbf1ef 100644
--- a/core/libdivecomputer.h
+++ b/core/libdivecomputer.h
@@ -29,8 +29,7 @@ extern "C" {
struct dive;
struct dive_computer;
-typedef struct dc_user_device_t
-{
+typedef struct {
dc_descriptor_t *descriptor;
const char *vendor, *product, *devname;
const char *model, *btname;
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index c271de4be..357758580 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -229,7 +229,7 @@ void BLEObject::addService(const QBluetoothUuid &newService)
}
}
-BLEObject::BLEObject(QLowEnergyController *c, dc_user_device_t *d)
+BLEObject::BLEObject(QLowEnergyController *c, device_data_t *d)
{
controller = c;
device = d;
@@ -520,13 +520,13 @@ dc_status_t BLEObject::setupHwTerminalIo(const QList<QLowEnergyCharacteristic> &
// Bluez is broken, and doesn't have a sane way to query
// whether to use a random address or not. So we have to
// fake it.
-static int use_random_address(dc_user_device_t *user_device)
+static int use_random_address(device_data_t *user_device)
{
return IS_SHEARWATER(user_device) || IS_GARMIN(user_device);
}
#endif
-dc_status_t qt_ble_open(void **io, dc_context_t *, const char *devaddr, dc_user_device_t *user_device)
+dc_status_t qt_ble_open(void **io, dc_context_t *, const char *devaddr, device_data_t *user_device)
{
debugCounter = 0;
QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
diff --git a/core/qt-ble.h b/core/qt-ble.h
index 4da51a981..5063a4f55 100644
--- a/core/qt-ble.h
+++ b/core/qt-ble.h
@@ -18,7 +18,7 @@ class BLEObject : public QObject
Q_OBJECT
public:
- BLEObject(QLowEnergyController *c, dc_user_device_t *);
+ BLEObject(QLowEnergyController *c, device_data_t *);
~BLEObject();
inline void set_timeout(int value) { timeout = value; }
dc_status_t write(const void* data, size_t size, size_t *actual);
@@ -50,7 +50,7 @@ private:
QLowEnergyService *preferred = nullptr;
QList<QByteArray> receivedPackets;
bool isCharacteristicWritten;
- dc_user_device_t *device;
+ device_data_t *device;
unsigned int hw_credit = 0;
unsigned int desc_written = 0;
int timeout;
@@ -65,7 +65,7 @@ private:
extern "C" {
-dc_status_t qt_ble_open(void **io, dc_context_t *context, const char *devaddr, dc_user_device_t *user_device);
+dc_status_t qt_ble_open(void **io, dc_context_t *context, const char *devaddr, device_data_t *user_device);
dc_status_t qt_ble_set_timeout(void *io, int timeout);
dc_status_t qt_ble_poll(void *io, int timeout);
dc_status_t qt_ble_read(void *io, void* data, size_t size, size_t *actual);
diff --git a/core/qtserialbluetooth.cpp b/core/qtserialbluetooth.cpp
index 0114a54f5..1dd57c592 100644
--- a/core/qtserialbluetooth.cpp
+++ b/core/qtserialbluetooth.cpp
@@ -300,7 +300,7 @@ ble_packet_open(dc_iostream_t **iostream, dc_context_t *context, const char* dev
.close = qt_ble_close,
};
- rc = qt_ble_open(&io, context, devaddr, (dc_user_device_t *) userdata);
+ rc = qt_ble_open(&io, context, devaddr, (device_data_t *) userdata);
if (rc != DC_STATUS_SUCCESS) {
return rc;
}