Merge PR #39: Simplify cluster inheritance

This commit is contained in:
Jenkins nymea 2022-03-10 12:33:45 +01:00
commit 38ee4c97ba
39 changed files with 21 additions and 146 deletions

View File

@ -112,8 +112,7 @@ ZigbeeClusterDoorLock::DoorState ZigbeeClusterDoorLock::doorState() const
void ZigbeeClusterDoorLock::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterDoorLock::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
switch (attribute.id()) { switch (attribute.id()) {
case AttributeLockState: case AttributeLockState:

View File

@ -46,8 +46,7 @@ float ZigbeeClusterAnalogInput::presentValue() const
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(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
switch (attribute.id()) { switch (attribute.id()) {
case AttributeOutOfService: case AttributeOutOfService:

View File

@ -33,9 +33,3 @@ ZigbeeClusterAnalogOutput::ZigbeeClusterAnalogOutput(ZigbeeNetwork *network, Zig
{ {
} }
void ZigbeeClusterAnalogOutput::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -58,9 +58,6 @@ public:
explicit ZigbeeClusterAnalogOutput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr); explicit ZigbeeClusterAnalogOutput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };
#endif // ZIGBEECLUSTERANANLOGOUTPUT_H #endif // ZIGBEECLUSTERANANLOGOUTPUT_H

View File

@ -33,9 +33,3 @@ ZigbeeClusterAnalogValue::ZigbeeClusterAnalogValue(ZigbeeNetwork *network, Zigbe
{ {
} }
void ZigbeeClusterAnalogValue::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -55,9 +55,6 @@ public:
explicit ZigbeeClusterAnalogValue(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr); explicit ZigbeeClusterAnalogValue(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };
#endif // ZIGBEECLUSTERANALOGVALUE_H #endif // ZIGBEECLUSTERANALOGVALUE_H

View File

@ -40,9 +40,3 @@ ZigbeeClusterReply *ZigbeeClusterBasic::resetToFactoryDefaults()
{ {
return executeClusterCommand(ZigbeeClusterBasic::CommandResetToFactoryDefaults); return executeClusterCommand(ZigbeeClusterBasic::CommandResetToFactoryDefaults);
} }
void ZigbeeClusterBasic::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -206,9 +206,6 @@ public:
ZigbeeClusterReply *resetToFactoryDefaults(); ZigbeeClusterReply *resetToFactoryDefaults();
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };
#endif // ZIGBEECLUSTERBASIC_H #endif // ZIGBEECLUSTERBASIC_H

View File

@ -41,8 +41,7 @@ bool ZigbeeClusterBinaryInput::presentValue() const
void ZigbeeClusterBinaryInput::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterBinaryInput::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
// Parse the information for convenience // Parse the information for convenience
if (attribute.id() == AttributePresentValue) { if (attribute.id() == AttributePresentValue) {

View File

@ -33,9 +33,3 @@ ZigbeeClusterBinaryOutput::ZigbeeClusterBinaryOutput(ZigbeeNetwork *network, Zig
{ {
} }
void ZigbeeClusterBinaryOutput::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -59,9 +59,6 @@ public:
explicit ZigbeeClusterBinaryOutput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr); explicit ZigbeeClusterBinaryOutput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };
#endif // ZIGBEECLUSTERBINARYOUTPUT_H #endif // ZIGBEECLUSTERBINARYOUTPUT_H

View File

@ -33,9 +33,3 @@ ZigbeeClusterBinaryValue::ZigbeeClusterBinaryValue(ZigbeeNetwork *network, Zigbe
{ {
} }
void ZigbeeClusterBinaryValue::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -58,9 +58,6 @@ public:
explicit ZigbeeClusterBinaryValue(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr); explicit ZigbeeClusterBinaryValue(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };
#endif // ZIGBEECLUSTERBINARYVALUE_H #endif // ZIGBEECLUSTERBINARYVALUE_H

View File

@ -94,9 +94,3 @@ ZigbeeClusterReply *ZigbeeClusterGroups::addGroupIfIdentifying(quint16 groupId,
} }
return executeClusterCommand(ZigbeeClusterGroups::CommandAddGroup, payload); return executeClusterCommand(ZigbeeClusterGroups::CommandAddGroup, payload);
} }
void ZigbeeClusterGroups::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -63,9 +63,6 @@ public:
signals: signals:
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };

View File

@ -61,12 +61,6 @@ ZigbeeClusterReply *ZigbeeClusterIdentify::triggerEffect(ZigbeeClusterIdentify::
return executeClusterCommand(ZigbeeClusterIdentify::CommandTriggerEffect, payload); return executeClusterCommand(ZigbeeClusterIdentify::CommandTriggerEffect, payload);
} }
void ZigbeeClusterIdentify::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}
void ZigbeeClusterIdentify::processDataIndication(ZigbeeClusterLibrary::Frame frame) void ZigbeeClusterIdentify::processDataIndication(ZigbeeClusterLibrary::Frame frame)
{ {
Command command = static_cast<Command>(frame.header.command); Command command = static_cast<Command>(frame.header.command);

View File

@ -75,9 +75,6 @@ public:
ZigbeeClusterReply *identifyQuery(); ZigbeeClusterReply *identifyQuery();
ZigbeeClusterReply *triggerEffect(Effect effect, quint8 effectVariant = 0x00); ZigbeeClusterReply *triggerEffect(Effect effect, quint8 effectVariant = 0x00);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
protected: protected:
void processDataIndication(ZigbeeClusterLibrary::Frame frame) override; void processDataIndication(ZigbeeClusterLibrary::Frame frame) override;

View File

@ -110,8 +110,7 @@ quint8 ZigbeeClusterLevelControl::currentLevel() const
void ZigbeeClusterLevelControl::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterLevelControl::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
// Parse the information for convenience // Parse the information for convenience
if (attribute.id() == AttributeCurrentLevel) { if (attribute.id() == AttributeCurrentLevel) {

View File

@ -33,9 +33,3 @@ ZigbeeClusterMultistateInput::ZigbeeClusterMultistateInput(ZigbeeNetwork *networ
{ {
} }
void ZigbeeClusterMultistateInput::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -55,9 +55,6 @@ public:
explicit ZigbeeClusterMultistateInput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr); explicit ZigbeeClusterMultistateInput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };
#endif // ZIGBEECLUSTERMULTISTATEINPUT_H #endif // ZIGBEECLUSTERMULTISTATEINPUT_H

View File

@ -33,9 +33,3 @@ ZigbeeClusterMultistateOutput::ZigbeeClusterMultistateOutput(ZigbeeNetwork *netw
{ {
} }
void ZigbeeClusterMultistateOutput::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -56,9 +56,6 @@ public:
explicit ZigbeeClusterMultistateOutput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr); explicit ZigbeeClusterMultistateOutput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };
#endif // ZIGBEECLUSTERMULTISTATEOUTPUT_H #endif // ZIGBEECLUSTERMULTISTATEOUTPUT_H

View File

@ -33,9 +33,3 @@ ZigbeeClusterMultistateValue::ZigbeeClusterMultistateValue(ZigbeeNetwork *networ
{ {
} }
void ZigbeeClusterMultistateValue::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}

View File

@ -56,9 +56,6 @@ public:
explicit ZigbeeClusterMultistateValue(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr); explicit ZigbeeClusterMultistateValue(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
}; };
#endif // ZIGBEECLUSTERMULTISTATEVALUE_H #endif // ZIGBEECLUSTERMULTISTATEVALUE_H

View File

@ -84,8 +84,7 @@ bool ZigbeeClusterOnOff::power() const
void ZigbeeClusterOnOff::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterOnOff::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
// Parse the information for convenience // Parse the information for convenience
if (attribute.id() == AttributeOnOff) { if (attribute.id() == AttributeOnOff) {

View File

@ -44,7 +44,7 @@ double ZigbeeClusterPowerConfiguration::batteryPercentage() const
void ZigbeeClusterPowerConfiguration::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterPowerConfiguration::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); ZigbeeCluster::setAttribute(attribute);
if (attribute.id() == AttributeBatteryPercentageRemaining) { if (attribute.id() == AttributeBatteryPercentageRemaining) {
bool valueOk = false; bool valueOk = false;

View File

@ -37,12 +37,6 @@ ZigbeeClusterScenes::ZigbeeClusterScenes(ZigbeeNetwork *network, ZigbeeNode *nod
} }
void ZigbeeClusterScenes::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}
void ZigbeeClusterScenes::processDataIndication(ZigbeeClusterLibrary::Frame frame) void ZigbeeClusterScenes::processDataIndication(ZigbeeClusterLibrary::Frame frame)
{ {
switch (m_direction) { switch (m_direction) {

View File

@ -65,9 +65,6 @@ public:
signals: signals:
void commandSent(ZigbeeClusterScenes::Command command, quint16 groupId, quint8 sceneId, quint8 transactionSequenceNumber); void commandSent(ZigbeeClusterScenes::Command command, quint16 groupId, quint8 sceneId, quint8 transactionSequenceNumber);
private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
protected: protected:
void processDataIndication(ZigbeeClusterLibrary::Frame frame) override; void processDataIndication(ZigbeeClusterLibrary::Frame frame) override;

View File

@ -226,7 +226,7 @@ ZigbeeClusterColorControl::ColorCapabilities ZigbeeClusterColorControl::colorCap
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); ZigbeeCluster::setAttribute(attribute);
switch (attribute.id()) { switch (attribute.id()) {
case AttributeColorTemperatureMireds: { case AttributeColorTemperatureMireds: {

View File

@ -43,8 +43,7 @@ quint16 ZigbeeClusterIlluminanceMeasurment::illuminance() const
void ZigbeeClusterIlluminanceMeasurment::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterIlluminanceMeasurment::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
// Parse the information for convenience // Parse the information for convenience
if (attribute.id() == AttributeMeasuredValue) { if (attribute.id() == AttributeMeasuredValue) {

View File

@ -43,8 +43,7 @@ bool ZigbeeClusterOccupancySensing::occupied() const
void ZigbeeClusterOccupancySensing::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterOccupancySensing::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
// Parse the information for convenience // Parse the information for convenience
if (attribute.id() == AttributeOccupancy) { if (attribute.id() == AttributeOccupancy) {

View File

@ -48,8 +48,7 @@ double ZigbeeClusterPressureMeasurement::pressureScaled() const
void ZigbeeClusterPressureMeasurement::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterPressureMeasurement::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
// Parse the information for convinience // Parse the information for convinience
if (attribute.id() == AttributeMeasuredValue) { if (attribute.id() == AttributeMeasuredValue) {

View File

@ -44,7 +44,7 @@ double ZigbeeClusterRelativeHumidityMeasurement::humidity() const
void ZigbeeClusterRelativeHumidityMeasurement::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterRelativeHumidityMeasurement::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); ZigbeeCluster::setAttribute(attribute);
// Parse the information for convenience // Parse the information for convenience
if (attribute.id() == AttributeMeasuredValue) { if (attribute.id() == AttributeMeasuredValue) {

View File

@ -43,8 +43,7 @@ double ZigbeeClusterTemperatureMeasurement::temperature() const
void ZigbeeClusterTemperatureMeasurement::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterTemperatureMeasurement::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
// Parse the information for convenience // Parse the information for convenience
if (attribute.id() == AttributeMeasuredValue) { if (attribute.id() == AttributeMeasuredValue) {

View File

@ -39,12 +39,6 @@ ZigbeeClusterOta::ZigbeeClusterOta(ZigbeeNetwork *network, ZigbeeNode *node, Zig
} }
void ZigbeeClusterOta::setAttribute(const ZigbeeClusterAttribute &attribute)
{
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType();
updateOrAddAttribute(attribute);
}
ZigbeeClusterOta::FileVersion ZigbeeClusterOta::parseFileVersion(quint32 fileVersionValue) ZigbeeClusterOta::FileVersion ZigbeeClusterOta::parseFileVersion(quint32 fileVersionValue)
{ {
FileVersion fileVersion; FileVersion fileVersion;

View File

@ -101,8 +101,6 @@ protected:
void processDataIndication(ZigbeeClusterLibrary::Frame frame) override; void processDataIndication(ZigbeeClusterLibrary::Frame frame) override;
private: private:
void setAttribute(const ZigbeeClusterAttribute &attribute) override;
FileVersion parseFileVersion(quint32 fileVersionValue); FileVersion parseFileVersion(quint32 fileVersionValue);
}; };

View File

@ -91,8 +91,7 @@ ZigbeeClusterReply *ZigbeeClusterIasZone::sendZoneStatusChangeNotification(Zigbe
void ZigbeeClusterIasZone::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeClusterIasZone::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast<Attribute>(attribute.id()) << attribute.dataType(); ZigbeeCluster::setAttribute(attribute);
updateOrAddAttribute(attribute);
if (attribute.id() == AttributeZoneState) { if (attribute.id() == AttributeZoneState) {
quint8 zoneStateInt = attribute.dataType().toUInt8(); quint8 zoneStateInt = attribute.dataType().toUInt8();

View File

@ -93,7 +93,13 @@ ZigbeeClusterAttribute ZigbeeCluster::attribute(quint16 attributeId)
void ZigbeeCluster::setAttribute(const ZigbeeClusterAttribute &attribute) void ZigbeeCluster::setAttribute(const ZigbeeClusterAttribute &attribute)
{ {
qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << attribute; qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << attribute;
updateOrAddAttribute(attribute); if (hasAttribute(attribute.id())) {
m_attributes[attribute.id()] = attribute;
emit attributeChanged(attribute);
} else {
m_attributes.insert(attribute.id(), attribute);
emit attributeChanged(attribute);
}
} }
ZigbeeClusterReply *ZigbeeCluster::readAttributes(QList<quint16> attributes, quint16 manufacturerCode) ZigbeeClusterReply *ZigbeeCluster::readAttributes(QList<quint16> attributes, quint16 manufacturerCode)
@ -410,17 +416,6 @@ void ZigbeeCluster::processDataIndication(ZigbeeClusterLibrary::Frame frame)
qCWarning(dcZigbeeCluster()) << "Unhandled ZCL indication in" << m_node << m_endpoint << this << frame; qCWarning(dcZigbeeCluster()) << "Unhandled ZCL indication in" << m_node << m_endpoint << this << frame;
} }
void ZigbeeCluster::updateOrAddAttribute(const ZigbeeClusterAttribute &attribute)
{
if (hasAttribute(attribute.id())) {
m_attributes[attribute.id()] = attribute;
emit attributeChanged(attribute);
} else {
m_attributes.insert(attribute.id(), attribute);
emit attributeChanged(attribute);
}
}
quint8 ZigbeeCluster::newTransactionSequenceNumber() quint8 ZigbeeCluster::newTransactionSequenceNumber()
{ {
static quint8 tsn = 1; static quint8 tsn = 1;

View File

@ -122,13 +122,10 @@ protected:
virtual void processDataIndication(ZigbeeClusterLibrary::Frame frame); virtual void processDataIndication(ZigbeeClusterLibrary::Frame frame);
void updateOrAddAttribute(const ZigbeeClusterAttribute &attribute); virtual void setAttribute(const ZigbeeClusterAttribute &attribute);
static quint8 newTransactionSequenceNumber(); static quint8 newTransactionSequenceNumber();
private:
virtual void setAttribute(const ZigbeeClusterAttribute &attribute);
signals: signals:
void attributeChanged(const ZigbeeClusterAttribute &attribute); void attributeChanged(const ZigbeeClusterAttribute &attribute);