Merge PR #70: Update all debug operators and make use of state saver

pull/74/head
jenkins 2022-10-17 11:20:00 +02:00
commit 4ea83aa44c
18 changed files with 63 additions and 28 deletions

View File

@ -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;
}

View File

@ -1097,6 +1097,7 @@ void ZigbeeBridgeControllerDeconz::disable()
QDebug operator<<(QDebug debug, const DeconzDeviceState &deviceState)
{
QDebugStateSaver saver(debug);
debug.nospace() << "DeviceState(";
switch (deviceState.networkState) {
case Deconz::NetworkStateJoining:
@ -1117,11 +1118,12 @@ QDebug operator<<(QDebug debug, const DeconzDeviceState &deviceState)
debug.nospace() << "Indication=" << static_cast<int>(deviceState.apsDataIndication) << ", ";
debug.nospace() << "ConfigChanged=" << static_cast<int>(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";
@ -1137,5 +1139,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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -272,9 +272,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;
}

View File

@ -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<quint16>(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;
}

View File

@ -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;
}

View File

@ -310,6 +310,7 @@ QList<ZigbeeClusterLibrary::AttributeReportingStatusRecord> 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" << ", ";
@ -326,11 +327,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) {
@ -338,19 +340,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;
@ -358,11 +362,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) << ", "
@ -372,16 +377,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;
}

View File

@ -290,15 +290,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";
@ -315,6 +317,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";
@ -327,6 +330,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";
@ -340,6 +344,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;
@ -348,6 +353,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";
@ -358,6 +364,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<ZigbeeClusterLibrary::ClusterId>(bindingTableListRecord.clusterId) << " --> ";
@ -377,6 +384,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 << ", ";
@ -385,12 +393,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 << ", ";

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1004,11 +1004,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;
}

View File

@ -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;
}

View File

@ -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<Zigbee::ZigbeeProfile>(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;
}

View File

@ -1060,6 +1060,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())
@ -1084,5 +1085,5 @@ QDebug operator<<(QDebug debug, ZigbeeNode *node)
debug.nospace().noquote() << ", RxOn:" << node->macCapabilities().receiverOnWhenIdle;
debug.nospace().noquote() << ")";
return debug.space().quote();
return debug;
}

View File

@ -355,6 +355,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) {
@ -366,5 +367,5 @@ QDebug operator<<(QDebug debug, ZigbeeNodeEndpoint *endpoint)
}
debug.nospace().noquote() << ")";
return debug.space().quote();
return debug;
}

View File

@ -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;
}