diff --git a/libnymea-zigbee/libnymea-zigbee.pro b/libnymea-zigbee/libnymea-zigbee.pro index 61448ee..869d183 100644 --- a/libnymea-zigbee/libnymea-zigbee.pro +++ b/libnymea-zigbee/libnymea-zigbee.pro @@ -19,6 +19,7 @@ SOURCES += \ zcl/closures/zigbeeclusterdoorlock.cpp \ zcl/general/zigbeeclusteranaloginput.cpp \ zcl/general/zigbeeclusteranalogoutput.cpp \ + zcl/general/zigbeeclusteranalogvalue.cpp \ zcl/general/zigbeeclustergroups.cpp \ zcl/general/zigbeeclusteridentify.cpp \ zcl/general/zigbeeclusterlevelcontrol.cpp \ @@ -79,6 +80,7 @@ HEADERS += \ zcl/closures/zigbeeclusterdoorlock.h \ zcl/general/zigbeeclusteranaloginput.h \ zcl/general/zigbeeclusteranalogoutput.h \ + zcl/general/zigbeeclusteranalogvalue.h \ zcl/general/zigbeeclustergroups.h \ zcl/general/zigbeeclusteridentify.h \ zcl/general/zigbeeclusterlevelcontrol.h \ diff --git a/libnymea-zigbee/zcl/general/zigbeeclusteranalogvalue.cpp b/libnymea-zigbee/zcl/general/zigbeeclusteranalogvalue.cpp new file mode 100644 index 0000000..8f92f8a --- /dev/null +++ b/libnymea-zigbee/zcl/general/zigbeeclusteranalogvalue.cpp @@ -0,0 +1,41 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea-zigbee. +* This project including source code and documentation is protected by copyright law, and +* remains the property of nymea GmbH. All rights, including reproduction, publication, +* editing and translation, are reserved. The use of this project is subject to the terms of a +* license agreement to be concluded with nymea GmbH in accordance with the terms +* of use of nymea GmbH, available under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the terms of the GNU +* Lesser General Public License as published by the Free Software Foundation; version 3. +* this project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along with this project. +* If not, see . +* +* For any further details and any questions please contact us under contact@nymea.io +* or see our FAQ/Licensing Information on https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "zigbeeclusteranalogvalue.h" +#include "loggingcategory.h" + +ZigbeeClusterAnalogValue::ZigbeeClusterAnalogValue(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent) : + ZigbeeCluster(network, node, endpoint, ZigbeeClusterLibrary::ClusterIdAnalogValue, direction, parent) +{ + +} + +void ZigbeeClusterAnalogValue::setAttribute(const ZigbeeClusterAttribute &attribute) +{ + qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast(attribute.id()) << attribute.dataType(); + updateOrAddAttribute(attribute); +} diff --git a/libnymea-zigbee/zcl/general/zigbeeclusteranalogvalue.h b/libnymea-zigbee/zcl/general/zigbeeclusteranalogvalue.h new file mode 100644 index 0000000..59bd891 --- /dev/null +++ b/libnymea-zigbee/zcl/general/zigbeeclusteranalogvalue.h @@ -0,0 +1,63 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea-zigbee. +* This project including source code and documentation is protected by copyright law, and +* remains the property of nymea GmbH. All rights, including reproduction, publication, +* editing and translation, are reserved. The use of this project is subject to the terms of a +* license agreement to be concluded with nymea GmbH in accordance with the terms +* of use of nymea GmbH, available under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the terms of the GNU +* Lesser General Public License as published by the Free Software Foundation; version 3. +* this project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along with this project. +* If not, see . +* +* For any further details and any questions please contact us under contact@nymea.io +* or see our FAQ/Licensing Information on https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef ZIGBEECLUSTERANALOGVALUE_H +#define ZIGBEECLUSTERANALOGVALUE_H + +#include + +#include "zcl/zigbeecluster.h" + +class ZigbeeClusterAnalogValue : public ZigbeeCluster +{ + Q_OBJECT + + friend class ZigbeeNode; + friend class ZigbeeNetwork; + +public: + enum Attribute { + AttributeDescription = 0x001C, + AttributeOutOfService = 0x0051, + AttributePresentValue = 0x0055, + AttributePriorityArray = 0x0057, + AttributeReliability = 0x0067, + AttributeRelinquishDefault = 0x0068, + AttributeStatusFlags = 0x006F, + AttributeEngineeringUnits = 0x0075, + AttributeApplicationType = 0x0100 + }; + Q_ENUM(Attribute) + + explicit ZigbeeClusterAnalogValue(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr); + +private: + void setAttribute(const ZigbeeClusterAttribute &attribute) override; + +}; + +#endif // ZIGBEECLUSTERANALOGVALUE_H diff --git a/libnymea-zigbee/zigbeenodeendpoint.cpp b/libnymea-zigbee/zigbeenodeendpoint.cpp index e9e5143..7da5dc4 100644 --- a/libnymea-zigbee/zigbeenodeendpoint.cpp +++ b/libnymea-zigbee/zigbeenodeendpoint.cpp @@ -181,6 +181,8 @@ ZigbeeCluster *ZigbeeNodeEndpoint::createCluster(ZigbeeClusterLibrary::ClusterId return new ZigbeeClusterAnalogInput(m_network, m_node, this, direction, this); case ZigbeeClusterLibrary::ClusterIdAnalogOutput: return new ZigbeeClusterAnalogOutput(m_network, m_node, this, direction, this); + case ZigbeeClusterLibrary::ClusterIdAnalogValue: + return new ZigbeeClusterAnalogValue(m_network, m_node, this, direction, this); case ZigbeeClusterLibrary::ClusterIdMultistateInput: return new ZigbeeClusterMultistateInput(m_network, m_node, this, direction, this); diff --git a/libnymea-zigbee/zigbeenodeendpoint.h b/libnymea-zigbee/zigbeenodeendpoint.h index 291f198..51cced5 100644 --- a/libnymea-zigbee/zigbeenodeendpoint.h +++ b/libnymea-zigbee/zigbeenodeendpoint.h @@ -45,6 +45,7 @@ #include "zcl/general/zigbeeclustergroups.h" #include "zcl/general/zigbeeclusteranaloginput.h" #include "zcl/general/zigbeeclusteranalogoutput.h" +#include "zcl/general/zigbeeclusteranalogvalue.h" #include "zcl/general/zigbeeclustermultistateinput.h" #include "zcl/closures/zigbeeclusterdoorlock.h"