mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
345e063eb5
commit
bc1a313c9f
1 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue