Report an error if enabling notifications fails

If enabling the notification fails, receiving data packets is not
possible. Instead of silently ignoring this fatal problem and trying to
continue, report the error back to the caller.

Signed-off-by: Jef Driesen <jef@libdivecomputer.org>
This commit is contained in:
Jef Driesen 2023-09-01 20:24:30 +02:00 committed by Michael Keller
parent 81f35c1ecf
commit 97a76a6615

View file

@ -673,6 +673,12 @@ dc_status_t qt_ble_open(void **io, dc_context_t *, const char *devaddr, device_d
ble->preferredService()->writeDescriptor(d, QByteArray::fromHex("0100"));
WAITFOR(ble->descriptorWritten(), 1000);
if (!ble->descriptorWritten()) {
qDebug() << "Bluetooth: Failed to enable notifications for characteristic" << c.uuid();
report_error("Bluetooth: Failed to enable notifications.");
delete ble;
return DC_STATUS_TIMEOUT;
}
break;
}
}