19#include "deconz/declspec.h"
97class ApsDataIndication;
119 Zcl8BitBitMap = 0x18,
120 Zcl16BitBitMap = 0x19,
121 Zcl24BitBitMap = 0x1a,
122 Zcl32BitBitMap = 0x1b,
123 Zcl40BitBitMap = 0x1c,
124 Zcl48BitBitMap = 0x1d,
125 Zcl56BitBitMap = 0x1e,
126 Zcl64BitBitMap = 0x1f,
146 ZclSingleFloat = 0x39,
147 ZclDoubleFloat = 0x3a,
148 ZclOctedString = 0x41,
149 ZclCharacterString = 0x42,
150 ZclLongOctedString = 0x43,
151 ZclLongCharacterString = 0x44,
158 ZclAttributeId = 0xe9,
160 ZclIeeeAddress = 0xf0,
161 Zcl128BitSecurityKey = 0xf1
167 ZclReadAttributesId = 0x00,
168 ZclReadAttributesResponseId = 0x01,
169 ZclWriteAttributesId = 0x02,
170 ZclWriteAttributesUndividedId = 0x03,
171 ZclWriteAttributesResponseId = 0x04,
172 ZclWriteAttributesNoResponseId = 0x05,
173 ZclConfigureReportingId = 0x06,
174 ZclConfigureReportingResponseId = 0x07,
175 ZclReadReportingConfigId = 0x08,
176 ZclReadReportingConfigResponseId = 0x09,
177 ZclReportAttributesId = 0x0a,
178 ZclDefaultResponseId = 0x0b,
179 ZclDiscoverAttributesId = 0x0c,
180 ZclDiscoverAttributesResponseId = 0x0d,
181 ZclReadAttributesStructuredId = 0x0e,
182 ZclWriteAttributesStructuredId = 0x0f,
183 ZclWriteAttributesStructuredResponseId = 0x10
203 ZclFCProfileCommand = 0x00,
204 ZclFCClusterCommand = 0x01,
205 ZclFCManufacturerSpecific = 0x04,
206 ZclFCDirectionServerToClient = 0x08,
207 ZclFCDirectionClientToServer = 0x00,
208 ZclFCEnableDefaultResponse = 0x00,
209 ZclFCDisableDefaultResponse = 0x10
240 constexpr bool isValid()
const {
return m_id > ZclNoData && m_id <= Zcl128BitSecurityKey; }
243 explicit operator quint8()
const {
return m_id; }
258 DECONZ_DLLSPEC QDataStream &
operator<<(QDataStream &ds, ZclDataTypeId_t
id);
260 DECONZ_DLLSPEC QDataStream &
operator>>(QDataStream &ds, ZclDataTypeId_t &
id);
295 inline namespace literals {
296 constexpr ZclDataTypeId_t DECONZ_DLLSPEC
operator ""_dtid(
unsigned long long id)
319 ZclDataType(uint8_t
id,
const QString &name,
const QString &shortname,
int length,
char analogDiscrete);
329 const QString &name()
const;
331 const QString &shortname()
const;
335 bool isValid()
const;
337 bool isAnalog()
const;
339 bool isDiscrete()
const;
367 constexpr explicit operator quint8()
const {
return m_id; }
382 DECONZ_DLLSPEC QDataStream &
operator<<(QDataStream &ds, ZclCommandId_t
id);
386 DECONZ_DLLSPEC QDataStream &
operator>>(QDataStream &ds, ZclCommandId_t &
id);
409 inline namespace literals {
410 constexpr ZclCommandId_t DECONZ_DLLSPEC
operator ""_cmdid(
unsigned long long id)
412 return ZclCommandId_t(
static_cast<quint8
>(
id));
542 constexpr explicit operator quint16()
const {
return m_id; }
557 DECONZ_DLLSPEC QDataStream &
operator<<(QDataStream &ds, ZclAttributeId_t
id);
561 DECONZ_DLLSPEC QDataStream &
operator>>(QDataStream &ds, ZclAttributeId_t &
id);
597 inline namespace literals {
598 constexpr ZclAttributeId_t DECONZ_DLLSPEC
operator ""_atid(
unsigned long long id)
600 return ZclAttributeId_t(
static_cast<quint16
>(
id));
624 constexpr explicit operator quint16()
const {
return m_id; }
639 DECONZ_DLLSPEC QDataStream &
operator<<(QDataStream &ds, ManufacturerCode_t mfcode);
643 DECONZ_DLLSPEC QDataStream &
operator>>(QDataStream &ds, ManufacturerCode_t &mfcode);
666 inline namespace literals {
667 constexpr ManufacturerCode_t DECONZ_DLLSPEC
operator ""_mfcode(
unsigned long long mfcode)
669 return ManufacturerCode_t(
static_cast<quint16
>(mfcode));
673 class ZclAttributePrivate;
715 const QString &description()
const;
717 void setDescription(
const QString &description);
719 uint8_t dataType()
const;
725 void setDataType(uint8_t type);
727 const QString &name()
const;
729 uint8_t subType()
const;
730 void setSubType(uint8_t subType);
745 QString valueNameAt(
int bitOrEnum)
const;
747 QStringList valuesNames()
const;
749 const std::vector<int> &valueNamePositions()
const;
751 void setValue(
bool value);
753 void setValue(quint64 value);
755 void setValue(qint64 value);
757 void setValue(
const QVariant &value);
760 void setLastRead(time_t time);
761 uint16_t listSizeAttribute()
const;
762 void setListSizeAttribute(uint16_t
id);
764 int listSize()
const;
765 void setListSize(
int listSize);
768 int64_t lastRead()
const;
770 bool isReadonly()
const;
772 bool isMandatory()
const;
774 bool isAvailable()
const;
776 void setAvailable(
bool available);
778 uint8_t numericBase()
const;
780 void setNumericBase(uint8_t base);
782 uint enumerator()
const;
784 void setEnumerator(uint value);
786 void setBit(uint bit,
bool one);
788 bool bit(
int bit)
const;
790 int bitCount()
const;
792 quint64 bitmap()
const;
794 void setBitmap(quint64 bmp);
796 int enumCount()
const;
798 quint8 enumerationId()
const;
800 void setEnumerationId(quint8
id);
802 bool writeToStream(QDataStream &stream)
const;
804 bool readFromStream(QDataStream &stream);
806 QString toString(FormatHint formatHint = DefaultFormat)
const;
808 QString toString(
const deCONZ::ZclDataType &dataType, FormatHint formatHint = DefaultFormat)
const;
810 const QVariant &toVariant()
const;
812 uint16_t minReportInterval()
const;
814 void setMinReportInterval(uint16_t interval);
816 uint16_t maxReportInterval()
const;
818 void setMaxReportInterval(uint16_t interval);
820 uint16_t reportTimeoutPeriod()
const;
822 void setReportTimeoutPeriod(uint16_t period);
826 void setReportableChange(
const NumericUnion &reportableChange);
828 bool writeReportableChangeToStream(QDataStream &stream)
const;
830 bool readReportableChangeFromStream(QDataStream &stream);
832 void setFormatHint(FormatHint formatHint);
834 FormatHint formatHint()
const;
836 int rangeMin()
const;
838 void setRangeMin(
int rangeMin);
840 int rangeMax()
const;
842 void setRangeMax(
int rangeMax);
844 quint16 manufacturerCode()
const;
850 void setManufacturerCode(quint16 mfcode);
856 bool isManufacturerSpecific()
const;
859 void setAttributeSet(quint16 attrSetId, quint16 mfcode);
860 quint16 attributeSet()
const;
861 quint16 attributeSetManufacturerCode()
const;
870 class ZclAttributeSetPrivate;
893 const QString &description()
const;
895 const std::vector<int> &attributes()
const;
899 void addAttribute(
int idx);
901 quint16 manufacturerCode()
const;
903 void setManufacturerCode(quint16 mfcode);
917 class ZclFramePrivate;
938 uint8_t frameControl()
const;
942 void setFrameControl(uint8_t frameControl);
944 uint16_t manufacturerCode()
const;
950 void setManufacturerCode(uint16_t code);
956 uint8_t sequenceNumber()
const;
958 void setSequenceNumber(uint8_t seqNumber);
960 uint8_t commandId()
const;
966 void setCommandId(uint8_t commandId);
975 unsigned char payloadAt(
int index)
const;
977 const QByteArray &payload()
const;
979 QByteArray &payload();
981 void setPayload(
const QByteArray &payload);
985 void writeToStream(QDataStream &stream);
989 void readFromStream(QDataStream &stream);
991 bool isClusterCommand()
const;
993 bool isProfileWideCommand()
const;
995 bool isDefaultResponse()
const;
999 bool isValid()
const;
1001 uint8_t defaultResponseCommandId()
const;
1007 ZclStatus defaultResponseStatus()
const;
1039 ZclCommand(uint8_t
id,
const QString &name,
bool required,
bool recv,
const QString &description = QString());
1049 void setId(uint8_t
id);
1051 uint16_t manufacturerId()
const;
1053 void setManufacturerId(uint16_t
id);
1055 bool isValid()
const;
1057 uint8_t responseId()
const;
1059 void setResponseId(uint8_t
id);
1061 bool hasResponse()
const;
1063 bool directionReceived()
const;
1065 bool directionSend()
const;
1067 const QString &name()
const;
1069 const QString &description()
const;
1071 void setDescription(
const QString &description);
1073 bool isProfileWide()
const;
1075 void setIsProfileWide(
bool profileWide);
1077 bool disableDefaultResponse()
const;
1079 void setDisableDefaultResponse(
bool disable);
1081 const std::vector<ZclAttribute> ¶meters()
const;
1083 std::vector<ZclAttribute> ¶meters();
1085 bool readFromStream(QDataStream &stream);
1087 bool writeToStream(QDataStream &stream)
const;
1115 constexpr explicit operator quint16()
const {
return m_id; }
1130 DECONZ_DLLSPEC QDataStream &
operator<<(QDataStream &ds, ZclClusterId_t
id);
1134 DECONZ_DLLSPEC QDataStream &
operator>>(QDataStream &ds, ZclClusterId_t &
id);
1157 inline namespace literals {
1158 constexpr ZclClusterId_t DECONZ_DLLSPEC
operator ""_clid(
unsigned long long id)
1160 return ZclClusterId_t(
static_cast<quint16
>(
id));
1164 class ZclClusterPrivate;
1180 ZclCluster(uint16_t
id,
const QString &name,
const QString &description = QString());
1186 uint16_t id()
const;
1192 void setId(uint16_t
id);
1194 uint16_t oppositeId()
const;
1196 void setOppositeId(uint16_t
id);
1198 uint16_t manufacturerCode()
const;
1204 void setManufacturerCode(uint16_t manufacturerCode);
1210 const QString &name()
const;
1212 const QString &description()
const;
1214 void setDescription(
const QString &description);
1216 bool isValid()
const;
1220 void setIsZcl(
bool isZcl);
1222 bool isServer()
const;
1224 bool isClient()
const;
1226 void setIsServer(
bool isServer);
1228 std::vector<ZclAttribute> &attributes();
1230 const std::vector<ZclAttribute> &attributes()
const;
1232 std::vector<ZclAttributeSet> &attributeSets();
1234 const std::vector<ZclAttributeSet> &attributeSets()
const;
1236 bool readCommand(
const ZclFrame &zclFrame);
1240 std::vector<ZclCommand> &commands();
1242 const std::vector<ZclCommand> &commands()
const;
1263 DECONZ_DLLSPEC
ZclCluster ZCL_InCluster(uint16_t profileId, uint16_t clusterId, uint16_t mfcode);
1264 DECONZ_DLLSPEC
ZclCluster ZCL_OutCluster(uint16_t profileId, uint16_t clusterId, uint16_t mfcode);
1265 DECONZ_DLLSPEC
ZclDataType ZCL_DataType(uint8_t
id);
1266 DECONZ_DLLSPEC
ZclDataType ZCL_DataType(
const QString &name);
APSDE-DATA.indication primitive.
Definition aps.h:408
A strong typed Zigbee manufacturer code.
Definition zcl.h:615
ManufacturerCode_t(T)=delete
Don't allow construction via implicit integer conversion.
constexpr ManufacturerCode_t(quint16 id)
Explicit constructor to init by value.
Definition zcl.h:622
constexpr bool operator!=(ManufacturerCode_t other) const
Not equal operator, requires strong type.
Definition zcl.h:633
constexpr ManufacturerCode_t()
Default constructor, with value = 0.
Definition zcl.h:620
constexpr bool operator==(ManufacturerCode_t other) const
Equal operator, requires strong type.
Definition zcl.h:631
A strong typed ZCL attribute identifier.
Definition zcl.h:533
constexpr bool operator!=(ZclAttributeId_t other) const
Not equal operator, requires strong type.
Definition zcl.h:551
constexpr ZclAttributeId_t(quint16 id)
Explicit constructor to init by value.
Definition zcl.h:540
constexpr bool operator==(ZclAttributeId_t other) const
Equal operator, requires strong type.
Definition zcl.h:549
ZclAttributeId_t(T)=delete
Don't allow construction via implicit integer conversion.
constexpr ZclAttributeId_t()
Default constructor, with value = 0.
Definition zcl.h:538
Definition zcl_private.h:54
Definition zcl_private.h:110
Represents a named group of ZclAttribute.
Definition zcl.h:878
Represents a ZigBee cluster attribute.
Definition zcl.h:681
FormatHint
Used to change the display format in the GUI.
Definition zcl.h:685
@ Prefix
Prepend prefix like 0x or 0b.
Definition zcl.h:687
A strong typed ZCL cluster identifier.
Definition zcl.h:1106
constexpr ZclClusterId_t()
Default constructor, with value = 0.
Definition zcl.h:1111
constexpr bool operator==(ZclClusterId_t other) const
Equal operator, requires strong type.
Definition zcl.h:1122
ZclClusterId_t(T)=delete
Don't allow construction via implicit integer conversion.
constexpr ZclClusterId_t(quint16 id)
Explicit constructor to init by value.
Definition zcl.h:1113
constexpr bool operator!=(ZclClusterId_t other) const
Not equal operator, requires strong type.
Definition zcl.h:1124
Definition zcl_private.h:120
Represents a ZigBee cluster (ZCL and non-ZCL).
Definition zcl.h:1173
A strong typed ZCL command identifier.
Definition zcl.h:358
constexpr ZclCommandId_t()
Default constructor, with value = 0.
Definition zcl.h:363
ZclCommandId_t(T)=delete
Don't allow construction via implicit integer conversion.
constexpr ZclCommandId_t(quint8 id)
Explicit constructor to init by value.
Definition zcl.h:365
constexpr bool operator!=(ZclCommandId_t other) const
Not equal operator, requires strong type.
Definition zcl.h:376
constexpr bool operator==(ZclCommandId_t other) const
Equal operator, requires strong type.
Definition zcl.h:374
Definition zcl_private.h:166
Represents a ZigBee cluster command (ZCL and non-ZCL).
Definition zcl.h:1026
Definition zcl_private.h:286
A strong typed ZCL data type identifier.
Definition zcl.h:224
constexpr ZclDataTypeId_t()
Default constructor with value = ZclNoData.
Definition zcl.h:229
ZclDataTypeId_t(T)=delete
Don't allow construction via implicit integer conversion.
constexpr bool operator==(ZclDataTypeId other) const
Equal operator, requires ZclDataTypeId enum.
Definition zcl.h:252
constexpr bool operator!=(ZclDataTypeId_t other) const
Not equal operator, requires strong type.
Definition zcl.h:250
constexpr ZclDataTypeId_t(ZclDataTypeId id)
Constructor to init by enum value (preferred).
Definition zcl.h:233
constexpr bool isValid() const
Returns true for known data types.
Definition zcl.h:240
constexpr ZclDataTypeId_t(quint8 id)
Explicit constructor to init by value.
Definition zcl.h:231
constexpr bool operator==(ZclDataTypeId_t other) const
Equal operator, requires strong type.
Definition zcl.h:248
constexpr bool operator!=(ZclDataTypeId other) const
Not equal operator, requires ZclDataTypeId enum.
Definition zcl.h:254
Definition zcl_private.h:148
Represents the data type of a ZigBee cluster attribute.
Definition zcl.h:310
Definition zcl_private.h:136
Helper to build ZCL based payloads to be transported via ApsDataRequest.
Definition zcl.h:925
ZclStatus
Common ZigBee Cluster Library (ZCL) status codes.
Definition types.h:123
ZclDataTypeId
Various data types as defined in ZigBee ZCL specification.
Definition zcl.h:108
The deCONZ namespace.
Definition aps.cpp:19
ZclAccess
Allowed access method of a ZclAttribute.
Definition zcl.h:418
ZclClusterSide
ZCL cluster side where client is a out cluster and server is a in cluster.
Definition zcl.h:912
DECONZ_DLLSPEC QDataStream & operator>>(QDataStream &ds, ZclDataTypeId_t &id)
Reads ZclDataTypeId_t as quint8 from the QDataStream.
Definition zcl.cpp:2726
DECONZ_DLLSPEC QDataStream & operator<<(QDataStream &ds, ZclDataTypeId_t id)
Writes ZclDataTypeId_t as quint8 to the QDataStream.
Definition zcl.cpp:2720
ZclFrameControl
General ZCL Frame Format.
Definition zcl.h:202
ZclGeneralCommandId
General ZCL command ids every cluster shall support.
Definition zcl.h:166
Declaration of the most common deCONZ library types.
Holds various numeric values 8-64 bit, signed and unsigned.
Definition types.h:329