mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
BLE debug: make things less verbose
Unless run with '-v -v -v'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a71b7e51d2
commit
01649503fb
1 changed files with 15 additions and 8 deletions
|
@ -52,14 +52,17 @@ extern "C" {
|
||||||
|
|
||||||
void BLEObject::serviceStateChanged(QLowEnergyService::ServiceState newState)
|
void BLEObject::serviceStateChanged(QLowEnergyService::ServiceState newState)
|
||||||
{
|
{
|
||||||
|
if (verbose > 2 || debugCounter < DEBUG_THRESHOLD)
|
||||||
qDebug() << "serviceStateChanged";
|
qDebug() << "serviceStateChanged";
|
||||||
auto service = qobject_cast<QLowEnergyService*>(sender());
|
auto service = qobject_cast<QLowEnergyService*>(sender());
|
||||||
if (service)
|
if (service)
|
||||||
|
if (verbose > 2 || debugCounter < DEBUG_THRESHOLD)
|
||||||
qDebug() << service->serviceUuid() << newState;
|
qDebug() << service->serviceUuid() << newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLEObject::characteristcStateChanged(const QLowEnergyCharacteristic &c, const QByteArray &value)
|
void BLEObject::characteristcStateChanged(const QLowEnergyCharacteristic &c, const QByteArray &value)
|
||||||
{
|
{
|
||||||
|
if (verbose > 2 || debugCounter < DEBUG_THRESHOLD)
|
||||||
qDebug() << QTime::currentTime() << "packet RECV" << value.toHex();
|
qDebug() << QTime::currentTime() << "packet RECV" << value.toHex();
|
||||||
if (IS_HW(device)) {
|
if (IS_HW(device)) {
|
||||||
if (c.uuid() == hwAllCharacteristics[HW_OSTC_BLE_DATA_TX]) {
|
if (c.uuid() == hwAllCharacteristics[HW_OSTC_BLE_DATA_TX]) {
|
||||||
|
@ -84,13 +87,14 @@ void BLEObject::characteristicWritten(const QLowEnergyCharacteristic &c, const Q
|
||||||
isCharacteristicWritten = true;
|
isCharacteristicWritten = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (debugCounter < DEBUG_THRESHOLD)
|
if (verbose > 2 || debugCounter < DEBUG_THRESHOLD)
|
||||||
qDebug() << "BLEObject::characteristicWritten";
|
qDebug() << "BLEObject::characteristicWritten";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLEObject::writeCompleted(const QLowEnergyDescriptor&, const QByteArray&)
|
void BLEObject::writeCompleted(const QLowEnergyDescriptor&, const QByteArray&)
|
||||||
{
|
{
|
||||||
|
if (verbose > 2 || debugCounter < DEBUG_THRESHOLD)
|
||||||
qDebug() << "BLE write completed";
|
qDebug() << "BLE write completed";
|
||||||
desc_written++;
|
desc_written++;
|
||||||
}
|
}
|
||||||
|
@ -178,6 +182,7 @@ dc_status_t BLEObject::write(const void *data, size_t size, size_t *actual)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QByteArray bytes((const char *)data, (int) size);
|
QByteArray bytes((const char *)data, (int) size);
|
||||||
|
if (verbose > 2 || debugCounter < DEBUG_THRESHOLD)
|
||||||
qDebug() << QTime::currentTime() << "packet SEND" << bytes.toHex();
|
qDebug() << QTime::currentTime() << "packet SEND" << bytes.toHex();
|
||||||
|
|
||||||
QLowEnergyService::WriteMode mode;
|
QLowEnergyService::WriteMode mode;
|
||||||
|
@ -202,6 +207,7 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
|
||||||
if (list.isEmpty())
|
if (list.isEmpty())
|
||||||
return DC_STATUS_IO;
|
return DC_STATUS_IO;
|
||||||
|
|
||||||
|
if (verbose > 2 || debugCounter < DEBUG_THRESHOLD)
|
||||||
qDebug() << QTime::currentTime() << "packet WAIT";
|
qDebug() << QTime::currentTime() << "packet WAIT";
|
||||||
|
|
||||||
WAITFOR(!receivedPackets.isEmpty(), timeout);
|
WAITFOR(!receivedPackets.isEmpty(), timeout);
|
||||||
|
@ -225,6 +231,7 @@ dc_status_t BLEObject::read(void *data, size_t size, size_t *actual)
|
||||||
if (actual)
|
if (actual)
|
||||||
*actual += packet.size();
|
*actual += packet.size();
|
||||||
|
|
||||||
|
if (verbose > 2 || debugCounter < DEBUG_THRESHOLD)
|
||||||
qDebug() << QTime::currentTime() << "packet READ" << packet.toHex();
|
qDebug() << QTime::currentTime() << "packet READ" << packet.toHex();
|
||||||
|
|
||||||
return DC_STATUS_SUCCESS;
|
return DC_STATUS_SUCCESS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue