Improve debug prints
parent
6b92b27c1f
commit
231c1d134f
|
|
@ -34,6 +34,7 @@
|
|||
#include "zigbeenetworkrequest.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QMetaEnum>
|
||||
|
||||
ZigbeeCluster::ZigbeeCluster(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, ZigbeeClusterLibrary::ClusterId clusterId, Direction direction, QObject *parent) :
|
||||
QObject(parent),
|
||||
|
|
@ -381,7 +382,11 @@ void ZigbeeCluster::processApsDataIndication(const QByteArray &asdu, const Zigbe
|
|||
QList<ZigbeeClusterLibrary::ReadAttributeStatusRecord> attributeStatusRecords = ZigbeeClusterLibrary::parseAttributeStatusRecords(frame.payload);
|
||||
foreach (const ZigbeeClusterLibrary::ReadAttributeStatusRecord &attributeStatusRecord, attributeStatusRecords) {
|
||||
qCDebug(dcZigbeeCluster()) << "Received read attribute status record" << this << attributeStatusRecord;
|
||||
if (attributeStatusRecord.attributeStatus == ZigbeeClusterLibrary::StatusSuccess) {
|
||||
setAttribute(ZigbeeClusterAttribute(attributeStatusRecord.attributeId, attributeStatusRecord.dataType));
|
||||
} else {
|
||||
qCWarning(dcZigbeeCluster()) << "Reading attribute status record returned an error" << attributeStatusRecord;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -420,9 +425,16 @@ QDebug operator<<(QDebug debug, ZigbeeCluster *cluster)
|
|||
{
|
||||
debug.nospace().noquote() << "ZigbeeCluster("
|
||||
<< ZigbeeUtils::convertUint16ToHexString(static_cast<quint16>(cluster->clusterId())) << ", "
|
||||
<< cluster->clusterName() << ", "
|
||||
<< cluster->direction()
|
||||
<< ")";
|
||||
<< cluster->clusterName() << ", ";
|
||||
switch (cluster->direction()) {
|
||||
case ZigbeeCluster::Server:
|
||||
debug.nospace().noquote() << "Servers)";
|
||||
break;
|
||||
case ZigbeeCluster::Client:
|
||||
debug.nospace().noquote() << "Client)";
|
||||
break;
|
||||
}
|
||||
|
||||
return debug.space();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -352,10 +352,11 @@ QDebug operator<<(QDebug debug, const ZigbeeClusterLibrary::ReadAttributeStatusR
|
|||
{
|
||||
debug.nospace() << "ReadAttributeStatusRecord("
|
||||
<< ZigbeeUtils::convertUint16ToHexString(attributeStatusRecord.attributeId) << ", "
|
||||
<< attributeStatusRecord.attributeStatus << ", "
|
||||
<< attributeStatusRecord.dataType
|
||||
<< ")";
|
||||
|
||||
<< attributeStatusRecord.attributeStatus;
|
||||
if (attributeStatusRecord.attributeStatus == ZigbeeClusterLibrary::StatusSuccess) {
|
||||
debug.nospace() << ", " << attributeStatusRecord.dataType;
|
||||
}
|
||||
debug.nospace() << ")";
|
||||
return debug.space();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,10 +245,9 @@ QString ZigbeeUtils::convertUint64ToHexString(const quint64 &value)
|
|||
|
||||
QString ZigbeeUtils::clusterIdToString(const ZigbeeClusterLibrary::ClusterId &clusterId)
|
||||
{
|
||||
QMetaObject metaObject = ZigbeeClusterLibrary::staticMetaObject;
|
||||
QMetaEnum metaEnum = metaObject.enumerator(metaObject.indexOfEnumerator("ClusterId"));
|
||||
QString enumString = metaEnum.valueToKey(clusterId);
|
||||
QString clusterName = enumString.remove("ZigbeeClusterLibrary::ClusterId(ClusterId").remove(")");
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<ZigbeeClusterLibrary::ClusterId>();
|
||||
QString enumString = QString(metaEnum.valueToKey(clusterId));
|
||||
QString clusterName = enumString.remove("ClusterId").remove(")");
|
||||
if (clusterName.isEmpty())
|
||||
clusterName = "Unknown";
|
||||
|
||||
|
|
@ -257,10 +256,10 @@ QString ZigbeeUtils::clusterIdToString(const ZigbeeClusterLibrary::ClusterId &cl
|
|||
|
||||
QString ZigbeeUtils::profileIdToString(const Zigbee::ZigbeeProfile &profileId)
|
||||
{
|
||||
QMetaObject metaObject = Zigbee::staticMetaObject;
|
||||
QMetaEnum metaEnum = metaObject.enumerator(metaObject.indexOfEnumerator("ZigbeeProfile"));
|
||||
QString enumString = metaEnum.valueToKey(profileId);
|
||||
return enumString.remove("Zigbee::ZigbeeProfile(ZigbeeProfile").remove(")");
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<Zigbee::ZigbeeProfile>();
|
||||
QString enumString = QString(metaEnum.valueToKey(profileId));
|
||||
QString profileName = enumString.remove("ZigbeeProfile").remove(")");
|
||||
return profileName;
|
||||
}
|
||||
|
||||
quint64 ZigbeeUtils::generateRandomPanId()
|
||||
|
|
|
|||
Loading…
Reference in New Issue