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_zdo_dev_control.h>
24 static void *_service_interface_ref_zigbee_zdo_dev_control(ZigBeeServiceInterface *service_interface)
26 ZigbeeObjectSkeleton *zigbee_object = NULL;
27 ZigbeeCustomData_t *custom_data = NULL;
28 ZigbeeZdo_dev_control *dev_control_object = NULL;
30 custom_data = (ZigbeeCustomData_t *)zblib_service_interface_ref_user_data(service_interface);
31 if (NULL == custom_data) {
32 Z_LOGE("D-BUS service interface custom_data is NULL!");
36 /* Get zigbee object */
37 zigbee_object = g_hash_table_lookup(custom_data->objects, ZIGBEE_SERVICE_PATH);
38 if (NULL == zigbee_object) {
39 Z_LOGW("Cannot find ZigBee D-BUS interface object!");
43 dev_control_object = zigbee_object_get_zdo_dev_control(ZIGBEE_OBJECT(zigbee_object));
44 return dev_control_object;
47 static void on_zdodev_control_nwk_addr_req_resp(ZigBeeServiceInterface *service_interface,
48 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
50 ZigbeeServiceInterfaceRespCbData_t *cb_data =
51 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
53 ZigbeeZdo_dev_control *dev_control_object;
54 GDBusMethodInvocation *invocation;
56 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
58 NOT_USED(service_interface);
61 if (NULL == resp_data || 0 == resp_data_len) {
62 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
67 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
68 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
70 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
71 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
73 zigbee_zdo_dev_control_complete_nwk_addr_req(dev_control_object, invocation,
79 static gboolean on_zdodev_control_nwk_addr_req(ZigbeeZdo_dev_control *zdodev_control_object,
80 GDBusMethodInvocation *invocation,
86 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
87 ZigbeeZdoDevControlNwkAddrReq_t req;
88 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
90 GVariantIter *iter = NULL;
95 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlNwkAddrReq_t));
97 /* Update request structure */
98 g_variant_get(eui64, "a(y)", &iter);
99 while (g_variant_iter_loop(iter, "(y)", &(req.eui64[i]))) {
101 if (i >= ZIGBEE_EUI64_SIZE)
104 req.request_type = request_type;
105 req.start_index = start_index;
107 /* Allocate response callback data */
109 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
110 invocation, NULL, 0);
111 if (NULL == resp_cb_data) {
112 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
114 /* Send failure response */
115 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
120 /* Dispatch request */
121 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
122 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
123 ZBLIB_ZDO_DEV_CONTROL_OPS_NWK_ADDR_REQ,
125 on_zdodev_control_nwk_addr_req_resp, resp_cb_data);
127 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
129 /* Free response callback data */
130 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
132 /* Send failure response */
133 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
141 static void on_zdodev_control_matched_descriptor_req_resp(ZigBeeServiceInterface *service_interface,
142 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
144 ZigbeeServiceInterfaceRespCbData_t *cb_data =
145 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
147 ZigbeeZdo_dev_control *dev_control_object;
148 GDBusMethodInvocation *invocation;
150 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
152 NOT_USED(service_interface);
153 NOT_USED(request_id);
155 if (NULL == resp_data || 0 == resp_data_len) {
156 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
161 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
162 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
164 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
165 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
167 zigbee_zdo_dev_control_complete_matched_descriptor_req(dev_control_object,
168 invocation, payload->result);
173 static gboolean on_zdodev_control_matched_descriptor_req(ZigbeeZdo_dev_control *zdodev_control_object,
174 GDBusMethodInvocation *invocation,
183 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
184 ZigbeeZdoDevControlMatchedDescriptorReq_t req;
185 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
187 GVariantIter *iter = NULL;
192 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlMatchedDescriptorReq_t));
194 /* Update request structure */
195 req.node_id = node_id;
196 req.profile_id = profile_id;
197 req.num_in_cl = num_in_cl;
199 req.in_cl = g_malloc0_n(num_in_cl, sizeof(unsigned short));
200 g_variant_get(in_cl, "aq", &iter);
201 while (g_variant_iter_loop(iter, "q", &(req.in_cl[i]))) {
211 req.num_out_cl = num_out_cl;
212 if (num_out_cl > 0) {
213 req.out_cl = g_malloc0_n(num_out_cl, sizeof(unsigned short));
214 g_variant_get(out_cl, "aq", &iter);
215 while (g_variant_iter_loop(iter, "q", &(req.out_cl[i]))) {
224 /* Allocate response callback data */
226 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
227 invocation, NULL, 0);
228 if (NULL == resp_cb_data) {
229 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
231 /* Send failure response */
232 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
239 /* Dispatch request */
240 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
241 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
242 ZBLIB_ZDO_DEV_CONTROL_OPS_MATCHED_DESCRIPTOR_REQ,
244 on_zdodev_control_matched_descriptor_req_resp, resp_cb_data);
251 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
253 /* Free response callback data */
254 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
256 /* Send failure response */
257 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
265 static void on_zdodev_control_ieee_addr_req_resp(ZigBeeServiceInterface *service_interface,
266 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
268 ZigbeeServiceInterfaceRespCbData_t *cb_data =
269 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
271 ZigbeeZdo_dev_control *dev_control_object;
272 GDBusMethodInvocation *invocation;
274 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
276 NOT_USED(service_interface);
277 NOT_USED(request_id);
279 if (NULL == resp_data || 0 == resp_data_len) {
280 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
285 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
286 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
288 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
289 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
291 zigbee_zdo_dev_control_complete_ieee_addr_req(dev_control_object,
292 invocation, payload->result);
297 static gboolean on_zdodev_control_ieee_addr_req(ZigbeeZdo_dev_control *zdodev_control_object,
298 GDBusMethodInvocation *invocation,
302 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
303 ZigbeeZdoDevControlIeeeAddrReq_t req;
304 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
308 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlIeeeAddrReq_t));
310 /* Update request structure */
311 req.node_id = node_id;
313 /* Allocate response callback data */
315 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
316 invocation, NULL, 0);
317 if (NULL == resp_cb_data) {
318 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
320 /* Send failure response */
321 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
326 /* Dispatch request */
327 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
328 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
329 ZBLIB_ZDO_DEV_CONTROL_OPS_IEEE_ADDR_REQ,
331 on_zdodev_control_ieee_addr_req_resp, resp_cb_data);
333 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
335 /* Free response callback data */
336 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
338 /* Send failure response */
339 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
347 static void on_zdodev_control_active_ep_req_resp(ZigBeeServiceInterface *service_interface,
348 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
350 ZigbeeServiceInterfaceRespCbData_t *cb_data =
351 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
353 ZigbeeZdo_dev_control *dev_control_object;
354 GDBusMethodInvocation *invocation;
356 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
358 NOT_USED(service_interface);
359 NOT_USED(request_id);
361 if (NULL == resp_data || 0 == resp_data_len) {
362 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
367 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
368 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
370 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
371 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
373 zigbee_zdo_dev_control_complete_active_ep_req(dev_control_object,
374 invocation, payload->result);
379 static gboolean on_zdodev_control_active_ep_req(ZigbeeZdo_dev_control *zdodev_control_object,
380 GDBusMethodInvocation *invocation,
384 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
385 ZigbeeZdoDevControlActiveEpReq_t req;
386 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
390 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlActiveEpReq_t));
392 /* Update request structure */
393 req.node_id = node_id;
395 /* Allocate response callback data */
397 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
398 invocation, NULL, 0);
399 if (NULL == resp_cb_data) {
400 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
402 /* Send failure response */
403 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
408 /* Dispatch request */
409 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
410 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
411 ZBLIB_ZDO_DEV_CONTROL_OPS_ACTIVE_EP_REQ,
413 on_zdodev_control_active_ep_req_resp, resp_cb_data);
415 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
417 /* Free response callback data */
418 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
420 /* Send failure response */
421 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
429 static void on_zdodev_control_node_desc_req_resp(ZigBeeServiceInterface *service_interface,
430 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
432 ZigbeeServiceInterfaceRespCbData_t *cb_data =
433 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
435 ZigbeeZdo_dev_control *dev_control_object;
436 GDBusMethodInvocation *invocation;
438 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
440 NOT_USED(service_interface);
441 NOT_USED(request_id);
443 if (NULL == resp_data || 0 == resp_data_len) {
444 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
449 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
450 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
452 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
453 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
455 zigbee_zdo_dev_control_complete_node_desc_req(dev_control_object,
456 invocation, payload->result);
461 static gboolean on_zdodev_control_node_desc_req(ZigbeeZdo_dev_control *zdodev_control_object,
462 GDBusMethodInvocation *invocation,
466 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
467 ZigbeeZdoDevControlNodeDescriptorReq_t req;
468 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
472 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlNodeDescriptorReq_t));
474 /* Update request structure */
475 req.node_id = node_id;
477 /* Allocate response callback data */
479 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
480 invocation, NULL, 0);
481 if (NULL == resp_cb_data) {
482 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
484 /* Send failure response */
485 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
490 /* Dispatch request */
491 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
492 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
493 ZBLIB_ZDO_DEV_CONTROL_OPS_NODE_DESC_REQ,
495 on_zdodev_control_node_desc_req_resp, resp_cb_data);
497 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
499 /* Free response callback data */
500 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
502 /* Send failure response */
503 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
511 static void on_zdodev_control_power_desc_req_resp(ZigBeeServiceInterface *service_interface,
512 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
514 ZigbeeServiceInterfaceRespCbData_t *cb_data =
515 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
517 ZigbeeZdo_dev_control *dev_control_object;
518 GDBusMethodInvocation *invocation;
520 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
522 NOT_USED(service_interface);
523 NOT_USED(request_id);
525 if (NULL == resp_data || 0 == resp_data_len) {
526 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
531 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
532 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
534 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
535 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
537 zigbee_zdo_dev_control_complete_power_desc_req(dev_control_object,
538 invocation, payload->result);
543 static gboolean on_zdodev_control_power_desc_req(ZigbeeZdo_dev_control *zdodev_control_object,
544 GDBusMethodInvocation *invocation,
548 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
549 ZigbeeZdoDevControlPowerDescriptorReq_t req;
550 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
554 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlPowerDescriptorReq_t));
556 /* Update request structure */
557 req.node_id = node_id;
559 /* Allocate response callback data */
561 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
562 invocation, NULL, 0);
563 if (NULL == resp_cb_data) {
564 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
566 /* Send failure response */
567 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
572 /* Dispatch request */
573 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
574 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
575 ZBLIB_ZDO_DEV_CONTROL_OPS_POWER_DESC_REQ,
577 on_zdodev_control_power_desc_req_resp, resp_cb_data);
579 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
581 /* Free response callback data */
582 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
584 /* Send failure response */
585 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
593 static void on_zdodev_control_complex_desc_req_resp(ZigBeeServiceInterface *service_interface,
594 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
596 ZigbeeServiceInterfaceRespCbData_t *cb_data =
597 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
599 ZigbeeZdo_dev_control *dev_control_object;
600 GDBusMethodInvocation *invocation;
602 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
604 NOT_USED(service_interface);
605 NOT_USED(request_id);
607 if (NULL == resp_data || 0 == resp_data_len) {
608 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
613 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
614 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
616 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
617 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
619 zigbee_zdo_dev_control_complete_complex_desc_req(dev_control_object,
620 invocation, payload->result);
625 static gboolean on_zdodev_control_complex_desc_req(ZigbeeZdo_dev_control *zdodev_control_object,
626 GDBusMethodInvocation *invocation,
630 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
631 ZigbeeZdoDevControlComplexDescriptorReq_t req;
632 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
636 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlComplexDescriptorReq_t));
638 /* Update request structure */
639 req.node_id = node_id;
641 /* Allocate response callback data */
643 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
644 invocation, NULL, 0);
645 if (NULL == resp_cb_data) {
646 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
648 /* Send failure response */
649 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
654 /* Dispatch request */
655 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
656 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
657 ZBLIB_ZDO_DEV_CONTROL_OPS_COMPLEX_DESC_REQ,
659 on_zdodev_control_complex_desc_req_resp, resp_cb_data);
661 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
663 /* Free response callback data */
664 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
666 /* Send failure response */
667 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
675 static void on_zdodev_control_user_desc_req_resp(ZigBeeServiceInterface *service_interface,
676 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
678 ZigbeeServiceInterfaceRespCbData_t *cb_data =
679 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
681 ZigbeeZdo_dev_control *dev_control_object;
682 GDBusMethodInvocation *invocation;
684 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
686 NOT_USED(service_interface);
687 NOT_USED(request_id);
689 if (NULL == resp_data || 0 == resp_data_len) {
690 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
695 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
696 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
698 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
699 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
701 zigbee_zdo_dev_control_complete_user_desc_req(dev_control_object,
702 invocation, payload->result);
707 static gboolean on_zdodev_control_user_desc_req(ZigbeeZdo_dev_control *zdodev_control_object,
708 GDBusMethodInvocation *invocation,
712 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
713 ZigbeeZdoDevControlUserDescriptorReq_t req;
714 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
718 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlUserDescriptorReq_t));
720 /* Update request structure */
721 req.node_id = node_id;
723 /* Allocate response callback data */
725 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
726 invocation, NULL, 0);
727 if (NULL == resp_cb_data) {
728 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
730 /* Send failure response */
731 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
736 /* Dispatch request */
737 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
738 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
739 ZBLIB_ZDO_DEV_CONTROL_OPS_USER_DESC_REQ,
741 on_zdodev_control_user_desc_req_resp, resp_cb_data);
743 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
745 /* Free response callback data */
746 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
748 /* Send failure response */
749 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
757 static void on_zdodev_control_user_desc_set_req_resp(ZigBeeServiceInterface *service_interface,
758 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
760 ZigbeeServiceInterfaceRespCbData_t *cb_data =
761 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
763 ZigbeeZdo_dev_control *dev_control_object;
764 GDBusMethodInvocation *invocation;
766 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
768 NOT_USED(service_interface);
769 NOT_USED(request_id);
771 if (NULL == resp_data || 0 == resp_data_len) {
772 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
777 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
778 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
780 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
781 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
783 zigbee_zdo_dev_control_complete_user_desc_set_req(dev_control_object,
784 invocation, payload->result);
789 static gboolean on_zdodev_control_user_desc_set_req(ZigbeeZdo_dev_control *zdodev_control_object,
790 GDBusMethodInvocation *invocation,
796 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
797 ZigbeeZdoDevControlUserDescriptorSetReq_t req;
798 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
800 GVariantIter *iter = NULL;
805 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlUserDescriptorSetReq_t));
807 /* Update request structure */
808 req.node_id = node_id;
809 req.user_descriptor_len = length;
810 g_variant_get(user_desc, "a(y)", &iter);
811 while (g_variant_iter_loop(iter, "(y)", &(req.user_descriptor[i]))) {
813 if (i >= ZIGBEE_ZDODEV_CONTROL_USER_DECRIPTOR_MAX_LEN)
817 /* Allocate response callback data */
819 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
820 invocation, NULL, 0);
821 if (NULL == resp_cb_data) {
822 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
824 /* Send failure response */
825 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
830 /* Dispatch request */
831 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
832 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
833 ZBLIB_ZDO_DEV_CONTROL_OPS_USER_DESC_SET_REQ,
835 on_zdodev_control_user_desc_set_req_resp, resp_cb_data);
837 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
839 /* Free response callback data */
840 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
842 /* Send failure response */
843 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
851 static void on_zdodev_control_device_announce_resp(ZigBeeServiceInterface *service_interface,
852 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
854 ZigbeeServiceInterfaceRespCbData_t *cb_data =
855 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
857 ZigbeeZdo_dev_control *dev_control_object;
858 GDBusMethodInvocation *invocation;
860 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
862 NOT_USED(service_interface);
863 NOT_USED(request_id);
865 if (NULL == resp_data || 0 == resp_data_len) {
866 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
871 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
872 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
874 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
875 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
877 zigbee_zdo_dev_control_complete_device_announce(dev_control_object,
878 invocation, payload->result);
883 static gboolean on_zdodev_control_device_announce(ZigbeeZdo_dev_control *zdodev_control_object,
884 GDBusMethodInvocation *invocation,
890 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
891 ZigbeeZdoDevControlDeviceAnnounce_t req;
892 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
894 GVariantIter *iter = NULL;
899 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlDeviceAnnounce_t));
901 /* Update request structure */
902 req.node_id = node_id;
903 g_variant_get(mac_addr, "a(y)", &iter);
904 while (g_variant_iter_loop(iter, "(y)", &(req.mac_addr[i]))) {
906 if (i >= ZIGBEE_EUI64_SIZE)
909 req.capability = capability;
911 /* Allocate response callback data */
913 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
914 invocation, NULL, 0);
915 if (NULL == resp_cb_data) {
916 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
918 /* Send failure response */
919 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
924 /* Dispatch request */
925 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
926 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
927 ZBLIB_ZDO_DEV_CONTROL_OPS_DEVICE_ANNOUNCE,
929 on_zdodev_control_device_announce_resp, resp_cb_data);
931 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
933 /* Free response callback data */
934 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
936 /* Send failure response */
937 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
945 static void on_zdodev_control_simple_desc_req_resp(ZigBeeServiceInterface *service_interface,
946 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
948 ZigbeeServiceInterfaceRespCbData_t *cb_data =
949 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
951 ZigbeeZdo_dev_control *dev_control_object;
952 GDBusMethodInvocation *invocation;
954 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
956 NOT_USED(service_interface);
957 NOT_USED(request_id);
959 if (NULL == resp_data || 0 == resp_data_len) {
960 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
965 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
966 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
968 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
969 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
971 zigbee_zdo_dev_control_complete_simple_desc_req(dev_control_object,
972 invocation, payload->result);
977 static gboolean on_zdodev_control_simple_desc_req(ZigbeeZdo_dev_control *zdodev_control_object,
978 GDBusMethodInvocation *invocation,
983 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
984 ZigbeeZdoDevControlSimpleDescriptorReq_t req;
985 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
989 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlSimpleDescriptorReq_t));
991 /* Update request structure */
992 req.node_id = node_id;
993 req.endpoint = endpoint;
995 /* Allocate response callback data */
997 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
998 invocation, NULL, 0);
999 if (NULL == resp_cb_data) {
1000 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1002 /* Send failure response */
1003 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1008 /* Dispatch request */
1009 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1010 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
1011 ZBLIB_ZDO_DEV_CONTROL_OPS_SIMPLE_DESC_REQ,
1013 on_zdodev_control_simple_desc_req_resp, resp_cb_data);
1015 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1017 /* Free response callback data */
1018 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1020 /* Send failure response */
1021 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1029 static void on_zdodev_control_mgmt_lqi_req_resp(ZigBeeServiceInterface *service_interface,
1030 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1032 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1033 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1035 ZigbeeZdo_dev_control *dev_control_object;
1036 GDBusMethodInvocation *invocation;
1038 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
1040 NOT_USED(service_interface);
1041 NOT_USED(request_id);
1043 if (NULL == resp_data || 0 == resp_data_len) {
1044 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
1049 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1050 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
1052 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1053 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1055 zigbee_zdo_dev_control_complete_mgmt_lqi_req(dev_control_object,
1056 invocation, payload->result);
1061 static gboolean on_zdodev_control_mgmt_lqi_req(ZigbeeZdo_dev_control *zdodev_control_object,
1062 GDBusMethodInvocation *invocation,
1067 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1068 ZigbeeZdoDevControlMgmtLqiReq_t req;
1069 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1073 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlMgmtLqiReq_t));
1075 /* Update request structure */
1076 req.node_id = node_id;
1077 req.start_index = start_idx;
1079 /* Allocate response callback data */
1081 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
1082 invocation, NULL, 0);
1083 if (NULL == resp_cb_data) {
1084 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1086 /* Send failure response */
1087 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1092 /* Dispatch request */
1093 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1094 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
1095 ZBLIB_ZDO_DEV_CONTROL_OPS_MGMT_LQI_REQ,
1097 on_zdodev_control_mgmt_lqi_req_resp, resp_cb_data);
1099 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1101 /* Free response callback data */
1102 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1104 /* Send failure response */
1105 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1113 static void on_zdodev_control_mgmt_rtg_req_resp(ZigBeeServiceInterface *service_interface,
1114 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1116 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1117 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1119 ZigbeeZdo_dev_control *dev_control_object;
1120 GDBusMethodInvocation *invocation;
1122 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
1124 NOT_USED(service_interface);
1125 NOT_USED(request_id);
1127 if (NULL == resp_data || 0 == resp_data_len) {
1128 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
1133 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1134 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
1136 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1137 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1139 zigbee_zdo_dev_control_complete_mgmt_rtg_req(dev_control_object,
1140 invocation, payload->result);
1145 static gboolean on_zdodev_control_mgmt_rtg_req(ZigbeeZdo_dev_control *zdodev_control_object,
1146 GDBusMethodInvocation *invocation,
1151 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1152 ZigbeeZdoDevControlMgmtRtgReq_t req;
1153 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1157 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlMgmtRtgReq_t));
1159 /* Update request structure */
1160 req.node_id = node_id;
1161 req.start_index = start_idx;
1163 /* Allocate response callback data */
1165 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
1166 invocation, NULL, 0);
1167 if (NULL == resp_cb_data) {
1168 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1170 /* Send failure response */
1171 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1176 /* Dispatch request */
1177 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1178 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
1179 ZBLIB_ZDO_DEV_CONTROL_OPS_MGMT_RTG_REQ,
1181 on_zdodev_control_mgmt_rtg_req_resp, resp_cb_data);
1183 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1185 /* Free response callback data */
1186 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1188 /* Send failure response */
1189 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1197 static void on_zdodev_control_mgmt_bind_req_resp(ZigBeeServiceInterface *service_interface,
1198 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1200 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1201 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1203 ZigbeeZdo_dev_control *dev_control_object;
1204 GDBusMethodInvocation *invocation;
1206 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
1208 NOT_USED(service_interface);
1209 NOT_USED(request_id);
1211 if (NULL == resp_data || 0 == resp_data_len) {
1212 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
1217 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1218 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
1220 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1221 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1223 zigbee_zdo_dev_control_complete_mgmt_bind_req(dev_control_object,
1224 invocation, payload->result);
1229 static gboolean on_zdodev_control_mgmt_bind_req(ZigbeeZdo_dev_control *zdodev_control_object,
1230 GDBusMethodInvocation *invocation,
1235 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1236 ZigbeeZdoDevControlMgmtBindReq_t req;
1237 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1241 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlMgmtBindReq_t));
1243 /* Update request structure */
1244 req.node_id = node_id;
1245 req.start_index = start_idx;
1247 /* Allocate response callback data */
1249 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
1250 invocation, NULL, 0);
1251 if (NULL == resp_cb_data) {
1252 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1254 /* Send failure response */
1255 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1260 /* Dispatch request */
1261 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1262 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
1263 ZBLIB_ZDO_DEV_CONTROL_OPS_MGMT_BIND_REQ,
1265 on_zdodev_control_mgmt_bind_req_resp, resp_cb_data);
1267 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1269 /* Free response callback data */
1270 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1272 /* Send failure response */
1273 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1281 static void on_zdodev_control_mgmt_permit_join_req_resp(ZigBeeServiceInterface *service_interface,
1282 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1284 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1285 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1287 ZigbeeZdo_dev_control *dev_control_object;
1288 GDBusMethodInvocation *invocation;
1290 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
1292 NOT_USED(service_interface);
1293 NOT_USED(request_id);
1295 if (NULL == resp_data || 0 == resp_data_len) {
1296 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
1301 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1302 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
1304 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1305 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1307 zigbee_zdo_dev_control_complete_mgmt_permit_join_req(dev_control_object,
1308 invocation, payload->result);
1313 static gboolean on_zdodev_control_mgmt_permit_join_req(ZigbeeZdo_dev_control *zdodev_control_object,
1314 GDBusMethodInvocation *invocation,
1317 gchar tc_significance,
1320 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1321 ZigbeeZdoDevControlMgmtPermitJoinReq_t req;
1322 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1326 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlMgmtPermitJoinReq_t));
1328 /* Update request structure */
1329 req.node_id = node_id;
1330 req.duration = duration;
1331 req.tc_significance = tc_significance;
1333 /* Allocate response callback data */
1335 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
1336 invocation, NULL, 0);
1337 if (NULL == resp_cb_data) {
1338 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1340 /* Send failure response */
1341 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1346 /* Dispatch request */
1347 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1348 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
1349 ZBLIB_ZDO_DEV_CONTROL_OPS_MGMT_PERMIT_JOIN_REQ,
1351 on_zdodev_control_mgmt_permit_join_req_resp, resp_cb_data);
1353 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1355 /* Free response callback data */
1356 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1358 /* Send failure response */
1359 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1367 static void on_zdodev_control_mgmt_nwk_update_req_resp(ZigBeeServiceInterface *service_interface,
1368 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1370 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1371 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1373 ZigbeeZdo_dev_control *dev_control_object;
1374 GDBusMethodInvocation *invocation;
1376 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
1378 NOT_USED(service_interface);
1379 NOT_USED(request_id);
1381 if (NULL == resp_data || 0 == resp_data_len) {
1382 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
1387 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1388 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
1390 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1391 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1393 zigbee_zdo_dev_control_complete_mgmt_nwk_update_req(dev_control_object,
1394 invocation, payload->result);
1399 static gboolean on_zdodev_control_mgmt_nwk_update_req(ZigbeeZdo_dev_control *zdodev_control_object,
1400 GDBusMethodInvocation *invocation,
1403 gchar scan_duration,
1408 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1409 ZigbeeZdoDevControlMgmtNwkUpdateReq_t req;
1410 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1414 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlMgmtNwkUpdateReq_t));
1416 /* Update request structure */
1417 req.node_id = node_id;
1418 req.scan_channel = scan_channel;
1419 req.scan_duration = scan_duration;
1420 req.scan_count = scan_count;
1421 req.network_update_id = nwk_update_id;
1423 /* Allocate response callback data */
1425 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
1426 invocation, NULL, 0);
1427 if (NULL == resp_cb_data) {
1428 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1430 /* Send failure response */
1431 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1436 /* Dispatch request */
1437 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1438 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
1439 ZBLIB_ZDO_DEV_CONTROL_OPS_MGMT_NWK_UPDATE_REQ,
1441 on_zdodev_control_mgmt_nwk_update_req_resp, resp_cb_data);
1443 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1445 /* Free response callback data */
1446 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1448 /* Send failure response */
1449 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1457 static void on_zdodev_control_mgmt_nwk_disc_req_resp(ZigBeeServiceInterface *service_interface,
1458 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1460 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1461 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1463 ZigbeeZdo_dev_control *dev_control_object;
1464 GDBusMethodInvocation *invocation;
1466 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
1468 NOT_USED(service_interface);
1469 NOT_USED(request_id);
1471 if (NULL == resp_data || 0 == resp_data_len) {
1472 Z_LOGE("resp_data=%p or resp_data_len=%d is null", resp_data, resp_data_len);
1477 dev_control_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1478 zblib_check_null_free_and_ret("dev_control_object", dev_control_object, cb_data);
1480 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1481 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1483 zigbee_zdo_dev_control_complete_mgmt_nwk_disc_req(dev_control_object,
1484 invocation, payload->result);
1489 static gboolean on_zdodev_control_mgmt_nwk_disc_req(ZigbeeZdo_dev_control *zdodev_control_object,
1490 GDBusMethodInvocation *invocation,
1493 gchar scan_duration,
1498 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1499 ZigbeeZdoDevControlMgmtNwkDiscoveryReq_t req;
1500 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1504 memset(&req, 0x0, sizeof(ZigbeeZdoDevControlMgmtNwkDiscoveryReq_t));
1506 /* Update request structure */
1507 req.node_id = node_id;
1508 req.scan_channel = scan_channel;
1509 req.scan_duration = scan_duration;
1510 req.scan_count = scan_count;
1511 req.start_index = start_index;
1513 /* Allocate response callback data */
1515 zigbee_service_dbus_interface_create_resp_cb_data(zdodev_control_object,
1516 invocation, NULL, 0);
1517 if (NULL == resp_cb_data) {
1518 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1520 /* Send failure response */
1521 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1526 /* Dispatch request */
1527 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1528 ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL,
1529 ZBLIB_ZDO_DEV_CONTROL_OPS_MGMT_NWK_DISC_REQ,
1531 on_zdodev_control_mgmt_nwk_disc_req_resp, resp_cb_data);
1533 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1535 /* Free response callback data */
1536 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1538 /* Send failure response */
1539 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1547 void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInterface *service_interface,
1548 guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
1550 ZigbeeZdo_dev_control *dev_control_object = NULL;
1552 zblib_check_null_ret("service_interface", service_interface);
1554 if (NULL == noti_data || 0 == noti_data_len) {
1555 Z_LOGE("noti_data is NULL");
1559 dev_control_object = _service_interface_ref_zigbee_zdo_dev_control(service_interface);
1560 zblib_check_null_ret("dev_control_object", dev_control_object);
1562 NOT_USED(noti_cb_data);
1565 case ZBLIB_ZDO_DEV_CONTROL_NOTI_NWK_ADDR_RSP: {
1566 ZigbeeZdoDevControlNwkAddrResp_t *nwk_addr_t =
1567 (ZigbeeZdoDevControlNwkAddrResp_t*)noti_data;
1569 GVariant *v_eui64 = NULL;
1570 v_eui64 = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"),
1571 nwk_addr_t->eui64, ZIGBEE_EUI64_SIZE, TRUE, NULL, NULL);
1572 if (NULL == v_eui64) {
1573 Z_LOGE("Failed to create variant!");
1575 Z_LOGD("nwk addr rsp : [0x%X]", nwk_addr_t->status);
1576 zigbee_zdo_dev_control_emit_nwk_addr_rsp(dev_control_object,
1577 nwk_addr_t->status, v_eui64, nwk_addr_t->node_id,
1578 nwk_addr_t->associated_count, nwk_addr_t->start_index);
1581 g_variant_unref(v_eui64);
1584 case ZBLIB_ZDO_DEV_CONTROL_NOTI_NWK_ADDR_EXT_RSP: {
1585 ZigbeeZdoDevControlNwkAddrExtResp_t *nwk_addr_t =
1586 (ZigbeeZdoDevControlNwkAddrExtResp_t*)noti_data;
1588 GVariant *v_eui64 = NULL;
1589 GVariant *v_associated = NULL;
1590 v_eui64 = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"),
1591 nwk_addr_t->eui64, ZIGBEE_EUI64_SIZE, TRUE, NULL, NULL);
1592 v_associated = g_variant_new_from_data(G_VARIANT_TYPE("aq"),
1593 nwk_addr_t->associated_addr_list,
1594 (sizeof(gushort) * nwk_addr_t->associated_count), TRUE, NULL, NULL);
1595 if (NULL == v_eui64 || NULL == v_associated) {
1596 Z_LOGE("Failed to create variant!");
1598 Z_LOGD("nwk addr ext rsp : [0x%X]", nwk_addr_t->status);
1599 zigbee_zdo_dev_control_emit_nwk_addr_ext_rsp(dev_control_object,
1600 nwk_addr_t->status, v_eui64, nwk_addr_t->node_id,
1601 nwk_addr_t->associated_count, nwk_addr_t->start_index, v_associated);
1604 g_variant_unref(v_eui64);
1606 g_variant_unref(v_associated);
1609 case ZBLIB_ZDO_DEV_CONTROL_NOTI_ACTIVE_EP_RSP: {
1610 ZigbeeZdoDevControlActiveEpResp_t *active_t =
1611 (ZigbeeZdoDevControlActiveEpResp_t *)noti_data;
1613 GVariant *v_ep_list = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"),
1614 active_t->endpoint_list, active_t->endpoint_count, TRUE, NULL, NULL);
1615 if (NULL == v_ep_list) {
1616 Z_LOGE("Failed to create variant!");
1618 Z_LOGD("Active endpoint rsp : [0x%X]", active_t->status);
1619 zigbee_zdo_dev_control_emit_active_ep_rsp(dev_control_object,
1620 active_t->status, active_t->node_id,
1621 v_ep_list, active_t->endpoint_count);
1624 g_variant_unref(v_ep_list);
1627 case ZBLIB_ZDO_DEV_CONTROL_NOTI_SIMPLE_DESC_RSP: {
1628 ZigbeeZdoDevControlSimpleDescriptorResp_t *desc_t =
1629 (ZigbeeZdoDevControlSimpleDescriptorResp_t *)noti_data;
1631 GVariant *v_in_cluster = NULL;
1632 GVariant *v_out_cluster = NULL;
1633 v_in_cluster = g_variant_new_from_data(G_VARIANT_TYPE("aq"),
1634 desc_t->in_cluster, (sizeof(gushort) * desc_t->in_cluster_count),
1636 v_out_cluster = g_variant_new_from_data(G_VARIANT_TYPE("aq"),
1637 desc_t->out_cluster, (sizeof(gushort) * desc_t->out_cluster_count),
1639 if (NULL == v_in_cluster || NULL == v_out_cluster) {
1640 Z_LOGE("Failed to create variant!");
1642 Z_LOGD("Simple descriptor rsp");
1643 zigbee_zdo_dev_control_emit_simple_desc_rsp(dev_control_object,
1644 desc_t->node_id, desc_t->length, desc_t->device_version,
1645 desc_t->endpoint, desc_t->profile_id, desc_t->device_id,
1646 desc_t->in_cluster_count, desc_t->out_cluster_count,
1647 v_in_cluster, v_out_cluster);
1650 g_variant_unref(v_in_cluster);
1652 g_variant_unref(v_out_cluster);
1655 case ZBLIB_ZDO_DEV_CONTROL_NOTI_MATCHED_DESC_RSP: {
1656 ZigbeeZdoDevControlMatchedDescriptorResp_t *desc_t =
1657 (ZigbeeZdoDevControlMatchedDescriptorResp_t *)noti_data;
1659 GVariant *v_match_list = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"),
1660 desc_t->match_list, desc_t->list_count, TRUE, NULL, NULL);
1661 if (NULL == v_match_list) {
1662 Z_LOGE("Failed to create variant!");
1664 Z_LOGD("matched descriptor rsp : [0x%X]", desc_t->status);
1665 zigbee_zdo_dev_control_emit_matched_descriptor_rsp(dev_control_object,
1666 desc_t->status, desc_t->node_id, desc_t->list_count, v_match_list);
1669 g_variant_unref(v_match_list);
1672 case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_BIND_RSP: {
1673 ZigbeeZdoDevControlMgmtBindResp_t *desc_t =
1674 (ZigbeeZdoDevControlMgmtBindResp_t *)noti_data;
1678 GVariant *v_entries = NULL;
1679 GVariantBuilder *entry_builder =
1680 g_variant_builder_new(G_VARIANT_TYPE("a(ayyqyqayy)"));
1681 if (NULL == entry_builder) {
1682 Z_LOGE("Failed to create variant builder!");
1686 for (i = 0; i < desc_t->table_list_count ; i++) {
1687 GVariantBuilder *eui64_builder =
1688 g_variant_builder_new(G_VARIANT_TYPE("ay"));
1689 GVariantBuilder *dest_eui64_builder =
1690 g_variant_builder_new(G_VARIANT_TYPE("ay"));
1692 if (NULL == eui64_builder || NULL == dest_eui64_builder) {
1693 Z_LOGE("Failed to create variant builder!");
1695 g_variant_builder_unref(eui64_builder);
1696 if (dest_eui64_builder)
1697 g_variant_builder_unref(dest_eui64_builder);
1698 g_variant_builder_unref(entry_builder);
1702 for (v = 0; v < ZIGBEE_EUI64_SIZE; v++) {
1703 g_variant_builder_add(eui64_builder, "y",
1704 desc_t->table_list[i].eui64[v]);
1705 g_variant_builder_add(dest_eui64_builder, "y",
1706 desc_t->table_list[i].dest_eui64[v]);
1709 g_variant_builder_add(entry_builder, "(ayyqyqayy)",
1711 desc_t->table_list[i].source_endpoint,
1712 desc_t->table_list[i].cluster_id,
1713 desc_t->table_list[i].dest_addr_mode,
1714 desc_t->table_list[i].dest_addr,
1716 desc_t->table_list[i].dest_endpoint);
1718 g_variant_builder_unref(eui64_builder);
1719 g_variant_builder_unref(dest_eui64_builder);
1721 v_entries = g_variant_builder_end(entry_builder);
1723 Z_LOGD("management bind rsp : [0x%X]", desc_t->status);
1724 zigbee_zdo_dev_control_emit_mgmt_bind_rsp(dev_control_object,
1725 desc_t->status, desc_t->table_entries,
1726 desc_t->start_index, desc_t->table_list_count,
1729 g_variant_builder_unref(entry_builder);
1731 g_variant_unref(v_entries);
1734 case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_LQI_RSP: {
1735 ZigbeeZdoDevControlMgmtLqiResp_t *desc_t =
1736 (ZigbeeZdoDevControlMgmtLqiResp_t *)noti_data;
1740 GVariant *v_entries = NULL;
1741 GVariantBuilder *entry_builder =
1742 g_variant_builder_new(G_VARIANT_TYPE("a(ayayyqyyyyy)"));
1743 if (NULL == entry_builder) {
1744 Z_LOGE("Failed to create variant builder!");
1748 for (i = 0; i < desc_t->table_list_count ; i++) {
1749 GVariantBuilder *ext_pan_builder =
1750 g_variant_builder_new(G_VARIANT_TYPE("ay"));
1751 GVariantBuilder *eui64_builder =
1752 g_variant_builder_new(G_VARIANT_TYPE("ay"));
1754 if (NULL == ext_pan_builder || NULL == eui64_builder) {
1755 Z_LOGE("Failed to create variant builder!");
1756 if (ext_pan_builder)
1757 g_variant_builder_unref(ext_pan_builder);
1759 g_variant_builder_unref(eui64_builder);
1760 g_variant_builder_unref(entry_builder);
1764 for (v = 0; v < ZIGBEE_EUI64_SIZE; v++) {
1765 g_variant_builder_add(ext_pan_builder, "y",
1766 desc_t->table_list[i].extended_pan_id[v]);
1767 g_variant_builder_add(eui64_builder, "y",
1768 desc_t->table_list[i].eui64[v]);
1771 g_variant_builder_add(entry_builder, "(ayayyqyyyyy)",
1774 desc_t->table_list[i].node_id,
1775 desc_t->table_list[i].device_type,
1776 desc_t->table_list[i].rx_on_when_idle,
1777 desc_t->table_list[i].relationship,
1778 desc_t->table_list[i].permit_joining,
1779 desc_t->table_list[i].depth,
1780 desc_t->table_list[i].lqi);
1782 g_variant_builder_unref(ext_pan_builder);
1783 g_variant_builder_unref(eui64_builder);
1785 v_entries = g_variant_builder_end(entry_builder);
1787 Z_LOGD("management LQI rsp : [0x%X]", desc_t->status);
1788 zigbee_zdo_dev_control_emit_mgmt_lqi_rsp(dev_control_object,
1789 desc_t->status, desc_t->table_entries,
1790 desc_t->start_index, desc_t->table_list_count,
1793 g_variant_builder_unref(entry_builder);
1795 g_variant_unref(v_entries);
1798 case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_RTG_RSP: {
1799 ZigbeeZdoDevControlMgmtRtgResp_t *desc_t =
1800 (ZigbeeZdoDevControlMgmtRtgResp_t *)noti_data;
1803 GVariant *v_entries = NULL;
1804 GVariantBuilder *entry_builder =
1805 g_variant_builder_new(G_VARIANT_TYPE("a(qyyyyq)"));
1806 if (NULL == entry_builder) {
1807 Z_LOGE("Failed to create variant builder!");
1811 for (i = 0; i < desc_t->table_list_count ; i++) {
1812 g_variant_builder_add(entry_builder, "(qyyyyq)",
1813 desc_t->table_list[i].dest_addr,
1814 desc_t->table_list[i].status,
1815 desc_t->table_list[i].memory_constrained,
1816 desc_t->table_list[i].many_to_one,
1817 desc_t->table_list[i].route_record_required,
1818 desc_t->table_list[i].next_hop_addr);
1820 v_entries = g_variant_builder_end(entry_builder);
1822 Z_LOGD("management routing rsp : [0x%X]", desc_t->status);
1823 zigbee_zdo_dev_control_emit_mgmt_rtg_rsp(dev_control_object,
1824 desc_t->status, desc_t->table_entries,
1825 desc_t->start_index, desc_t->table_list_count,
1828 g_variant_builder_unref(entry_builder);
1830 g_variant_unref(v_entries);
1833 case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_PERMIT_JOIN_RSP: {
1834 ZigbeeZdoDevControlMgmtPermitJoinResp_t *resp_t =
1835 (ZigbeeZdoDevControlMgmtPermitJoinResp_t *)noti_data;
1837 zigbee_zdo_dev_control_emit_mgmt_permit_join_rsp(dev_control_object,
1841 case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_LEAVE_RSP: {
1842 ZigbeeZdoDevControlMgmtLeftResp_t *resp_t =
1843 (ZigbeeZdoDevControlMgmtLeftResp_t *)noti_data;
1845 zigbee_zdo_dev_control_emit_mgmt_leave_rsp(dev_control_object,
1849 case ZBLIB_ZDO_DEV_CONTROL_NOTI_MGMT_NWK_DISC_RSP: {
1850 ZigbeeZdoDevControlMgmtNwkDiscoveryResp_t *nwk_disc_t =
1851 (ZigbeeZdoDevControlMgmtNwkDiscoveryResp_t *)noti_data;
1855 GVariant *v_entries = NULL;
1856 GVariantBuilder *entry_builder =
1857 g_variant_builder_new(G_VARIANT_TYPE("a(ayyyyyyy)"));
1858 if (NULL == entry_builder) {
1859 Z_LOGE("Failed to create variant builder!");
1863 for (i = 0; i < nwk_disc_t->table_list_count ; i++) {
1864 GVariantBuilder *ext_pan_builder =
1865 g_variant_builder_new(G_VARIANT_TYPE("ay"));
1866 if (NULL == ext_pan_builder) {
1867 Z_LOGE("Failed to create variant builder!");
1868 g_variant_builder_unref(entry_builder);
1872 for (v = 0; v < ZIGBEE_EUI64_SIZE; v++) {
1873 g_variant_builder_add(ext_pan_builder, "y",
1874 nwk_disc_t->table_list[i].extended_pan_id[v]);
1877 g_variant_builder_add(entry_builder, "(ayyyyyyy)",
1879 nwk_disc_t->table_list[i].logical_channel,
1880 nwk_disc_t->table_list[i].stack_profile,
1881 nwk_disc_t->table_list[i].zigbee_version,
1882 nwk_disc_t->table_list[i].beacon_order,
1883 nwk_disc_t->table_list[i].superframe_order,
1884 nwk_disc_t->table_list[i].permit_joining);
1886 g_variant_builder_unref(ext_pan_builder);
1888 v_entries = g_variant_builder_end(entry_builder);
1890 Z_LOGD("Network discovery rsp : [0x%X]", nwk_disc_t->status);
1891 zigbee_zdo_dev_control_emit_mgmt_nwk_disc_rsp(dev_control_object,
1892 nwk_disc_t->status, nwk_disc_t->network_count,
1893 nwk_disc_t->start_index, nwk_disc_t->table_list_count,
1896 g_variant_builder_unref(entry_builder);
1898 g_variant_unref(v_entries);
1901 case ZBLIB_ZDO_DEV_CONTROL_NOTI_NODE_DESC_RSP: {
1902 ZigbeeZdoDevControlNodeDescriptorResp_t *desc_t =
1903 (ZigbeeZdoDevControlNodeDescriptorResp_t *)noti_data;
1905 zigbee_zdo_dev_control_emit_node_desc_rsp(dev_control_object,
1906 desc_t->status, desc_t->node_id, desc_t->logical_type,
1907 desc_t->complex_desciptor_available,
1908 desc_t->user_descriptor_available,
1909 desc_t->aps_flags, desc_t->frequency_band,
1910 desc_t->mac_capability_flags, desc_t->manufacturer_code,
1911 desc_t->max_buffer_size, desc_t->max_incoming_transfer_size,
1912 desc_t->server_mask, desc_t->max_outgoing_transfer_size,
1913 desc_t->descriptor_capability_field);
1916 case ZBLIB_ZDO_DEV_CONTROL_NOTI_POWER_DESC_RSP: {
1917 ZigbeeZdoDevControlPowerDescriptorResp_t *desc_t =
1918 (ZigbeeZdoDevControlPowerDescriptorResp_t *)noti_data;
1920 zigbee_zdo_dev_control_emit_power_desc_rsp(dev_control_object,
1921 desc_t->status, desc_t->node_id,
1922 desc_t->current_power_mode,
1923 desc_t->available_power_sources,
1924 desc_t->current_power_source,
1925 desc_t->current_power_source_level);
1928 case ZBLIB_ZDO_DEV_CONTROL_NOTI_COMPLEX_DESC_RSP: {
1929 ZigbeeZdoDevControlComplexDescriptorResp_t *desc_t =
1930 (ZigbeeZdoDevControlComplexDescriptorResp_t *)noti_data;
1932 GVariant *v_desc_list = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"),
1933 desc_t->complex_descriptor_list, desc_t->list_count,
1935 if (NULL == v_desc_list) {
1936 Z_LOGE("Failed to create variant!");
1938 Z_LOGD("Complex descriptor rsp : [0x%X]", desc_t->status);
1939 zigbee_zdo_dev_control_emit_complex_desc_rsp(dev_control_object,
1940 desc_t->status, desc_t->node_id, desc_t->list_count, v_desc_list);
1943 g_variant_unref(v_desc_list);
1946 case ZBLIB_ZDO_DEV_CONTROL_NOTI_USER_DESC_RSP: {
1947 ZigbeeZdoDevControlUserDescriptorResp_t *desc_t =
1948 (ZigbeeZdoDevControlUserDescriptorResp_t *)noti_data;
1950 GVariant *v_desc_list = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"),
1951 desc_t->user_descriptor_list, desc_t->list_count,
1953 if (NULL == v_desc_list) {
1954 Z_LOGE("Failed to create variant!");
1956 Z_LOGD("User descriptor rsp : [0x%X]", desc_t->status);
1957 zigbee_zdo_dev_control_emit_user_desc_rsp(dev_control_object,
1958 desc_t->status, desc_t->node_id, desc_t->list_count, v_desc_list);
1961 g_variant_unref(v_desc_list);
1964 case ZBLIB_ZDO_DEV_CONTROL_NOTI_USER_DESC_CONFIRM: {
1965 ZigbeeZdoDevControlUserDescriptorConfirm_t *resp_t =
1966 (ZigbeeZdoDevControlUserDescriptorConfirm_t *)noti_data;
1968 zigbee_zdo_dev_control_emit_user_desc_confirm(dev_control_object,
1973 Z_LOGE("Unexpected notification [%x]", noti_id);
1977 /* ZigbeeZdo_dev_control should be dereferenced */
1978 g_object_unref(dev_control_object);
1980 /* LCOV_EXCL_STOP */
1982 gboolean zigbee_service_dbus_interface_zdo_dev_control_init(ZigBeeServiceInterface *service_interface,
1983 ZigbeeObjectSkeleton *zigbee_object)
1985 ZigbeeZdo_dev_control *zdodev_control_object;
1987 if (NULL == service_interface) {
1988 /* LCOV_EXCL_START */
1989 Z_LOGE("service_interface is NULL");
1991 /* LCOV_EXCL_STOP */
1994 zdodev_control_object = zigbee_zdo_dev_control_skeleton_new();
1995 zigbee_object_skeleton_set_zdo_dev_control(zigbee_object, zdodev_control_object);
1996 g_object_unref(zdodev_control_object);
1998 Z_LOGI("zdodev_control_object: [%p]", zdodev_control_object);
2001 * Register signal handlers for 'zdodev_control' interface
2003 g_signal_connect(zdodev_control_object,
2004 "handle-nwk-addr-req",
2005 G_CALLBACK(on_zdodev_control_nwk_addr_req), service_interface);
2007 g_signal_connect(zdodev_control_object,
2008 "handle-matched-descriptor-req",
2009 G_CALLBACK(on_zdodev_control_matched_descriptor_req), service_interface);
2011 g_signal_connect(zdodev_control_object,
2012 "handle-ieee-addr-req",
2013 G_CALLBACK(on_zdodev_control_ieee_addr_req), service_interface);
2015 g_signal_connect(zdodev_control_object,
2016 "handle-active-ep-req",
2017 G_CALLBACK(on_zdodev_control_active_ep_req), service_interface);
2019 g_signal_connect(zdodev_control_object,
2020 "handle-node-desc-req",
2021 G_CALLBACK(on_zdodev_control_node_desc_req), service_interface);
2023 g_signal_connect(zdodev_control_object,
2024 "handle-power-desc-req",
2025 G_CALLBACK(on_zdodev_control_power_desc_req), service_interface);
2027 g_signal_connect(zdodev_control_object,
2028 "handle-complex-desc-req",
2029 G_CALLBACK(on_zdodev_control_complex_desc_req), service_interface);
2031 g_signal_connect(zdodev_control_object,
2032 "handle-user-desc-req",
2033 G_CALLBACK(on_zdodev_control_user_desc_req), service_interface);
2035 g_signal_connect(zdodev_control_object,
2036 "handle-user-desc-set-req",
2037 G_CALLBACK(on_zdodev_control_user_desc_set_req), service_interface);
2039 g_signal_connect(zdodev_control_object,
2040 "handle-device-announce",
2041 G_CALLBACK(on_zdodev_control_device_announce), service_interface);
2043 g_signal_connect(zdodev_control_object,
2044 "handle-simple-desc-req",
2045 G_CALLBACK(on_zdodev_control_simple_desc_req), service_interface);
2047 g_signal_connect(zdodev_control_object,
2048 "handle-mgmt-lqi-req",
2049 G_CALLBACK(on_zdodev_control_mgmt_lqi_req), service_interface);
2051 g_signal_connect(zdodev_control_object,
2052 "handle-mgmt-rtg-req",
2053 G_CALLBACK(on_zdodev_control_mgmt_rtg_req), service_interface);
2055 g_signal_connect(zdodev_control_object,
2056 "handle-mgmt-bind-req",
2057 G_CALLBACK(on_zdodev_control_mgmt_bind_req), service_interface);
2059 g_signal_connect(zdodev_control_object,
2060 "handle-mgmt-permit-join-req",
2061 G_CALLBACK(on_zdodev_control_mgmt_permit_join_req), service_interface);
2063 g_signal_connect(zdodev_control_object,
2064 "handle-mgmt-nwk-update-req",
2065 G_CALLBACK(on_zdodev_control_mgmt_nwk_update_req), service_interface);
2067 g_signal_connect(zdodev_control_object,
2068 "handle-mgmt-nwk-disc-req",
2069 G_CALLBACK(on_zdodev_control_mgmt_nwk_disc_req), service_interface);