summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2018-09-23 20:04:08 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-25 16:41:13 -0700
commit05fe19a23ff4b23fc2d4cbcf84fdc141d4491e4b (patch)
treecf08f20e62481648fdacab3e5d8cda548ddc5701
parent0ba105d2a71d65fb272837a753bf54c3e5094f8f (diff)
downloadsubsurface-05fe19a23ff4b23fc2d4cbcf84fdc141d4491e4b.tar.gz
qt-ble: add BLE packet debugging code
This is perhaps overly verbose, but the timing details helped figure out some EON Core download issues, and it's nice to see when things actually happen. It's also good to see when the data actually enters our queues, and when we read and write the packets. That might help debug the issues Fabio is seeing with the Mares Bluelink. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--core/qt-ble.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index 4fc2cd5df..8d4003d0f 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -9,6 +9,7 @@
#include <QEventLoop>
#include <QThread>
#include <QTimer>
+#include <QTime>
#include <QDebug>
#include <QLoggingCategory>
@@ -59,6 +60,7 @@ void BLEObject::serviceStateChanged(QLowEnergyService::ServiceState newState)
void BLEObject::characteristcStateChanged(const QLowEnergyCharacteristic &c, const QByteArray &value)
{
+ qDebug() << QTime::currentTime() << "packet RECV" << value.toHex();
if (IS_HW(device)) {
if (c.uuid() == hwAllCharacteristics[HW_OSTC_BLE_DATA_TX]) {
hw_credit--;
@@ -156,6 +158,7 @@ dc_status_t BLEObject::write(const void *data, size_t size, size_t *actual)
continue;
QByteArray bytes((const char *)data, (int) size);
+ qDebug() << QTime::currentTime() << "packet SEND" << bytes.toHex();
QLowEnergyService::WriteMode mode;
mode = (c.properties() & QLowEnergyCharacteristic::WriteNoResponse) ?
@@ -179,6 +182,8 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
if (list.isEmpty())
return DC_STATUS_IO;
+ qDebug() << QTime::currentTime() << "packet WAIT";
+
WAITFOR(!receivedPackets.isEmpty(), BLE_TIMEOUT);
if (receivedPackets.isEmpty())
return DC_STATUS_IO;
@@ -193,6 +198,8 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
if (actual)
*actual += packet.size();
+ qDebug() << QTime::currentTime() << "packet READ" << packet.toHex();
+
return DC_STATUS_SUCCESS;
}