Skip to content

Commit 048d3d7

Browse files
authored
Cleanup debug prints and remove addr.toStringExt() usage (dresden-elektronik#7140)
The PR removes various legacy log outputs which I think aren't relevant anymore and superseeded by DDFs. Further `QString deCONZ::Address::toStringExt()` is deprecated in first steps to create a QString alternative. Since its a heavy method also which allocates memory on each call, change debug printing to plain numeric printf. It isn't pretty but will do for now. There will be a better method to print MAC addresses soon.
1 parent 5990477 commit 048d3d7

File tree

8 files changed

+18
-57
lines changed

8 files changed

+18
-57
lines changed

bindings.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,24 +284,13 @@ void DeRestPluginPrivate::handleMgmtBindRspIndication(const deCONZ::ApsDataIndic
284284
stream >> seqNo;
285285
stream >> status;
286286

287-
if (btReader)
288-
{
289-
DBG_Printf(DBG_ZDP, "MgmtBind_rsp id: %d %s seq: %u, status 0x%02X \n", btReader->apsReq.id(),
290-
qPrintable(node->address().toStringExt()), seqNo, status);
291-
}
292-
else
293-
{
294-
DBG_Printf(DBG_ZDP, "MgmtBind_rsp (no BTR) %s seq: %u, status 0x%02X \n", qPrintable(node->address().toStringExt()), seqNo, status);
295-
}
296-
297287
if (status != deCONZ::ZdpSuccess)
298288
{
299289
if (status == deCONZ::ZdpNotPermitted ||
300290
status == deCONZ::ZdpNotSupported)
301291
{
302292
if (node->mgmtBindSupported())
303293
{
304-
DBG_Printf(DBG_ZDP, "MgmtBind_req/rsp %s not supported, deactivate \n", qPrintable(node->address().toStringExt()));
305294
node->setMgmtBindSupported(false);
306295
}
307296
}
@@ -347,7 +336,7 @@ void DeRestPluginPrivate::handleMgmtBindRspIndication(const deCONZ::ApsDataIndic
347336
btReader->state = BindingTableReader::StateFinished;
348337
}
349338

350-
enqueueEvent({RDevices, REventBindingTable, status, ind.srcAddress().ext()});
339+
enqueueEvent({RDevices, REventBindingTable, status, ind.srcAddress().ext()}); // TODO(mpi): I think this event is obsolete and should be removed
351340
}
352341

353342
while (listCount && !stream.atEnd())

de_web_plugin.cpp

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,7 +2527,6 @@ void DeRestPluginPrivate::addLightNode(const deCONZ::Node *node)
25272527
if (lightNode2->node() != node)
25282528
{
25292529
lightNode2->setNode(const_cast<deCONZ::Node*>(node));
2530-
DBG_Printf(DBG_INFO, "LightNode %s set node %s\n", qPrintable(lightNode2->id()), qPrintable(node->address().toStringExt()));
25312530
}
25322531

25332532
lightNode2->setManufacturerCode(node->nodeDescriptor().manufacturerCode());
@@ -2539,7 +2538,6 @@ void DeRestPluginPrivate::addLightNode(const deCONZ::Node *node)
25392538
{
25402539
// the node existed before
25412540
// refresh all with new values
2542-
DBG_Printf(DBG_INFO, "LightNode %u: %s updated\n", lightNode2->id().toUInt(), qPrintable(lightNode2->name()));
25432541
reachable->setValue(avail);
25442542
Event e(RLights, RStateReachable, lightNode2->id(), reachable);
25452543
enqueueEvent(e);
@@ -3354,7 +3352,6 @@ void DeRestPluginPrivate::nodeZombieStateChanged(const deCONZ::Node *node)
33543352
if (i->node() != node)
33553353
{
33563354
i->setNode(const_cast<deCONZ::Node*>(node));
3357-
DBG_Printf(DBG_INFO, "LightNode %s set node %s\n", qPrintable(i->id()), qPrintable(node->address().toStringExt()));
33583355
}
33593356

33603357
ResourceItem *item = i->item(RStateReachable);
@@ -3396,7 +3393,6 @@ void DeRestPluginPrivate::nodeZombieStateChanged(const deCONZ::Node *node)
33963393
if (i->node() != node)
33973394
{
33983395
i->setNode(const_cast<deCONZ::Node*>(node));
3399-
DBG_Printf(DBG_INFO, "Sensor %s set node %s\n", qPrintable(i->id()), qPrintable(node->address().toStringExt()));
34003396
}
34013397

34023398
checkSensorNodeReachable(&(*i));
@@ -3438,7 +3434,6 @@ LightNode *DeRestPluginPrivate::updateLightNode(const deCONZ::NodeEvent &event)
34383434
if (lightNode->node() != event.node())
34393435
{
34403436
lightNode->setNode(const_cast<deCONZ::Node*>(event.node()));
3441-
DBG_Printf(DBG_INFO, "LightNode %s set node %s\n", qPrintable(lightNode->id()), qPrintable(event.node()->address().toStringExt()));
34423437
}
34433438

34443439
if (lightNode->toBool(RStateReachable))
@@ -5568,7 +5563,6 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
55685563
if (i->node() != node)
55695564
{
55705565
i->setNode(const_cast<deCONZ::Node*>(node));
5571-
DBG_Printf(DBG_INFO, "SensorNode %s set node %s\n", qPrintable(i->id()), qPrintable(node->address().toStringExt()));
55725566

55735567
pushSensorInfoToCore(&*i);
55745568

@@ -5578,7 +5572,6 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
55785572
auto *itemPending = i->item(RConfigPending);
55795573
if (itemPending)
55805574
{
5581-
DBG_Printf(DBG_INFO, "Init Poll Control for %s\n", qPrintable(node->address().toStringExt()));
55825575
pollControlInitialized = true;
55835576
itemPending->setValue(itemPending->toNumber() | R_PENDING_WRITE_POLL_CHECKIN_INTERVAL | R_PENDING_SET_LONG_POLL_INTERVAL);
55845577
}
@@ -8437,7 +8430,6 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
84378430
if (i->node() != event.node())
84388431
{
84398432
i->setNode(const_cast<deCONZ::Node*>(event.node()));
8440-
DBG_Printf(DBG_INFO, "Sensor %s set node %s\n", qPrintable(i->id()), qPrintable(event.node()->address().toStringExt()));
84418433
}
84428434

84438435
if (event.event() == deCONZ::NodeEvent::UpdatedClusterDataZclReport ||
@@ -12064,14 +12056,6 @@ void DeRestPluginPrivate::processTasks()
1206412056

1206512057
if (!ok) // destination already busy
1206612058
{
12067-
if (i->req.dstAddressMode() == deCONZ::ApsExtAddress)
12068-
{
12069-
DBG_Printf(DBG_INFO_L2, "delay sending request %u ep: 0x%02X cluster 0x%04X to %s onAir %d\n", i->req.id(), i->req.dstEndpoint(), i->req.clusterId(), qPrintable(i->req.dstAddress().toStringExt()), onAir);
12070-
}
12071-
else if (i->req.dstAddressMode() == deCONZ::ApsGroupAddress)
12072-
{
12073-
DBG_Printf(DBG_INFO, "delay sending request %u - type: %d to group 0x%04X\n", i->req.id(), i->taskType, i->req.dstAddress().group());
12074-
}
1207512059
}
1207612060
else
1207712061
{
@@ -12247,7 +12231,6 @@ void DeRestPluginPrivate::nodeEvent(const deCONZ::NodeEvent &event)
1224712231

1224812232
case deCONZ::NodeEvent::NodeZombieChanged:
1224912233
{
12250-
DBG_Printf(DBG_INFO, "Node zombie state changed %s\n", qPrintable(event.node()->address().toStringExt()));
1225112234
nodeZombieStateChanged(event.node());
1225212235
}
1225312236
break;
@@ -12328,8 +12311,6 @@ void DeRestPluginPrivate::nodeEvent(const deCONZ::NodeEvent &event)
1232812311
}
1232912312
}
1233012313

12331-
DBG_Printf(DBG_INFO_L2, "Node data %s profileId: 0x%04X, clusterId: 0x%04X\n", qPrintable(event.node()->address().toStringExt()), event.profileId(), event.clusterId());
12332-
1233312314
// filter for supported sensor clusters
1233412315
switch (event.clusterId())
1233512316
{
@@ -12598,8 +12579,6 @@ void DeRestPluginPrivate::handleGroupClusterIndication(const deCONZ::ApsDataIndi
1259812579
lightNode->setGroupCapacity(capacity);
1259912580
lightNode->setGroupCount(count);
1260012581

12601-
// DBG_Printf(DBG_INFO, "verified group capacity: %u and group count: %u of LightNode %s\n", capacity, count, qPrintable(lightNode->address().toStringExt()));
12602-
1260312582
QVector<quint16> responseGroups;
1260412583
for (uint i = 0; i < count; i++)
1260512584
{
@@ -12610,7 +12589,7 @@ void DeRestPluginPrivate::handleGroupClusterIndication(const deCONZ::ApsDataIndi
1261012589

1261112590
responseGroups.push_back(groupId);
1261212591

12613-
DBG_Printf(DBG_INFO, "%s found group 0x%04X\n", qPrintable(lightNode->address().toStringExt()), groupId);
12592+
DBG_Printf(DBG_INFO, FMT_MAC " found group 0x%04X\n", (unsigned long long)lightNode->address().ext(), groupId);
1261412593

1261512594
foundGroup(groupId);
1261612595
foundGroupMembership(lightNode, groupId);
@@ -12629,7 +12608,7 @@ void DeRestPluginPrivate::handleGroupClusterIndication(const deCONZ::ApsDataIndi
1262912608
&& !responseGroups.contains(i->id)
1263012609
&& i->state == GroupInfo::StateInGroup)
1263112610
{
12632-
DBG_Printf(DBG_INFO, "restore group 0x%04X for lightNode %s\n", i->id, qPrintable(lightNode->address().toStringExt()));
12611+
DBG_Printf(DBG_INFO, FMT_MAC " restore group 0x%04X for lightNode\n", (unsigned long long)lightNode->address().ext(), i->id);
1263312612
i->actions &= ~GroupInfo::ActionRemoveFromGroup; // sanity
1263412613
i->actions |= GroupInfo::ActionAddToGroup;
1263512614
i->state = GroupInfo::StateInGroup;
@@ -12888,7 +12867,7 @@ void DeRestPluginPrivate::handleSceneClusterIndication(const deCONZ::ApsDataIndi
1288812867

1288912868
if (i != v.end())
1289012869
{
12891-
DBG_Printf(DBG_INFO, "Added/stored scene %u in node %s Response. Status: 0x%02X\n", sceneId, qPrintable(lightNode->address().toStringExt()), status);
12870+
DBG_Printf(DBG_INFO, FMT_MAC " added/stored scene %u response status: 0x%02X\n", (unsigned long long)lightNode->address().ext(), sceneId, status);
1289212871
groupInfo->addScenes.erase(i);
1289312872

1289412873
if (status == 0x00)
@@ -13148,8 +13127,7 @@ void DeRestPluginPrivate::handleSceneClusterIndication(const deCONZ::ApsDataIndi
1314813127

1314913128
if (i != v.end())
1315013129
{
13151-
DBG_Printf(DBG_INFO, "Modified scene %u in node %s status 0x%02X\n", sceneId, qPrintable(lightNode->address().toStringExt()), status);
13152-
13130+
DBG_Printf(DBG_INFO, FMT_MAC " modified scene %u status 0x%02X\n", (unsigned long long)lightNode->address().ext(), sceneId, status);
1315313131
if (status == deCONZ::ZclSuccessStatus)
1315413132
{
1315513133
groupInfo->modifyScenesRetries = 0;
@@ -13874,7 +13852,7 @@ void DeRestPluginPrivate::handleCommissioningClusterIndication(const deCONZ::Aps
1387413852
stream >> startIndex;
1387513853
stream >> count;
1387613854

13877-
DBG_Printf(DBG_INFO, "Get group identifiers response of sensor %s. Count: %u\n", qPrintable(sensorNode->address().toStringExt()), count);
13855+
DBG_Printf(DBG_INFO, FMT_MAC " get ZLL group identifiers response: count: %u\n", (unsigned long long)sensorNode->address().ext(), unsigned(count));
1387813856

1387913857
while (!stream.atEnd() && epIter < count)
1388013858
{

de_web_widget.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2020 dresden elektronik ingenieurtechnik gmbh.
2+
* Copyright (c) 2013-2023 dresden elektronik ingenieurtechnik gmbh.
33
* All rights reserved.
44
*
55
* The software in this package is published under the terms of the BSD
@@ -118,7 +118,6 @@ void DeRestWidget::readBindingTableTriggered()
118118
{
119119
if (m_selectedNodeAddress.hasExt())
120120
{
121-
122121
auto *restNode = dynamic_cast<RestNodeBase*>(plugin->d->getLightNodeForAddress(m_selectedNodeAddress));
123122

124123
if (!restNode)
@@ -129,7 +128,6 @@ void DeRestWidget::readBindingTableTriggered()
129128
if (restNode)
130129
{
131130
restNode->setMgmtBindSupported(true);
132-
DBG_Printf(DBG_INFO, "read binding table for %s (%s) \n", qPrintable(m_selectedNodeAddress.toStringExt()), qPrintable(m_selectedNodeAddress.toStringNwk()));
133131
plugin->d->readBindingTable(restNode, 0);
134132
}
135133
}

reset_device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ void DeRestPluginPrivate::handleMgmtLeaveRspIndication(const deCONZ::ApsDataIndi
226226
stream >> seqNo; // use SeqNo ?
227227
stream >> status;
228228

229-
DBG_Printf(DBG_INFO, "MgmtLeave_rsp %s seq: %u, status 0x%02X \n", qPrintable(ind.srcAddress().toStringExt()), seqNo, status);
229+
DBG_Printf(DBG_INFO, "MgmtLeave_rsp " FMT_MAC " seq: %u, status 0x%02X \n", (unsigned long long)ind.srcAddress().ext(), seqNo, status);
230230

231231
if (status == deCONZ::ZdpSuccess || status == deCONZ::ZdpNotSupported)
232232
{

rest_lights.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ int DeRestPluginPrivate::setLightState(const ApiRequest &req, ApiResponse &rsp)
16101610

16111611
if (!taskRef.lightNode->stateChanges().empty())
16121612
{
1613-
DBG_Printf(DBG_INFO, "emit event/tick: %s\n", qPrintable(taskRef.lightNode->address().toStringExt()));
1613+
DBG_Printf(DBG_INFO, "emit event/tick: " FMT_MAC "\n", (unsigned long long)taskRef.lightNode->address().ext());
16141614
enqueueEvent({taskRef.lightNode->prefix(), REventTick, taskRef.lightNode->uniqueId(), taskRef.lightNode->address().ext()});
16151615
}
16161616

rest_touchlink.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016 dresden elektronik ingenieurtechnik gmbh.
2+
* Copyright (c) 2016-2023 dresden elektronik ingenieurtechnik gmbh.
33
* All rights reserved.
44
*
55
* The software in this package is published under the terms of the BSD
@@ -174,7 +174,7 @@ int DeRestPluginPrivate::getTouchlinkScanResults(const ApiRequest &req, ApiRespo
174174
for (; i != end; ++i)
175175
{
176176
QVariantMap item;
177-
item["address"] = i->address.toStringExt();
177+
item["address"] = QString("0x%1").arg(i->address.ext(), int(16), int(16), QChar('0'));
178178
item["factorynew"] = i->factoryNew;
179179
item["rssi"] = (double)i->rssi;
180180
item["channel"] = (double)i->channel;
@@ -793,8 +793,8 @@ void DeRestPluginPrivate::interpanDataIndication(const QByteArray &data)
793793
scanResponse.transactionId = touchlinkReq.transactionId();
794794
scanResponse.rssi = rssi;
795795

796-
DBG_Printf(DBG_TLINK, "scan response %s, fn=%u, channel=%u rssi=%d TrId=0x%08X in state=%d action=%d\n",
797-
qPrintable(scanResponse.address.toStringExt()),
796+
DBG_Printf(DBG_TLINK, "scan response " FMT_MAC ", fn=%u, channel=%u rssi=%d TrId=0x%08X in state=%d action=%d\n",
797+
(unsigned long long)scanResponse.address.ext(),
798798
scanResponse.factoryNew, touchlinkChannel, rssi, scanResponse.transactionId,
799799
touchlinkState, touchlinkAction);
800800

window_covering.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@
6969
* To leave calibration mode, clear bit #1 in the Mode attribute, e.g. write attribute 0x0017 as 0x00.
7070
*/
7171

72-
73-
74-
#include "de_web_plugin.h"
7572
#include "de_web_plugin_private.h"
7673
#include "product_match.h"
7774

@@ -646,10 +643,10 @@ void DeRestPluginPrivate::calibrateWindowCoveringNextStep()
646643
TaskItem task;
647644
copyTaskReq(calibrationTask, task);
648645

649-
DBG_Printf(DBG_INFO, "ubisys NextStep calibrationStep = %d, task=%s calibrationTask = %s \n",
646+
DBG_Printf(DBG_INFO, "ubisys NextStep calibrationStep = %d, task=" FMT_MAC " calibrationTask = " FMT_MAC "\n",
650647
calibrationStep,
651-
qPrintable(task.req.dstAddress().toStringExt()),
652-
qPrintable(calibrationTask.req.dstAddress().toStringExt()));
648+
(unsigned long long)task.req.dstAddress().ext(),
649+
(unsigned long long)calibrationTask.req.dstAddress().ext());
653650

654651
switch(calibrationStep)
655652
{

zdp/zdp_handlers.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021 dresden elektronik ingenieurtechnik gmbh.
2+
* Copyright (c) 2021-2023 dresden elektronik ingenieurtechnik gmbh.
33
* All rights reserved.
44
*
55
* The software in this package is published under the terms of the BSD
@@ -8,7 +8,6 @@
88
*
99
*/
1010

11-
#include "de_web_plugin.h"
1211
#include "de_web_plugin_private.h"
1312
#include "utils/utils.h"
1413
#include "zdp_handlers.h"
@@ -131,7 +130,7 @@ void DeRestPluginPrivate::handleDeviceAnnceIndication(const deCONZ::ApsDataIndic
131130
updateEtag(gwConfigEtag);
132131
}
133132

134-
DBG_Printf(DBG_INFO, "DeviceAnnce of LightNode: %s Permit Join: %i\n", qPrintable(i->address().toStringExt()), gwPermitJoinDuration);
133+
DBG_Printf(DBG_INFO, "DeviceAnnce of LightNode: " FMT_MAC " Permit Join: %i\n", (unsigned long long)i->address().ext(), gwPermitJoinDuration);
135134

136135
// force reading attributes
137136
i->enableRead(READ_GROUPS | READ_SCENES);

0 commit comments

Comments
 (0)