Fix gvariant string
authorJiwan Kim <ji-wan.kim@samsung.com>
Wed, 25 Jan 2017 09:02:13 +0000 (18:02 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 11 May 2017 09:10:25 +0000 (18:10 +0900)
- 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 <ji-wan.kim@samsung.com>
zigbee-daemon/zigbee-interface/introspection/service.xml
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_service.c
zigbee-daemon/zigbee-lib/include/zblib.h
zigbee-daemon/zigbee-lib/include/zblib_types.h [new file with mode: 0644]

index f5cd66c..148bebf 100644 (file)
@@ -1,8 +1,8 @@
 <node>
        <interface name='org.tizen.zigbee.service'>
                <method name='enable'>
-                       <arg type='b' name='enabled' direction='out'/>
                        <arg type='i' name='result' direction='out'/>
+                       <arg type='b' name='enabled' direction='out'/>
                </method>
                <method name='disable'>
                        <arg type='i' name='result' direction='out'/>
@@ -25,7 +25,7 @@
                </method>
                <method name='get_network_info'>
                        <arg type='i' name='result' direction='out'/>
-                       <arg type='ay' name='macAddress' direction='out'/>
+                       <arg type='a(y)' name='macAddress' direction='out'/>
                        <arg type='q' name='nodeId' direction='out'/>
                        <arg type='q' name='panId' direction='out'/>
                        <arg type='y' name='channel' direction='out'/>
index cd83955..988e961 100644 (file)
@@ -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);
index 6dcd6b3..d439aa5 100644 (file)
@@ -26,6 +26,7 @@
 #include <glib.h>
 
 #include <zblib_log.h>
+#include <zblib_types.h>
 #include <zblib_common.h>
 
 #include <zigbee_service_type.h>
diff --git a/zigbee-daemon/zigbee-lib/include/zblib_types.h b/zigbee-daemon/zigbee-lib/include/zblib_types.h
new file mode 100644 (file)
index 0000000..ba8f2ce
--- /dev/null
@@ -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__ */