deCONZ C++ API v2.6.1
Loading...
Searching...
No Matches
zdp_descriptors.h
1#ifndef DECONZ_ZDP_DESCRIPTORS_H
2#define DECONZ_ZDP_DESCRIPTORS_H
3
4/*
5 * Copyright (c) 2012-2023 dresden elektronik ingenieurtechnik gmbh.
6 * All rights reserved.
7 *
8 * The software in this package is published under the terms of the BSD
9 * style license a copy of which has been included with this distribution in
10 * the LICENSE.txt file.
11 *
12 */
13
14#include <QObject>
15#include <deconz/zcl.h>
16#include <deconz/types.h>
17
18class zme : public QObject
19{
20 Q_OBJECT
21
22 Q_ENUMS(NodeServerMask)
23
24public:
28 enum NodeServerFlag
29 {
30 PrimaryTrustCenter = (1 << 0),
31 BackupTrustCenter = (1 << 1),
32 PrimaryBindingTableCache = (1 << 2),
33 BackupBindingTableCache = (1 << 3),
34 PrimaryDiscoveryCache = (1 << 4),
35 BackupDiscoveryCache = (1 << 5),
36 NetworkManager = (1 << 6),
37 };
38
39 Q_DECLARE_FLAGS(NodeServerFlags, NodeServerFlag)
40};
41
42Q_DECLARE_OPERATORS_FOR_FLAGS(zme::NodeServerFlags)
43
44
49namespace deCONZ {
50
52enum MacCapability : unsigned char
53{
55 MacDeviceIsFFD = (1 << 1),
56 MacIsMainsPowered = (1 << 2),
58 MacSecuritySupport = (1 << 6),
59 MacAllocateAddress = (1 << 7)
60};
61
62Q_DECLARE_FLAGS(MacCapabilities, MacCapability)
63Q_DECLARE_OPERATORS_FOR_FLAGS(deCONZ::MacCapabilities)
64
65
69{
71 ModePeriodic = 0x01,
72 ModeStimulated = 0x02
73};
74
79{
80 PowerSourceUnknown = 0x00,
84};
85
86Q_DECLARE_FLAGS(PowerSources, PowerSource)
87Q_DECLARE_OPERATORS_FOR_FLAGS(PowerSources)
88
89
93{
95 PowerLevel33 = 0x04,
96 PowerLevel66 = 0x08,
97 PowerLevel100 = 0x0c
98};
99
100class NodeDescriptorPrivate;
101
108class DECONZ_DLLSPEC NodeDescriptor
109{
110
111public:
115 NodeDescriptor(const NodeDescriptor &other);
117 NodeDescriptor &operator=(const NodeDescriptor &other);
121 void readFromStream(QDataStream &stream);
123 deCONZ::DeviceType deviceType() const;
125 void setDeviceType(deCONZ::DeviceType deviceType);
127 uint16_t manufacturerCode() const;
131 ManufacturerCode_t manufacturerCode_t() const;
133 void setManufacturerCode(quint16 code);
137 void setManufacturerCode(ManufacturerCode_t code);
139 MacCapabilities macCapabilities() const;
141 void setMacCapabilities(MacCapabilities cap);
143 bool hasComplexDescriptor() const;
145 void setHasComplexDescriptor(bool hasComplex);
147 bool hasUserDescriptor() const;
149 void setHasUserDescriptor(bool hasUser);
151 deCONZ::FrequencyBand frequencyBand() const;
153 void setFrequenzyBand(deCONZ::FrequencyBand freq);
155 const char *frequencyBandString() const;
157 bool isAlternatePanCoordinator() const;
159 void setIsAlternatePanCoordinator(bool isAlt);
161 bool isFullFunctionDevice() const;
163 void setIsFFD(bool isFFD);
165 bool isMainsPowered() const;
167 void setIsMainsPowered(bool isMains);
169 bool receiverOnWhenIdle() const;
171 void setRxOnWhenIdle(bool on);
173 bool securitySupport() const;
175 void setSecuritySupport(bool supported);
177 bool allocateAddress() const;
179 bool hasEndpointList() const;
181 bool hasSimpleDescriptorList() const;
183 const zme::NodeServerFlags serverMask() const;
185 uint8_t maxBufferSize() const;
187 uint16_t maxIncomingTransferSize() const;
189 uint16_t maxOutgoingTransferSize() const;
191 bool isNull() const;
193 void setIsNull(bool isNull);
195 QByteArray toByteArray() const;
197 unsigned stackRevision() const;
198
199private:
200 NodeDescriptorPrivate *d = nullptr;
201};
202
204
211class DECONZ_DLLSPEC PowerDescriptor
212{
213public:
217 PowerDescriptor(const PowerDescriptor &other);
219 PowerDescriptor &operator=(const PowerDescriptor &other);
221 PowerDescriptor(const QByteArray &data);
225 PowerMode currentPowerMode() const;
227 PowerSources availablePowerSources() const;
229 PowerSource currentPowerSource() const;
231 PowerSourceLevel currentPowerLevel() const;
233 bool isValid() const;
235 QByteArray toByteArray() const;
236
237private:
238 PowerDescriptorPrivate *d = nullptr;
239};
240
242
253class DECONZ_DLLSPEC SimpleDescriptor
254{
255public:
261 SimpleDescriptor &operator=(const SimpleDescriptor &other);
265 void readFromStream(QDataStream &stream, quint16 mfcode);
267 void writeToStream(QDataStream &stream) const;
269 uint8_t endpoint() const;
271 void setEndpoint(uint8_t endpoint);
273 uint16_t profileId() const;
275 void setProfileId(uint16_t profileId);
277 uint16_t deviceId() const;
279 void setDeviceId(uint16_t deviceId);
281 uint8_t deviceVersion() const;
283 void setDeviceVersion(uint8_t version);
285 bool isValid() const;
287 std::vector<ZclCluster> &inClusters();
289 const std::vector<ZclCluster> &inClusters() const;
291 std::vector<ZclCluster> &outClusters();
293 const std::vector<ZclCluster> &outClusters() const;
294 /* \cond INTERNAL_SYMBOLS */ // TODO: move in SimpleDescriptorPrivate
295 ZclCluster *cluster(uint16_t id, ZclClusterSide side);
296 std::vector<ZclCluster> &clusters(ZclClusterSide side);
297 const std::vector<ZclCluster> &clusters(ZclClusterSide side) const;
298 /* \endcond */
299
300private:
301 SimpleDescriptorPrivate *d = nullptr;
302};
303
304} // namespace deCONZ
305
306#endif // DECONZ_ZDP_DESCRIPTORS_H
A strong typed Zigbee manufacturer code.
Definition zcl.h:615
Definition zdp_descriptors.cpp:20
Represents a ZigBee node descriptor.
Definition zdp_descriptors.h:109
Definition zdp_descriptors.cpp:210
Represents a ZigBee power descriptor.
Definition zdp_descriptors.h:212
Definition zdp_descriptors.cpp:318
Represents a ZigBee simple descriptor.
Definition zdp_descriptors.h:254
Represents a ZigBee cluster (ZCL and non-ZCL).
Definition zcl.h:1173
FrequencyBand
ZigBee frequency band.
Definition types.h:415
The deCONZ namespace.
Definition aps.cpp:19
ZclClusterSide
ZCL cluster side where client is a out cluster and server is a in cluster.
Definition zcl.h:912
PowerSourceLevel
Current power source level in node power descriptor.
Definition zdp_descriptors.h:93
@ PowerLevelCritical
Critical.
Definition zdp_descriptors.h:94
@ PowerLevel33
33%
Definition zdp_descriptors.h:95
@ PowerLevel66
66%
Definition zdp_descriptors.h:96
@ PowerLevel100
100%
Definition zdp_descriptors.h:97
MacCapability
IEEE 802.15.4 MAC capabilities.
Definition zdp_descriptors.h:53
@ MacAlternatePanCoordinator
Can be a alternate pan coordinator.
Definition zdp_descriptors.h:54
@ MacDeviceIsFFD
Is a full function device.
Definition zdp_descriptors.h:55
@ MacSecuritySupport
Has (high) security support.
Definition zdp_descriptors.h:58
@ MacReceiverOnWhenIdle
Has receiver on when idle.
Definition zdp_descriptors.h:57
@ MacAllocateAddress
Allocates address.
Definition zdp_descriptors.h:59
@ MacIsMainsPowered
Is mains powered.
Definition zdp_descriptors.h:56
DeviceType
ZigBee device types.
Definition types.h:225
PowerSource
Available power sources in node power descriptor.
Definition zdp_descriptors.h:79
@ PowerSourceMains
Constant (mains) power.
Definition zdp_descriptors.h:81
@ PowerSourceRechargeable
Rechargeable battery.
Definition zdp_descriptors.h:82
@ PowerSourceDisposable
Disposable battery.
Definition zdp_descriptors.h:83
PowerMode
Current power mode in node power descriptor.
Definition zdp_descriptors.h:69
@ ModePeriodic
Receiver comes on periodically as defined by the node power descriptor.
Definition zdp_descriptors.h:71
@ ModeStimulated
Receiver comes on when stimulated, e.g.
Definition zdp_descriptors.h:72
@ ModeOnWhenIdle
Receiver synchronized with the receiver on when idle sub-field of the node descriptor.
Definition zdp_descriptors.h:70
Declaration of the most common deCONZ library types.