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