Extend color cluster with color temperature property
parent
008fd0c55b
commit
be292a67f6
|
|
@ -213,10 +213,32 @@ ZigbeeClusterReply *ZigbeeClusterColorControl::commandStepColorTemperature(Zigbe
|
||||||
return executeClusterCommand(ZigbeeClusterColorControl::CommandStepColorTemperature, payload);
|
return executeClusterCommand(ZigbeeClusterColorControl::CommandStepColorTemperature, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint16 ZigbeeClusterColorControl::colorTemperatureMireds() const
|
||||||
|
{
|
||||||
|
return m_colorTemperatureMireds;
|
||||||
|
}
|
||||||
|
|
||||||
void ZigbeeClusterColorControl::setAttribute(const ZigbeeClusterAttribute &attribute)
|
void ZigbeeClusterColorControl::setAttribute(const ZigbeeClusterAttribute &attribute)
|
||||||
{
|
{
|
||||||
qCDebug(dcZigbeeCluster()) << "Attribute changed" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
|
qCDebug(dcZigbeeCluster()) << "Attribute changed" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
|
||||||
updateOrAddAttribute(attribute);
|
updateOrAddAttribute(attribute);
|
||||||
|
|
||||||
|
switch (attribute.id()) {
|
||||||
|
case AttributeColorTemperatureMireds: {
|
||||||
|
bool valueOk = false;
|
||||||
|
quint16 value = attribute.dataType().toUInt16(&valueOk);
|
||||||
|
if (valueOk) {
|
||||||
|
m_colorTemperatureMireds = value;
|
||||||
|
qCDebug(dcZigbeeCluster()) << "Color temperature mired changed on" << m_node << m_endpoint << this << m_colorTemperatureMireds;
|
||||||
|
emit colorTemperatureMiredsChanged(m_colorTemperatureMireds);
|
||||||
|
} else {
|
||||||
|
qCWarning(dcZigbeeCluster()) << "Failed to parse attribute data" << m_node << m_endpoint << this << attribute;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZigbeeClusterColorControl::processDataIndication(ZigbeeClusterLibrary::Frame frame)
|
void ZigbeeClusterColorControl::processDataIndication(ZigbeeClusterLibrary::Frame frame)
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public:
|
||||||
ColorCapabilityXY = 0x08,
|
ColorCapabilityXY = 0x08,
|
||||||
ColorCapabilityColorTemperature = 0x10
|
ColorCapabilityColorTemperature = 0x10
|
||||||
};
|
};
|
||||||
Q_ENUM(ColorCapability)
|
Q_FLAG(ColorCapability)
|
||||||
Q_DECLARE_FLAGS(ColorCapabilities, ColorCapability)
|
Q_DECLARE_FLAGS(ColorCapabilities, ColorCapability)
|
||||||
|
|
||||||
enum Command {
|
enum Command {
|
||||||
|
|
@ -189,7 +189,7 @@ public:
|
||||||
ColorLoopUpdateTime = 0x04,
|
ColorLoopUpdateTime = 0x04,
|
||||||
ColorLoopUpdateStartHue = 0x08
|
ColorLoopUpdateStartHue = 0x08
|
||||||
};
|
};
|
||||||
Q_ENUM(ColorLoopUpdate)
|
Q_FLAG(ColorLoopUpdate)
|
||||||
Q_DECLARE_FLAGS(ColorLoopUpdateFlags, ColorLoopUpdate)
|
Q_DECLARE_FLAGS(ColorLoopUpdateFlags, ColorLoopUpdate)
|
||||||
|
|
||||||
enum ColorLoopAction {
|
enum ColorLoopAction {
|
||||||
|
|
@ -231,7 +231,14 @@ public:
|
||||||
ZigbeeClusterReply *commandMoveColorTemperature(MoveMode moveMode, quint16 rate, quint16 minColorTemperature, quint16 maxColorTemperature);
|
ZigbeeClusterReply *commandMoveColorTemperature(MoveMode moveMode, quint16 rate, quint16 minColorTemperature, quint16 maxColorTemperature);
|
||||||
ZigbeeClusterReply *commandStepColorTemperature(StepMode stepMode, quint16 stepSize, quint16 transitionTime, quint16 minColorTemperature, quint16 maxColorTemperature);
|
ZigbeeClusterReply *commandStepColorTemperature(StepMode stepMode, quint16 stepSize, quint16 transitionTime, quint16 minColorTemperature, quint16 maxColorTemperature);
|
||||||
|
|
||||||
|
quint16 colorTemperatureMireds() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void colorTemperatureMiredsChanged(quint16 colorTemperatureMireds);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
quint16 m_colorTemperatureMireds = 0;
|
||||||
|
|
||||||
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
|
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -239,7 +246,4 @@ protected:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ZigbeeClusterColorControl::ColorCapabilities)
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ZigbeeClusterColorControl::ColorLoopUpdateFlags)
|
|
||||||
|
|
||||||
#endif // ZIGBEECLUSTERCOLORCONTROL_H
|
#endif // ZIGBEECLUSTERCOLORCONTROL_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue