2 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
4 * Contact: Suresh Kumar N (suresh.n@samsung.com)
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #include "zigbee_service_interface_common.h"
21 #include <zblib_driver_zcl_color_control.h>
23 static void on_zcl_color_move_to_hue_resp(ZigBeeServiceInterface *service_interface,
24 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
26 ZigbeeServiceInterfaceRespCbData_t *cb_data =
27 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
30 NOT_USED(service_interface);
33 NOT_USED(resp_data_len);
36 static gboolean on_zcl_color_move_to_hue(ZigbeeZcl_color_control *zcl_color_object,
37 GDBusMethodInvocation *invocation,
42 gshort transition_time,
45 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
46 ZigbeeZclColorMoveToHue_t req;
47 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
51 memset(&req, 0x0, sizeof(ZigbeeZclColorMoveToHue_t));
53 /* Update request structure */
54 req.node_id = node_id;
55 req.dest_ep = endpoint;
57 req.direction = direction;
58 req.transition_time = transition_time;
60 /* Allocate response callback data */
62 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
64 if (NULL == resp_cb_data) {
65 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
67 /* Send failure response */
68 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
73 /* Dispatch request */
74 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
75 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
76 ZBLIB_ZCL_COLOR_OPS_MOVE_TO_HUE,
78 on_zcl_color_move_to_hue_resp, resp_cb_data);
80 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
82 /* Free response callback data */
83 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
85 /* Send failure response */
86 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
94 static void on_zcl_color_move_hue_resp(ZigBeeServiceInterface *service_interface,
95 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
97 ZigbeeServiceInterfaceRespCbData_t *cb_data =
98 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
101 NOT_USED(service_interface);
102 NOT_USED(request_id);
104 NOT_USED(resp_data_len);
107 static gboolean on_zcl_color_move_hue(ZigbeeZcl_color_control *zcl_color_object,
108 GDBusMethodInvocation *invocation,
115 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
116 ZigbeeZclColorMoveHue_t req;
117 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
121 memset(&req, 0x0, sizeof(ZigbeeZclColorMoveHue_t));
123 /* Update request structure */
124 req.node_id = node_id;
125 req.dest_ep = endpoint;
126 req.move_mode = move_mode;
129 /* Allocate response callback data */
131 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
132 invocation, NULL, 0);
133 if (NULL == resp_cb_data) {
134 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
136 /* Send failure response */
137 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
142 /* Dispatch request */
143 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
144 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
145 ZBLIB_ZCL_COLOR_OPS_MOVE_HUE,
147 on_zcl_color_move_hue_resp, resp_cb_data);
149 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
151 /* Free response callback data */
152 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
154 /* Send failure response */
155 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
163 static void on_zcl_color_step_hue_resp(ZigBeeServiceInterface *service_interface,
164 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
166 ZigbeeServiceInterfaceRespCbData_t *cb_data =
167 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
170 NOT_USED(service_interface);
171 NOT_USED(request_id);
173 NOT_USED(resp_data_len);
176 static gboolean on_zcl_color_step_hue(ZigbeeZcl_color_control *zcl_color_object,
177 GDBusMethodInvocation *invocation,
182 gchar transition_time,
185 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
186 ZigbeeZclColorStepHue_t req;
187 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
191 memset(&req, 0x0, sizeof(ZigbeeZclColorStepHue_t));
193 /* Update request structure */
194 req.node_id = node_id;
195 req.dest_ep = endpoint;
196 req.step_mode = step_mode;
197 req.step_size = step_size;
198 req.transition_time = transition_time;
200 /* Allocate response callback data */
202 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
203 invocation, NULL, 0);
204 if (NULL == resp_cb_data) {
205 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
207 /* Send failure response */
208 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
213 /* Dispatch request */
214 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
215 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
216 ZBLIB_ZCL_COLOR_OPS_STEP_HUE,
218 on_zcl_color_step_hue_resp, resp_cb_data);
220 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
222 /* Free response callback data */
223 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
225 /* Send failure response */
226 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
234 static void on_zcl_color_move_to_saturation_resp(ZigBeeServiceInterface *service_interface,
235 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
237 ZigbeeServiceInterfaceRespCbData_t *cb_data =
238 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
241 NOT_USED(service_interface);
242 NOT_USED(request_id);
244 NOT_USED(resp_data_len);
247 static gboolean on_zcl_color_move_to_saturation(ZigbeeZcl_color_control *zcl_color_object,
248 GDBusMethodInvocation *invocation,
252 gshort transition_time,
255 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
256 ZigbeeZclColorMoveToSaturation_t req;
257 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
261 memset(&req, 0x0, sizeof(ZigbeeZclColorMoveToSaturation_t));
263 /* Update request structure */
264 req.node_id = node_id;
265 req.dest_ep = endpoint;
266 req.saturation = saturation;
267 req.transition_time = transition_time;
269 /* Allocate response callback data */
271 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
272 invocation, NULL, 0);
273 if (NULL == resp_cb_data) {
274 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
276 /* Send failure response */
277 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
282 /* Dispatch request */
283 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
284 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
285 ZBLIB_ZCL_COLOR_OPS_MOVE_TO_STAURATION,
287 on_zcl_color_move_to_saturation_resp, resp_cb_data);
289 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
291 /* Free response callback data */
292 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
294 /* Send failure response */
295 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
303 static void on_zcl_color_move_saturation_resp(ZigBeeServiceInterface *service_interface,
304 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
306 ZigbeeServiceInterfaceRespCbData_t *cb_data =
307 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
310 NOT_USED(service_interface);
311 NOT_USED(request_id);
313 NOT_USED(resp_data_len);
316 static gboolean on_zcl_color_move_saturation(ZigbeeZcl_color_control *zcl_color_object,
317 GDBusMethodInvocation *invocation,
324 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
325 ZigbeeZclColorMoveSaturation_t req;
326 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
330 memset(&req, 0x0, sizeof(ZigbeeZclColorMoveSaturation_t));
332 /* Update request structure */
333 req.node_id = node_id;
334 req.dest_ep = endpoint;
335 req.move_mode = move_mode;
338 /* Allocate response callback data */
340 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
341 invocation, NULL, 0);
342 if (NULL == resp_cb_data) {
343 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
345 /* Send failure response */
346 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
351 /* Dispatch request */
352 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
353 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
354 ZBLIB_ZCL_COLOR_OPS_MOVE_STAURATION,
356 on_zcl_color_move_saturation_resp, resp_cb_data);
358 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
360 /* Free response callback data */
361 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
363 /* Send failure response */
364 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
372 static void on_zcl_color_step_saturation_resp(ZigBeeServiceInterface *service_interface,
373 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
375 ZigbeeServiceInterfaceRespCbData_t *cb_data =
376 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
379 NOT_USED(service_interface);
380 NOT_USED(request_id);
382 NOT_USED(resp_data_len);
385 static gboolean on_zcl_color_step_saturation(ZigbeeZcl_color_control *zcl_color_object,
386 GDBusMethodInvocation *invocation,
391 gchar transition_time,
394 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
395 ZigbeeZclColorStepSaturation_t req;
396 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
400 memset(&req, 0x0, sizeof(ZigbeeZclColorStepSaturation_t));
402 /* Update request structure */
403 req.node_id = node_id;
404 req.dest_ep = endpoint;
405 req.step_mode = step_mode;
406 req.step_size = step_size;
407 req.transition_time = transition_time;
409 /* Allocate response callback data */
411 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
412 invocation, NULL, 0);
413 if (NULL == resp_cb_data) {
414 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
416 /* Send failure response */
417 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
422 /* Dispatch request */
423 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
424 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
425 ZBLIB_ZCL_COLOR_OPS_STEP_STAURATION,
427 on_zcl_color_step_saturation_resp, resp_cb_data);
429 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
431 /* Free response callback data */
432 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
434 /* Send failure response */
435 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
443 static void on_zcl_color_move_to_hue_and_saturation_resp(ZigBeeServiceInterface *service_interface,
444 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
446 ZigbeeServiceInterfaceRespCbData_t *cb_data =
447 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
450 NOT_USED(service_interface);
451 NOT_USED(request_id);
453 NOT_USED(resp_data_len);
456 static gboolean on_zcl_color_move_to_hue_and_saturation(ZigbeeZcl_color_control *zcl_color_object,
457 GDBusMethodInvocation *invocation,
462 gshort transition_time,
465 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
466 ZigbeeZclColorMoveToHueAndSaturation_t req;
467 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
471 memset(&req, 0x0, sizeof(ZigbeeZclColorMoveToHueAndSaturation_t));
473 /* Update request structure */
474 req.node_id = node_id;
475 req.dest_ep = endpoint;
477 req.saturation = saturation;
478 req.transition_time = transition_time;
480 /* Allocate response callback data */
482 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
483 invocation, NULL, 0);
484 if (NULL == resp_cb_data) {
485 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
487 /* Send failure response */
488 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
493 /* Dispatch request */
494 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
495 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
496 ZBLIB_ZCL_COLOR_OPS_MOVE_TO_HUE_AND_SATURATION,
498 on_zcl_color_move_to_hue_and_saturation_resp, resp_cb_data);
500 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
502 /* Free response callback data */
503 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
505 /* Send failure response */
506 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
514 static void on_zcl_color_move_to_color_resp(ZigBeeServiceInterface *service_interface,
515 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
517 ZigbeeServiceInterfaceRespCbData_t *cb_data =
518 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
521 NOT_USED(service_interface);
522 NOT_USED(request_id);
524 NOT_USED(resp_data_len);
527 static gboolean on_zcl_color_move_to_color(ZigbeeZcl_color_control *zcl_color_object,
528 GDBusMethodInvocation *invocation,
533 gshort transition_time,
536 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
537 ZigbeeZclColorMoveToColor_t req;
538 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
542 memset(&req, 0x0, sizeof(ZigbeeZclColorMoveToColor_t));
544 /* Update request structure */
545 req.node_id = node_id;
546 req.dest_ep = endpoint;
547 req.color_x = start_x;
548 req.color_y = start_y;
549 req.transition_time = transition_time;
551 /* Allocate response callback data */
553 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
554 invocation, NULL, 0);
555 if (NULL == resp_cb_data) {
556 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
558 /* Send failure response */
559 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
564 /* Dispatch request */
565 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
566 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
567 ZBLIB_ZCL_COLOR_OPS_MOVE_TO_COLOR,
569 on_zcl_color_move_to_color_resp, resp_cb_data);
571 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
573 /* Free response callback data */
574 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
576 /* Send failure response */
577 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
585 static void on_zcl_color_move_color_resp(ZigBeeServiceInterface *service_interface,
586 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
588 ZigbeeServiceInterfaceRespCbData_t *cb_data =
589 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
592 NOT_USED(service_interface);
593 NOT_USED(request_id);
595 NOT_USED(resp_data_len);
598 static gboolean on_zcl_color_move_color(ZigbeeZcl_color_control *zcl_color_object,
599 GDBusMethodInvocation *invocation,
606 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
607 ZigbeeZclColorMoveColor_t req;
608 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
612 memset(&req, 0x0, sizeof(ZigbeeZclColorMoveColor_t));
614 /* Update request structure */
615 req.node_id = node_id;
616 req.dest_ep = endpoint;
620 /* Allocate response callback data */
622 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
623 invocation, NULL, 0);
624 if (NULL == resp_cb_data) {
625 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
627 /* Send failure response */
628 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
633 /* Dispatch request */
634 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
635 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
636 ZBLIB_ZCL_COLOR_OPS_MOVE_COLOR,
638 on_zcl_color_move_color_resp, resp_cb_data);
640 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
642 /* Free response callback data */
643 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
645 /* Send failure response */
646 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
654 static void on_zcl_color_step_color_resp(ZigBeeServiceInterface *service_interface,
655 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
657 ZigbeeServiceInterfaceRespCbData_t *cb_data =
658 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
661 NOT_USED(service_interface);
662 NOT_USED(request_id);
664 NOT_USED(resp_data_len);
667 static gboolean on_zcl_color_step_color(ZigbeeZcl_color_control *zcl_color_object,
668 GDBusMethodInvocation *invocation,
673 gshort transition_time,
676 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
677 ZigbeeZclColorStepColor_t req;
678 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
682 memset(&req, 0x0, sizeof(ZigbeeZclColorStepColor_t));
684 /* Update request structure */
685 req.node_id = node_id;
686 req.dest_ep = endpoint;
689 req.transition_time = transition_time;
691 /* Allocate response callback data */
693 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
694 invocation, NULL, 0);
695 if (NULL == resp_cb_data) {
696 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
698 /* Send failure response */
699 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
704 /* Dispatch request */
705 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
706 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
707 ZBLIB_ZCL_COLOR_OPS_STEP_COLOR,
709 on_zcl_color_step_color_resp, resp_cb_data);
711 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
713 /* Free response callback data */
714 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
716 /* Send failure response */
717 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
725 static void on_zcl_color_move_color_temperature_resp(ZigBeeServiceInterface *service_interface,
726 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
728 ZigbeeServiceInterfaceRespCbData_t *cb_data =
729 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
732 NOT_USED(service_interface);
733 NOT_USED(request_id);
735 NOT_USED(resp_data_len);
738 static gboolean on_zcl_color_move_color_temperature(ZigbeeZcl_color_control *zcl_color_object,
739 GDBusMethodInvocation *invocation,
742 gshort color_temperature,
743 gshort transition_time,
746 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
747 ZigbeeZclColorMoveColorTemperature_t req;
748 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
752 memset(&req, 0x0, sizeof(ZigbeeZclColorMoveColorTemperature_t));
754 /* Update request structure */
755 req.node_id = node_id;
756 req.dest_ep = endpoint;
757 req.color_temperature = color_temperature;
758 req.transition_time = transition_time;
760 /* Allocate response callback data */
762 zigbee_service_dbus_interface_create_resp_cb_data(zcl_color_object,
763 invocation, NULL, 0);
764 if (NULL == resp_cb_data) {
765 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
767 /* Send failure response */
768 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
773 /* Dispatch request */
774 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
775 ZBLIB_DRIVER_TYPE_ZCL_COLOR,
776 ZBLIB_ZCL_COLOR_OPS_MOVE_COLOR_TEMPERATURE,
778 on_zcl_color_move_color_temperature_resp, resp_cb_data);
780 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
782 /* Free response callback data */
783 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
785 /* Send failure response */
786 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
794 gboolean zigbee_service_dbus_interface_zcl_color_control_init(ZigBeeServiceInterface *service_interface,
795 ZigbeeObjectSkeleton *zigbee_object)
797 ZigbeeZcl_color_control *zcl_color_object;
799 if (NULL == service_interface) {
800 Z_LOGE("service_interface is NULL");
804 zcl_color_object = zigbee_zcl_color_control_skeleton_new();
805 zigbee_object_skeleton_set_zcl_color_control(zigbee_object, zcl_color_object);
806 g_object_unref(zcl_color_object);
808 Z_LOGI("zcl_color_object: [%p]", zcl_color_object);
811 * Register signal handlers for 'zcl_color' interface
813 g_signal_connect(zcl_color_object,
814 "handle-move-to-hue",
815 G_CALLBACK(on_zcl_color_move_to_hue), service_interface);
817 g_signal_connect(zcl_color_object,
819 G_CALLBACK(on_zcl_color_move_hue), service_interface);
821 g_signal_connect(zcl_color_object,
823 G_CALLBACK(on_zcl_color_step_hue), service_interface);
825 g_signal_connect(zcl_color_object,
826 "handle-move-to-saturation",
827 G_CALLBACK(on_zcl_color_move_to_saturation), service_interface);
829 g_signal_connect(zcl_color_object,
830 "handle-move-saturation",
831 G_CALLBACK(on_zcl_color_move_saturation), service_interface);
833 g_signal_connect(zcl_color_object,
834 "handle-step-saturation",
835 G_CALLBACK(on_zcl_color_step_saturation), service_interface);
837 g_signal_connect(zcl_color_object,
838 "handle-move-to-hue-and-saturation",
839 G_CALLBACK(on_zcl_color_move_to_hue_and_saturation), service_interface);
841 g_signal_connect(zcl_color_object,
842 "handle-move-to-color",
843 G_CALLBACK(on_zcl_color_move_to_color), service_interface);
845 g_signal_connect(zcl_color_object,
847 G_CALLBACK(on_zcl_color_move_color), service_interface);
849 g_signal_connect(zcl_color_object,
851 G_CALLBACK(on_zcl_color_step_color), service_interface);
853 g_signal_connect(zcl_color_object,
854 "handle-move-color-temperature",
855 G_CALLBACK(on_zcl_color_move_color_temperature), service_interface);