Provide access to formatting settings for electrical measurement cluster
This commit is contained in:
parent
d584d30f8d
commit
359fc305f3
@ -16,6 +16,16 @@ quint16 ZigbeeClusterElectricalMeasurement::activePowerPhaseA() const
|
|||||||
return m_activePowerPhaseA;
|
return m_activePowerPhaseA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint16 ZigbeeClusterElectricalMeasurement::acPowerMultiplier() const
|
||||||
|
{
|
||||||
|
return m_acPowerMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint16 ZigbeeClusterElectricalMeasurement::acPowerDivisor() const
|
||||||
|
{
|
||||||
|
return m_acPowerDivisor;
|
||||||
|
}
|
||||||
|
|
||||||
void ZigbeeClusterElectricalMeasurement::setAttribute(const ZigbeeClusterAttribute &attribute)
|
void ZigbeeClusterElectricalMeasurement::setAttribute(const ZigbeeClusterAttribute &attribute)
|
||||||
{
|
{
|
||||||
ZigbeeCluster::setAttribute(attribute);
|
ZigbeeCluster::setAttribute(attribute);
|
||||||
@ -26,6 +36,12 @@ void ZigbeeClusterElectricalMeasurement::setAttribute(const ZigbeeClusterAttribu
|
|||||||
m_activePowerPhaseA = attribute.dataType().toInt16();
|
m_activePowerPhaseA = attribute.dataType().toInt16();
|
||||||
emit activePowerPhaseAChanged(m_activePowerPhaseA);
|
emit activePowerPhaseAChanged(m_activePowerPhaseA);
|
||||||
break;
|
break;
|
||||||
|
case AttributeACFormattingPowerMultiplier:
|
||||||
|
m_acPowerMultiplier = attribute.dataType().toUInt16();
|
||||||
|
break;
|
||||||
|
case AttributeACFormattingPowerDivisor:
|
||||||
|
m_acPowerDivisor = attribute.dataType().toUInt16();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,3 +91,16 @@ void ZigbeeClusterElectricalMeasurement::processDataIndication(ZigbeeClusterLibr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZigbeeClusterReply *ZigbeeClusterElectricalMeasurement::readFormatting()
|
||||||
|
{
|
||||||
|
ZigbeeClusterReply *readDivisorReply = readAttributes({ZigbeeClusterElectricalMeasurement::AttributeACFormattingPowerDivisor, ZigbeeClusterElectricalMeasurement::AttributeACFormattingPowerMultiplier});
|
||||||
|
connect(readDivisorReply, &ZigbeeClusterReply::finished, this, [=](){
|
||||||
|
if (readDivisorReply->error() != ZigbeeClusterReply::ErrorNoError) {
|
||||||
|
qCWarning(dcZigbeeCluster()) << "Failed to read formatting." << readDivisorReply->error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return readDivisorReply;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -260,6 +260,12 @@ public:
|
|||||||
|
|
||||||
explicit ZigbeeClusterElectricalMeasurement(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
|
explicit ZigbeeClusterElectricalMeasurement(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
// Used to refresh formatting attributes (multiplier/divisor)
|
||||||
|
ZigbeeClusterReply* readFormatting();
|
||||||
|
|
||||||
|
quint16 acPowerMultiplier() const;
|
||||||
|
quint16 acPowerDivisor() const;
|
||||||
|
|
||||||
quint16 activePowerPhaseA() const;
|
quint16 activePowerPhaseA() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -275,7 +281,8 @@ private:
|
|||||||
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
|
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
|
||||||
|
|
||||||
qint16 m_activePowerPhaseA = 0;
|
qint16 m_activePowerPhaseA = 0;
|
||||||
|
quint16 m_acPowerMultiplier = 1;
|
||||||
|
quint16 m_acPowerDivisor = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ZIGBEECLUSTERELECTRICALMEASUREMENT_H
|
#endif // ZIGBEECLUSTERELECTRICALMEASUREMENT_H
|
||||||
|
|||||||
Reference in New Issue
Block a user