Merge PR #38: Add helpers for mandatory attributes in AnalogInput cluster
This commit is contained in:
commit
fd5449688d
@ -34,8 +34,30 @@ ZigbeeClusterAnalogInput::ZigbeeClusterAnalogInput(ZigbeeNetwork *network, Zigbe
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ZigbeeClusterAnalogInput::outOfService() const
|
||||||
|
{
|
||||||
|
return m_outOfService;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ZigbeeClusterAnalogInput::presentValue() const
|
||||||
|
{
|
||||||
|
return m_presentValue;
|
||||||
|
}
|
||||||
|
|
||||||
void ZigbeeClusterAnalogInput::setAttribute(const ZigbeeClusterAttribute &attribute)
|
void ZigbeeClusterAnalogInput::setAttribute(const ZigbeeClusterAttribute &attribute)
|
||||||
{
|
{
|
||||||
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
|
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
|
||||||
updateOrAddAttribute(attribute);
|
updateOrAddAttribute(attribute);
|
||||||
|
|
||||||
|
switch (attribute.id()) {
|
||||||
|
case AttributeOutOfService:
|
||||||
|
m_outOfService = attribute.dataType().toBool();
|
||||||
|
emit outOfServiceChanged(m_outOfService);
|
||||||
|
break;
|
||||||
|
case AttributePresentValue:
|
||||||
|
m_presentValue = attribute.dataType().toFloat();
|
||||||
|
qCDebug(dcZigbeeCluster()) << "Present value changed:" << m_presentValue;
|
||||||
|
emit presentValueChanged(m_presentValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,9 +56,18 @@ public:
|
|||||||
|
|
||||||
explicit ZigbeeClusterAnalogInput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
|
explicit ZigbeeClusterAnalogInput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
bool outOfService() const;
|
||||||
|
float presentValue() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void outOfServiceChanged(bool outOfService);
|
||||||
|
void presentValueChanged(float presentValue);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
|
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
|
||||||
|
|
||||||
|
bool m_outOfService = false;
|
||||||
|
float m_presentValue = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ZIGBEECLUSTERANALOGINPUT_H
|
#endif // ZIGBEECLUSTERANALOGINPUT_H
|
||||||
|
|||||||
Reference in New Issue
Block a user