summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-06-27 20:53:11 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-06-27 20:53:11 -0700
commitf98fa50c3955008186456459ff0296fe79d43258 (patch)
tree6f39c0d8f0848e1566a1c5e41e5130386206b372 /core
parentfbdba88dece31e6a84f4992d4f8a4909982a699c (diff)
downloadsubsurface-f98fa50c3955008186456459ff0296fe79d43258.tar.gz
BLE code: address some compiler warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/qt-ble.cpp14
-rw-r--r--core/qtserialbluetooth.cpp13
2 files changed, 21 insertions, 6 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index 246b59ee9..d6a716652 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -37,6 +37,8 @@ void waitFor(int ms) {
void BLEObject::serviceStateChanged(QLowEnergyService::ServiceState s)
{
+ Q_UNUSED(s)
+
QList<QLowEnergyCharacteristic> list;
auto service = qobject_cast<QLowEnergyService*>(sender());
@@ -50,12 +52,17 @@ void BLEObject::serviceStateChanged(QLowEnergyService::ServiceState s)
void BLEObject::characteristcStateChanged(const QLowEnergyCharacteristic &c, const QByteArray &value)
{
+ Q_UNUSED(c)
+
receivedPackets.append(value);
waitForPacket.exit();
}
void BLEObject::writeCompleted(const QLowEnergyDescriptor &d, const QByteArray &value)
{
+ Q_UNUSED(d)
+ Q_UNUSED(value)
+
qDebug() << "BLE write completed";
}
@@ -99,6 +106,8 @@ static int device_is_shearwater(dc_user_device_t *device)
dc_status_t BLEObject::write(const void *data, size_t size, size_t *actual)
{
+ Q_UNUSED(actual) // that seems like it might cause problems
+
QList<QLowEnergyCharacteristic> list = preferredService()->characteristics();
QByteArray bytes((const char *)data, (int) size);
@@ -127,8 +136,6 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
if (list.isEmpty())
return DC_STATUS_IO;
- const QLowEnergyCharacteristic &c = list.constLast();
-
QTimer timer;
int msec = 5000;
timer.setSingleShot(true);
@@ -147,7 +154,7 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
if (device_is_shearwater(device))
packet.remove(0,2);
- if (size > packet.size())
+ if (size > (size_t)packet.size())
size = packet.size();
memcpy(data, packet.data(), size);
*actual = size;
@@ -156,6 +163,7 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *devaddr)
{
+ Q_UNUSED(context)
/*
* LE-only devices get the "LE:" prepended by the scanning
* code, so that the rfcomm code can see they only do LE.
diff --git a/core/qtserialbluetooth.cpp b/core/qtserialbluetooth.cpp
index 5f4419c5e..f317a0c94 100644
--- a/core/qtserialbluetooth.cpp
+++ b/core/qtserialbluetooth.cpp
@@ -106,7 +106,7 @@ static dc_status_t ble_serial_flush_write(void)
if (!bytes)
return DC_STATUS_SUCCESS;
buffer.out_bytes = 0;
- ble_serial_ops.packet_write(&ble_serial_ops, buffer.out, bytes, NULL);
+ return ble_serial_ops.packet_write(&ble_serial_ops, buffer.out, bytes, NULL);
}
static dc_status_t ble_serial_flush_read(void)
@@ -124,7 +124,8 @@ static dc_status_t ble_serial_close(dc_custom_io_t *io)
static dc_status_t ble_serial_read(dc_custom_io_t *io, void* data, size_t size, size_t *actual)
{
- int len;
+ Q_UNUSED(io)
+ size_t len;
if (buffer.in_pos >= buffer.in_bytes) {
dc_status_t rc;
@@ -153,12 +154,13 @@ static dc_status_t ble_serial_read(dc_custom_io_t *io, void* data, size_t size,
static dc_status_t ble_serial_write(dc_custom_io_t *io, const void* data, size_t size, size_t *actual)
{
+ Q_UNUSED(io)
dc_status_t rc = DC_STATUS_SUCCESS;
size_t transferred = 0;
ble_serial_flush_read();
while (size) {
- int len = sizeof(buffer.out) - buffer.out_bytes;
+ size_t len = sizeof(buffer.out) - buffer.out_bytes;
if (len > size)
len = size;
@@ -181,18 +183,23 @@ static dc_status_t ble_serial_write(dc_custom_io_t *io, const void* data, size_t
static dc_status_t ble_serial_purge(dc_custom_io_t *io, dc_direction_t queue)
{
+ Q_UNUSED(io)
+ Q_UNUSED(queue)
/* Do we care? */
return DC_STATUS_SUCCESS;
}
static dc_status_t ble_serial_get_available(dc_custom_io_t *io, size_t *available)
{
+ Q_UNUSED(io)
*available = buffer.in_bytes - buffer.in_pos;
return DC_STATUS_SUCCESS;
}
static dc_status_t ble_serial_set_timeout(dc_custom_io_t *io, long timeout)
{
+ Q_UNUSED(io)
+ Q_UNUSED(timeout)
/* Do we care? */
return DC_STATUS_SUCCESS;
}