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_service.h>
23 static void *_service_interface_ref_zigbee_service(ZigBeeServiceInterface *service_interface)
25 ZigbeeObjectSkeleton *zigbee_object = NULL;
26 ZigbeeCustomData_t *custom_data = NULL;
27 ZigbeeService *service = NULL;
29 custom_data = (ZigbeeCustomData_t *)zblib_service_interface_ref_user_data(service_interface);
30 if (NULL == custom_data) {
31 Z_LOGE("D-BUS service interface custom_data is NULL!");
35 /* Get zigbee object */
36 zigbee_object = g_hash_table_lookup(custom_data->objects, ZIGBEE_SERVICE_PATH);
37 if (NULL == zigbee_object) {
38 Z_LOGW("Cannot find ZigBee D-BUS interface object!", zigbee_object);
42 service = zigbee_object_get_service(ZIGBEE_OBJECT(zigbee_object));
46 static void on_service_enable_resp(ZigBeeServiceInterface *service_interface,
47 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
49 ZigbeeServiceInterfaceRespCbData_t *cb_data =
50 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
52 ZigbeeService *service_object;
53 GDBusMethodInvocation *invocation;
54 ZigbeeServiceServiceState_t *payload =
55 (ZigbeeServiceServiceState_t*)resp_data;
57 NOT_USED(service_interface);
60 if (NULL == resp_data || 0 == resp_data_len) {
61 Z_LOGE("resp_data is null");
65 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
66 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
68 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
69 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
71 zigbee_service_complete_enable(service_object, invocation,
72 payload->result, payload->enabled);
77 static gboolean on_service_enable(ZigbeeService *service_object,
78 GDBusMethodInvocation *invocation,
81 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
82 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
88 /* Allocate response callback data */
90 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
92 if (NULL == resp_cb_data) {
93 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
95 /* Send failure response */
96 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
101 /* Dispatch request */
102 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
103 ZBLIB_DRIVER_TYPE_SERVICE,
104 ZBLIB_SERVICE_OPS_ENABLE,
106 on_service_enable_resp, resp_cb_data);
108 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
110 /* Free response callback data */
111 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
113 /* Send failure response */
114 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
122 static void on_service_disable_resp(ZigBeeServiceInterface *service_interface,
123 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
125 ZigbeeServiceInterfaceRespCbData_t *cb_data =
126 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
128 ZigbeeService *service_object;
129 GDBusMethodInvocation *invocation;
130 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
132 NOT_USED(service_interface);
133 NOT_USED(request_id);
135 if (NULL == resp_data || 0 == resp_data_len) {
136 Z_LOGE("resp_data is null");
140 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
141 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
143 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
144 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
146 zigbee_service_complete_disable(service_object, invocation, payload->result);
151 static gboolean on_service_disable(ZigbeeService *service_object,
152 GDBusMethodInvocation *invocation,
155 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
156 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
160 /* Allocate response callback data */
162 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
163 invocation, NULL, 0);
164 if (NULL == resp_cb_data) {
165 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
167 /* Send failure response */
168 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
173 /* Dispatch request */
174 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
175 ZBLIB_DRIVER_TYPE_SERVICE,
176 ZBLIB_SERVICE_OPS_DISABLE,
178 on_service_disable_resp, resp_cb_data);
180 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
182 /* Free response callback data */
183 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
185 /* Send failure response */
186 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
194 static void on_service_zb_hw_reset_resp(ZigBeeServiceInterface *service_interface,
195 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
197 ZigbeeServiceInterfaceRespCbData_t *cb_data =
198 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
200 ZigbeeService *service_object;
201 GDBusMethodInvocation *invocation;
202 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
204 NOT_USED(service_interface);
205 NOT_USED(request_id);
207 if (NULL == resp_data || 0 == resp_data_len) {
208 Z_LOGE("resp_data is null");
212 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
213 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
215 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
216 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
218 zigbee_service_complete_zb_hw_reset(service_object, invocation, payload->result);
223 static gboolean on_service_zb_hw_reset(ZigbeeService *service_object,
224 GDBusMethodInvocation *invocation,
227 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
228 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
232 /* Allocate response callback data */
234 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
235 invocation, NULL, 0);
236 if (NULL == resp_cb_data) {
237 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
239 /* Send failure response */
240 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
245 /* Dispatch request */
246 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
247 ZBLIB_DRIVER_TYPE_SERVICE,
248 ZBLIB_SERVICE_OPS_ZB_HW_RESET,
250 on_service_zb_hw_reset_resp, resp_cb_data);
252 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
254 /* Free response callback data */
255 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
257 /* Send failure response */
258 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
266 static void on_service_form_network_resp(ZigBeeServiceInterface *service_interface,
267 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
269 ZigbeeServiceInterfaceRespCbData_t *cb_data =
270 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
272 ZigbeeService *service_object;
273 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 is null");
284 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
285 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
287 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
288 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
290 zigbee_service_complete_form_network(service_object, invocation, payload->result);
295 static gboolean on_service_form_network(ZigbeeService *service_object,
296 GDBusMethodInvocation *invocation,
299 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
300 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
304 /* Allocate response callback data */
306 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
307 invocation, NULL, 0);
308 if (NULL == resp_cb_data) {
309 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
311 /* Send failure response */
312 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
317 /* Dispatch request */
318 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
319 ZBLIB_DRIVER_TYPE_SERVICE,
320 ZBLIB_SERVICE_OPS_FORM_NETWORK,
322 on_service_form_network_resp, resp_cb_data);
324 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
326 /* Free response callback data */
327 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
329 /* Send failure response */
330 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
338 static void on_service_coex_start_resp(ZigBeeServiceInterface *service_interface,
339 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
341 ZigbeeServiceInterfaceRespCbData_t *cb_data =
342 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
344 ZigbeeService *service_object;
345 GDBusMethodInvocation *invocation;
346 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
348 NOT_USED(service_interface);
349 NOT_USED(request_id);
351 if (NULL == resp_data || 0 == resp_data_len) {
352 Z_LOGE("resp_data is null");
356 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
357 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
359 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
360 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
362 zigbee_service_complete_coex_start(service_object, invocation, payload->result);
367 static gboolean on_service_coex_start(ZigbeeService *service_object,
368 GDBusMethodInvocation *invocation,
372 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
373 ZigbeeServiceCoexStart_t req;
374 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
378 memset(&req, 0x0, sizeof(ZigbeeServiceCoexStart_t));
380 /* Update request structure */
381 req.channel = channel;
383 /* Allocate response callback data */
385 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
386 invocation, NULL, 0);
387 if (NULL == resp_cb_data) {
388 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
390 /* Send failure response */
391 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
396 /* Dispatch request */
397 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
398 ZBLIB_DRIVER_TYPE_SERVICE,
399 ZBLIB_SERVICE_OPS_COEX_START,
401 on_service_coex_start_resp, resp_cb_data);
403 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
405 /* Free response callback data */
406 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
408 /* Send failure response */
409 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
417 static void on_service_coex_stop_resp(ZigBeeServiceInterface *service_interface,
418 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
420 ZigbeeServiceInterfaceRespCbData_t *cb_data =
421 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
423 ZigbeeService *service_object;
424 GDBusMethodInvocation *invocation;
425 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
427 NOT_USED(service_interface);
428 NOT_USED(request_id);
430 if (NULL == resp_data || 0 == resp_data_len) {
431 Z_LOGE("resp_data is null");
435 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
436 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
438 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
439 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
441 zigbee_service_complete_coex_stop(service_object, invocation, payload->result);
446 static gboolean on_service_coex_stop(ZigbeeService *service_object,
447 GDBusMethodInvocation *invocation,
450 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
451 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
455 /* Allocate response callback data */
457 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
458 invocation, NULL, 0);
459 if (NULL == resp_cb_data) {
460 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
462 /* Send failure response */
463 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
468 /* Dispatch request */
469 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
470 ZBLIB_DRIVER_TYPE_SERVICE,
471 ZBLIB_SERVICE_OPS_COEX_STOP,
473 on_service_coex_stop_resp, resp_cb_data);
475 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
477 /* Free response callback data */
478 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
480 /* Send failure response */
481 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
489 static void on_service_leave_network_resp(ZigBeeServiceInterface *service_interface,
490 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
492 ZigbeeServiceInterfaceRespCbData_t *cb_data =
493 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
495 ZigbeeService *service_object;
496 GDBusMethodInvocation *invocation;
497 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
499 NOT_USED(service_interface);
500 NOT_USED(request_id);
502 if (NULL == resp_data || 0 == resp_data_len) {
503 Z_LOGE("resp_data is null");
507 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
508 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
510 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
511 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
513 zigbee_service_complete_leave_network(service_object, invocation, payload->result);
518 static gboolean on_service_leave_network(ZigbeeService *service_object,
519 GDBusMethodInvocation *invocation,
522 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
523 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
527 /* Allocate response callback data */
529 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
530 invocation, NULL, 0);
531 if (NULL == resp_cb_data) {
532 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
534 /* Send failure response */
535 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
540 /* Dispatch request */
541 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
542 ZBLIB_DRIVER_TYPE_SERVICE,
543 ZBLIB_SERVICE_OPS_LEAVE_NETWORK,
545 on_service_leave_network_resp, resp_cb_data);
547 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
549 /* Free response callback data */
550 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
552 /* Send failure response */
553 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
561 static void on_service_get_network_info_resp(ZigBeeServiceInterface *service_interface,
562 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
564 ZigbeeServiceInterfaceRespCbData_t *cb_data =
565 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
567 ZigbeeService *service_object;
568 GDBusMethodInvocation *invocation;
570 ZigbeeServiceGetNetworkInfo_t *payload =
571 (ZigbeeServiceGetNetworkInfo_t*)resp_data;
573 GVariant *v_eui64 = NULL;
575 NOT_USED(service_interface);
576 NOT_USED(request_id);
578 if (NULL == resp_data || 0 == resp_data_len) {
579 Z_LOGE("resp_data is null");
583 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
584 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
586 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
587 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
589 v_eui64 = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"),
590 payload->eui64, ZIGBEE_EUI64_SIZE, TRUE, NULL, NULL);
592 zigbee_service_complete_get_network_info(service_object, invocation,
593 payload->result, v_eui64, payload->node_id,
594 payload->pan_id, payload->channel, payload->radio_tx_power);
599 static gboolean on_service_get_network_info(ZigbeeService *service_object,
600 GDBusMethodInvocation *invocation,
603 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
604 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
608 /* Allocate response callback data */
610 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
611 invocation, NULL, 0);
612 if (NULL == resp_cb_data) {
613 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
615 /* Send failure response */
616 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
621 /* Dispatch request */
622 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
623 ZBLIB_DRIVER_TYPE_SERVICE,
624 ZBLIB_SERVICE_OPS_GET_NETWORK_INFO,
626 on_service_get_network_info_resp, resp_cb_data);
628 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
630 /* Free response callback data */
631 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
633 /* Send failure response */
634 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
642 static void on_service_permit_join_resp(ZigBeeServiceInterface *service_interface,
643 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
645 ZigbeeServiceInterfaceRespCbData_t *cb_data =
646 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
648 ZigbeeService *service_object;
649 GDBusMethodInvocation *invocation;
650 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
652 NOT_USED(service_interface);
653 NOT_USED(request_id);
655 if (NULL == resp_data || 0 == resp_data_len) {
656 Z_LOGE("resp_data is null");
660 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
661 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
663 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
664 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
666 zigbee_service_complete_permit_join(service_object, invocation, payload->result);
671 static gboolean on_service_permit_join(ZigbeeService *service_object,
672 GDBusMethodInvocation *invocation,
674 gboolean permit_join,
677 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
678 ZigbeeServicePermitJoin_t req;
679 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
683 memset(&req, 0x0, sizeof(ZigbeeServicePermitJoin_t));
685 /* Update request structure */
686 req.duration = duration;
687 req.permit_join = permit_join;
689 /* Allocate response callback data */
691 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
692 invocation, NULL, 0);
693 if (NULL == resp_cb_data) {
694 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
696 /* Send failure response */
697 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
702 /* Dispatch request */
703 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
704 ZBLIB_DRIVER_TYPE_SERVICE,
705 ZBLIB_SERVICE_OPS_PERMIT_JOIN,
707 on_service_permit_join_resp, resp_cb_data);
709 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
711 /* Free response callback data */
712 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
714 /* Send failure response */
715 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
723 static void on_service_leave_request_resp(ZigBeeServiceInterface *service_interface,
724 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
726 ZigbeeServiceInterfaceRespCbData_t *cb_data =
727 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
729 ZigbeeService *service_object;
730 GDBusMethodInvocation *invocation;
731 ZigbeeGeneralResp_t *payload = (ZigbeeGeneralResp_t*)resp_data;
733 NOT_USED(service_interface);
734 NOT_USED(request_id);
736 if (NULL == resp_data || 0 == resp_data_len) {
737 Z_LOGE("resp_data is null");
741 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
742 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
744 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
745 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
747 zigbee_service_complete_leave_request(service_object, invocation, payload->result);
752 static gboolean on_service_leave_request(ZigbeeService *service_object,
753 GDBusMethodInvocation *invocation,
759 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
760 ZigbeeServiceLeaveRequest_t req;
761 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
763 GVariantIter *iter = NULL;
768 memset(&req, 0x0, sizeof(ZigbeeServiceLeaveRequest_t));
770 /* Update request structure */
771 g_variant_get(eui64, "ay", &iter);
772 while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
774 if (i >= ZIGBEE_EUI64_SIZE)
777 req.remove_child = remove_child;
780 /* Allocate response callback data */
782 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
783 invocation, NULL, 0);
784 if (NULL == resp_cb_data) {
785 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
787 /* Send failure response */
788 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
793 /* Dispatch request */
794 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
795 ZBLIB_DRIVER_TYPE_SERVICE,
796 ZBLIB_SERVICE_OPS_LEAVE_REQUEST,
798 on_service_leave_request_resp, resp_cb_data);
800 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
802 /* Free response callback data */
803 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
805 /* Send failure response */
806 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
814 static void on_service_get_device_list_resp(ZigBeeServiceInterface *service_interface,
815 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
817 ZigbeeServiceInterfaceRespCbData_t *cb_data =
818 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
820 ZigbeeService *service_object;
821 GDBusMethodInvocation *invocation;
823 NOT_USED(service_interface);
824 NOT_USED(request_id);
826 if (NULL == resp_data || 0 == resp_data_len) {
827 Z_LOGE("resp_data is null");
832 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
833 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
835 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
836 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
838 /* To-To : zigbee_service_complete_get_device_list */
839 //zigbee_service_complete_get_device_list(service_object, invocation, resp_data);
844 static gboolean on_service_get_device_list(ZigbeeService *service_object,
845 GDBusMethodInvocation *invocation,
848 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
849 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
853 /* Allocate response callback data */
855 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
856 invocation, NULL, 0);
857 if (NULL == resp_cb_data) {
858 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
860 /* Send failure response */
861 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
866 /* Dispatch request */
867 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
868 ZBLIB_DRIVER_TYPE_SERVICE,
869 ZBLIB_SERVICE_OPS_GET_DEVICE_LIST,
871 on_service_get_device_list_resp, resp_cb_data);
873 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
875 /* Free response callback data */
876 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
878 /* Send failure response */
879 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
887 static void on_service_get_mac_resp(ZigBeeServiceInterface *service_interface,
888 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
890 ZigbeeServiceInterfaceRespCbData_t *cb_data =
891 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
893 ZigbeeService *service_object;
894 GDBusMethodInvocation *invocation;
895 ZigbeeServiceGetMac_t *payload =
896 (ZigbeeServiceGetMac_t*)resp_data;
898 GVariant *v_eui64 = NULL;
900 NOT_USED(service_interface);
901 NOT_USED(request_id);
903 if (NULL == resp_data || 0 == resp_data_len) {
904 Z_LOGE("resp_data is null");
909 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
910 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
912 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
913 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
915 v_eui64 = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"),
916 payload->eui64, ZIGBEE_EUI64_SIZE, TRUE, NULL, NULL);
918 zigbee_service_complete_get_mac(service_object, invocation, payload->result,
924 static gboolean on_service_get_mac(ZigbeeService *service_object,
925 GDBusMethodInvocation *invocation,
928 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
929 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
933 /* Allocate response callback data */
935 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
936 invocation, NULL, 0);
937 if (NULL == resp_cb_data) {
938 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
940 /* Send failure response */
941 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
946 /* Dispatch request */
947 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
948 ZBLIB_DRIVER_TYPE_SERVICE,
949 ZBLIB_SERVICE_OPS_GET_MAC,
951 on_service_get_mac_resp, resp_cb_data);
953 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
955 /* Free response callback data */
956 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
958 /* Send failure response */
959 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
967 static void on_service_get_device_info_resp(ZigBeeServiceInterface *service_interface,
968 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
970 ZigbeeServiceInterfaceRespCbData_t *cb_data =
971 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
973 ZigbeeService *service_object;
974 GDBusMethodInvocation *invocation;
976 NOT_USED(service_interface);
977 NOT_USED(request_id);
979 if (NULL == resp_data || 0 == resp_data_len) {
980 Z_LOGE("resp_data is null");
985 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
986 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
988 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
989 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
991 /* To-Do : zigbee_service_complete_get_device_list */
992 //zigbee_service_complete_get_device_info(service_object, invocation, resp_data);
997 static gboolean on_service_get_device_info(ZigbeeService *service_object,
998 GDBusMethodInvocation *invocation,
1001 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1002 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1006 /* Allocate response callback data */
1008 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
1009 invocation, NULL, 0);
1010 if (NULL == resp_cb_data) {
1011 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1013 /* Send failure response */
1014 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1019 /* Dispatch request */
1020 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1021 ZBLIB_DRIVER_TYPE_SERVICE,
1022 ZBLIB_SERVICE_OPS_GET_DEVICE_INFO,
1024 on_service_get_device_info_resp, resp_cb_data);
1026 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1028 /* Free response callback data */
1029 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1031 /* Send failure response */
1032 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1040 static void on_service_get_endpoint_list_resp(ZigBeeServiceInterface *service_interface,
1041 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1043 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1044 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1046 ZigbeeService *service_object;
1047 GDBusMethodInvocation *invocation;
1049 NOT_USED(service_interface);
1050 NOT_USED(request_id);
1052 if (NULL == resp_data || 0 == resp_data_len) {
1053 Z_LOGE("resp_data is null");
1058 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1059 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
1061 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1062 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1064 /* To fix : end-points must be changed gchar* -> GVariant ay */
1065 //zigbee_service_complete_get_endpoint_list(service_object, invocation, resp_data);
1070 static gboolean on_service_get_endpoint_list(ZigbeeService *service_object,
1071 GDBusMethodInvocation *invocation,
1075 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1076 ZigbeeServiceGetEndpointList_t req;
1077 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1079 GVariantIter *iter = NULL;
1084 memset(&req, 0x0, sizeof(ZigbeeServiceGetEndpointList_t));
1086 /* Update request structure */
1087 g_variant_get(eui64, "ay", &iter);
1088 while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
1090 if (i >= ZIGBEE_EUI64_SIZE)
1094 /* Allocate response callback data */
1096 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
1097 invocation, NULL, 0);
1098 if (NULL == resp_cb_data) {
1099 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1101 /* Send failure response */
1102 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1107 /* Dispatch request */
1108 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1109 ZBLIB_DRIVER_TYPE_SERVICE,
1110 ZBLIB_SERVICE_OPS_GET_ENDPOINT_LIST,
1112 on_service_get_endpoint_list_resp, resp_cb_data);
1114 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1116 /* Free response callback data */
1117 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1119 /* Send failure response */
1120 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1128 static void on_service_get_cluster_list_resp(ZigBeeServiceInterface *service_interface,
1129 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1131 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1132 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1134 ZigbeeService *service_object;
1135 GDBusMethodInvocation *invocation;
1137 NOT_USED(service_interface);
1138 NOT_USED(request_id);
1140 if (NULL == resp_data || 0 == resp_data_len) {
1141 Z_LOGE("resp_data is null");
1146 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1147 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
1149 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1150 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1152 /* To-Do : zigbee_service_complete_get_cluster_list */
1153 //zigbee_service_complete_get_cluster_list(service_object, invocation, resp_data);
1158 static gboolean on_service_get_cluster_list(ZigbeeService *service_object,
1159 GDBusMethodInvocation *invocation,
1164 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1165 ZigbeeServiceGetClusterList_t req;
1166 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1168 GVariantIter *iter = NULL;
1173 memset(&req, 0x0, sizeof(ZigbeeServiceGetClusterList_t));
1175 /* Update request structure */
1176 g_variant_get(eui64, "ay", &iter);
1177 while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
1179 if (i >= ZIGBEE_EUI64_SIZE)
1182 req.endpoint = endpoint;
1184 /* Allocate response callback data */
1186 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
1187 invocation, NULL, 0);
1188 if (NULL == resp_cb_data) {
1189 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1191 /* Send failure response */
1192 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1197 /* Dispatch request */
1198 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1199 ZBLIB_DRIVER_TYPE_SERVICE,
1200 ZBLIB_SERVICE_OPS_GET_CLUSTER_LIST,
1202 on_service_get_cluster_list_resp, resp_cb_data);
1204 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1206 /* Free response callback data */
1207 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1209 /* Send failure response */
1210 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1218 static void on_service_get_node_type_resp(ZigBeeServiceInterface *service_interface,
1219 guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data)
1221 ZigbeeServiceInterfaceRespCbData_t *cb_data =
1222 (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data;
1224 ZigbeeService *service_object;
1225 GDBusMethodInvocation *invocation;
1226 ZigbeeServiceServiceNodeType_t *payload =
1227 (ZigbeeServiceServiceNodeType_t *)resp_data;
1229 NOT_USED(service_interface);
1230 NOT_USED(request_id);
1232 if (NULL == resp_data || 0 == resp_data_len) {
1233 Z_LOGE("resp_data is null");
1238 service_object = zigbee_service_dbus_interface_ref_interface_object(cb_data);
1239 zblib_check_null_free_and_ret("service_object", service_object, cb_data);
1241 invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
1242 zblib_check_null_free_and_ret("invocation", invocation, cb_data);
1244 zigbee_service_complete_get_node_type(service_object, invocation,
1245 payload->result, payload->node_type);
1250 static gboolean on_service_get_node_type(ZigbeeService *service_object,
1251 GDBusMethodInvocation *invocation,
1255 ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
1256 ZigbeeServiceGetNodeType_t req;
1257 ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
1259 GVariantIter *iter = NULL;
1264 memset(&req, 0x0, sizeof(ZigbeeServiceGetNodeType_t));
1266 /* Update request structure */
1267 g_variant_get(eui64, "ay", &iter);
1268 while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
1270 if (i >= ZIGBEE_EUI64_SIZE)
1274 /* Allocate response callback data */
1276 zigbee_service_dbus_interface_create_resp_cb_data(service_object,
1277 invocation, NULL, 0);
1278 if (NULL == resp_cb_data) {
1279 Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!");
1281 /* Send failure response */
1282 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1287 /* Dispatch request */
1288 ret = zigbee_service_dbus_interface_dispatch_request(service_interface,
1289 ZBLIB_DRIVER_TYPE_SERVICE,
1290 ZBLIB_SERVICE_OPS_GET_NODE_TYPE,
1292 on_service_get_node_type_resp, resp_cb_data);
1294 Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
1296 /* Free response callback data */
1297 zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data);
1299 /* Send failure response */
1300 ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
1308 void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface *service_interface,
1309 guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
1311 ZigbeeService *service_object;
1313 zblib_check_null_ret("service_interface", service_interface);
1315 if (NULL == noti_data || 0 == noti_data_len) {
1316 Z_LOGE("noti_data is NULL");
1320 service_object = _service_interface_ref_zigbee_service(service_interface);
1321 zblib_check_null_ret("service_object", service_object);
1323 NOT_USED(noti_cb_data);
1326 case ZBLIB_SERVICE_NOTI_FORM_NETWORK_DONE: {
1327 ZigbeeServiceServiceFormNetworkDone_t *panid_t =
1328 (ZigbeeServiceServiceFormNetworkDone_t*)noti_data;
1330 Z_LOGD("form_network_done : [0x%X]", panid_t->pan_id);
1332 zigbee_service_emit_form_network_done(service_object, panid_t->pan_id);
1335 case ZBLIB_SERVICE_NOTI_CHILD_JOINED: {
1336 zigbee_service_emit_child_joined(service_object, (GVariant *)noti_data);
1339 case ZBLIB_SERVICE_NOTI_CHILD_REJOINED: {
1340 ZigbeeServiceServiceChildRejoined_t ieee_addr_t;
1341 memcpy(&ieee_addr_t, noti_data, noti_data_len);
1342 zigbee_service_emit_child_rejoined(service_object, ieee_addr_t.eui64);
1345 case ZBLIB_SERVICE_NOTI_CHILD_LEFT: {
1346 ZigbeeServiceServiceChildLeft_t child_left_t;
1347 memcpy(&child_left_t, noti_data, noti_data_len);
1348 zigbee_service_emit_child_left(service_object, child_left_t.eui64, child_left_t.status);
1351 case ZBLIB_SERVICE_NOTI_LEAVE_NETWORK_DONE: {
1352 ZigbeeServiceServiceLeaveNetworkDone_t leave_net_t;
1353 memcpy(&leave_net_t, noti_data, noti_data_len);
1354 zigbee_service_emit_leave_network_done(service_object, leave_net_t.pan_id);
1358 Z_LOGE("Unexpected notification [%x]", noti_id);
1362 /* ZigbeeService should be dereferenced */
1363 g_object_unref(service_object);
1366 gboolean zigbee_service_dbus_interface_service_init(ZigBeeServiceInterface *service_interface,
1367 ZigbeeObjectSkeleton *zigbee_object)
1369 ZigbeeService *service_object;
1371 if (NULL == service_interface) {
1372 Z_LOGE("service_interface is NULL");
1376 service_object = zigbee_service_skeleton_new();
1377 zigbee_object_skeleton_set_service(zigbee_object, service_object);
1378 g_object_unref(service_object);
1380 Z_LOGI("service_object: [%p]", service_object);
1383 * Register signal handlers for 'service' interface
1385 g_signal_connect(service_object,
1387 G_CALLBACK(on_service_enable), service_interface);
1389 g_signal_connect(service_object,
1391 G_CALLBACK(on_service_disable), service_interface);
1393 g_signal_connect(service_object,
1394 "handle-zb-hw-reset",
1395 G_CALLBACK(on_service_zb_hw_reset), service_interface);
1397 g_signal_connect(service_object,
1398 "handle-form-network",
1399 G_CALLBACK(on_service_form_network), service_interface);
1401 g_signal_connect(service_object,
1402 "handle-coex-start",
1403 G_CALLBACK(on_service_coex_start), service_interface);
1405 g_signal_connect(service_object,
1407 G_CALLBACK(on_service_coex_stop), service_interface);
1409 g_signal_connect(service_object,
1410 "handle-leave-network",
1411 G_CALLBACK(on_service_leave_network), service_interface);
1413 g_signal_connect(service_object,
1414 "handle-get-network-info",
1415 G_CALLBACK(on_service_get_network_info), service_interface);
1417 g_signal_connect(service_object,
1418 "handle-permit-join",
1419 G_CALLBACK(on_service_permit_join), service_interface);
1421 g_signal_connect(service_object,
1422 "handle-leave-request",
1423 G_CALLBACK(on_service_leave_request), service_interface);
1425 g_signal_connect(service_object,
1426 "handle-get-device-list",
1427 G_CALLBACK(on_service_get_device_list), service_interface);
1429 g_signal_connect(service_object,
1431 G_CALLBACK(on_service_get_mac), service_interface);
1433 g_signal_connect(service_object,
1434 "handle-get-device-info",
1435 G_CALLBACK(on_service_get_device_info), service_interface);
1437 g_signal_connect(service_object,
1438 "handle-get-endpoint-list",
1439 G_CALLBACK(on_service_get_endpoint_list), service_interface);
1441 g_signal_connect(service_object,
1442 "handle-get-cluster-list",
1443 G_CALLBACK(on_service_get_cluster_list), service_interface);
1445 g_signal_connect(service_object,
1446 "handle-get-node-type",
1447 G_CALLBACK(on_service_get_node_type), service_interface);