From 2aa22ee262c9ca8c405b59e8d7c406b574c76faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 10 Oct 2022 16:33:01 +0200 Subject: [PATCH] Update all debug operators and make use of state saver --- .../interface/zigbeeinterfacedeconzreply.cpp | 3 ++- .../deconz/zigbeebridgecontrollerdeconz.cpp | 6 ++++-- .../nxp/interface/zigbeeinterfacenxpreply.cpp | 3 ++- .../backends/ti/zigbeebridgecontrollerti.cpp | 3 ++- libnymea-zigbee/zcl/ota/zigbeeclusterota.cpp | 3 ++- libnymea-zigbee/zcl/zigbeecluster.cpp | 6 ++++-- libnymea-zigbee/zcl/zigbeeclusterattribute.cpp | 3 ++- libnymea-zigbee/zcl/zigbeeclusterlibrary.cpp | 18 ++++++++++++------ libnymea-zigbee/zdo/zigbeedeviceprofile.cpp | 13 +++++++++++-- libnymea-zigbee/zigbee.cpp | 9 ++++++--- libnymea-zigbee/zigbeechannelmask.cpp | 3 ++- libnymea-zigbee/zigbeedatatype.cpp | 3 ++- libnymea-zigbee/zigbeenetwork.cpp | 3 ++- libnymea-zigbee/zigbeenetworkkey.cpp | 3 ++- libnymea-zigbee/zigbeenetworkrequest.cpp | 3 ++- libnymea-zigbee/zigbeenode.cpp | 3 ++- libnymea-zigbee/zigbeenodeendpoint.cpp | 3 ++- libnymea-zigbee/zigbeeuartadapter.cpp | 3 ++- 18 files changed, 63 insertions(+), 28 deletions(-) diff --git a/libnymea-zigbee/backends/deconz/interface/zigbeeinterfacedeconzreply.cpp b/libnymea-zigbee/backends/deconz/interface/zigbeeinterfacedeconzreply.cpp index 66015d4..a8138a6 100644 --- a/libnymea-zigbee/backends/deconz/interface/zigbeeinterfacedeconzreply.cpp +++ b/libnymea-zigbee/backends/deconz/interface/zigbeeinterfacedeconzreply.cpp @@ -105,6 +105,7 @@ void ZigbeeInterfaceDeconzReply::onTimeout() QDebug operator<<(QDebug debug, ZigbeeInterfaceDeconzReply *reply) { + QDebugStateSaver saver(debug); debug.nospace() << "InterfaceReply(" << reply->requestName() << ", " << reply->sequenceNumber() << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/backends/deconz/zigbeebridgecontrollerdeconz.cpp b/libnymea-zigbee/backends/deconz/zigbeebridgecontrollerdeconz.cpp index d76dfd7..5e66b31 100644 --- a/libnymea-zigbee/backends/deconz/zigbeebridgecontrollerdeconz.cpp +++ b/libnymea-zigbee/backends/deconz/zigbeebridgecontrollerdeconz.cpp @@ -1084,6 +1084,7 @@ void ZigbeeBridgeControllerDeconz::disable() QDebug operator<<(QDebug debug, const DeconzDeviceState &deviceState) { + QDebugStateSaver saver(debug); debug.nospace() << "DeviceState("; switch (deviceState.networkState) { case Deconz::NetworkStateJoining: @@ -1104,11 +1105,12 @@ QDebug operator<<(QDebug debug, const DeconzDeviceState &deviceState) debug.nospace() << "Indication=" << static_cast(deviceState.apsDataIndication) << ", "; debug.nospace() << "ConfigChanged=" << static_cast(deviceState.configurationChanged) << ", "; debug.nospace() << "CanSend=" << deviceState.apsDataRequestFreeSlots << ")"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const DeconzNetworkConfiguration &configuration) { + QDebugStateSaver saver(debug); debug.nospace() << "Network configuration: " << "\n"; debug.nospace() << " - Node type:" << configuration.nodeType << "\n"; debug.nospace() << " - IEEE address: " << configuration.ieeeAddress.toString() << "\n"; @@ -1124,5 +1126,5 @@ QDebug operator<<(QDebug debug, const DeconzNetworkConfiguration &configuration) debug.nospace() << " - Protocol version: " << ZigbeeUtils::convertUint16ToHexString(configuration.protocolVersion) << "\n"; debug.nospace() << " - Network update ID: " << ZigbeeUtils::convertByteToHexString(configuration.networkUpdateId) << "\n"; debug.nospace() << " - Watchdog TTL: " << configuration.watchdogTimeout << "\n"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.cpp b/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.cpp index 5898d9f..ced13f4 100644 --- a/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.cpp +++ b/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.cpp @@ -106,6 +106,7 @@ void ZigbeeInterfaceNxpReply::onTimeout() QDebug operator<<(QDebug debug, ZigbeeInterfaceNxpReply *reply) { + QDebugStateSaver saver(debug); debug.nospace() << "InterfaceReply(" << reply->requestName() << ", " << reply->sequenceNumber() << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/backends/ti/zigbeebridgecontrollerti.cpp b/libnymea-zigbee/backends/ti/zigbeebridgecontrollerti.cpp index 86666b8..d24c910 100644 --- a/libnymea-zigbee/backends/ti/zigbeebridgecontrollerti.cpp +++ b/libnymea-zigbee/backends/ti/zigbeebridgecontrollerti.cpp @@ -1044,6 +1044,7 @@ void ZigbeeBridgeControllerTi::disable() QDebug operator<<(QDebug debug, const TiNetworkConfiguration &configuration) { + QDebugStateSaver saver(debug); debug.nospace() << "Network configuration: " << "\n"; debug.nospace() << " - IEEE address: " << configuration.ieeeAddress.toString() << "\n"; debug.nospace() << " - NWK address: " << ZigbeeUtils::convertUint16ToHexString(configuration.shortAddress) << "\n"; @@ -1052,6 +1053,6 @@ QDebug operator<<(QDebug debug, const TiNetworkConfiguration &configuration) debug.nospace() << " - Channel mask: " << ZigbeeChannelMask(configuration.channelMask) << "\n"; debug.nospace() << " - Channel: " << configuration.currentChannel << "\n"; debug.nospace() << " - ZNP version: " << ZigbeeUtils::convertUint16ToHexString(configuration.znpVersion) << "\n"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zcl/ota/zigbeeclusterota.cpp b/libnymea-zigbee/zcl/ota/zigbeeclusterota.cpp index d8c4245..14b2d0f 100644 --- a/libnymea-zigbee/zcl/ota/zigbeeclusterota.cpp +++ b/libnymea-zigbee/zcl/ota/zigbeeclusterota.cpp @@ -108,9 +108,10 @@ void ZigbeeClusterOta::processDataIndication(ZigbeeClusterLibrary::Frame frame) QDebug operator<<(QDebug debug, const ZigbeeClusterOta::FileVersion &fileVersion) { + QDebugStateSaver saver(debug); debug.nospace().noquote() << "FileVersion(Application Release: " << fileVersion.applicationRelease << ", Application Build: " << fileVersion.applicationBuild << ", Stack Release: " << fileVersion.stackRelease << ", Stack Build: " << fileVersion.stackBuild << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zcl/zigbeecluster.cpp b/libnymea-zigbee/zcl/zigbeecluster.cpp index ef161c2..ac85a5f 100644 --- a/libnymea-zigbee/zcl/zigbeecluster.cpp +++ b/libnymea-zigbee/zcl/zigbeecluster.cpp @@ -484,6 +484,7 @@ void ZigbeeCluster::processApsDataIndication(const QByteArray &asdu, const Zigbe QDebug operator<<(QDebug debug, ZigbeeCluster *cluster) { + QDebugStateSaver saver(debug); debug.nospace().noquote() << "ZigbeeCluster(" << ZigbeeUtils::convertUint16ToHexString(static_cast(cluster->clusterId())) << ", " << cluster->clusterName() << ", "; @@ -496,11 +497,12 @@ QDebug operator<<(QDebug debug, ZigbeeCluster *cluster) break; } - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const ZigbeeClusterAttributeReport &attributeReport) { + QDebugStateSaver saver(debug); debug.nospace().noquote() << "AttributeReport(" << attributeReport.clusterId << ", " << attributeReport.attributeId << ", " @@ -509,6 +511,6 @@ QDebug operator<<(QDebug debug, const ZigbeeClusterAttributeReport &attributeRep << ZigbeeUtils::convertByteArrayToHexString(attributeReport.data) << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zcl/zigbeeclusterattribute.cpp b/libnymea-zigbee/zcl/zigbeeclusterattribute.cpp index 2ae659b..bd9ece6 100644 --- a/libnymea-zigbee/zcl/zigbeeclusterattribute.cpp +++ b/libnymea-zigbee/zcl/zigbeeclusterattribute.cpp @@ -80,9 +80,10 @@ bool ZigbeeClusterAttribute::isValid() const QDebug operator<<(QDebug debug, const ZigbeeClusterAttribute &attribute) { + QDebugStateSaver saver(debug); debug.nospace().noquote() << "ZigbeeClusterAttribute(" << ZigbeeUtils::convertUint16ToHexString(attribute.id()) << ", " << attribute.dataType() << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zcl/zigbeeclusterlibrary.cpp b/libnymea-zigbee/zcl/zigbeeclusterlibrary.cpp index 6af02a2..b3abcf6 100644 --- a/libnymea-zigbee/zcl/zigbeeclusterlibrary.cpp +++ b/libnymea-zigbee/zcl/zigbeeclusterlibrary.cpp @@ -309,6 +309,7 @@ QList ZigbeeClusterLibrary QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::FrameControl &frameControl) { + QDebugStateSaver saver(debug); debug.nospace() << "FrameControl("; if (frameControl.frameType == ZigbeeClusterLibrary::FrameTypeGlobal) { debug.nospace() << "Frame Type: Global" << ", "; @@ -325,11 +326,12 @@ QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::FrameControl &frameC } debug.nospace() << "Disable default response: " << (frameControl.disableDefaultResponse ? "1" : "0") << ")"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::Header &header) { + QDebugStateSaver saver(debug); debug.nospace() << "Header("; debug.nospace() << header.frameControl; if (header.frameControl.manufacturerSpecific) { @@ -337,19 +339,21 @@ QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::Header &header) } debug.nospace() << "TSN:" << header.transactionSequenceNumber << ", "; debug.nospace() << header.command << ")"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::Frame &frame) { + QDebugStateSaver saver(debug); debug.nospace() << "Frame("; debug.nospace() << frame.header; debug.nospace() << ZigbeeUtils::convertByteArrayToHexString(frame.payload) << ")"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::ReadAttributeStatusRecord &attributeStatusRecord) { + QDebugStateSaver saver(debug); debug.nospace() << "ReadAttributeStatusRecord(" << ZigbeeUtils::convertUint16ToHexString(attributeStatusRecord.attributeId) << ", " << attributeStatusRecord.attributeStatus; @@ -357,11 +361,12 @@ QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::ReadAttributeStatusR debug.nospace() << ", " << attributeStatusRecord.dataType; } debug.nospace() << ")"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::AttributeReportingConfiguration &attributeReportingConfiguration) { + QDebugStateSaver saver(debug); debug.nospace() << "AttributeReportingConfiguration(" << attributeReportingConfiguration.direction << ", " << ZigbeeUtils::convertUint16ToHexString(attributeReportingConfiguration.attributeId) << ", " @@ -371,16 +376,17 @@ QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::AttributeReportingCo << "Change: " << ZigbeeUtils::convertByteArrayToHexString(attributeReportingConfiguration.reportableChange) << ", " << "Timeout period: " << attributeReportingConfiguration.timeoutPeriod << "[s]" << ")"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::AttributeReportingStatusRecord &attributeReportingStatusRecord) { + QDebugStateSaver saver(debug); debug.nospace() << "AttributeReportingConfiguration(" << attributeReportingStatusRecord.status << ", " << attributeReportingStatusRecord.attributeId << ", " << attributeReportingStatusRecord.direction << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zdo/zigbeedeviceprofile.cpp b/libnymea-zigbee/zdo/zigbeedeviceprofile.cpp index 1362446..f7c1b5c 100644 --- a/libnymea-zigbee/zdo/zigbeedeviceprofile.cpp +++ b/libnymea-zigbee/zdo/zigbeedeviceprofile.cpp @@ -250,15 +250,17 @@ ZigbeeDeviceProfile::Adpu ZigbeeDeviceProfile::parseAdpu(const QByteArray &adpu) QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::Adpu &adpu) { + QDebugStateSaver saver(debug); debug.nospace() << "DeviceProfileAdpu(SQN: " << adpu.transactionSequenceNumber << ", "; debug.nospace() << adpu.status << ", "; debug.nospace() << ZigbeeUtils::convertUint16ToHexString(adpu.addressOfInterest) << ", "; debug.nospace() << "Payload: " << ZigbeeUtils::convertByteArrayToHexString(adpu.payload) << ")"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NodeDescriptor &nodeDescriptor) { + QDebugStateSaver saver(debug); debug.nospace() << "NodeDescriptor(" << nodeDescriptor.nodeType << ")" << "\n"; debug.nospace() << " Complex descriptor available: " << nodeDescriptor.complexDescriptorAvailable << "\n"; debug.nospace() << " User descriptor available: " << nodeDescriptor.userDescriptorAvailable << "\n"; @@ -275,6 +277,7 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NodeDescriptor &nodeD QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::MacCapabilities &macCapabilities) { + QDebugStateSaver saver(debug); debug.nospace() << "MacCapabilities(" << ZigbeeUtils::convertByteToHexString(macCapabilities.flag) << ")" << "\n"; debug.nospace() << " Alternate PAN Coordinator: " << macCapabilities.alternatePanCoordinator << "\n"; debug.nospace() << " " << macCapabilities.deviceType << "\n"; @@ -287,6 +290,7 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::MacCapabilities &macC QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::ServerMask &serverMask) { + QDebugStateSaver saver(debug); debug.nospace() << "ServerMask(" << ZigbeeUtils::convertUint16ToHexString(serverMask.serverMaskFlag) << ")" << "\n"; debug.nospace() << " Primary trust center: " << serverMask.primaryTrustCenter << "\n"; debug.nospace() << " Backup trust center: " << serverMask.backupTrustCenter << "\n"; @@ -300,6 +304,7 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::ServerMask &serverMas QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::DescriptorCapabilities &descriptorCapabilities) { + QDebugStateSaver saver(debug); debug.nospace() << "DescriptorCapabilities(" << ZigbeeUtils::convertByteToHexString(descriptorCapabilities.descriptorCapabilitiesFlag) << ")" << "\n"; debug.nospace() << " Extended active endpoint list available: " << descriptorCapabilities.extendedActiveEndpointListAvailable << "\n"; debug.nospace() << " Extended simple descriptor list available: " << descriptorCapabilities.extendedSimpleDescriptorListAvailable; @@ -308,6 +313,7 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::DescriptorCapabilitie QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::PowerDescriptor &powerDescriptor) { + QDebugStateSaver saver(debug); debug.nospace() << "PowerDescriptor(" << ZigbeeUtils::convertByteToHexString(powerDescriptor.powerDescriptoFlag) << ")" << "\n"; debug.nospace() << " Power mode: " << powerDescriptor.powerMode << "\n"; debug.nospace() << " Available power sources: " << powerDescriptor.availablePowerSources << "\n"; @@ -318,6 +324,7 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::PowerDescriptor &powe QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::BindingTableListRecord &bindingTableListRecord) { + QDebugStateSaver saver(debug); debug.nospace() << "BindingTableListRecord(" << bindingTableListRecord.sourceAddress.toString() << ", "; debug.nospace() << "source endpoint: " << bindingTableListRecord.sourceEndpoint << ", "; debug.nospace() << "cluster: " << static_cast(bindingTableListRecord.clusterId) << " --> "; @@ -337,6 +344,7 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::BindingTableListRecor QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NeighborTableListRecord &neighborTableListRecord) { + QDebugStateSaver saver(debug); debug.nospace() << "NeighborTableListRecord(" << neighborTableListRecord.ieeeAddress.toString() << ", "; debug.nospace() << "NWK address: " << ZigbeeUtils::convertUint16ToHexString(neighborTableListRecord.shortAddress) << ", "; debug.nospace() << "Extended PAN ID: " << neighborTableListRecord.extendedPanId << ", "; @@ -345,12 +353,13 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NeighborTableListReco debug.nospace() << "Relationship: " << neighborTableListRecord.relationship << ", "; debug.nospace() << "Permit join: " << neighborTableListRecord.permitJoining << ", "; debug.nospace() << "Depth: " << neighborTableListRecord.depth << ", "; - debug.nospace() << "LQI: " << neighborTableListRecord.lqi << ") "; + debug.nospace() << "LQI: " << neighborTableListRecord.lqi << ")"; return debug; } QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::RoutingTableListRecord &routingTableListRecord) { + QDebugStateSaver saver(debug); debug.nospace() << "RoutingTableListRecord("; debug.nospace() << "Destination address: " << ZigbeeUtils::convertUint16ToHexString(routingTableListRecord.destinationAddress) << ", "; debug.nospace() << "Next hop: " << routingTableListRecord.nextHopAddress << ", "; diff --git a/libnymea-zigbee/zigbee.cpp b/libnymea-zigbee/zigbee.cpp index 144440a..e50f487 100644 --- a/libnymea-zigbee/zigbee.cpp +++ b/libnymea-zigbee/zigbee.cpp @@ -31,6 +31,7 @@ QDebug operator<<(QDebug debug, const Zigbee::ApsdeDataConfirm &confirm) { + QDebugStateSaver saver(debug); debug.nospace() << "APSDE-DATA.confirm("; debug.nospace() << "SQN: " << confirm.requestId << ", "; @@ -48,11 +49,12 @@ QDebug operator<<(QDebug debug, const Zigbee::ApsdeDataConfirm &confirm) debug.nospace() << "Status:" << ZigbeeUtils::zigbeeStatusToString(confirm.zigbeeStatusCode); debug.nospace() << ")"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const Zigbee::ApsdeDataIndication &indication) { + QDebugStateSaver saver(debug); debug.nospace() << "APSDE-DATA.indication("; if (indication.destinationAddressMode == Zigbee::DestinationAddressModeGroup) debug.nospace() << "Group address:" << ZigbeeUtils::convertUint16ToHexString(indication.destinationShortAddress) << ", "; @@ -82,11 +84,12 @@ QDebug operator<<(QDebug debug, const Zigbee::ApsdeDataIndication &indication) debug.nospace() << "ASDU: " << ZigbeeUtils::convertByteArrayToHexString(indication.asdu) << ", "; debug.nospace() << "LQI: " << indication.lqi << ", "; debug.nospace() << "RSSI: " << indication.rssi << "dBm)"; - return debug.space(); + return debug; } QDebug operator<<(QDebug debug, const Zigbee::ApsdeDataAck &acknowledgement) { + QDebugStateSaver saver(debug); debug.nospace() << "APSDE-DATA.acknowledgement("; debug.nospace() << "SQN: " << acknowledgement.requestId << ", "; if (acknowledgement.destinationAddressMode == Zigbee::DestinationAddressModeGroup) { @@ -104,5 +107,5 @@ QDebug operator<<(QDebug debug, const Zigbee::ApsdeDataAck &acknowledgement) } debug.nospace() << "Status:" << ZigbeeUtils::zigbeeStatusToString(acknowledgement.zigbeeStatusCode); debug.nospace() << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zigbeechannelmask.cpp b/libnymea-zigbee/zigbeechannelmask.cpp index e3ed233..219d960 100644 --- a/libnymea-zigbee/zigbeechannelmask.cpp +++ b/libnymea-zigbee/zigbeechannelmask.cpp @@ -148,9 +148,10 @@ bool ZigbeeChannelMask::operator!=(const ZigbeeChannelMask &other) const QDebug operator<<(QDebug debug, const ZigbeeChannelMask &channelMaks) { + QDebugStateSaver saver(debug); debug.nospace() << "ChannelMask(" << ZigbeeUtils::convertUint32ToHexString(channelMaks.toUInt32()); debug.nospace() << ", " << channelMaks.channelArray(); - debug.nospace() << ") "; + debug.nospace() << ")"; return debug; } diff --git a/libnymea-zigbee/zigbeedatatype.cpp b/libnymea-zigbee/zigbeedatatype.cpp index 59d2554..3655c63 100644 --- a/libnymea-zigbee/zigbeedatatype.cpp +++ b/libnymea-zigbee/zigbeedatatype.cpp @@ -1165,6 +1165,7 @@ void ZigbeeDataType::setDataType(Zigbee::DataType dataType) QDebug operator<<(QDebug debug, const ZigbeeDataType &dataType) { // FIXME: print data depending on the datatype + QDebugStateSaver saver(debug); debug.nospace() << "ZigbeeDataType(" << dataType.name(); switch (dataType.dataType()) { case Zigbee::OctetString: @@ -1178,5 +1179,5 @@ QDebug operator<<(QDebug debug, const ZigbeeDataType &dataType) } debug.nospace() << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zigbeenetwork.cpp b/libnymea-zigbee/zigbeenetwork.cpp index 679568b..1927e4d 100644 --- a/libnymea-zigbee/zigbeenetwork.cpp +++ b/libnymea-zigbee/zigbeenetwork.cpp @@ -1000,11 +1000,12 @@ void ZigbeeNetwork::evaluateNodeReachableStates() QDebug operator<<(QDebug debug, ZigbeeNetwork *network) { + QDebugStateSaver saver(debug); debug.nospace().noquote() << "ZigbeeNetwork(" << network->macAddress().toString() << ", " << network->networkUuid().toString() << ", " << network->backendType() << ", " << "Channel: " << network->channel() << ", " << network->state() << ")"; - return debug.space().quote(); + return debug; } diff --git a/libnymea-zigbee/zigbeenetworkkey.cpp b/libnymea-zigbee/zigbeenetworkkey.cpp index 95f4212..a79b4e9 100644 --- a/libnymea-zigbee/zigbeenetworkkey.cpp +++ b/libnymea-zigbee/zigbeenetworkkey.cpp @@ -114,6 +114,7 @@ bool ZigbeeNetworkKey::operator!=(const ZigbeeNetworkKey &other) const QDebug operator<<(QDebug debug, const ZigbeeNetworkKey &key) { + QDebugStateSaver saver(debug); debug.nospace() << "ZigbeeNetworkKey(" << key.toString() << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zigbeenetworkrequest.cpp b/libnymea-zigbee/zigbeenetworkrequest.cpp index d1b6ad5..9851003 100644 --- a/libnymea-zigbee/zigbeenetworkrequest.cpp +++ b/libnymea-zigbee/zigbeenetworkrequest.cpp @@ -146,6 +146,7 @@ void ZigbeeNetworkRequest::setRadius(quint8 radius) QDebug operator<<(QDebug debug, const ZigbeeNetworkRequest &request) { + QDebugStateSaver saver(debug); debug.nospace() << "Request(ID:" << request.requestId() << ", "; debug.nospace() << static_cast(request.profileId()) << ", "; if (request.profileId() == Zigbee::ZigbeeProfileDevice) { @@ -169,5 +170,5 @@ QDebug operator<<(QDebug debug, const ZigbeeNetworkRequest &request) debug.nospace() << request.txOptions() << ", "; debug.nospace() << ZigbeeUtils::convertByteArrayToHexString(request.asdu()); debug.nospace() << ")"; - return debug.space(); + return debug; } diff --git a/libnymea-zigbee/zigbeenode.cpp b/libnymea-zigbee/zigbeenode.cpp index 6726921..c523381 100644 --- a/libnymea-zigbee/zigbeenode.cpp +++ b/libnymea-zigbee/zigbeenode.cpp @@ -953,6 +953,7 @@ void ZigbeeNode::handleZigbeeClusterLibraryIndication(const Zigbee::ApsdeDataInd QDebug operator<<(QDebug debug, ZigbeeNode *node) { + QDebugStateSaver saver(debug); debug.nospace().noquote() << "ZigbeeNode(" << ZigbeeUtils::convertUint16ToHexString(node->shortAddress()); debug.nospace().noquote() << ", " << node->extendedAddress().toString(); if (!node->manufacturerName().isEmpty()) @@ -977,5 +978,5 @@ QDebug operator<<(QDebug debug, ZigbeeNode *node) debug.nospace().noquote() << ", RxOn:" << node->macCapabilities().receiverOnWhenIdle; debug.nospace().noquote() << ")"; - return debug.space().quote(); + return debug; } diff --git a/libnymea-zigbee/zigbeenodeendpoint.cpp b/libnymea-zigbee/zigbeenodeendpoint.cpp index 6ec23a0..7d138d9 100644 --- a/libnymea-zigbee/zigbeenodeendpoint.cpp +++ b/libnymea-zigbee/zigbeenodeendpoint.cpp @@ -352,6 +352,7 @@ void ZigbeeNodeEndpoint::handleZigbeeClusterLibraryIndication(const Zigbee::Apsd QDebug operator<<(QDebug debug, ZigbeeNodeEndpoint *endpoint) { + QDebugStateSaver saver(debug); debug.nospace().noquote() << "ZigbeeNodeEndpoint(" << ZigbeeUtils::convertByteToHexString(endpoint->endpointId()); debug.nospace().noquote() << ", " << endpoint->profile(); if (endpoint->profile() == Zigbee::ZigbeeProfileLightLink) { @@ -363,5 +364,5 @@ QDebug operator<<(QDebug debug, ZigbeeNodeEndpoint *endpoint) } debug.nospace().noquote() << ")"; - return debug.space().quote(); + return debug; } diff --git a/libnymea-zigbee/zigbeeuartadapter.cpp b/libnymea-zigbee/zigbeeuartadapter.cpp index 5d26f50..235c29e 100644 --- a/libnymea-zigbee/zigbeeuartadapter.cpp +++ b/libnymea-zigbee/zigbeeuartadapter.cpp @@ -104,6 +104,7 @@ void ZigbeeUartAdapter::setBaudRate(qint32 baudRate) QDebug operator<<(QDebug debug, const ZigbeeUartAdapter &adapter) { + QDebugStateSaver saver(debug); debug.nospace() << "ZigbeeUartAdapter(" << adapter.name() << " - " << adapter.description(); debug.nospace() << ", " << adapter.serialPort(); if (!adapter.serialNumber().isEmpty()) { @@ -115,5 +116,5 @@ QDebug operator<<(QDebug debug, const ZigbeeUartAdapter &adapter) } debug.nospace() << ")"; - return debug.space(); + return debug; }