Provide access to formatting settings for electrical measurement cluster
parent
d584d30f8d
commit
359fc305f3
|
|
@ -16,6 +16,16 @@ quint16 ZigbeeClusterElectricalMeasurement::activePowerPhaseA() const
|
|||
return m_activePowerPhaseA;
|
||||
}
|
||||
|
||||
quint16 ZigbeeClusterElectricalMeasurement::acPowerMultiplier() const
|
||||
{
|
||||
return m_acPowerMultiplier;
|
||||
}
|
||||
|
||||
quint16 ZigbeeClusterElectricalMeasurement::acPowerDivisor() const
|
||||
{
|
||||
return m_acPowerDivisor;
|
||||
}
|
||||
|
||||
void ZigbeeClusterElectricalMeasurement::setAttribute(const ZigbeeClusterAttribute &attribute)
|
||||
{
|
||||
ZigbeeCluster::setAttribute(attribute);
|
||||
|
|
@ -26,6 +36,12 @@ void ZigbeeClusterElectricalMeasurement::setAttribute(const ZigbeeClusterAttribu
|
|||
m_activePowerPhaseA = attribute.dataType().toInt16();
|
||||
emit activePowerPhaseAChanged(m_activePowerPhaseA);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// Used to refresh formatting attributes (multiplier/divisor)
|
||||
ZigbeeClusterReply* readFormatting();
|
||||
|
||||
quint16 acPowerMultiplier() const;
|
||||
quint16 acPowerDivisor() const;
|
||||
|
||||
quint16 activePowerPhaseA() const;
|
||||
|
||||
signals:
|
||||
|
|
@ -275,7 +281,8 @@ private:
|
|||
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
|
||||
|
||||
qint16 m_activePowerPhaseA = 0;
|
||||
|
||||
quint16 m_acPowerMultiplier = 1;
|
||||
quint16 m_acPowerDivisor = 1;
|
||||
};
|
||||
|
||||
#endif // ZIGBEECLUSTERELECTRICALMEASUREMENT_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue