mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
0ba105d2a7
commit
05fe19a23f
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue