deCONZ C++ API v2.6.1
Loading...
Searching...
No Matches
green_power.h
1#ifndef DECONZ_GREEN_POWER_H
2#define DECONZ_GREEN_POWER_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 "deconz/types.h"
15#include "deconz/declspec.h"
16
17class QDataStream;
18
19namespace deCONZ
20{
21
22enum GpDeviceIds
23{
24 // GP Generic
25 GpDeviceIdOnOffSwitch = 0x02
26};
27
28enum GpCommandIds
29{
30 GpCommandIdIdentify = 0x00,
31 // 0x01 - 0x0f reserved
32 GpCommandIdScene0 = 0x10,
33 GpCommandIdScene1 = 0x11,
34 GpCommandIdScene2 = 0x12,
35 GpCommandIdScene3 = 0x13,
36 GpCommandIdScene4 = 0x14,
37 GpCommandIdScene5 = 0x15,
38 GpCommandIdScene6 = 0x16,
39 GpCommandIdScene7 = 0x17,
40 GpCommandIdScene8 = 0x18,
41 GpCommandIdScene9 = 0x19,
42 GpCommandIdScene10 = 0x1a,
43 GpCommandIdScene11 = 0x1b,
44 GpCommandIdScene12 = 0x1c,
45 GpCommandIdScene13 = 0x1d,
46 GpCommandIdScene14 = 0x1e,
47 GpCommandIdScene15 = 0x1f,
48 GpCommandIdOff = 0x20,
49 GpCommandIdOn = 0x21,
50 GpCommandIdToggle = 0x22,
51 GpCommandIdRelease = 0x23,
52 // 0x24 - 0x2f reserved
53 GpCommandIdMoveUp = 0x30,
54 GpCommandIdMoveDown = 0x31,
55 GpCommandIdStepUp = 0x32,
56 GpCommandIdStepDown = 0x33,
57 GpCommandIdLevelControlStop = 0x34,
58 GpCommandIdMoveUpWithOnOff = 0x35,
59 GpCommandIdMoveDownWithOnOff = 0x36,
60 GpCommandIdStepUpWithOnOff = 0x37,
61 GpCommandIdStepDownWithOnOff = 0x38,
62
63 GpCommandIdMoveHueUp = 0x41,
64 GpCommandIdMoveHueDown = 0x42,
65 GpCommandIdStepHueUp = 0x43,
66 GpCommandIdStepHueDown = 0x44,
67 GpCommandIdMoveSaturationUp = 0x46,
68 GpCommandIdMoveSaturationDown = 0x47,
69 GpCommandIdStepSaturationUp = 0x48,
70 GpCommandIdStepSaturationDown = 0x49,
71 GpCommandIdMoveColor = 0x4a,
72 GpCommandIdStepColor = 0x4b,
73
74 GpCommandIdPress1Of1 = 0x60,
75 GpCommandIdRelease1Of1 = 0x61,
76 GpCommandIdPress1Of2 = 0x62,
77 GpCommandIdRelease1Of2 = 0x63,
78 GpCommandIdPress2Of2 = 0x64,
79 GpCommandIdRelease2Of2 = 0x65,
80 GpCommandIdShortPress1Of1 = 0x66,
81 GpCommandIdShortPress1Of2 = 0x67,
82 GpCommandIdShortPress2Of2 = 0x68,
83 // 0x69 - 0x6f reserved
84 // 0x70 - 0x9f reserved
85 GpCommandIdAttributeReporting = 0xa0,
86 GpCommandIdManufacturerAttributeReporting = 0xa1,
87 GpCommandIdMultiClusterReporting = 0xa2,
88 GpCommandIdManufacturerMultiClusterReporting = 0xa3,
89 GpCommandIdRequestAttributes = 0xa4,
90 GpCommandIdReadAttributesResponse = 0xa5,
91 // 0xa6 - 0xae reserved
92 GpCommandIdAnyGPGSensorCommand = 0xaf, // (0xa0 - 0xa3)
93 // 0xb0 - 0xdf reserved
94 GpCommandIdCommissioning = 0xe0,
95 GpCommandIdDecommissioning = 0xe1,
96 GpCommandIdSuccess = 0xe2,
97 GpCommandIdChannelRequest = 0xe3,
98 // 0xe4 - 0xef reserved
99 GpCommandIdCommissioningReply = 0xf0,
100 GpCommandIdWriteAttributes = 0xf1,
101 GpCommandIdReadAttributes = 0xf2,
102 GpCommandIdChannelConfiguration = 0xf3,
103 // 0xf4 - 0xff reserved for other commands sent to the GPD
104};
105
106enum GppCommandIds
107{
108 GppCommandIdNotification = 0x00,
109 GppCommandIdCommissioningNotification = 0x04
110};
111
112enum GppGpdLqi
113{
114 GppGpdLqiPoor = 0x00,
115 GppGpdLqiModerate = 0x01,
116 GppGpdLqiHigh = 0x02,
117 GppGpdLqiExcellent = 0x03
118};
119
121{
122 struct Bits
123 {
124 unsigned int macSequenceNumerCapability : 1;
125 unsigned int rxOnCapability : 1;
126 unsigned int reserved : 2;
127 unsigned int panIdRequest : 1;
128 unsigned int gpSecurityKeyRequest : 1;
129 unsigned int fixedLocation : 1;
130 unsigned int extOptionsField : 1;
131 } bits;
132 quint8 byte;
133};
134
136{
137 struct Bits
138 {
139 unsigned int securityLevelCapabilities : 2;
140 unsigned int keyType : 3;
141 unsigned int gpdKeyPresent : 1;
142 unsigned int gpdKeyEncryption : 1;
143 unsigned int gpdOutgoingCounterPresent : 1;
144 } bits;
145 quint8 byte;
146};
147
149
155class DECONZ_DLLSPEC GpDataIndication
156{
157public:
163 GpDataIndication &operator=(const GpDataIndication &other);
166
168 bool readFromStream(QDataStream &stream);
169
171 bool readFromStreamGpNotification(QDataStream &stream);
172
174 quint32 gpdSrcId() const;
176 quint8 gpdCommandId() const;
178 quint32 frameCounter() const;
180 const QByteArray &payload() const;
181
186 quint16 gppShortAddress() const;
187
192 quint8 gppGpdLink() const;
197 qint8 gppRssi() const;
202 GppGpdLqi gppLqi() const;
203
204private:
206 Q_DECLARE_PRIVATE(GpDataIndication)
207};
208
209} // namespace deCONZ
210
211Q_DECLARE_METATYPE(deCONZ::GpDataIndication)
212
213#endif // DECONZ_GREEN_POWER_H
Definition green_power.cpp:31
GPDE-DATA.indication primitive.
Definition green_power.h:156
The deCONZ namespace.
Definition aps.cpp:19
Definition green_power.h:123
Definition green_power.h:138
Declaration of the most common deCONZ library types.
Definition green_power.h:121
Definition green_power.h:136