summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-03 17:46:22 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-03 22:22:16 -0700
commitbc1a313c9f130640b21e13663d3ff6c447cd1de2 (patch)
tree543b68ce91b994a36a726cfb2dc5b0c3cd30262d /core
parent345e063eb5ff76306e4aafc110351c1bee0e1335 (diff)
downloadsubsurface-bc1a313c9f130640b21e13663d3ff6c447cd1de2.tar.gz
Increase the BLE timeout to 12 seconds
This seems really long, but one user appeared to get a response after almost 10 seconds. So going with 12 for some margin of error. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/qt-ble.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index d6a716652..5cf7f1f5d 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -19,6 +19,8 @@
#include <libdivecomputer/custom_io.h>
+#define BLE_TIMEOUT 12000 // 12 seconds seems like a very long time to wait
+
extern "C" {
void waitFor(int ms) {
@@ -137,7 +139,7 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
return DC_STATUS_IO;
QTimer timer;
- int msec = 5000;
+ int msec = BLE_TIMEOUT;
timer.setSingleShot(true);
waitForPacket.connect(&timer, SIGNAL(timeout()), SLOT(quit()));
@@ -190,7 +192,7 @@ dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *d
controller->connectToDevice();
// Create a timer. If the connection doesn't succeed after five seconds or no error occurs then stop the opening step
- int msec = 5000;
+ int msec = BLE_TIMEOUT;
while (msec > 0 && controller->state() == QLowEnergyController::ConnectingState) {
waitFor(100);
msec -= 100;
@@ -216,7 +218,7 @@ dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *d
controller->discoverServices();
- msec = 5000;
+ msec = BLE_TIMEOUT;
while (msec > 0 && controller->state() == QLowEnergyController::DiscoveringState) {
waitFor(100);
msec -= 100;
@@ -232,7 +234,7 @@ dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *d
}
qDebug() << " .. discovering details";
- msec = 5000;
+ msec = BLE_TIMEOUT;
while (msec > 0 && ble->preferredService()->state() == QLowEnergyService::DiscoveringServices) {
waitFor(100);
msec -= 100;