From 73f51f75b214ec0021f4a6ee84824709b58761cc Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Wed, 25 Jan 2017 18:02:13 +0900 Subject: [PATCH] Fix gvariant string - After changing with XML introspection, regarding 'ay' variable makes some unexpected error. - Change gvariant string and logic to get variable properly. - Another variable will be updated. Change-Id: Iaf96ef377fbbfa144129dd3f1ef4b9f746f6de1b Signed-off-by: Jiwan Kim --- .../zigbee-interface/introspection/service.xml | 4 +-- .../src/zigbee_service_dbus_interface_service.c | 9 ++++-- zigbee-daemon/zigbee-lib/include/zblib.h | 1 + zigbee-daemon/zigbee-lib/include/zblib_types.h | 34 ++++++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 zigbee-daemon/zigbee-lib/include/zblib_types.h diff --git a/zigbee-daemon/zigbee-interface/introspection/service.xml b/zigbee-daemon/zigbee-interface/introspection/service.xml index f5cd66c..148bebf 100644 --- a/zigbee-daemon/zigbee-interface/introspection/service.xml +++ b/zigbee-daemon/zigbee-interface/introspection/service.xml @@ -1,8 +1,8 @@ - + @@ -25,7 +25,7 @@ - + diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c index cd83955..988e961 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c @@ -567,9 +567,11 @@ static void on_service_get_network_info_resp(ZigBeeServiceInterface *service_int ZigbeeService *service_object; GDBusMethodInvocation *invocation; - ZigbeeServiceGetNetworkInfo_t *payload = + ZigbeeServiceGetNetworkInfo_t *payload = (ZigbeeServiceGetNetworkInfo_t*)resp_data; + GVariant *v_eui64; + NOT_USED(service_interface); NOT_USED(request_id); @@ -584,8 +586,11 @@ static void on_service_get_network_info_resp(ZigBeeServiceInterface *service_int invocation = zigbee_service_dbus_interface_ref_invocation(cb_data); zblib_check_null_ret("invocation", invocation); + v_eui64 = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"), + payload->eui64, ZIGBEE_EUI64_SIZE, TRUE, NULL, NULL); + zigbee_service_complete_get_network_info(service_object, invocation, - payload->result, payload->eui64, payload->node_id, + payload->result, v_eui64, payload->node_id, payload->pan_id, payload->channel, payload->radio_tx_power); g_free(cb_data); diff --git a/zigbee-daemon/zigbee-lib/include/zblib.h b/zigbee-daemon/zigbee-lib/include/zblib.h index 6dcd6b3..d439aa5 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib.h +++ b/zigbee-daemon/zigbee-lib/include/zblib.h @@ -26,6 +26,7 @@ #include #include +#include #include #include diff --git a/zigbee-daemon/zigbee-lib/include/zblib_types.h b/zigbee-daemon/zigbee-lib/include/zblib_types.h new file mode 100644 index 0000000..ba8f2ce --- /dev/null +++ b/zigbee-daemon/zigbee-lib/include/zblib_types.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Suresh Kumar N (suresh.n@samsung.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __ZIGBEE_LIB_TYPES_H__ +#define __ZIGBEE_LIB_TYPES_H__ + +/* -------------------------------------------------------------------------------------- + * For Responses + * -------------------------------------------------------------------------------------*/ + +/* Previous 'status' return value uses vendor return code directly. + * It need to be changed */ +typedef enum +{ + ZBLIB_ERROR_NONE = 0, /**< Successful */ + ZBLIB_ERROR_UNKNOWN /**< Unknown error */ +} zblib_error_e; + +#endif /* __ZIGBEE_LIB_TYPES_H__ */ -- 2.7.4