summaryrefslogtreecommitdiffstats
path: root/core/qt-ble.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/qt-ble.cpp')
-rw-r--r--core/qt-ble.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index 0ecad50c3..ba75c8472 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -131,6 +131,7 @@ BLEObject::BLEObject(QLowEnergyController *c, dc_user_device_t *d)
device = d;
debugCounter = 0;
isCharacteristicWritten = false;
+ timeout = BLE_TIMEOUT;
}
BLEObject::~BLEObject()
@@ -203,7 +204,7 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
qDebug() << QTime::currentTime() << "packet WAIT";
- WAITFOR(!receivedPackets.isEmpty(), BLE_TIMEOUT);
+ WAITFOR(!receivedPackets.isEmpty(), timeout);
if (receivedPackets.isEmpty())
return DC_STATUS_IO;
}
@@ -516,6 +517,17 @@ static void checkThreshold()
}
}
+/*
+ * NOTE! The 'set_timeout()' function only affects the timeout
+ * for qt_ble_read(), not for the various general BLE operations.
+ */
+dc_status_t qt_ble_set_timeout(void *io, int timeout)
+{
+ BLEObject *ble = (BLEObject *) io;
+ ble->set_timeout(timeout);
+ return DC_STATUS_SUCCESS;
+}
+
dc_status_t qt_ble_read(void *io, void* data, size_t size, size_t *actual)
{
checkThreshold();