Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-zbee-zcl-lighting.c
blob44db428cb6ecfb2672c5d1492b3a5208d967e047
1 /* packet-zbee-zcl-lighting.c
2 * Dissector routines for the ZigBee ZCL Lighting clusters
3 * Color Control, Ballast Configuration
4 * By Aditya Jain <aditya.jain@samsung.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 /* Include Files */
14 #include "config.h"
16 #include <epan/packet.h>
17 #include <epan/to_str.h>
19 #include "packet-zbee.h"
20 #include "packet-zbee-aps.h"
21 #include "packet-zbee-zcl.h"
23 /* ########################################################################## */
24 /* #### (0x0300) COLOR CONTROL CLUSTER ###################################### */
25 /* ########################################################################## */
27 /*************************/
28 /* Defines */
29 /*************************/
31 #define ZBEE_ZCL_COLOR_CONTROL_NUM_ETT 3
33 #define ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_HS_MASK 0x0001 /* bit 0 */
34 #define ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_EHS_MASK 0x0002 /* bit 1 */
35 #define ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_LOOP_MASK 0x0004 /* bit 2 */
36 #define ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_XY_MASK 0x0008 /* bit 3 */
37 #define ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_CT_MASK 0x0010 /* bit 4 */
38 #define ZBEE_ZCL_COLOR_LOOP_UPDATE_ACTION_MASK 0x01 /* bit 0 */
39 #define ZBEE_ZCL_COLOR_LOOP_UPDATE_DIRECTION_MASK 0x02 /* bit 1 */
40 #define ZBEE_ZCL_COLOR_LOOP_UPDATE_TIME_MASK 0x04 /* bit 2 */
41 #define ZBEE_ZCL_COLOR_LOOP_UPDATE_START_HUE_MASK 0x08 /* bit 3 */
43 /* Attributes */
44 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_HUE 0x0000 /* Current Hue */
45 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_SATURATION 0x0001 /* Current Saturation */
46 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_REMAINING_TIME 0x0002 /* Remaining Time */
47 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_X 0x0003 /* Current X */
48 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_Y 0x0004 /* Current Y */
49 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_DRIFT_COMPENSATION 0x0005 /* Drift Compensation */
50 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COMPENSATION_TEXT 0x0006 /* Compensation Text */
51 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMP 0x0007 /* Color Temperature */
52 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_MODE 0x0008 /* Color Mode */
53 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_NO_OF_PRIMARIES 0x0010 /* Number of Primaries */
54 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_X 0x0011 /* Primary 1X */
55 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_Y 0x0012 /* Primary 1Y */
56 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_INTENSITY 0x0013 /* Primary 1intensity */
57 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_X 0x0015 /* Primary 2X */
58 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_Y 0x0016 /* Primary 2Y */
59 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_INTENSITY 0x0017 /* Primary 2intensity */
60 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_X 0x0019 /* Primary 3X */
61 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_Y 0x001a /* Primary 3Y */
62 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_INTENSITY 0x001b /* Primary 3intensity */
63 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_X 0x0020 /* Primary 4X */
64 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_Y 0x0021 /* Primary 4Y */
65 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_INTENSITY 0x0022 /* Primary 4intensity */
66 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_X 0x0024 /* Primary 5X */
67 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_Y 0x0025 /* Primary 5Y */
68 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_INTENSITY 0x0026 /* Primary 5intensity */
69 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_X 0x0028 /* Primary 6X */
70 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_Y 0x0029 /* Primary 6Y */
71 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_INTENSITY 0x002a /* Primary 6intensity */
72 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_WHITE_POINT_X 0x0030 /* White Point X */
73 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_WHITE_POINT_Y 0x0031 /* White Point Y */
74 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_X 0x0032 /* Color Point RX */
75 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_Y 0x0033 /* Color Point RY */
76 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_INTENSITY 0x0034 /* Color Point Rintensity */
77 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_X 0x0036 /* Color Point GX */
78 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_Y 0x0037 /* Color Point GY */
79 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_INTENSITY 0x0038 /* Color Point Gintensity */
80 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_X 0x003a /* Color Point BX */
81 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_Y 0x003b /* Color Point BY */
82 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_INTENSITY 0x003c /* Color Point Bintensity */
83 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_ENHANCED_CURRENT_HUE 0x4000 /* Enhanced Current Hue */
84 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_ENHANCED_COLOR_MODE 0x4001 /* Enhanced Color Mode */
85 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_ACTIVE 0x4002 /* Color Loop Active */
86 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_DIRECTION 0x4003 /* Color Loop Direction */
87 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_TIME 0x4004 /* Color Loop Time */
88 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_START_ENH_HUE 0x4005 /* Color Loop Start Enhanced Hue */
89 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_STORED_ENH_HUE 0x4006 /* Color Loop Stored Enhanced Hue */
90 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_CAPABILITIES 0x400a /* Color Capabilities */
91 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MIN 0x400b /* Color Temperature Physical Min */
92 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MAX 0x400c /* Color Temperature Physical Max */
93 #define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_STARTUP_COLOR_TEMPERATURE 0x4010 /* Startup Color Temperature */
95 /* Server Commands Received */
96 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE 0x00 /* Move to Hue */
97 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_HUE 0x01 /* Move Hue */
98 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_HUE 0x02 /* Step Hue */
99 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_SATURATION 0x03 /* Move to Saturation */
100 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_SATURATION 0x04 /* Move Saturation */
101 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_SATURATION 0x05 /* Step Saturation */
102 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE_AND_SATURATION 0x06 /* Move to Hue and Saturation */
103 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_COLOR 0x07 /* Move to Color */
104 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_COLOR 0x08 /* Move Color */
105 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_COLOR 0x09 /* Step Color */
106 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_COLOR_TEMP 0x0a /* Move to Color Temperature */
107 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_TO_HUE 0x40 /* Enhanced Move to Hue */
108 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_HUE 0x41 /* Enhanced Move Hue */
109 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_STEP_HUE 0x42 /* Enhanced Step Hue */
110 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_TO_HUE_AND_SATURATION 0x43 /* Enhanced Move to Hue and Saturation */
111 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_COLOR_LOOP_SET 0x44 /* Color Loop Set */
112 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STOP_MOVE_STEP 0x47 /* Stop Move Step */
113 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_COLOR_TEMP 0x4b /* Move Color Temperature */
114 #define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_COLOR_TEMP 0x4c /* Step Color Temperature */
116 #define ZBEE_ZCL_NORMAL_HUE false
117 #define ZBEE_ZCL_ENHANCED_HUE true
119 /* Server Commands Generated - None */
121 /*************************/
122 /* Function Declarations */
123 /*************************/
125 void proto_register_zbee_zcl_color_control(void);
126 void proto_reg_handoff_zbee_zcl_color_control(void);
128 /* Command Dissector Helpers */
129 static void dissect_zcl_color_control_move_to_hue (tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced);
130 static void dissect_zcl_color_control_move_hue_saturation (tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced);
131 static void dissect_zcl_color_control_step_hue_saturation (tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced);
132 static void dissect_zcl_color_control_move_to_saturation (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
133 static void dissect_zcl_color_control_move_to_hue_and_saturation (tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced);
134 static void dissect_zcl_color_control_move_to_color (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
135 static void dissect_zcl_color_control_move_color (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
136 static void dissect_zcl_color_control_step_color (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
137 static void dissect_zcl_color_control_move_to_color_temp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
138 static void dissect_zcl_color_control_color_loop_set (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
139 static void dissect_zcl_color_control_move_color_temp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
140 static void dissect_zcl_color_control_step_color_temp (tvbuff_t *tvb, proto_tree *tree, unsigned *offset);
142 static void dissect_zcl_color_control_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
144 /* Private functions prototype */
146 /*************************/
147 /* Global Variables */
148 /*************************/
149 /* Initialize the protocol and registered fields */
150 static int proto_zbee_zcl_color_control;
152 static int hf_zbee_zcl_color_control_attr_id;
153 static int hf_zbee_zcl_color_control_attr_current_hue;
154 static int hf_zbee_zcl_color_control_attr_current_saturation;
155 static int hf_zbee_zcl_color_control_attr_remaining_time;
156 static int hf_zbee_zcl_color_control_attr_color_x;
157 static int hf_zbee_zcl_color_control_attr_color_y;
158 static int hf_zbee_zcl_color_control_attr_drift_compensation;
159 static int hf_zbee_zcl_color_control_attr_color_temperature;
160 static int hf_zbee_zcl_color_control_attr_color_mode;
161 static int hf_zbee_zcl_color_control_attr_nr_of_primaries;
162 static int hf_zbee_zcl_color_control_attr_primary_1_x;
163 static int hf_zbee_zcl_color_control_attr_primary_1_y;
164 static int hf_zbee_zcl_color_control_attr_primary_1_intensity;
165 static int hf_zbee_zcl_color_control_attr_primary_2_x;
166 static int hf_zbee_zcl_color_control_attr_primary_2_y;
167 static int hf_zbee_zcl_color_control_attr_primary_2_intensity;
168 static int hf_zbee_zcl_color_control_attr_primary_3_x;
169 static int hf_zbee_zcl_color_control_attr_primary_3_y;
170 static int hf_zbee_zcl_color_control_attr_primary_3_intensity;
171 static int hf_zbee_zcl_color_control_attr_primary_4_x;
172 static int hf_zbee_zcl_color_control_attr_primary_4_y;
173 static int hf_zbee_zcl_color_control_attr_primary_4_intensity;
174 static int hf_zbee_zcl_color_control_attr_primary_5_x;
175 static int hf_zbee_zcl_color_control_attr_primary_5_y;
176 static int hf_zbee_zcl_color_control_attr_primary_5_intensity;
177 static int hf_zbee_zcl_color_control_attr_primary_6_x;
178 static int hf_zbee_zcl_color_control_attr_primary_6_y;
179 static int hf_zbee_zcl_color_control_attr_primary_6_intensity;
180 static int hf_zbee_zcl_color_control_attr_white_point_x;
181 static int hf_zbee_zcl_color_control_attr_white_point_y;
182 static int hf_zbee_zcl_color_control_attr_red_x;
183 static int hf_zbee_zcl_color_control_attr_red_y;
184 static int hf_zbee_zcl_color_control_attr_red_intensity;
185 static int hf_zbee_zcl_color_control_attr_green_x;
186 static int hf_zbee_zcl_color_control_attr_green_y;
187 static int hf_zbee_zcl_color_control_attr_green_intensity;
188 static int hf_zbee_zcl_color_control_attr_blue_x;
189 static int hf_zbee_zcl_color_control_attr_blue_y;
190 static int hf_zbee_zcl_color_control_attr_blue_intensity;
191 static int hf_zbee_zcl_color_control_attr_enhanced_current_hue;
192 static int hf_zbee_zcl_color_control_attr_enhanced_color_mode;
193 static int hf_zbee_zcl_color_control_attr_color_loop_active;
194 static int hf_zbee_zcl_color_control_attr_color_loop_direction;
195 static int hf_zbee_zcl_color_control_attr_color_loop_time;
196 static int hf_zbee_zcl_color_control_attr_color_loop_start_enhanced_hue;
197 static int hf_zbee_zcl_color_control_attr_color_loop_stored_enhanced_hue;
198 static int hf_zbee_zcl_color_control_attr_color_capabilities;
199 static int hf_zbee_zcl_color_control_attr_color_capabilities_hs;
200 static int hf_zbee_zcl_color_control_attr_color_capabilities_ehs;
201 static int hf_zbee_zcl_color_control_attr_color_capabilities_loop;
202 static int hf_zbee_zcl_color_control_attr_color_capabilities_xy;
203 static int hf_zbee_zcl_color_control_attr_color_capabilities_ct;
204 static int hf_zbee_zcl_color_control_attr_color_temperature_phys_min;
205 static int hf_zbee_zcl_color_control_attr_color_temperature_phys_max;
206 static int hf_zbee_zcl_color_control_attr_startup_color_temperature;
207 static int hf_zbee_zcl_color_control_hue;
208 static int hf_zbee_zcl_color_control_direction;
209 static int hf_zbee_zcl_color_control_transit_time;
210 static int hf_zbee_zcl_color_control_move_mode;
211 static int hf_zbee_zcl_color_control_rate;
212 static int hf_zbee_zcl_color_control_step_mode;
213 static int hf_zbee_zcl_color_control_step_size;
214 static int hf_zbee_zcl_color_control_transit_time_8bit;
215 static int hf_zbee_zcl_color_control_saturation;
216 static int hf_zbee_zcl_color_control_color_X;
217 static int hf_zbee_zcl_color_control_color_Y;
218 static int hf_zbee_zcl_color_control_rate_X;
219 static int hf_zbee_zcl_color_control_rate_Y;
220 static int hf_zbee_zcl_color_control_step_X;
221 static int hf_zbee_zcl_color_control_step_Y;
222 static int hf_zbee_zcl_color_control_color_temp;
223 static int hf_zbee_zcl_color_control_enhanced_hue;
224 static int hf_zbee_zcl_color_control_enhanced_rate;
225 static int hf_zbee_zcl_color_control_enhanced_step_size;
226 static int hf_zbee_zcl_color_control_color_loop_update_flags;
227 static int hf_zbee_zcl_color_control_color_loop_update_action;
228 static int hf_zbee_zcl_color_control_color_loop_update_direction;
229 static int hf_zbee_zcl_color_control_color_loop_update_time;
230 static int hf_zbee_zcl_color_control_color_loop_update_start_hue;
231 static int hf_zbee_zcl_color_control_color_loop_action;
232 static int hf_zbee_zcl_color_control_color_loop_direction;
233 static int hf_zbee_zcl_color_control_color_loop_time;
234 static int hf_zbee_zcl_color_control_color_loop_start_hue;
235 static int hf_zbee_zcl_color_control_color_temp_min;
236 static int hf_zbee_zcl_color_control_color_temp_max;
237 static int hf_zbee_zcl_color_control_srv_rx_cmd_id;
239 /* Initialize the subtree pointers */
240 static int ett_zbee_zcl_color_control;
241 static int ett_zbee_zcl_color_control_color_capabilities;
242 static int ett_zbee_zcl_color_control_color_loop_settings;
244 /* Attributes */
245 static const value_string zbee_zcl_color_control_attr_names[] = {
246 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_HUE, "Current Hue" },
247 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_SATURATION, "Current Saturation" },
248 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_REMAINING_TIME, "Remaining Time" },
249 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_X, "Current X" },
250 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_Y, "Current Y" },
251 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_DRIFT_COMPENSATION, "Drift Compensation" },
252 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COMPENSATION_TEXT, "Compensation Text" },
253 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMP, "Color Temperature" },
254 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_MODE, "Color Mode" },
255 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_NO_OF_PRIMARIES, "Number of Primaries" },
256 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_X, "Primary 1 X" },
257 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_Y, "Primary 1 Y" },
258 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_INTENSITY, "Primary 1 Intensity" },
259 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_X, "Primary 2 X" },
260 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_Y, "Primary 2 Y" },
261 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_INTENSITY, "Primary 2 Intensity" },
262 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_X, "Primary 3 X" },
263 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_Y, "Primary 3 Y" },
264 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_INTENSITY, "Primary 3 Intensity" },
265 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_X, "Primary 4 X" },
266 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_Y, "Primary 4 Y" },
267 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_INTENSITY, "Primary 4 Intensity" },
268 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_X, "Primary 5 X" },
269 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_Y, "Primary 5 Y" },
270 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_INTENSITY, "Primary 5 Intensity" },
271 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_X, "Primary 6 X" },
272 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_Y, "Primary 6 Y" },
273 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_INTENSITY, "Primary 6 Intensity" },
274 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_WHITE_POINT_X, "White Point X" },
275 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_WHITE_POINT_Y, "White Point Y" },
276 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_X, "Color Point Red X" },
277 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_Y, "Color Point Red Y" },
278 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_INTENSITY, "Color Point Red Intensity" },
279 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_X, "Color Point Green X" },
280 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_Y, "Color Point Green Y" },
281 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_INTENSITY, "Color Point Green Intensity" },
282 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_X, "Color Point Blue X" },
283 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_Y, "Color Point Blue Y" },
284 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_INTENSITY, "Color Point Blue Intensity" },
285 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_ENHANCED_CURRENT_HUE, "Enhanced Current Hue" },
286 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_ENHANCED_COLOR_MODE, "Enhanced Color Mode" },
287 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_ACTIVE, "Color Loop Active" },
288 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_DIRECTION, "Color Loop Direction" },
289 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_TIME, "Color Loop Time" },
290 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_START_ENH_HUE, "Color Loop Start Enhanced Hue" },
291 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_STORED_ENH_HUE, "Color Loop Stored Enhanced Hue" },
292 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_CAPABILITIES, "Color Capabilities" },
293 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MIN, "Color Temperature Physical Min" },
294 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MAX, "Color Temperature Physical Max" },
295 { ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_STARTUP_COLOR_TEMPERATURE, "Startup Color Temperature" },
296 { 0, NULL }
299 /* Server Commands Received */
300 static const value_string zbee_zcl_color_control_srv_rx_cmd_names[] = {
301 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE, "Move to Hue" },
302 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_HUE, "Move Hue" },
303 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_HUE, "Step Hue" },
304 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_SATURATION, "Move to Saturation" },
305 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_SATURATION, "Move Saturation" },
306 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_SATURATION, "Step Saturation" },
307 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE_AND_SATURATION, "Move to Hue and Saturation" },
308 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_COLOR, "Move to Color" },
309 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_COLOR, "Move Color" },
310 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_COLOR, "Step Color" },
311 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_COLOR_TEMP, "Move to Color Temperature" },
312 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_TO_HUE, "Enhanced Move to Hue" },
313 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_HUE, "Enhanced Move Hue" },
314 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_STEP_HUE, "Enhanced Step Hue" },
315 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_TO_HUE_AND_SATURATION, "Enhanced Move to Hue and Saturation" },
316 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_COLOR_LOOP_SET, "Color Loop Set" },
317 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STOP_MOVE_STEP, "Stop Move Step" },
318 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_COLOR_TEMP, "Move Color Temperature" },
319 { ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_COLOR_TEMP, "Step Color Temperature" },
320 { 0, NULL }
323 /* Drift Compensation Values */
324 static const value_string zbee_zcl_color_control_drift_compensation_values[] = {
325 { 0x00, "None" },
326 { 0x01, "Other/Unknown" },
327 { 0x02, "Temperature monitoring" },
328 { 0x03, "Optical Luminance Monitoring and Feedback" },
329 { 0x04, "Optical Color Monitoring and Feedback" },
330 { 0, NULL }
333 /* Color Mode Values */
334 static const value_string zbee_zcl_color_control_color_mode_values[] = {
335 { 0x00, "Hue and Saturation" },
336 { 0x01, "Color X and Y" },
337 { 0x02, "Color Temperature" },
338 { 0x03, "Enhanced Hue and Saturation" },
339 { 0, NULL }
342 /* Color Loop Directions */
343 static const value_string zbee_zcl_color_control_color_loop_direction_values[] = {
344 { 0x00, "Hue is Decrementing" },
345 { 0x01, "Hue is Incrementing" },
346 { 0, NULL }
349 /* Direction Values */
350 static const value_string zbee_zcl_color_control_direction_values[] = {
351 { 0x00, "Shortest Distance" },
352 { 0x01, "Longest Distance" },
353 { 0x02, "Up" },
354 { 0x03, "Down" },
355 { 0, NULL }
358 /* Move Mode Values */
359 static const value_string zbee_zcl_color_control_move_mode[] = {
360 { 0x00, "Stop" },
361 { 0x01, "Up" },
362 { 0x02, "Reserved" },
363 { 0x03, "Down" },
364 { 0, NULL }
367 /* Step Mode Values */
368 static const value_string zbee_zcl_color_control_step_mode[] = {
369 { 0x00, "Reserved" },
370 { 0x01, "Up" },
371 { 0x02, "Reserved" },
372 { 0x03, "Down" },
373 { 0, NULL }
376 /* Move Mode Values */
377 static const value_string zbee_zcl_color_control_action[] = {
378 { 0x00, "De-activate" },
379 { 0x01, "Activate from the value in the ColorLoopStartEnhancedHue field" },
380 { 0x02, "Activate from the value of the EnhancedCurrentHue attribute" },
381 { 0, NULL }
384 /*************************/
385 /* Function Bodies */
386 /*************************/
389 *ZigBee ZCL Color Control cluster dissector for wireshark.
391 *@param tvb pointer to buffer containing raw packet.
392 *@param pinfo pointer to packet information fields
393 *@param tree pointer to data tree Wireshark uses to display packet.
395 static int
396 dissect_zbee_zcl_color_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
398 proto_tree *payload_tree;
399 zbee_zcl_packet *zcl;
400 unsigned offset = 0;
401 uint8_t cmd_id;
402 int rem_len;
404 /* Reject the packet if data is NULL */
405 if (data == NULL)
406 return 0;
407 zcl = (zbee_zcl_packet *)data;
408 cmd_id = zcl->cmd_id;
410 /* Create a subtree for the ZCL Command frame, and add the command ID to it. */
411 if (zcl->direction == ZBEE_ZCL_FCF_TO_SERVER) {
412 /* Append the command name to the info column. */
413 col_append_fstr(pinfo->cinfo, COL_INFO, "%s, Seq: %u",
414 val_to_str_const(cmd_id, zbee_zcl_color_control_srv_rx_cmd_names, "Unknown Command"),
415 zcl->tran_seqno);
417 /* Add the command ID. */
418 proto_tree_add_item(tree, hf_zbee_zcl_color_control_srv_rx_cmd_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
420 /* Check if this command has a payload, then add the payload tree */
421 rem_len = tvb_reported_length_remaining(tvb, ++offset);
422 if (rem_len > 0) {
423 payload_tree = proto_tree_add_subtree(tree, tvb, offset, rem_len, ett_zbee_zcl_color_control, NULL, "Payload");
425 /* Call the appropriate command dissector */
426 switch (cmd_id) {
427 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE:
428 dissect_zcl_color_control_move_to_hue(tvb, payload_tree, &offset, ZBEE_ZCL_NORMAL_HUE);
429 break;
431 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_HUE:
432 dissect_zcl_color_control_move_hue_saturation(tvb, payload_tree, &offset, ZBEE_ZCL_NORMAL_HUE);
433 break;
435 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_HUE:
436 dissect_zcl_color_control_step_hue_saturation(tvb, payload_tree, &offset, ZBEE_ZCL_NORMAL_HUE);
437 break;
439 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_SATURATION:
440 dissect_zcl_color_control_move_to_saturation(tvb, payload_tree, &offset);
441 break;
443 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_SATURATION:
444 dissect_zcl_color_control_move_hue_saturation(tvb, payload_tree, &offset, ZBEE_ZCL_NORMAL_HUE);
445 break;
447 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_SATURATION:
448 dissect_zcl_color_control_step_hue_saturation(tvb, payload_tree, &offset, ZBEE_ZCL_NORMAL_HUE);
449 break;
451 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE_AND_SATURATION:
452 dissect_zcl_color_control_move_to_hue_and_saturation(tvb, payload_tree, &offset, ZBEE_ZCL_NORMAL_HUE);
453 break;
455 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_COLOR:
456 dissect_zcl_color_control_move_to_color(tvb, payload_tree, &offset);
457 break;
459 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_COLOR:
460 dissect_zcl_color_control_move_color(tvb, payload_tree, &offset);
461 break;
463 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_COLOR:
464 dissect_zcl_color_control_step_color(tvb, payload_tree, &offset);
465 break;
467 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_COLOR_TEMP:
468 dissect_zcl_color_control_move_to_color_temp(tvb, payload_tree, &offset);
469 break;
471 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_TO_HUE:
472 dissect_zcl_color_control_move_to_hue(tvb, payload_tree, &offset, ZBEE_ZCL_ENHANCED_HUE);
473 break;
475 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_HUE:
476 dissect_zcl_color_control_move_hue_saturation(tvb, payload_tree, &offset, ZBEE_ZCL_ENHANCED_HUE);
477 break;
479 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_STEP_HUE:
480 dissect_zcl_color_control_step_hue_saturation(tvb, payload_tree, &offset, ZBEE_ZCL_ENHANCED_HUE);
481 break;
483 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_TO_HUE_AND_SATURATION:
484 dissect_zcl_color_control_move_to_hue_and_saturation(tvb, payload_tree, &offset, ZBEE_ZCL_ENHANCED_HUE);
485 break;
487 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_COLOR_LOOP_SET:
488 dissect_zcl_color_control_color_loop_set(tvb, payload_tree, &offset);
489 break;
491 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_COLOR_TEMP:
492 dissect_zcl_color_control_move_color_temp(tvb, payload_tree, &offset);
493 break;
495 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_COLOR_TEMP:
496 dissect_zcl_color_control_step_color_temp(tvb, payload_tree, &offset);
497 break;
499 case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STOP_MOVE_STEP:
500 default:
501 break;
506 return tvb_captured_length(tvb);
507 } /*dissect_zbee_zcl_color_control*/
511 *This function decodes the Add Group or Add Group If
513 *@param tvb the tv buffer of the current data_type
514 *@param tree the tree to append this item to
515 *@param offset offset of data in tvb
517 static void
518 dissect_zcl_color_control_move_to_hue(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced)
520 /* Retrieve "Hue" field */
521 if (enhanced)
523 proto_tree_add_item(tree, hf_zbee_zcl_color_control_enhanced_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
524 *offset += 2;
526 else
528 proto_tree_add_item(tree, hf_zbee_zcl_color_control_hue, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
529 *offset += 1;
532 /* Retrieve "Direction" field */
533 proto_tree_add_item(tree, hf_zbee_zcl_color_control_direction, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
534 *offset += 1;
536 /* Retrieve "Transition Time" field */
537 proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
538 *offset += 2;
540 } /*dissect_zcl_color_control_move_to_hue*/
544 *This function decodes the Move Hue and Move Saturation payload.
546 *@param tvb the tv buffer of the current data_type
547 *@param tree the tree to append this item to
548 *@param offset offset of data in tvb
550 static void
551 dissect_zcl_color_control_move_hue_saturation(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced)
553 /* Retrieve "Move Mode" field */
554 proto_tree_add_item(tree, hf_zbee_zcl_color_control_move_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
555 *offset += 1;
557 /* Retrieve "Rate" field */
558 if (enhanced)
560 proto_tree_add_item(tree, hf_zbee_zcl_color_control_enhanced_rate, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
561 *offset += 2;
563 else
565 proto_tree_add_item(tree, hf_zbee_zcl_color_control_rate, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
566 *offset += 1;
569 } /*dissect_zcl_color_control_move_hue_saturation*/
573 *This function decodes the Step Hue and Step Saturation payload
575 *@param tvb the tv buffer of the current data_type
576 *@param tree the tree to append this item to
577 *@param offset offset of data in tvb
579 static void
580 dissect_zcl_color_control_step_hue_saturation(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced)
582 /* Retrieve "Step Mode" field */
583 proto_tree_add_item(tree, hf_zbee_zcl_color_control_step_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
584 *offset += 1;
586 /* Retrieve "Step Size" field */
587 if (enhanced)
589 proto_tree_add_item(tree, hf_zbee_zcl_color_control_enhanced_step_size, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
590 *offset += 2;
592 else
594 proto_tree_add_item(tree, hf_zbee_zcl_color_control_step_size, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
595 *offset += 1;
598 /* Retrieve "Transition Time" field */
599 proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time_8bit, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
600 *offset += 1;
602 } /*dissect_zcl_color_control_step_hue_saturation*/
606 *This function decodes the Move to Saturation payload.
608 *@param tvb the tv buffer of the current data_type
609 *@param tree the tree to append this item to
610 *@param offset offset of data in tvb
612 static void
613 dissect_zcl_color_control_move_to_saturation(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
615 /* Retrieve "Saturation" field */
616 proto_tree_add_item(tree, hf_zbee_zcl_color_control_saturation, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
617 *offset += 1;
619 /* Retrieve "Transition Time" field */
620 proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
621 *offset += 2;
623 } /*dissect_zcl_color_control_move_to_saturation*/
627 *This function decodes the Move to Hue and Saturation payload.
629 *@param tvb the tv buffer of the current data_type
630 *@param tree the tree to append this item to
631 *@param offset offset of data in tvb
633 static void
634 dissect_zcl_color_control_move_to_hue_and_saturation(tvbuff_t *tvb, proto_tree *tree, unsigned *offset, bool enhanced)
636 /* Retrieve "Hue" field */
637 if (enhanced)
639 proto_tree_add_item(tree, hf_zbee_zcl_color_control_enhanced_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
640 *offset += 2;
642 else
644 proto_tree_add_item(tree, hf_zbee_zcl_color_control_hue, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
645 *offset += 1;
648 /* Retrieve "Saturation" field */
649 proto_tree_add_item(tree, hf_zbee_zcl_color_control_saturation, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
650 *offset += 1;
652 /* Retrieve "Transition Time" field */
653 proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
654 *offset += 2;
656 } /*dissect_zcl_color_control_move_to_hue_and_saturation*/
660 *This function decodes the Move to Color payload.
662 *@param tvb the tv buffer of the current data_type
663 *@param tree the tree to append this item to
664 *@param offset offset of data in tvb
666 static void
667 dissect_zcl_color_control_move_to_color(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
669 /* Retrieve "Color X" field */
670 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_X, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
671 *offset += 2;
673 /* Retrieve "Color Y" field */
674 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_Y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
675 *offset += 2;
677 /* Retrieve "Transition Time" field */
678 proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
679 *offset += 2;
681 } /*dissect_zcl_color_control_move_to_color*/
684 *This function decodes the Move Color payload.
686 *@param tvb the tv buffer of the current data_type
687 *@param tree the tree to append this item to
688 *@param offset offset of data in tvb
690 static void
691 dissect_zcl_color_control_move_color(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
693 /* Retrieve "Rate X" field */
694 proto_tree_add_item(tree, hf_zbee_zcl_color_control_rate_X, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
695 *offset += 2;
697 /* Retrieve "Rate Y" field */
698 proto_tree_add_item(tree, hf_zbee_zcl_color_control_rate_Y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
699 *offset += 2;
701 } /*dissect_zcl_color_control_move_color*/
705 *This function decodes the Step Color payload.
707 *@param tvb the tv buffer of the current data_type
708 *@param tree the tree to append this item to
709 *@param offset offset of data in tvb
711 static void
712 dissect_zcl_color_control_step_color(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
714 /* Retrieve "Step X" field */
715 proto_tree_add_item(tree, hf_zbee_zcl_color_control_step_X, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
716 *offset += 2;
718 /* Retrieve "Step Y" field */
719 proto_tree_add_item(tree, hf_zbee_zcl_color_control_step_Y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
720 *offset += 2;
722 /* Retrieve "Transition Time" field */
723 proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
724 *offset += 2;
726 } /*dissect_zcl_color_control_step_color*/
729 *This function decodes the Move to Color Temperature payload.
731 *@param tvb the tv buffer of the current data_type
732 *@param tree the tree to append this item to
733 *@param offset offset of data in tvb
735 static void
736 dissect_zcl_color_control_move_to_color_temp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
738 /* Retrieve "Color Temperature" field */
739 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_temp, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
740 *offset += 2;
742 /* Retrieve "Transition Time" field */
743 proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
744 *offset += 2;
746 } /*dissect_zcl_color_control_move_to_color_temp*/
749 *This function decodes the Color Loop Set payload.
751 *@param tvb the tv buffer of the current data_type
752 *@param tree the tree to append this item to
753 *@param offset offset of data in tvb
755 static void
756 dissect_zcl_color_control_color_loop_set(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
758 static int * const color_loop_update_fields[] = {
759 &hf_zbee_zcl_color_control_color_loop_update_action,
760 &hf_zbee_zcl_color_control_color_loop_update_direction,
761 &hf_zbee_zcl_color_control_color_loop_update_time,
762 &hf_zbee_zcl_color_control_color_loop_update_start_hue,
763 NULL
766 /* Retrieve "Update Flags" field */
767 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_color_control_color_loop_update_flags, ett_zbee_zcl_color_control_color_loop_settings, color_loop_update_fields, ENC_LITTLE_ENDIAN);
768 *offset += 1;
770 /* Retrieve "Action" field */
771 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_loop_action, tvb, *offset, 1, ENC_NA);
772 *offset += 1;
774 /* Retrieve "Direction" field */
775 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_loop_direction, tvb, *offset, 1, ENC_NA);
776 *offset += 1;
778 /* Retrieve "Time" field */
779 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_loop_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
780 *offset += 2;
782 /* Retrieve "Start Hue" field */
783 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_loop_start_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
784 *offset += 2;
786 } /*dissect_zcl_color_control_color_loop_set*/
789 *This function decodes the Move Color Temperature payload.
791 *@param tvb the tv buffer of the current data_type
792 *@param tree the tree to append this item to
793 *@param offset offset of data in tvb
795 static void
796 dissect_zcl_color_control_move_color_temp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
798 /* Retrieve "Move Mode" field */
799 proto_tree_add_item(tree, hf_zbee_zcl_color_control_move_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
800 *offset += 1;
802 /* Retrieve "Rate" field */
803 proto_tree_add_item(tree, hf_zbee_zcl_color_control_enhanced_rate, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
804 *offset += 2;
806 /* Retrieve "Color Temperature Min" field */
807 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_temp_min, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
808 *offset += 2;
810 /* Retrieve "Color Temperature Max" field */
811 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_temp_max, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
812 *offset += 2;
814 } /*dissect_zcl_color_control_move_color_temp*/
817 *This function decodes the Step Color Temperature payload.
819 *@param tvb the tv buffer of the current data_type
820 *@param tree the tree to append this item to
821 *@param offset offset of data in tvb
823 static void
824 dissect_zcl_color_control_step_color_temp(tvbuff_t *tvb, proto_tree *tree, unsigned *offset)
826 /* Retrieve "Step Mode" field */
827 proto_tree_add_item(tree, hf_zbee_zcl_color_control_step_mode, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
828 *offset += 1;
830 /* Retrieve "Step" field */
831 proto_tree_add_item(tree, hf_zbee_zcl_color_control_enhanced_step_size, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
832 *offset += 2;
834 /* Retrieve "Time" field */
835 proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
836 *offset += 2;
838 /* Retrieve "Color Temperature Min" field */
839 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_temp_min, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
840 *offset += 2;
842 /* Retrieve "Color Temperature Max" field */
843 proto_tree_add_item(tree, hf_zbee_zcl_color_control_color_temp_max, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
844 *offset += 2;
846 } /*dissect_zcl_color_control_step_color_temp*/
848 /*FUNCTION:------------------------------------------------------
849 * NAME
850 * decode_color_xy
851 * DESCRIPTION
852 * this function decodes color xy values
853 * PARAMETERS
854 * unsigned *s - string to display
855 * uint16_t value - value to decode
856 * RETURNS
857 * none
858 *---------------------------------------------------------------
860 static void
861 decode_color_xy(char *s, uint16_t value)
863 snprintf(s, ITEM_LABEL_LENGTH, "%.4lf", value/65535.0);
864 return;
865 } /*decode_power_conf_voltage*/
867 /*FUNCTION:------------------------------------------------------
868 * NAME
869 * decode_color_temperature
870 * DESCRIPTION
871 * this function decodes color temperature values
872 * PARAMETERS
873 * unsigned *s - string to display
874 * uint16_t value - value to decode
875 * RETURNS
876 * none
877 *---------------------------------------------------------------
879 static void
880 decode_color_temperature(char *s, uint16_t value)
882 if (value == 0) {
883 snprintf(s, ITEM_LABEL_LENGTH, "%u [Mired]", value);
884 } else {
885 snprintf(s, ITEM_LABEL_LENGTH, "%u [Mired] (%u [K])", value, 1000000/value);
887 return;
888 } /*decode_color_temperature*/
890 /*FUNCTION:------------------------------------------------------
891 * NAME
892 * decode_startup_color_temperature
893 * DESCRIPTION
894 * this function decodes color temperature values
895 * PARAMETERS
896 * unsigned *s - string to display
897 * uint16_t value - value to decode
898 * RETURNS
899 * none
900 *---------------------------------------------------------------
902 static void
903 decode_startup_color_temperature(char *s, uint16_t value)
905 if (value == 0xffff)
907 snprintf(s, ITEM_LABEL_LENGTH, "Set the Color Temperature attribute to its previous value");
909 else
911 decode_color_temperature(s, value);
913 return;
914 } /*decode_startup_color_temperature*/
917 *This function is called by ZCL foundation dissector in order to decode
919 *@param tree pointer to data tree Wireshark uses to display packet.
920 *@param tvb pointer to buffer containing raw packet.
921 *@param offset pointer to buffer offset
922 *@param attr_id attribute identifier
923 *@param data_type attribute data type
924 *@param client_attr ZCL client
926 void
927 dissect_zcl_color_control_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
929 static int * const capabilities_fields[] = {
930 &hf_zbee_zcl_color_control_attr_color_capabilities_hs,
931 &hf_zbee_zcl_color_control_attr_color_capabilities_ehs,
932 &hf_zbee_zcl_color_control_attr_color_capabilities_loop,
933 &hf_zbee_zcl_color_control_attr_color_capabilities_xy,
934 &hf_zbee_zcl_color_control_attr_color_capabilities_ct,
935 NULL
938 /* Dissect attribute data type and data */
939 switch ( attr_id ) {
941 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_HUE:
942 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_current_hue, tvb, *offset, 1, ENC_NA);
943 *offset += 1;
944 break;
946 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_SATURATION:
947 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_current_saturation, tvb, *offset, 1, ENC_NA);
948 *offset += 1;
949 break;
951 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_REMAINING_TIME:
952 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_remaining_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
953 *offset += 2;
954 break;
956 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_X:
957 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
958 *offset += 2;
959 break;
961 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_CURRENT_Y:
962 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
963 *offset += 2;
964 break;
966 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_DRIFT_COMPENSATION:
967 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_drift_compensation, tvb, *offset, 1, ENC_NA);
968 *offset += 1;
969 break;
971 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMP:
972 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_temperature, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
973 *offset += 2;
974 break;
976 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_MODE:
977 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_mode, tvb, *offset, 1, ENC_NA);
978 *offset += 1;
979 break;
981 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_NO_OF_PRIMARIES:
982 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_nr_of_primaries, tvb, *offset, 1, ENC_NA);
983 *offset += 1;
984 break;
986 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_X:
987 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_1_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
988 *offset += 2;
989 break;
991 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_Y:
992 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_1_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
993 *offset += 2;
994 break;
996 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_1_INTENSITY:
997 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_1_intensity, tvb, *offset, 1, ENC_NA);
998 *offset += 1;
999 break;
1001 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_X:
1002 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_2_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1003 *offset += 2;
1004 break;
1006 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_Y:
1007 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_2_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1008 *offset += 2;
1009 break;
1011 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_2_INTENSITY:
1012 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_2_intensity, tvb, *offset, 1, ENC_NA);
1013 *offset += 1;
1014 break;
1016 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_X:
1017 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_3_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1018 *offset += 2;
1019 break;
1021 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_Y:
1022 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_3_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1023 *offset += 2;
1024 break;
1026 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_3_INTENSITY:
1027 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_3_intensity, tvb, *offset, 1, ENC_NA);
1028 *offset += 1;
1029 break;
1031 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_X:
1032 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_4_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1033 *offset += 2;
1034 break;
1036 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_Y:
1037 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_4_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1038 *offset += 2;
1039 break;
1041 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_4_INTENSITY:
1042 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_4_intensity, tvb, *offset, 1, ENC_NA);
1043 *offset += 1;
1044 break;
1046 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_X:
1047 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_5_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1048 *offset += 2;
1049 break;
1051 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_Y:
1052 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_5_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1053 *offset += 2;
1054 break;
1056 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_5_INTENSITY:
1057 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_5_intensity, tvb, *offset, 1, ENC_NA);
1058 *offset += 1;
1059 break;
1061 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_X:
1062 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_6_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1063 *offset += 2;
1064 break;
1066 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_Y:
1067 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_6_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1068 *offset += 2;
1069 break;
1071 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_PRIMARY_6_INTENSITY:
1072 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_primary_6_intensity, tvb, *offset, 1, ENC_NA);
1073 *offset += 1;
1074 break;
1076 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_WHITE_POINT_X:
1077 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_white_point_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1078 *offset += 2;
1079 break;
1081 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_WHITE_POINT_Y:
1082 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_white_point_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1083 *offset += 2;
1084 break;
1086 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_X:
1087 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_red_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1088 *offset += 2;
1089 break;
1091 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_Y:
1092 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_red_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1093 *offset += 2;
1094 break;
1096 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_R_INTENSITY:
1097 proto_tree_add_item(tree,hf_zbee_zcl_color_control_attr_red_intensity, tvb, *offset, 1, ENC_NA);
1098 *offset += 1;
1099 break;
1101 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_X:
1102 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_green_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1103 *offset += 2;
1104 break;
1106 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_Y:
1107 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_green_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1108 *offset += 2;
1109 break;
1111 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_G_INTENSITY:
1112 proto_tree_add_item(tree,hf_zbee_zcl_color_control_attr_green_intensity, tvb, *offset, 1, ENC_NA);
1113 *offset += 1;
1114 break;
1116 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_X:
1117 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_blue_x, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1118 *offset += 2;
1119 break;
1121 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_Y:
1122 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_blue_y, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1123 *offset += 2;
1124 break;
1126 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_POINT_B_INTENSITY:
1127 proto_tree_add_item(tree,hf_zbee_zcl_color_control_attr_blue_intensity, tvb, *offset, 1, ENC_NA);
1128 *offset += 1;
1129 break;
1131 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_ENHANCED_CURRENT_HUE:
1132 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_enhanced_current_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1133 *offset += 2;
1134 break;
1136 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_ENHANCED_COLOR_MODE:
1137 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_enhanced_color_mode, tvb, *offset, 1, ENC_NA);
1138 *offset += 1;
1139 break;
1141 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_ACTIVE:
1142 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_loop_active, tvb, *offset, 1, ENC_NA);
1143 *offset += 1;
1144 break;
1146 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_DIRECTION:
1147 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_loop_direction, tvb, *offset, 1, ENC_NA);
1148 *offset += 1;
1149 break;
1151 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_TIME:
1152 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_loop_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1153 *offset += 2;
1154 break;
1156 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_START_ENH_HUE:
1157 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_loop_start_enhanced_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1158 *offset += 2;
1159 break;
1161 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_LOOP_STORED_ENH_HUE:
1162 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_loop_stored_enhanced_hue, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1163 *offset += 2;
1164 break;
1166 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_CAPABILITIES:
1167 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_color_control_attr_color_capabilities, ett_zbee_zcl_color_control_color_capabilities, capabilities_fields, ENC_LITTLE_ENDIAN);
1168 *offset += 2;
1169 break;
1171 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MIN:
1172 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_temperature_phys_min, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1173 *offset += 2;
1174 break;
1176 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MAX:
1177 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_color_temperature_phys_max, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1178 *offset += 2;
1179 break;
1181 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_STARTUP_COLOR_TEMPERATURE:
1182 proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_startup_color_temperature, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
1183 *offset += 2;
1184 break;
1186 case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COMPENSATION_TEXT:
1187 default:
1188 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1189 break;
1192 } /*dissect_zcl_color_control_attr_data*/
1196 *ZigBee ZCL Color Control cluster protocol registration routine.
1199 void
1200 proto_register_zbee_zcl_color_control(void)
1202 /* Setup list of header fields */
1203 static hf_register_info hf[] = {
1205 { &hf_zbee_zcl_color_control_attr_id,
1206 { "Attribute", "zbee_zcl_lighting.color_control.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_color_control_attr_names),
1207 0x0, NULL, HFILL } },
1209 { &hf_zbee_zcl_color_control_attr_current_hue,
1210 { "Hue", "zbee_zcl_lighting.color_control.attr.current_hue", FT_UINT8, BASE_DEC, NULL,
1211 0x0, NULL, HFILL } },
1213 { &hf_zbee_zcl_color_control_attr_current_saturation,
1214 { "Saturation", "zbee_zcl_lighting.color_control.attr.current_saturation", FT_UINT8, BASE_DEC, NULL,
1215 0x0, NULL, HFILL } },
1217 { &hf_zbee_zcl_color_control_attr_remaining_time,
1218 { "Time", "zbee_zcl_lighting.color_control.attr.remaining_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
1219 0x0, NULL, HFILL } },
1221 { &hf_zbee_zcl_color_control_attr_color_x,
1222 { "X", "zbee_zcl_lighting.color_control.attr.color_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1223 0x0, NULL, HFILL } },
1225 { &hf_zbee_zcl_color_control_attr_color_y,
1226 { "Y", "zbee_zcl_lighting.color_control.attr.color_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1227 0x0, NULL, HFILL } },
1229 { &hf_zbee_zcl_color_control_attr_drift_compensation,
1230 { "Drift Compensation", "zbee_zcl_lighting.color_control.attr.drift_compensation", FT_UINT8, BASE_HEX, VALS(zbee_zcl_color_control_drift_compensation_values),
1231 0x0, NULL, HFILL } },
1233 { &hf_zbee_zcl_color_control_attr_color_temperature,
1234 { "Color Temperature", "zbee_zcl_lighting.color_control.attr.color_temperature", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_temperature),
1235 0x0, NULL, HFILL } },
1237 { &hf_zbee_zcl_color_control_attr_color_mode,
1238 { "Color Mode", "zbee_zcl_lighting.color_control.attr.color_mode", FT_UINT8, BASE_HEX, VALS(zbee_zcl_color_control_color_mode_values),
1239 0x0, NULL, HFILL } },
1241 { &hf_zbee_zcl_color_control_attr_nr_of_primaries,
1242 { "Number", "zbee_zcl_lighting.color_control.attr.nr_of_primaries", FT_UINT8, BASE_DEC, NULL,
1243 0x0, NULL, HFILL } },
1245 { &hf_zbee_zcl_color_control_attr_primary_1_x,
1246 { "X", "zbee_zcl_lighting.color_control.attr.primary_1_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1247 0x0, NULL, HFILL } },
1249 { &hf_zbee_zcl_color_control_attr_primary_1_y,
1250 { "Y", "zbee_zcl_lighting.color_control.attr.primary_1_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1251 0x0, NULL, HFILL } },
1253 { &hf_zbee_zcl_color_control_attr_primary_1_intensity,
1254 { "Intensity", "zbee_zcl_lighting.color_control.attr.primary_1_intensity", FT_UINT8, BASE_DEC, NULL,
1255 0x0, NULL, HFILL } },
1257 { &hf_zbee_zcl_color_control_attr_primary_2_x,
1258 { "X", "zbee_zcl_lighting.color_control.attr.primary_2_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1259 0x0, NULL, HFILL } },
1261 { &hf_zbee_zcl_color_control_attr_primary_2_y,
1262 { "Y", "zbee_zcl_lighting.color_control.attr.primary_2_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1263 0x0, NULL, HFILL } },
1265 { &hf_zbee_zcl_color_control_attr_primary_2_intensity,
1266 { "Intensity", "zbee_zcl_lighting.color_control.attr.primary_2_intensity", FT_UINT8, BASE_DEC, NULL,
1267 0x0, NULL, HFILL } },
1269 { &hf_zbee_zcl_color_control_attr_primary_3_x,
1270 { "X", "zbee_zcl_lighting.color_control.attr.primary_3_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1271 0x0, NULL, HFILL } },
1273 { &hf_zbee_zcl_color_control_attr_primary_3_y,
1274 { "Y", "zbee_zcl_lighting.color_control.attr.primary_3_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1275 0x0, NULL, HFILL } },
1277 { &hf_zbee_zcl_color_control_attr_primary_3_intensity,
1278 { "Intensity", "zbee_zcl_lighting.color_control.attr.primary_3_intensity", FT_UINT8, BASE_DEC, NULL,
1279 0x0, NULL, HFILL } },
1281 { &hf_zbee_zcl_color_control_attr_primary_4_x,
1282 { "X", "zbee_zcl_lighting.color_control.attr.primary_4_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1283 0x0, NULL, HFILL } },
1285 { &hf_zbee_zcl_color_control_attr_primary_4_y,
1286 { "Y", "zbee_zcl_lighting.color_control.attr.primary_4_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1287 0x0, NULL, HFILL } },
1289 { &hf_zbee_zcl_color_control_attr_primary_4_intensity,
1290 { "Intensity", "zbee_zcl_lighting.color_control.attr.primary_4_intensity", FT_UINT8, BASE_DEC, NULL,
1291 0x0, NULL, HFILL } },
1293 { &hf_zbee_zcl_color_control_attr_primary_5_x,
1294 { "X", "zbee_zcl_lighting.color_control.attr.primary_5_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1295 0x0, NULL, HFILL } },
1297 { &hf_zbee_zcl_color_control_attr_primary_5_y,
1298 { "Y", "zbee_zcl_lighting.color_control.attr.primary_5_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1299 0x0, NULL, HFILL } },
1301 { &hf_zbee_zcl_color_control_attr_primary_5_intensity,
1302 { "Intensity", "zbee_zcl_lighting.color_control.attr.primary_5_intensity", FT_UINT8, BASE_DEC, NULL,
1303 0x0, NULL, HFILL } },
1305 { &hf_zbee_zcl_color_control_attr_primary_6_x,
1306 { "X", "zbee_zcl_lighting.color_control.attr.primary_6_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1307 0x0, NULL, HFILL } },
1309 { &hf_zbee_zcl_color_control_attr_primary_6_y,
1310 { "Y", "zbee_zcl_lighting.color_control.attr.primary_6_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1311 0x0, NULL, HFILL } },
1313 { &hf_zbee_zcl_color_control_attr_primary_6_intensity,
1314 { "Intensity", "zbee_zcl_lighting.color_control.attr.primary_6_intensity", FT_UINT8, BASE_DEC, NULL,
1315 0x0, NULL, HFILL } },
1317 { &hf_zbee_zcl_color_control_attr_white_point_x,
1318 { "X", "zbee_zcl_lighting.color_control.attr.white_point_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1319 0x0, NULL, HFILL } },
1321 { &hf_zbee_zcl_color_control_attr_white_point_y,
1322 { "Y", "zbee_zcl_lighting.color_control.attr.white_point_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1323 0x0, NULL, HFILL } },
1325 { &hf_zbee_zcl_color_control_attr_red_x,
1326 { "X", "zbee_zcl_lighting.color_control.attr.red_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1327 0x0, NULL, HFILL } },
1329 { &hf_zbee_zcl_color_control_attr_red_y,
1330 { "Y", "zbee_zcl_lighting.color_control.attr.red_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1331 0x0, NULL, HFILL } },
1333 { &hf_zbee_zcl_color_control_attr_red_intensity,
1334 { "Intensity", "zbee_zcl_lighting.color_control.attr.red_intensity", FT_UINT8, BASE_DEC, NULL,
1335 0x0, NULL, HFILL } },
1337 { &hf_zbee_zcl_color_control_attr_green_x,
1338 { "X", "zbee_zcl_lighting.color_control.attr.green_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1339 0x0, NULL, HFILL } },
1341 { &hf_zbee_zcl_color_control_attr_green_y,
1342 { "Y", "zbee_zcl_lighting.color_control.attr.green_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1343 0x0, NULL, HFILL } },
1345 { &hf_zbee_zcl_color_control_attr_green_intensity,
1346 { "Intensity", "zbee_zcl_lighting.color_control.attr.green_intensity", FT_UINT8, BASE_DEC, NULL,
1347 0x0, NULL, HFILL } },
1349 { &hf_zbee_zcl_color_control_attr_blue_x,
1350 { "X", "zbee_zcl_lighting.color_control.attr.blue_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1351 0x0, NULL, HFILL } },
1353 { &hf_zbee_zcl_color_control_attr_blue_y,
1354 { "Y", "zbee_zcl_lighting.color_control.attr.blue_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1355 0x0, NULL, HFILL } },
1357 { &hf_zbee_zcl_color_control_attr_blue_intensity,
1358 { "Intensity", "zbee_zcl_lighting.color_control.attr.blue_intensity", FT_UINT8, BASE_DEC, NULL,
1359 0x0, NULL, HFILL } },
1361 { &hf_zbee_zcl_color_control_attr_enhanced_current_hue,
1362 { "Enhanced Hue", "zbee_zcl_lighting.color_control.attr.enhanced_current_hue", FT_UINT16, BASE_DEC, NULL,
1363 0x0, NULL, HFILL } },
1365 { &hf_zbee_zcl_color_control_attr_enhanced_color_mode,
1366 { "Enhanced Color Mode", "zbee_zcl_lighting.color_control.attr.enhanced_color_mode", FT_UINT8, BASE_DEC, VALS(zbee_zcl_color_control_color_mode_values),
1367 0x0, NULL, HFILL } },
1369 { &hf_zbee_zcl_color_control_attr_color_loop_active,
1370 { "Active", "zbee_zcl_lighting.color_control.attr.color_loop_active", FT_BOOLEAN, BASE_NONE, NULL,
1371 0x0, NULL, HFILL } },
1373 { &hf_zbee_zcl_color_control_attr_color_loop_direction,
1374 { "Direction", "zbee_zcl_lighting.color_control.attr.color_loop_direction", FT_UINT8, BASE_DEC, VALS(zbee_zcl_color_control_color_loop_direction_values),
1375 0x0, NULL, HFILL } },
1377 { &hf_zbee_zcl_color_control_attr_color_loop_time,
1378 { "Time", "zbee_zcl_lighting.color_control.attr.color_loop_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds),
1379 0x0, NULL, HFILL } },
1381 { &hf_zbee_zcl_color_control_attr_color_loop_start_enhanced_hue,
1382 { "Enhanced Hue", "zbee_zcl_lighting.color_control.attr.color_loop_start_enhanced_hue", FT_UINT16, BASE_DEC, NULL,
1383 0x0, NULL, HFILL } },
1385 { &hf_zbee_zcl_color_control_attr_color_loop_stored_enhanced_hue,
1386 { "Enhanced Hue", "zbee_zcl_lighting.color_control.attr.color_loop_stored_enhanced_hue", FT_UINT16, BASE_DEC, NULL,
1387 0x0, NULL, HFILL } },
1389 { &hf_zbee_zcl_color_control_attr_color_capabilities,
1390 { "Capabilities", "zbee_zcl_lighting.color_control.attr.color_capabilities", FT_UINT16, BASE_HEX, NULL,
1391 0x0, NULL, HFILL } },
1393 { &hf_zbee_zcl_color_control_attr_color_capabilities_hs,
1394 { "Support Hue and Saturation", "zbee_zcl_lighting.color_control.attr.color_capabilities.hue_saturation", FT_UINT16, BASE_DEC, NULL,
1395 ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_HS_MASK, NULL, HFILL } },
1397 { &hf_zbee_zcl_color_control_attr_color_capabilities_ehs,
1398 { "Support Enhanced Hue and Saturation", "zbee_zcl_lighting.color_control.attr.color_capabilities.enhanced_hue_saturation", FT_UINT16, BASE_DEC, NULL,
1399 ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_EHS_MASK, NULL, HFILL } },
1401 { &hf_zbee_zcl_color_control_attr_color_capabilities_loop,
1402 { "Support Color Loop", "zbee_zcl_lighting.color_control.attr.color_capabilities.color_loop", FT_UINT16, BASE_DEC, NULL,
1403 ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_LOOP_MASK, NULL, HFILL } },
1405 { &hf_zbee_zcl_color_control_attr_color_capabilities_xy,
1406 { "Support Color XY", "zbee_zcl_lighting.color_control.attr.color_capabilities.color_xy", FT_UINT16, BASE_DEC, NULL,
1407 ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_XY_MASK, NULL, HFILL } },
1409 { &hf_zbee_zcl_color_control_attr_color_capabilities_ct,
1410 { "Support Color Temperature", "zbee_zcl_lighting.color_control.attr.color_capabilities.color_temperature", FT_UINT16, BASE_DEC, NULL,
1411 ZBEE_ZCL_COLOR_CAPABILITIES_SUPPORT_CT_MASK, NULL, HFILL } },
1413 { &hf_zbee_zcl_color_control_attr_color_temperature_phys_min,
1414 { "Color Temperature", "zbee_zcl_lighting.color_control.attr.color_temperature_physical_min", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_temperature),
1415 0x0, NULL, HFILL } },
1417 { &hf_zbee_zcl_color_control_attr_color_temperature_phys_max,
1418 { "Color Temperature", "zbee_zcl_lighting.color_control.attr.color_temperature_physical_max", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_temperature),
1419 0x0, NULL, HFILL } },
1421 { &hf_zbee_zcl_color_control_attr_startup_color_temperature,
1422 { "Startup Color Temperature", "zbee_zcl_lighting.color_control.attr.startup_color_temperature", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_startup_color_temperature),
1423 0x0, NULL, HFILL } },
1425 { &hf_zbee_zcl_color_control_hue,
1426 { "Hue", "zbee_zcl_lighting.color_control.hue", FT_UINT8, BASE_DEC, NULL,
1427 0x0, NULL, HFILL } },
1429 { &hf_zbee_zcl_color_control_direction,
1430 { "Direction", "zbee_zcl_lighting.color_control.direction", FT_UINT8, BASE_DEC, VALS(zbee_zcl_color_control_direction_values),
1431 0x0, NULL, HFILL } },
1433 { &hf_zbee_zcl_color_control_transit_time,
1434 { "Transition Time", "zbee_zcl_lighting.color_control.transit_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
1435 0x0, NULL, HFILL } },
1437 { &hf_zbee_zcl_color_control_move_mode,
1438 { "Move Mode", "zbee_zcl_lighting.color_control.move_mode", FT_UINT8, BASE_DEC, VALS(zbee_zcl_color_control_move_mode),
1439 0x0, NULL, HFILL } },
1441 { &hf_zbee_zcl_color_control_rate,
1442 { "Rate", "zbee_zcl_lighting.color_control.rate", FT_UINT8, BASE_DEC, NULL,
1443 0x0, NULL, HFILL }},
1445 { &hf_zbee_zcl_color_control_step_mode,
1446 { "Step Mode", "zbee_zcl_lighting.color_control.step_mode", FT_UINT8, BASE_DEC, VALS(zbee_zcl_color_control_step_mode),
1447 0x0, NULL, HFILL }},
1449 { &hf_zbee_zcl_color_control_step_size,
1450 { "Step Size", "zbee_zcl_lighting.color_control.step_size", FT_UINT8, BASE_DEC, NULL,
1451 0x0, NULL, HFILL }},
1453 { &hf_zbee_zcl_color_control_transit_time_8bit,
1454 { "Transition Time", "zbee_zcl_lighting.color_control.transition_time_8bit", FT_UINT8, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
1455 0x0, NULL, HFILL }},
1457 { &hf_zbee_zcl_color_control_saturation,
1458 { "Saturation", "zbee_zcl_lighting.color_control.saturation", FT_UINT8, BASE_DEC, NULL,
1459 0x0, NULL, HFILL }},
1461 { &hf_zbee_zcl_color_control_color_X,
1462 { "Color X", "zbee_zcl_lighting.color_control.color_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1463 0x0, NULL, HFILL }},
1465 { &hf_zbee_zcl_color_control_color_Y,
1466 { "Color Y", "zbee_zcl_lighting.color_control.color_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1467 0x0, NULL, HFILL }},
1469 { &hf_zbee_zcl_color_control_rate_X,
1470 { "Rate X", "zbee_zcl_lighting.color_control.rate_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1471 0x0, NULL, HFILL }},
1473 { &hf_zbee_zcl_color_control_rate_Y,
1474 { "Rate Y", "zbee_zcl_lighting.color_control.rate_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1475 0x0, NULL, HFILL }},
1477 { &hf_zbee_zcl_color_control_step_X,
1478 { "Step X", "zbee_zcl_lighting.color_control.step_x", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1479 0x0, NULL, HFILL }},
1481 { &hf_zbee_zcl_color_control_step_Y,
1482 { "Step Y", "zbee_zcl_lighting.color_control.step_y", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_xy),
1483 0x0, NULL, HFILL }},
1485 { &hf_zbee_zcl_color_control_color_temp,
1486 { "Color temperature", "zbee_zcl_lighting.color_control.color_temp", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_temperature),
1487 0x0, NULL, HFILL }},
1489 { &hf_zbee_zcl_color_control_enhanced_hue,
1490 { "Enhanced Hue", "zbee_zcl_lighting.color_control.enhanced_hue", FT_UINT16, BASE_DEC, NULL,
1491 0x0, NULL, HFILL } },
1493 { &hf_zbee_zcl_color_control_enhanced_rate,
1494 { "Enhanced Rate", "zbee_zcl_lighting.color_control.enhanced_rate", FT_UINT16, BASE_DEC, NULL,
1495 0x0, NULL, HFILL }},
1497 { &hf_zbee_zcl_color_control_enhanced_step_size,
1498 { "Enhanced Step Size", "zbee_zcl_lighting.color_control.enhanced_step_size", FT_UINT16, BASE_DEC, NULL,
1499 0x0, NULL, HFILL }},
1501 { &hf_zbee_zcl_color_control_color_loop_update_flags,
1502 { "Update Flags", "zbee_zcl_lighting.color_control.color_loop_update", FT_UINT8, BASE_HEX, NULL,
1503 0x0, NULL, HFILL } },
1505 { &hf_zbee_zcl_color_control_color_loop_update_action,
1506 { "Update Action", "zbee_zcl_lighting.color_control.color_loop_update.action", FT_UINT8, BASE_DEC, NULL,
1507 ZBEE_ZCL_COLOR_LOOP_UPDATE_ACTION_MASK, NULL, HFILL } },
1509 { &hf_zbee_zcl_color_control_color_loop_update_direction,
1510 { "Update Direction", "zbee_zcl_lighting.color_control.color_loop_update.direction", FT_UINT8, BASE_DEC, NULL,
1511 ZBEE_ZCL_COLOR_LOOP_UPDATE_DIRECTION_MASK, NULL, HFILL } },
1513 { &hf_zbee_zcl_color_control_color_loop_update_time,
1514 { "Update Time", "zbee_zcl_lighting.color_control.color_loop_update.time", FT_UINT8, BASE_DEC, NULL,
1515 ZBEE_ZCL_COLOR_LOOP_UPDATE_TIME_MASK, NULL, HFILL } },
1517 { &hf_zbee_zcl_color_control_color_loop_update_start_hue,
1518 { "Update Start Hue", "zbee_zcl_lighting.color_control.color_loop_update.start_hue", FT_UINT8, BASE_DEC, NULL,
1519 ZBEE_ZCL_COLOR_LOOP_UPDATE_START_HUE_MASK, NULL, HFILL } },
1521 { &hf_zbee_zcl_color_control_color_loop_action,
1522 { "Action", "zbee_zcl_lighting.color_control.color_loop_action", FT_UINT8, BASE_DEC, VALS(zbee_zcl_color_control_action),
1523 0x0, NULL, HFILL }},
1525 { &hf_zbee_zcl_color_control_color_loop_direction,
1526 { "Direction", "zbee_zcl_lighting.color_control.color_loop_direction", FT_UINT8, BASE_DEC, VALS(zbee_zcl_color_control_color_loop_direction_values),
1527 0x0, NULL, HFILL }},
1529 { &hf_zbee_zcl_color_control_color_loop_time,
1530 { "Time", "zbee_zcl_lighting.color_control.color_loop_time", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_seconds),
1531 0x0, NULL, HFILL } },
1533 { &hf_zbee_zcl_color_control_color_loop_start_hue,
1534 { "Enhanced Hue", "zbee_zcl_lighting.color_control.color_loop_start_hue", FT_UINT16, BASE_DEC, NULL,
1535 0x0, NULL, HFILL } },
1537 { &hf_zbee_zcl_color_control_color_temp_min,
1538 { "Color Temperature Minimum Mired", "zbee_zcl_lighting.color_control.color_temp_min", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_temperature),
1539 0x0, NULL, HFILL }},
1541 { &hf_zbee_zcl_color_control_color_temp_max,
1542 { "Color Temperature Maximum Mired", "zbee_zcl_lighting.color_control.color_temp_max", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_temperature),
1543 0x0, NULL, HFILL }},
1545 { &hf_zbee_zcl_color_control_srv_rx_cmd_id,
1546 { "Command", "zbee_zcl_lighting.color_control.cmd.srv_rx.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_color_control_srv_rx_cmd_names),
1547 0x0, NULL, HFILL } }
1550 /* ZCL Color Control subtrees */
1551 static int *ett[ZBEE_ZCL_COLOR_CONTROL_NUM_ETT];
1552 ett[0] = &ett_zbee_zcl_color_control;
1553 ett[1] = &ett_zbee_zcl_color_control_color_capabilities;
1554 ett[2] = &ett_zbee_zcl_color_control_color_loop_settings;
1556 /* Register the ZigBee ZCL Color Control cluster protocol name and description */
1557 proto_zbee_zcl_color_control = proto_register_protocol("ZigBee ZCL Color Control", "ZCL Color Control", ZBEE_PROTOABBREV_ZCL_COLOR_CONTROL);
1558 proto_register_field_array(proto_zbee_zcl_color_control, hf, array_length(hf));
1559 proto_register_subtree_array(ett, array_length(ett));
1561 /* Register the ZigBee ZCL Color Control dissector. */
1562 register_dissector(ZBEE_PROTOABBREV_ZCL_COLOR_CONTROL, dissect_zbee_zcl_color_control, proto_zbee_zcl_color_control);
1564 } /*proto_register_zbee_zcl_color_control*/
1568 *Hands off the ZCL Color Control dissector.
1571 void
1572 proto_reg_handoff_zbee_zcl_color_control(void)
1574 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_COLOR_CONTROL,
1575 proto_zbee_zcl_color_control,
1576 ett_zbee_zcl_color_control,
1577 ZBEE_ZCL_CID_COLOR_CONTROL,
1578 ZBEE_MFG_CODE_NONE,
1579 hf_zbee_zcl_color_control_attr_id,
1580 hf_zbee_zcl_color_control_attr_id,
1581 hf_zbee_zcl_color_control_srv_rx_cmd_id,
1583 (zbee_zcl_fn_attr_data)dissect_zcl_color_control_attr_data
1585 } /*proto_reg_handoff_zbee_zcl_color_control*/
1588 /* ########################################################################## */
1589 /* #### (0x0300) BALLAST CONFIGURATION CLUSTER ############################## */
1590 /* ########################################################################## */
1592 /*************************/
1593 /* Defines */
1594 /*************************/
1596 #define ZBEE_ZCL_BALLAST_CONFIGURATION_NUM_ETT 3
1598 /*Attributes*/
1599 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_PHYSICAL_MIN_LEVEL 0x0000 /* Physical Min Level */
1600 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_PHYSICAL_MAX_LEVEL 0x0001 /* Physical Max Level */
1601 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_BALLAST_STATUS 0x0002 /* Ballast Status */
1602 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_MIN_LEVEL 0x0010 /* Min Level */
1603 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_MAX_LEVEL 0x0011 /* Max Level */
1604 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_POWER_ON_LEVEL 0x0012 /* Power On Level */
1605 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_POWER_ON_FADE_TIME 0x0013 /* Power On Fade Time */
1606 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_INTRINSIC_BALLAST_FACTOR 0x0014 /* Intrinsic Ballast Factor */
1607 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_BALLAST_FACT_ADJ 0x0015 /* Ballast Factor Adjustment */
1608 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_QUANTITY 0x0020 /* Lamp Quantity */
1609 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_TYPE 0x0030 /* Lamp Type */
1610 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_MANUFACTURER 0x0031 /* Lamp Manufacturer */
1611 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_RATED_HOURS 0x0032 /* Lamp Rated Hours */
1612 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_BURN_HOURS 0x0033 /* Lamp Burn Hours */
1613 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_ALARM_MODE 0x0034 /* Lamp Alarm Mode */
1614 #define ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_BURN_HOURS_TRIP_POINT 0x0035 /* Lamp Burn Hours Trip Point */
1616 /*Server commands received - none*/
1618 /*Server commands generated - none*/
1620 /*Ballast Status Mask Values*/
1621 #define ZBEE_ZCL_BALLAST_CONFIGURATION_STATUS_NON_OPERATIONAL 0x01 /* Non-operational */
1622 #define ZBEE_ZCL_BALLAST_CONFIGURATION_STATUS_LAMP_NOT_IN_SOCKET 0x02 /* Lamp Not in Socket */
1624 /*Lamp Alarm Mode Mask Value*/
1625 #define ZBEE_ZCL_BALLAST_CONFIGURATION_LAMP_ALARM_MODE_LAMP_BURN_HOURS 0x01 /* Lamp Burn Hours */
1627 /*************************/
1628 /* Function Declarations */
1629 /*************************/
1631 void proto_register_zbee_zcl_ballast_configuration(void);
1632 void proto_reg_handoff_zbee_zcl_ballast_configuration(void);
1634 /* Command Dissector Helpers */
1635 static void dissect_zcl_ballast_configuration_attr_data (proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr);
1637 /* Private functions prototype */
1639 /*************************/
1640 /* Global Variables */
1641 /*************************/
1642 /* Initialize the protocol and registered fields */
1643 static int proto_zbee_zcl_ballast_configuration;
1645 static int hf_zbee_zcl_ballast_configuration_attr_id;
1646 static int hf_zbee_zcl_ballast_configuration_status;
1647 static int hf_zbee_zcl_ballast_configuration_status_non_operational;
1648 static int hf_zbee_zcl_ballast_configuration_status_lamp_not_in_socket;
1649 static int hf_zbee_zcl_ballast_configuration_lamp_alarm_mode;
1650 static int hf_zbee_zcl_ballast_configuration_lamp_alarm_mode_lamp_burn_hours;
1652 /* Initialize the subtree pointers */
1653 static int ett_zbee_zcl_ballast_configuration;
1654 static int ett_zbee_zcl_ballast_configuration_status;
1655 static int ett_zbee_zcl_ballast_configuration_lamp_alarm_mode;
1657 /* Attributes */
1658 static const value_string zbee_zcl_ballast_configuration_attr_names[] = {
1659 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_PHYSICAL_MIN_LEVEL, "Physical Min Level" },
1660 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_PHYSICAL_MAX_LEVEL, "Physical Max Level" },
1661 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_BALLAST_STATUS, "Ballast Status" },
1662 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_MIN_LEVEL, "Min Level" },
1663 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_MAX_LEVEL, "Max Level" },
1664 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_POWER_ON_LEVEL, "Power On Level" },
1665 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_POWER_ON_FADE_TIME, "Power On Fade Time" },
1666 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_INTRINSIC_BALLAST_FACTOR, "Intrinsic Ballast Factor" },
1667 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_BALLAST_FACT_ADJ, "Ballast Factor Adjustment" },
1668 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_QUANTITY, "Lamp Quantity" },
1669 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_TYPE, "Lamp Type" },
1670 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_MANUFACTURER, "Lamp Manufacturer" },
1671 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_RATED_HOURS, "Lamp Rated Hours" },
1672 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_BURN_HOURS, "Lamp Burn Hours" },
1673 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_ALARM_MODE, "Lamp Alarm Mode" },
1674 { ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_BURN_HOURS_TRIP_POINT, "Lamp Burn Hours Trip Point" },
1675 { 0, NULL }
1678 /*Non-operational Values*/
1679 static const value_string zbee_zcl_ballast_configuration_status_non_operational_names[] = {
1680 {0, "Fully Operational"},
1681 {1, "Not Fully Operational"},
1682 {0, NULL}
1685 /*Not in Socket Values*/
1686 static const value_string zbee_zcl_ballast_configuration_status_lamp_not_in_socket_names[] = {
1687 {0, "All lamps in Socket"},
1688 {1, "At least one lamp not in Socket"},
1689 {0, NULL}
1693 /*************************/
1694 /* Function Bodies */
1695 /*************************/
1698 *ZigBee ZCL Ballast Configuration cluster dissector for wireshark.
1700 *@param tvb pointer to buffer containing raw packet.
1701 *@param pinfo pointer to packet information fields
1702 *@param tree pointer to data tree Wireshark uses to display packet.
1705 static int
1706 dissect_zbee_zcl_ballast_configuration(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
1708 return tvb_captured_length(tvb);
1709 } /*dissect_zbee_zcl_ballast_configuration*/
1713 *This function is called by ZCL foundation dissector in order to decode
1715 *@param tree pointer to data tree Wireshark uses to display packet.
1716 *@param tvb pointer to buffer containing raw packet.
1717 *@param offset pointer to buffer offset
1718 *@param attr_id attribute identifier
1719 *@param data_type attribute data type
1720 *@param client_attr ZCL client
1722 void
1723 dissect_zcl_ballast_configuration_attr_data(proto_tree *tree, tvbuff_t *tvb, unsigned *offset, uint16_t attr_id, unsigned data_type, bool client_attr)
1725 static int * const ballast_status[] = {
1726 &hf_zbee_zcl_ballast_configuration_status_non_operational,
1727 &hf_zbee_zcl_ballast_configuration_status_lamp_not_in_socket,
1728 NULL
1731 static int * const lamp_alarm_mode[] = {
1732 &hf_zbee_zcl_ballast_configuration_lamp_alarm_mode_lamp_burn_hours,
1733 NULL
1736 /* Dissect attribute data type and data */
1737 switch (attr_id) {
1739 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_BALLAST_STATUS:
1740 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_ballast_configuration_status, ett_zbee_zcl_ballast_configuration_status, ballast_status, ENC_LITTLE_ENDIAN);
1741 *offset += 1;
1742 break;
1744 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_ALARM_MODE:
1745 proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_ballast_configuration_lamp_alarm_mode, ett_zbee_zcl_ballast_configuration_lamp_alarm_mode, lamp_alarm_mode, ENC_LITTLE_ENDIAN);
1746 *offset += 1;
1747 break;
1749 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_PHYSICAL_MIN_LEVEL:
1750 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_PHYSICAL_MAX_LEVEL:
1751 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_MIN_LEVEL:
1752 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_MAX_LEVEL:
1753 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_POWER_ON_LEVEL:
1754 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_POWER_ON_FADE_TIME:
1755 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_INTRINSIC_BALLAST_FACTOR:
1756 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_BALLAST_FACT_ADJ:
1757 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_QUANTITY:
1758 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_TYPE:
1759 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_MANUFACTURER:
1760 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_RATED_HOURS:
1761 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_BURN_HOURS:
1762 case ZBEE_ZCL_ATTR_ID_BALLAST_CONFIGURATION_LAMP_BURN_HOURS_TRIP_POINT:
1763 default:
1764 dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
1765 break;
1768 } /*dissect_zcl_ballast_configuration_attr_data*/
1772 *ZigBee ZCL Ballast Configuration cluster protocol registration routine.
1775 void
1776 proto_register_zbee_zcl_ballast_configuration(void)
1778 /* Setup list of header fields */
1779 static hf_register_info hf[] = {
1781 { &hf_zbee_zcl_ballast_configuration_attr_id,
1782 { "Attribute", "zbee_zcl_lighting.ballast_configuration.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_ballast_configuration_attr_names),
1783 0x0, NULL, HFILL } },
1785 /* start Ballast Status fields */
1786 { &hf_zbee_zcl_ballast_configuration_status,
1787 { "Status", "zbee_zcl_lighting.ballast_configuration.attr.status", FT_UINT8, BASE_HEX, NULL,
1788 0x0, NULL, HFILL } },
1790 { &hf_zbee_zcl_ballast_configuration_status_non_operational,
1791 { "Non-operational", "zbee_zcl_lighting.ballast_configuration.attr.status.non_operational", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ballast_configuration_status_non_operational_names),
1792 ZBEE_ZCL_BALLAST_CONFIGURATION_STATUS_NON_OPERATIONAL, NULL, HFILL } },
1794 { &hf_zbee_zcl_ballast_configuration_status_lamp_not_in_socket,
1795 { "Not in Socket", "zbee_zcl_lighting.ballast_configuration.attr.status.not_in_socket", FT_UINT8, BASE_HEX, VALS(zbee_zcl_ballast_configuration_status_lamp_not_in_socket_names),
1796 ZBEE_ZCL_BALLAST_CONFIGURATION_STATUS_LAMP_NOT_IN_SOCKET, NULL, HFILL } },
1797 /* end Ballast Status fields */
1799 /*stat Lamp Alarm Mode fields*/
1800 { &hf_zbee_zcl_ballast_configuration_lamp_alarm_mode,
1801 { "Lamp Alarm Mode", "zbee_zcl_lighting.ballast_configuration.attr.lamp_alarm_mode", FT_UINT8, BASE_HEX, NULL,
1802 0x0, NULL, HFILL } },
1804 { &hf_zbee_zcl_ballast_configuration_lamp_alarm_mode_lamp_burn_hours,
1805 { "Lamp Burn Hours", "zbee_zcl_lighting.ballast_configuration.attr.lamp_alarm_mode.lamp_burn_hours", FT_BOOLEAN, 8, NULL,
1806 ZBEE_ZCL_BALLAST_CONFIGURATION_LAMP_ALARM_MODE_LAMP_BURN_HOURS, NULL, HFILL } }
1807 /* end Lamp Alarm Mode fields */
1810 /* ZCL Ballast Configuration subtrees */
1811 static int *ett[ZBEE_ZCL_BALLAST_CONFIGURATION_NUM_ETT];
1813 ett[0] = &ett_zbee_zcl_ballast_configuration;
1814 ett[1] = &ett_zbee_zcl_ballast_configuration_status;
1815 ett[2] = &ett_zbee_zcl_ballast_configuration_lamp_alarm_mode;
1817 /* Register the ZigBee ZCL Ballast Configuration cluster protocol name and description */
1818 proto_zbee_zcl_ballast_configuration = proto_register_protocol("ZigBee ZCL Ballast Configuration", "ZCL Ballast Configuration", ZBEE_PROTOABBREV_ZCL_BALLAST_CONFIG);
1819 proto_register_field_array(proto_zbee_zcl_ballast_configuration, hf, array_length(hf));
1820 proto_register_subtree_array(ett, array_length(ett));
1822 /* Register the ZigBee ZCL Ballast Configuration dissector. */
1823 register_dissector(ZBEE_PROTOABBREV_ZCL_BALLAST_CONFIG, dissect_zbee_zcl_ballast_configuration, proto_zbee_zcl_ballast_configuration);
1824 } /*proto_register_zbee_zcl_ballast_configuration*/
1827 *Hands off the ZCL Ballast Configuration dissector.
1830 void
1831 proto_reg_handoff_zbee_zcl_ballast_configuration(void)
1833 zbee_zcl_init_cluster( ZBEE_PROTOABBREV_ZCL_BALLAST_CONFIG,
1834 proto_zbee_zcl_ballast_configuration,
1835 ett_zbee_zcl_ballast_configuration,
1836 ZBEE_ZCL_CID_BALLAST_CONFIG,
1837 ZBEE_MFG_CODE_NONE,
1838 hf_zbee_zcl_ballast_configuration_attr_id,
1839 hf_zbee_zcl_ballast_configuration_attr_id,
1840 -1, -1,
1841 (zbee_zcl_fn_attr_data)dissect_zcl_ballast_configuration_attr_data
1843 } /*proto_reg_handoff_zbee_zcl_ballast_configuration*/
1846 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1848 * Local variables:
1849 * c-basic-offset: 4
1850 * tab-width: 8
1851 * indent-tabs-mode: nil
1852 * End:
1854 * vi: set shiftwidth=4 tabstop=8 expandtab:
1855 * :indentSize=4:tabSize=8:noTabs=true: