From f3ab52b0ed845dc2e826aa091b79004151a7e6f3 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Fri, 17 Feb 2017 11:07:05 +0900 Subject: [PATCH 01/16] Add getting ownwership of 'org.tizen.zigbee.manager' for D-Bus activation Change-Id: Iaad9e82dfaf21168a1b5651af8d219f5f5150295 Signed-off-by: saerome kim --- .../src/zigbee_service_dbus_interface.c | 28 ++++++++++++++++++++++ .../src/zigbee_service_interface_common.h | 1 + 2 files changed, 29 insertions(+) diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c index 5d790dd..3f729d5 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c @@ -442,6 +442,20 @@ OUT: g_free(path); } +static void zigbee_get_activation_sbus(ZigbeeCustomData_t *interface_data) +{ + /* Get D-Bus owner to activate zigbee-daemon */ + interface_data->activation_dbus_id = g_bus_own_name(G_BUS_TYPE_SYSTEM, + ZIGBEE_DBUS_SERVICE".manager", + G_BUS_NAME_OWNER_FLAGS_REPLACE, + NULL, + NULL, + NULL, + NULL, + NULL); + Z_LOGI("ZigBee D-BUS activation ID: [%d]", interface_data->activation_dbus_id); +} + /**< Zigbee service dbus interface initialization */ gboolean zigbee_service_dbus_interface_init(ZigBeeService *service) { @@ -508,6 +522,11 @@ gboolean zigbee_service_dbus_interface_init(ZigBeeService *service) g_free, NULL); /* + * Acquire "org.tizen.zigbee.manager" named bus on D-BUS SYSTEM bus. + */ + zigbee_get_activation_sbus(interface_data); + + /* * Acquire "org.tizen.zigbee" named bus on D-BUS SYSTEM bus. */ interface_data->bus_id = g_bus_own_name(G_BUS_TYPE_SYSTEM, @@ -573,6 +592,15 @@ void zigbee_service_dbus_interface_deinit(ZigBeeService *service) } /* + * Unown "org.tizen.zigbee.manager" named bus on D-BUS SYSTEM bus + */ + if (interface_data->activation_dbus_id > 0) { + Z_LOGI("Unowning ZigBee Service interface activation D-BUS ID: [%d]", + interface_data->activation_dbus_id); + g_bus_unown_name(interface_data->activation_dbus_id); + } + + /* * Unown "org.tizen.zigbee" named bus on D-BUS SYSTEM bus */ if (interface_data->bus_id > 0) { diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_interface_common.h b/zigbee-daemon/zigbee-interface/src/zigbee_service_interface_common.h index 57f4241..70c9272 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_interface_common.h +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_interface_common.h @@ -74,6 +74,7 @@ typedef struct { GHashTable *objects; /**< ZigBee D-BUS object(s) */ gint bus_id; /**< ZigBee D-BUS ID */ + gint activation_dbus_id; /**< Activation D-BUS ID */ gboolean name_acquired; /**< ZigBee D-BUS name acquired */ gboolean sevice_interface_init_complete; /**< ZigBee D-BUS service init completed */ -- 2.7.4 From 229856b4fc53b0bc18e1c0e70c69738674c1b72b Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Wed, 22 Mar 2017 19:38:29 +0900 Subject: [PATCH 02/16] Support privilege check on daemon side Change-Id: I2c6ce0da7276752d04625a251f3644e3c8d11150 Signed-off-by: Jiwan Kim --- packaging/zigbee-manager.spec | 9 +- packaging/zigbee.conf | 368 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 375 insertions(+), 2 deletions(-) create mode 100644 packaging/zigbee.conf diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index 307bdc8..f6af1cb 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -10,6 +10,7 @@ Summary: ZigBee Daemon Group: System/Network Source0: %{name}-%{version}.tar.gz Source1: org.tizen.zigbee.service +Source2: zigbee.conf BuildRequires: cmake BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(gio-2.0) @@ -42,6 +43,8 @@ ZigBee library (devel) chmod 644 %{SOURCE1} cp -a %{SOURCE1} . +chmod 644 %{SOURCE2} +cp -a %{SOURCE2} . %build cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DVERSION=%{version} \ @@ -49,7 +52,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DVERSION=%{version} \ make %{?_smp_mflags} %install - %make_install # Do not execute daemon on boot time @@ -57,7 +59,9 @@ make %{?_smp_mflags} #ln -s %{_libdir}/systemd/system/zigbee-daemon.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services/ -cp org.tizen.zigbee.service %{buildroot}%{_datadir}/dbus-1/system-services/org.tizen.zigbee.service +mkdir -p %{buildroot}%{_datadir}/dbus-1/system.d/ +cp %{SOURCE1} %{buildroot}%{_datadir}/dbus-1/system-services/org.tizen.zigbee.service +cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %post -p /sbin/ldconfig @@ -71,6 +75,7 @@ cp org.tizen.zigbee.service %{buildroot}%{_datadir}/dbus-1/system-services/org.t #%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service %{_datadir}/license/zigbee-daemon %attr(644,root,root) %{_datadir}/dbus-1/system-services/* +%{_datadir}/dbus-1/system.d/zigbee.conf %files -n zigbee-lib %defattr(644,system,system,-) diff --git a/packaging/zigbee.conf b/packaging/zigbee.conf new file mode 100644 index 0000000..7080e4d --- /dev/null +++ b/packaging/zigbee.conf @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.7.4 From 2d6956cfe0264531e07aad7391e569eb77daaf55 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Fri, 24 Mar 2017 13:35:05 +0900 Subject: [PATCH 03/16] Add privilege check method - 'check_privilege' method is added for privilege check Change-Id: Ic4508898d95274a069e84ffa445389fc5923652d Signed-off-by: Jiwan Kim --- zigbee-daemon/zigbee-interface/introspection/service.xml | 1 + .../src/zigbee_service_dbus_interface_service.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/zigbee-daemon/zigbee-interface/introspection/service.xml b/zigbee-daemon/zigbee-interface/introspection/service.xml index d4c9752..68cf015 100644 --- a/zigbee-daemon/zigbee-interface/introspection/service.xml +++ b/zigbee-daemon/zigbee-interface/introspection/service.xml @@ -64,6 +64,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 108a923..9403883 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 @@ -1217,6 +1217,17 @@ static gboolean on_service_get_node_type(ZigbeeService *service_object, return TRUE; } +static gboolean on_service_check_privilege(ZigbeeService *service_object, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + NOT_USED(user_data); + + zigbee_service_complete_check_privilege(service_object, invocation); + + return TRUE; +} + void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface *service_interface, guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data) { @@ -1384,5 +1395,9 @@ gboolean zigbee_service_dbus_interface_service_init(ZigBeeServiceInterface *serv "handle-get-node-type", G_CALLBACK(on_service_get_node_type), service_interface); + g_signal_connect(service_object, + "handle-check-privilege", + G_CALLBACK(on_service_check_privilege), service_interface); + return TRUE; } -- 2.7.4 From 352eeded64d38344829acb67cdf61184bc6478b6 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Fri, 24 Mar 2017 17:02:43 +0900 Subject: [PATCH 04/16] Adjust privileges for platform APIs - coex_start / stop - aps_send - zcl_send - send_to_local Change-Id: I16ef2ec9fc8d1d73b9668d79c42ec1c486c58fc3 Signed-off-by: Jiwan Kim --- packaging/zigbee.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packaging/zigbee.conf b/packaging/zigbee.conf index 7080e4d..1b7b821 100644 --- a/packaging/zigbee.conf +++ b/packaging/zigbee.conf @@ -44,9 +44,9 @@ + send_member="coex_start" privilege="http://tizen.org/privilege/zigbee.admin"/> + send_member="coex_stop" privilege="http://tizen.org/privilege/zigbee.admin"/> + send_member="aps_send" privilege="http://tizen.org/privilege/zigbee.admin"/> + send_member="zcl_send" privilege="http://tizen.org/privilege/zigbee.admin"/> + send_member="send_to_local" privilege="http://tizen.org/privilege/zigbee.admin"/> -- 2.7.4 From d568797ecbc98b9bbf7d537690c326f88f07424d Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Mon, 3 Apr 2017 15:33:56 +0900 Subject: [PATCH 05/16] Support asynchronous plugin initializer - To support firmware update on plugin initialize time, asynchronous init function is required. - Add support logic for async initializer. Change-Id: Ie8631a62c0fdb97cef87383bf075e3e346880a97 Signed-off-by: Jiwan Kim --- zigbee-daemon/src/main.c | 15 +- .../src/zigbee_service_dbus_interface.c | 47 +++-- zigbee-daemon/zigbee-lib/include/zblib.h | 1 + .../zigbee-lib/include/zblib_driver_manager.h | 27 +++ zigbee-daemon/zigbee-lib/include/zblib_plugin.h | 6 +- zigbee-daemon/zigbee-lib/include/zblib_service.h | 1 + zigbee-daemon/zigbee-lib/src/zblib_service.c | 190 ++++++++++++++++++++- zigbee-daemon/zigbee-service/src/zigbee_service.c | 10 +- 8 files changed, 278 insertions(+), 19 deletions(-) create mode 100644 zigbee-daemon/zigbee-lib/include/zblib_driver_manager.h diff --git a/zigbee-daemon/src/main.c b/zigbee-daemon/src/main.c index 05895ff..78639c3 100644 --- a/zigbee-daemon/src/main.c +++ b/zigbee-daemon/src/main.c @@ -34,6 +34,15 @@ /**< ZigBee Service */ ZigBeeService *zigbee_service; +static gboolean _request_terminate(gpointer user_data) +{ + NOTUSED(user_data); + + zblib_service_exit(zigbee_service); + + return G_SOURCE_REMOVE; +} + int main(int arg, char **argv) { ZigBeeService *service = NULL; @@ -49,8 +58,6 @@ int main(int arg, char **argv) NOTUSED(arg); NOTUSED(argv); - Z_LOGI("service mainloop start"); - /* Create ZigBee service */ zigbee_service = service = zblib_service_new(); @@ -65,10 +72,12 @@ int main(int arg, char **argv) ret = zigbee_service_init(service); if (G_UNLIKELY(FALSE == ret)) { Z_LOGE("zigbee_service_init failed!"); - goto END; + /* Minimum mainloop time is required to notify the result */ + g_timeout_add(100, _request_terminate, NULL); } /* Run ZigBee service */ + Z_LOGI("service mainloop start"); ret = zblib_service_run(service); if (G_UNLIKELY(FALSE == ret)) { Z_LOGE("Run service failed!"); diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c index 3f729d5..97111d9 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "zigbee_service_interface.h" #include "zigbee_service_interface_common.h" @@ -34,6 +35,26 @@ /**< ZigBee D-BUS service interface name */ #define ZIGBEE_DBUS_SERVICE_INTERFACE_NAME "zigbee-dbus" +static void _notify_zigbee_state(ZigBeeServiceInterface *service_interface, + gboolean result) +{ + ZigbeeCustomData_t *custom_data = zblib_service_interface_ref_user_data(service_interface); + ZigBeeService *service = zblib_service_interface_ref_service(service_interface); + + if (NULL == custom_data) { + Z_LOGE("Unexpected invalid parameter !"); + return; + } + + if (result) { + /* Notify zigbee service manually here (Enabled) */ + zigbee_manager_emit_zigbee_state(custom_data->zigbee_mgr, result); + } else { + /* ZigBee state will be emitted on bus termination */ + zblib_service_exit(service); + } +} + static gboolean on_manager_enable(ZigbeeManager *zigbee_mgr, GDBusMethodInvocation *invocation, gpointer user_data) @@ -49,11 +70,6 @@ static gboolean on_manager_enable(ZigbeeManager *zigbee_mgr, zigbee_manager_complete_enable(zigbee_mgr, invocation); - if (TRUE == custom_data->sevice_interface_init_complete) { - /* Emit zigbee_state - enabled */ - zigbee_manager_emit_zigbee_state(zigbee_mgr, TRUE); - } - return TRUE; } @@ -291,6 +307,18 @@ static void zigbee_service_dbus_interface_noti_cb(ZigBeeServiceInterface *servic } break; + case ZBLIB_DRIVER_TYPE_MANAGER: { + /* Handle 'enabled' notification here */ + if (notification_id == ZBLIB_MANAGER_NOTI_ZIGBEE_ENABLED) { + gboolean *rsp = (gboolean*)noti_data; + + Z_LOGD("Firmware update result : [%s]", ((*rsp) ? "Succeed" : "Failed")); + _notify_zigbee_state(service_interface, *rsp); + } else + Z_LOGE("Unhandled notification id: [%d]", notification_id); + } + break; + case ZBLIB_DRIVER_TYPE_NONE: /* Fall through */ default: { Z_LOGE("Unhandled driver type: [%d]", driver_type); @@ -329,11 +357,6 @@ static void zigbee_on_name_acquired(GDBusConnection *connection, /* Bus name is 'acquired' */ custom_data->name_acquired = TRUE; - - if (TRUE == custom_data->sevice_interface_init_complete) { - /* Emit zigbee_state - enabled */ - zigbee_manager_emit_zigbee_state(custom_data->zigbee_mgr, TRUE); - } } static void zigbee_on_bus_acquired(GDBusConnection *connection, @@ -591,6 +614,10 @@ void zigbee_service_dbus_interface_deinit(ZigBeeService *service) goto EXIT; } + /* Emit zigbee_state - disabled */ + Z_LOGD("Update zigbee_state ----"); + zigbee_manager_emit_zigbee_state(interface_data->zigbee_mgr, FALSE); + /* * Unown "org.tizen.zigbee.manager" named bus on D-BUS SYSTEM bus */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib.h b/zigbee-daemon/zigbee-lib/include/zblib.h index d439aa5..2fc35ac 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib.h +++ b/zigbee-daemon/zigbee-lib/include/zblib.h @@ -61,6 +61,7 @@ typedef struct zblib_request_type ZigBeeRequest; /**< ZigBee driver types */ typedef enum { ZBLIB_DRIVER_TYPE_NONE, /**< None */ + ZBLIB_DRIVER_TYPE_MANAGER, /**< Manager */ ZBLIB_DRIVER_TYPE_SERVICE, /**< Service */ ZBLIB_DRIVER_TYPE_ZDO_DEV_CONTROL, /**< ZDO Dev control */ ZBLIB_DRIVER_TYPE_ZDO_BIND, /**< ZDO bind */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_manager.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_manager.h new file mode 100644 index 0000000..5b5bafa --- /dev/null +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_manager.h @@ -0,0 +1,27 @@ +/* + * 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_DRIVER_MANAGER_H__ +#define __ZIGBEE_LIB_DRIVER_MANAGER_H__ + +/**< ZigBee 'Manager' notification IDs */ +typedef enum { + ZBLIB_MANAGER_NOTI_ZIGBEE_ENABLED = 1, /**< Zigbee enabled */ +} ZblibManagerNoti_e; + +#endif /* __ZIGBEE_LIB_DRIVER_MANAGER_H__ */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_plugin.h b/zigbee-daemon/zigbee-lib/include/zblib_plugin.h index c901a96..cd77d97 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_plugin.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_plugin.h @@ -19,13 +19,17 @@ #ifndef __ZIGBEE_LIB_PLUGIN_H__ #define __ZIGBEE_LIB_PLUGIN_H__ +/**< ZigBee plug-in asynchronous initializer callback */ +typedef void (*zblib_plugin_init_finished_cb)(gboolean result, void *user_data); + /**< ZigBee plug-in descriptor */ typedef struct { const gchar *name; int version; - gboolean (*is_implemented)(); /**< Is plug-in implemented */ gboolean (*load)(); /**< Load plugin */ gboolean (*init)(ZigBeePlugin *); /**< Initialize plugin */ + gboolean (*init_async)(ZigBeePlugin *, zblib_plugin_init_finished_cb, void *); + /**< Initialize plugin asynchronously */ void (*unload)(ZigBeePlugin *); /**< Unload plugin */ } ZblibPluginDescriptor_t; diff --git a/zigbee-daemon/zigbee-lib/include/zblib_service.h b/zigbee-daemon/zigbee-lib/include/zblib_service.h index 6034098..e0dc480 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_service.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_service.h @@ -30,6 +30,7 @@ gboolean zblib_service_remove_plugin(ZigBeeService *service, ZigBeePlugin *plugi gboolean zblib_service_load_plugins(ZigBeeService *service, const char *plugin_path); gboolean zblib_service_initialize_plugins(ZigBeeService *service); +gboolean zblib_service_initialize_async_plugins(ZigBeeService *service); gboolean zblib_service_unload_plugins(ZigBeeService *service); GSList *zblib_service_ref_plugins(ZigBeeService *service); diff --git a/zigbee-daemon/zigbee-lib/src/zblib_service.c b/zigbee-daemon/zigbee-lib/src/zblib_service.c index 681dc31..72e26e7 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_service.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_service.c @@ -24,6 +24,16 @@ #include #include #include +#include +#include + +struct _zblib_async_init_info { + gboolean is_initialized; /**< Does initialization succeeded? */ + gboolean is_finished; /**< Does initialization finished? */ + + ZigBeePlugin *plugin; /**< ZigBee plugin */ + void *user_data; /**< User data */ +}; /**< ZigBee Service object */ struct zblib_service_type { @@ -34,8 +44,95 @@ struct zblib_service_type { GHashTable *request_table; /**< Request Hash table */ guint request_id; /**< Request ID */ + + GSList *async_initializer; /**< Hash table for asynchronous initializer */ + zblib_plugin_init_finished_cb callback; /**< Callback */ }; +static GSList *__zblib_service_ref_async_initializer(ZigBeeService* service) +{ + zblib_check_null_ret_error("service", service, NULL); + + return service->async_initializer; +} + +static void __zblib_service_set_async_initializer(ZigBeeService* service, GSList* list) +{ + zblib_check_null_ret("service", service); + + service->async_initializer = list; +} + +static void __on_zblib_init_async_finished(gboolean result, void *user_data) +{ + GSList *list_async = NULL; + ZigBeeService *service = NULL; + ZigBeePlugin *plugin = NULL; + struct _zblib_async_init_info *info = (struct _zblib_async_init_info*)user_data; + char *plugin_name = NULL; + + int i = 0; + int _finished_count = 0; + int _succeeded_count = 0; + + zblib_check_null_ret("info", info); + + plugin = info->plugin; + service = zblib_plugin_ref_service(plugin); + plugin_name = zblib_plugin_get_plugin_name(plugin); + + zblib_check_null_ret("service", service); + + info->is_finished = TRUE; + if (result) { + Z_LOGD("Plugin [%s] succeeded async init", plugin_name); + info->is_initialized = TRUE; + } else { + Z_LOGE("Plugin [%s] failed to init !", plugin_name); + } + g_free(plugin_name); + + /* Check all async initializer list */ + list_async = __zblib_service_ref_async_initializer(service); + while (list_async != NULL) { + /* Initialize each plug-in */ + struct _zblib_async_init_info *in = + (struct _zblib_async_init_info *)(list_async->data); + i++; + if (G_UNLIKELY(NULL == in)) { + Z_LOGE("Invalid parameter !"); + list_async = g_slist_next(list_async); + continue; + } + + if (in->is_finished) + _finished_count++; + if (in->is_initialized) + _succeeded_count++; + + list_async = g_slist_next(list_async); + } + + if (i == _finished_count) { + gboolean ret = TRUE; + guint driver_noti_id = (ZBLIB_DRIVER_TYPE_MANAGER << 24) + | ZBLIB_MANAGER_NOTI_ZIGBEE_ENABLED; + + if (_finished_count == _succeeded_count) { + /* All initializer finished successfully */ + Z_LOGD("All async init finished !"); + ret = TRUE; + } else { + /* Some initializers are failed */ + Z_LOGE("There are some failed plugin initializer !"); + ret = FALSE; + } + /* Notify whether zigbee service is enabled or not */ + zblib_plugin_send_notification(plugin, + driver_noti_id, &ret, sizeof(ret)); + } +} + static void *__zblib_service_load_plugin(gchar *filename, ZblibPluginDescriptor_t **descriptor_out) { @@ -97,7 +194,10 @@ static gboolean __zblib_service_init_plugin(ZigBeePlugin *plugin) const ZblibPluginDescriptor_t *descriptor = zblib_plugin_get_descriptor(plugin); zblib_check_null_ret_error("descriptor", descriptor, FALSE); - zblib_check_null_ret_error("descriptor->init", descriptor->init, FALSE); + if (NULL == descriptor->init) { + Z_LOGD("descriptor->init is NULL, trying async init"); + return FALSE; + } if (G_UNLIKELY(FALSE == descriptor->init(plugin))) { char *plugin_name = zblib_plugin_get_plugin_name(plugin); @@ -111,6 +211,28 @@ static gboolean __zblib_service_init_plugin(ZigBeePlugin *plugin) return TRUE; } +static gboolean __zblib_service_init_async_plugin(ZigBeePlugin *plugin, + zblib_plugin_init_finished_cb callback, void *user_data) +{ + const ZblibPluginDescriptor_t *descriptor = zblib_plugin_get_descriptor(plugin); + char *plugin_name = zblib_plugin_get_plugin_name(plugin); + + zblib_check_null_ret_error("descriptor", descriptor, FALSE); + zblib_check_null_ret_error("descriptor->init_async", descriptor->init_async, FALSE); + + if (G_UNLIKELY(NULL != plugin_name)) + plugin_name = g_strdup("NONAME"); + + if (G_UNLIKELY(FALSE == descriptor->init_async(plugin, callback, user_data))) { + Z_LOGE("plugin(%s) init failed!", plugin_name); + g_free(plugin_name); + return FALSE; + } + + g_free(plugin_name); + return TRUE; +} + static gboolean __zblib_service_unload_plugin(ZigBeePlugin *plugin) { const ZblibPluginDescriptor_t *descriptor = zblib_plugin_get_descriptor(plugin); @@ -193,6 +315,12 @@ void zblib_service_free(ZigBeeService *service) } } + /* Free async initializer */ + if (service->async_initializer) { + g_slist_free(service->async_initializer); + service->async_initializer = NULL; + } + /* Free plug-ins */ if (service->plugins) { g_slist_free(service->plugins); @@ -315,20 +443,74 @@ gboolean zblib_service_load_plugins(ZigBeeService *service, const char *plugin_p gboolean zblib_service_initialize_plugins(ZigBeeService *service) { GSList *list; + GSList *list_async; zblib_check_null_ret_error("service", service, FALSE); /* Refer plug-in list */ list = zblib_service_ref_plugins(service); + list_async = __zblib_service_ref_async_initializer(service); while (list != NULL) { /* Initialize each plug-in */ - if (G_UNLIKELY(FALSE == __zblib_service_init_plugin((ZigBeePlugin *)(list->data)))) { - list = g_slist_next(list); - continue; + ZigBeePlugin *plugin = (ZigBeePlugin *)(list->data); + if (FALSE == __zblib_service_init_plugin(plugin)) { + /* If there is no initializer, it should have asynchronous one */ + const ZblibPluginDescriptor_t *descriptor = + zblib_plugin_get_descriptor(plugin); + if (NULL != descriptor->init_async) { + /* Register async initializer */ + struct _zblib_async_init_info *info = + g_try_new0(struct _zblib_async_init_info, 1); + if(NULL == info) { + Z_LOGE("Fatal : Failed to allocate memory"); + return FALSE; + } + info->is_finished = FALSE; + info->is_initialized = FALSE; + info->plugin = plugin; + info->user_data = NULL; + + list_async = g_slist_append(list_async, info); + } else { + Z_LOGE("Fatal : Failed to initialize plugin"); + return FALSE; + } } list = g_slist_next(list); } + __zblib_service_set_async_initializer(service, list_async); + + return TRUE; +} + +gboolean zblib_service_initialize_async_plugins(ZigBeeService *service) +{ + GSList *list_async; + + zblib_check_null_ret_error("service", service, FALSE); + + /* Refer async initializer list */ + list_async = __zblib_service_ref_async_initializer(service); + while (list_async != NULL) { + /* Initialize each plug-in */ + struct _zblib_async_init_info *info = + (struct _zblib_async_init_info *)(list_async->data); + + if (G_UNLIKELY(NULL == info)) { + Z_LOGE("Invalid parameter !"); + list_async = g_slist_next(list_async); + continue; + } + + if (G_UNLIKELY(FALSE == __zblib_service_init_async_plugin( + info->plugin, __on_zblib_init_async_finished, info))) { + Z_LOGE("Fatal : Failed to initialize mandatory plugin"); + return FALSE; + } + list_async = g_slist_next(list_async); + } + return TRUE; } diff --git a/zigbee-daemon/zigbee-service/src/zigbee_service.c b/zigbee-daemon/zigbee-service/src/zigbee_service.c index d80dbf7..b2a7284 100644 --- a/zigbee-daemon/zigbee-service/src/zigbee_service.c +++ b/zigbee-daemon/zigbee-service/src/zigbee_service.c @@ -56,7 +56,15 @@ gboolean zigbee_service_init(ZigBeeService *service) return FALSE; } - Z_TIME_CHECK("Initializing Plugins Complete. Starting Daemon"); + Z_TIME_CHECK("Initializing Plugins Complete."); + + /* Initialize ZigBee plug-ins */ + if (G_UNLIKELY(TRUE != zblib_service_initialize_async_plugins(service))) { + Z_LOGE("Asynchronously initialize plug-ins failed!"); + return FALSE; + } + + Z_TIME_CHECK("Asynchronous initializer launched successfully. Starting Daemon"); return TRUE; } -- 2.7.4 From c3c8fb7249b79edaecc7e7c397c901fadfcb16df Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Wed, 26 Apr 2017 13:36:07 +0900 Subject: [PATCH 06/16] Fix a bug on zb_zcl_identify_query() - Callback was not launched as 'dest_ep' was not set. - Set 'dest_ep' with given parameter. Change-Id: I7f18a1ee51e17c4bcfb793d4e5b330db8c963a80 Signed-off-by: Jiwan Kim --- zigbee-daemon/zigbee-lib/src/zblib_request.c | 1 + 1 file changed, 1 insertion(+) diff --git a/zigbee-daemon/zigbee-lib/src/zblib_request.c b/zigbee-daemon/zigbee-lib/src/zblib_request.c index b3c314f..9a9c7bd 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_request.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_request.c @@ -1844,6 +1844,7 @@ static gpointer __zblib_request_create_zcl_identify_request_data(guint request_t /* Copy data */ req->node_id = in_req->node_id; + req->dest_ep = in_req->dest_ep; } zclidentify_control_request_data = (gpointer)req; -- 2.7.4 From 2e7f11f7c6188f80d1b4f157897bbe6d5402d5ee Mon Sep 17 00:00:00 2001 From: saerome kim Date: Fri, 28 Apr 2017 10:39:45 +0900 Subject: [PATCH 07/16] Disable privilege check function temporally until ACR compelte Change-Id: I542ad01de258dfaef119bb97f2cb109a877087df Signed-off-by: saerome kim --- packaging/zigbee-manager.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index f6af1cb..19fb9fc 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -1,6 +1,7 @@ %define major 0 %define minor 1 %define patchlevel 0 +%define CHECK_ZIGBEE_PRIVILEGE False Name: zigbee-manager Version: %{major}.%{minor}.%{patchlevel} @@ -43,8 +44,10 @@ ZigBee library (devel) chmod 644 %{SOURCE1} cp -a %{SOURCE1} . +%if %{CHECK_ZIGBEE_PRIVILEGE} == "True" chmod 644 %{SOURCE2} cp -a %{SOURCE2} . +%endif %build cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DVERSION=%{version} \ @@ -61,7 +64,9 @@ make %{?_smp_mflags} mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services/ mkdir -p %{buildroot}%{_datadir}/dbus-1/system.d/ cp %{SOURCE1} %{buildroot}%{_datadir}/dbus-1/system-services/org.tizen.zigbee.service +%if %{CHECK_ZIGBEE_PRIVILEGE} == "True" cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf +%endif %post -p /sbin/ldconfig @@ -75,7 +80,9 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf #%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service %{_datadir}/license/zigbee-daemon %attr(644,root,root) %{_datadir}/dbus-1/system-services/* +%if %{CHECK_ZIGBEE_PRIVILEGE} == "True" %{_datadir}/dbus-1/system.d/zigbee.conf +%endif %files -n zigbee-lib %defattr(644,system,system,-) -- 2.7.4 From 691ff0189bb1cf9097978cf40e7459fe188f1306 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Wed, 10 May 2017 20:25:51 +0900 Subject: [PATCH 08/16] Fix to follow coding convention Change-Id: Ic3841e498e07fc936d49a9cbeebdb36b9482ec15 Signed-off-by: Jiwan Kim --- .../src/zigbee_service_dbus_interface.c | 10 +- .../src/zigbee_service_dbus_interface_custom.c | 2 +- .../src/zigbee_service_dbus_interface_service.c | 37 ++- .../src/zigbee_service_dbus_interface_zcl_alarm.c | 2 +- .../src/zigbee_service_dbus_interface_zcl_basic.c | 2 +- ...gbee_service_dbus_interface_zcl_color_control.c | 2 +- ...bee_service_dbus_interface_zcl_global_control.c | 34 ++- .../src/zigbee_service_dbus_interface_zcl_group.c | 2 +- .../zigbee_service_dbus_interface_zcl_ias_zone.c | 2 +- .../zigbee_service_dbus_interface_zcl_identify.c | 2 +- ...gbee_service_dbus_interface_zcl_level_control.c | 2 +- .../src/zigbee_service_dbus_interface_zcl_on_off.c | 2 +- ...igbee_service_dbus_interface_zcl_poll_control.c | 2 +- .../src/zigbee_service_dbus_interface_zcl_scene.c | 2 +- .../zigbee_service_dbus_interface_zcl_thermostat.c | 2 +- .../src/zigbee_service_dbus_interface_zdo_bind.c | 2 +- ...zigbee_service_dbus_interface_zdo_dev_control.c | 46 +-- zigbee-daemon/zigbee-lib/src/zblib_driver.c | 3 +- zigbee-daemon/zigbee-lib/src/zblib_request.c | 315 +++++++-------------- zigbee-daemon/zigbee-lib/src/zblib_service.c | 5 +- 20 files changed, 179 insertions(+), 297 deletions(-) diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c index 97111d9..afab090 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface.c @@ -457,10 +457,6 @@ static void zigbee_on_bus_acquired(GDBusConnection *connection, /* Service interface initialization completed */ custom_data->sevice_interface_init_complete = TRUE; - if (TRUE == custom_data->name_acquired) { - /* TODO - Emit zigbee_state signal */ - } - OUT: g_free(path); } @@ -574,9 +570,8 @@ EXIT: */ ret = zblib_service_remove_service_interface(service, service_interface); - if (FALSE == ret) { + if (FALSE == ret) Z_LOGE("Remove service interface failed!"); - } /* * Free Service interface object @@ -645,9 +640,8 @@ EXIT: */ ret = zblib_service_remove_service_interface(service, service_interface); - if (FALSE == ret) { + if (FALSE == ret) Z_LOGE("Remove service interface failed!"); - } /* * Free Service interface object diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_custom.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_custom.c index 19404db..3389215 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_custom.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_custom.c @@ -364,7 +364,7 @@ void zigbee_service_dbus_interface_custom_notification(ZigBeeServiceInterface *s NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_CUSTOM_NOTI_APS_SEND: { int i; GVariant* payload = NULL; 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 9403883..3327890 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 @@ -701,8 +701,8 @@ static void on_service_get_device_list_resp(ZigBeeServiceInterface *service_inte invocation = zigbee_service_dbus_interface_ref_invocation(cb_data); zblib_check_null_free_and_ret("invocation", invocation, cb_data); - /* To-To : zigbee_service_complete_get_device_list */ - //zigbee_service_complete_get_device_list(service_object, invocation, resp_data); + /* TODO : zigbee_service_complete_get_device_list */ + /* zigbee_service_complete_get_device_list(service_object, invocation, resp_data); */ g_free(cb_data); } @@ -861,25 +861,23 @@ static void on_service_get_device_info_resp(ZigBeeServiceInterface *service_inte invocation = zigbee_service_dbus_interface_ref_invocation(cb_data); zblib_check_null_free_and_ret("invocation", invocation, cb_data); - builder = g_variant_builder_new(G_VARIANT_TYPE ("a(qyayyay)")); + builder = g_variant_builder_new(G_VARIANT_TYPE("a(qyayyay)")); for (index = 0; index < payload->count; index++) { ZigbeeServiceGetDeviceInfoDetailResp_t *device = &(payload->list[index]); - GVariantBuilder* mac_builder = g_variant_builder_new(G_VARIANT_TYPE ("ay")); - GVariantBuilder* endpoint_builder = g_variant_builder_new(G_VARIANT_TYPE ("ay")); + GVariantBuilder* mac_builder = g_variant_builder_new(G_VARIANT_TYPE("ay")); + GVariantBuilder* endpoint_builder = g_variant_builder_new(G_VARIANT_TYPE("ay")); - for (i = 0; i < ZIGBEE_EUI64_SIZE; i++) { - g_variant_builder_add (mac_builder, "y", device->eui64[i]); - } - for (i = 0; i < device->endpoint_count; i++) { - g_variant_builder_add (endpoint_builder, "y", device->endpoints[i]); - } + for (i = 0; i < ZIGBEE_EUI64_SIZE; i++) + g_variant_builder_add(mac_builder, "y", device->eui64[i]); + for (i = 0; i < device->endpoint_count; i++) + g_variant_builder_add(endpoint_builder, "y", device->endpoints[i]); - g_variant_builder_add (builder, "(qyayyay)", + g_variant_builder_add(builder, "(qyayyay)", device->node_id, device->node_type, mac_builder, device->endpoint_count, endpoint_builder); - g_variant_builder_unref (mac_builder); - g_variant_builder_unref (endpoint_builder); + g_variant_builder_unref(mac_builder); + g_variant_builder_unref(endpoint_builder); } variant = g_variant_builder_end(builder); @@ -1245,7 +1243,7 @@ void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface * NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_SERVICE_NOTI_FORM_NETWORK_DONE: { ZigbeeServiceServiceFormNetworkDone_t *panid_t = (ZigbeeServiceServiceFormNetworkDone_t*)noti_data; @@ -1284,11 +1282,10 @@ void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface * GVariant *v_eui64 = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"), child_t->eui64, ZIGBEE_EUI64_SIZE, TRUE, NULL, NULL); - if (NULL == v_eui64) { + if (NULL == v_eui64) Z_LOGE("Failed to create variant!"); - } else { + else zigbee_service_emit_child_rejoined(service_object, v_eui64); - } } break; case ZBLIB_SERVICE_NOTI_CHILD_LEFT: { @@ -1297,9 +1294,9 @@ void zigbee_service_dbus_interface_service_notification(ZigBeeServiceInterface * GVariant *v_eui64 = g_variant_new_from_data(G_VARIANT_TYPE("a(y)"), child_left_t->eui64, ZIGBEE_EUI64_SIZE, TRUE, NULL, NULL); - if (NULL == v_eui64) { + if (NULL == v_eui64) Z_LOGE("Failed to create variant!"); - } else { + else { zigbee_service_emit_child_left(service_object, v_eui64, child_left_t->status); } diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_alarm.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_alarm.c index 20b8e36..787a40c 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_alarm.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_alarm.c @@ -590,7 +590,7 @@ void zigbee_service_dbus_interface_zcl_alarm_notification(ZigBeeServiceInterface NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZCL_ALARM_NOTI_GET_ALARM_RSP: { ZigbeeZclAlarmGetAlarmRsp_t *rsp = (ZigbeeZclAlarmGetAlarmRsp_t*)noti_data; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_basic.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_basic.c index fdb7332..2512877 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_basic.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_basic.c @@ -144,7 +144,7 @@ void zigbee_service_dbus_interface_zcl_basic_notification(ZigBeeServiceInterface NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { default: Z_LOGE("Unexpected notification [%x]", noti_id); break; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_color_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_color_control.c index 08f4206..6a5b4a5 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_color_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_color_control.c @@ -1041,7 +1041,7 @@ void zigbee_service_dbus_interface_zcl_color_control_notification(ZigBeeServiceI NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { default: Z_LOGE("Unexpected notification [%x]", noti_id); break; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c index c8f1fe2..19eb958 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c @@ -1326,7 +1326,7 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZCL_GLOBAL_NOTI_READ_ATTR_RSP: { ZigbeeZclGlobalControlReadAttributesResp_t *attr_t = (ZigbeeZclGlobalControlReadAttributesResp_t*)noti_data; @@ -1455,7 +1455,7 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService break; } - index_builder = g_variant_builder_new (G_VARIANT_TYPE ("aq")); + index_builder = g_variant_builder_new(G_VARIANT_TYPE("aq")); if (NULL == index_builder) { Z_LOGE("Failed to create variant builder!"); g_variant_unref(v_status); @@ -1463,12 +1463,11 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService g_variant_unref(v_indicator); break; } - for(i = 0; i < attr_t->record_length; i++) { - for(j = 0; j < attr_t->indicator_list[i]; j++) { - g_variant_builder_add (index_builder, "q", attr_t->index_list[i][j]); - } + for (i = 0; i < attr_t->record_length; i++) { + for (j = 0; j < attr_t->indicator_list[i]; j++) + g_variant_builder_add(index_builder, "q", attr_t->index_list[i][j]); } - v_index = g_variant_builder_end (index_builder); + v_index = g_variant_builder_end(index_builder); g_variant_builder_unref(index_builder); Z_LOGD("Write attribute structured resp"); @@ -1582,19 +1581,18 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService break; } - values_builder = g_variant_builder_new (G_VARIANT_TYPE ("a(y)")); + values_builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)")); if (NULL == values_builder) { Z_LOGE("Failed to create variant builder!"); g_variant_unref(v_data_type); g_variant_unref(v_attrs); break; } - for(i = 0; i < attr_t->list_count; i++) { - for(j = 0; j < attr_t->values_count[i]; j++) { - g_variant_builder_add (values_builder, "(y)", attr_t->values[i][j]); - } + for (i = 0; i < attr_t->list_count; i++) { + for (j = 0; j < attr_t->values_count[i]; j++) + g_variant_builder_add(values_builder, "(y)", attr_t->values[i][j]); } - v_values = g_variant_builder_end (values_builder); + v_values = g_variant_builder_end(values_builder); g_variant_builder_unref(values_builder); Z_LOGD("Report attributes handler resp"); @@ -1613,15 +1611,15 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService GVariant *v_entries = NULL; GVariantBuilder *entry_builder = - g_variant_builder_new (G_VARIANT_TYPE ("a(yyqyqqayq)")); + g_variant_builder_new(G_VARIANT_TYPE("a(yyqyqqayq)")); if (NULL == entry_builder) { Z_LOGE("Failed to create variant builder!"); break; } - for(i = 0; i < resp_t->record_count ; i++) { + for (i = 0; i < resp_t->record_count ; i++) { GVariantBuilder *change_builder = - g_variant_builder_new (G_VARIANT_TYPE ("ay")); + g_variant_builder_new(G_VARIANT_TYPE("ay")); if (NULL == change_builder) { Z_LOGE("Failed to create variant builder!"); g_variant_builder_unref(entry_builder); @@ -1629,11 +1627,11 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService } for (v = 0; v < resp_t->entry_list[i].change_count; v++) { - g_variant_builder_add (change_builder, "y", + g_variant_builder_add(change_builder, "y", resp_t->entry_list[i].change[v]); } - g_variant_builder_add (entry_builder, "(yyqyqqayq)", + g_variant_builder_add(entry_builder, "(yyqyqqayq)", resp_t->entry_list[i].status, resp_t->entry_list[i].dir, resp_t->entry_list[i].attribute_id, diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_group.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_group.c index 7ade053..c449a5f 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_group.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_group.c @@ -608,7 +608,7 @@ void zigbee_service_dbus_interface_zcl_group_notification(ZigBeeServiceInterface NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_SERVICE_NOTI_ADD_GROUP_RSP: { ZigbeeZclGroupAddGroupNoti_t *rsp = (ZigbeeZclGroupAddGroupNoti_t*)noti_data; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_ias_zone.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_ias_zone.c index c49f883..5f67aee 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_ias_zone.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_ias_zone.c @@ -147,7 +147,7 @@ void zigbee_service_dbus_interface_zcl_ias_zone_notification(ZigBeeServiceInterf NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZCL_IAS_ZONE_NOTI_ZONE_STATUS_CHANGE: { ZigbeeZclIasZoneStatusChangeNoti_t *rsp = (ZigbeeZclIasZoneStatusChangeNoti_t*)noti_data; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_identify.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_identify.c index 25d9fbf..b6e2d45 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_identify.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_identify.c @@ -229,7 +229,7 @@ void zigbee_service_dbus_interface_zcl_identify_notification(ZigBeeServiceInterf NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZCL_IDENTIFY_NOTI_QUERY_RSP: { ZigbeeZclIdentifyQueryNoti_t *rsp = (ZigbeeZclIdentifyQueryNoti_t*)noti_data; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_level_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_level_control.c index 941f9f0..22ba279 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_level_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_level_control.c @@ -676,7 +676,7 @@ void zigbee_service_dbus_interface_zcl_level_control_notification(ZigBeeServiceI NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { default: Z_LOGE("Unexpected notification [%x]", noti_id); break; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_on_off.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_on_off.c index 17d2bde..396fed3 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_on_off.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_on_off.c @@ -228,7 +228,7 @@ void zigbee_service_dbus_interface_zcl_on_off_notification(ZigBeeServiceInterfac NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZCL_ON_OFF_NOTI_ON_OFF_STATE: { ZigbeeZclOnOffOnOffState_t *state_t = (ZigbeeZclOnOffOnOffState_t*)noti_data; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c index 2ecf836..f787200 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c @@ -401,7 +401,7 @@ void zigbee_service_dbus_interface_zcl_poll_control_notification(ZigBeeServiceIn NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZCL_POLL_CONTROL_NOTI_CHECKIN_RESPONSE: { ZigbeeZclPollControlCheckinResponseNoti_t *rsp = (ZigbeeZclPollControlCheckinResponseNoti_t*)noti_data; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c index 079b927..a7c9832 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c @@ -696,7 +696,7 @@ void zigbee_service_dbus_interface_zcl_scene_notification(ZigBeeServiceInterface NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZCL_SCENE_NOTI_ADD_SCENE: { ZigbeeZclSceneAddSceneResp_t *rsp = (ZigbeeZclSceneAddSceneResp_t*)noti_data; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_thermostat.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_thermostat.c index b3ad201..08a5b97 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_thermostat.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_thermostat.c @@ -538,7 +538,7 @@ void zigbee_service_dbus_interface_zcl_thermostat_notification(ZigBeeServiceInte NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { default: Z_LOGE("Unexpected notification [%x]", noti_id); break; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_bind.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_bind.c index ffdabcc..46e3fcd 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_bind.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_bind.c @@ -279,7 +279,7 @@ void zigbee_service_dbus_interface_zdo_bind_notification(ZigBeeServiceInterface NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZDO_BIND_NOTI_BIND_REQ: { ZigbeeZdoBindUnbindNoti_t *rsp = (ZigbeeZdoBindUnbindNoti_t*)noti_data; diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c index 0388c28..15f3fa2 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c @@ -1558,7 +1558,7 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt NOT_USED(noti_cb_data); - switch(noti_id) { + switch (noti_id) { case ZBLIB_ZDO_DEV_CONTROL_NOTI_NWK_ADDR_RSP: { ZigbeeZdoDevControlNwkAddrResp_t *nwk_addr_t = (ZigbeeZdoDevControlNwkAddrResp_t*)noti_data; @@ -1668,17 +1668,17 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt GVariant *v_entries = NULL; GVariantBuilder *entry_builder = - g_variant_builder_new (G_VARIANT_TYPE ("a(ayyqyqayy)")); + g_variant_builder_new(G_VARIANT_TYPE("a(ayyqyqayy)")); if (NULL == entry_builder) { Z_LOGE("Failed to create variant builder!"); break; } - for(i = 0; i < desc_t->table_list_count ; i++) { + for (i = 0; i < desc_t->table_list_count ; i++) { GVariantBuilder *eui64_builder = - g_variant_builder_new (G_VARIANT_TYPE ("ay")); + g_variant_builder_new(G_VARIANT_TYPE("ay")); GVariantBuilder *dest_eui64_builder = - g_variant_builder_new (G_VARIANT_TYPE ("ay")); + g_variant_builder_new(G_VARIANT_TYPE("ay")); if (NULL == eui64_builder || NULL == dest_eui64_builder) { Z_LOGE("Failed to create variant builder!"); @@ -1691,13 +1691,13 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt } for (v = 0; v < ZIGBEE_EUI64_SIZE; v++) { - g_variant_builder_add (eui64_builder, "y", + g_variant_builder_add(eui64_builder, "y", desc_t->table_list[i].eui64[v]); - g_variant_builder_add (dest_eui64_builder, "y", + g_variant_builder_add(dest_eui64_builder, "y", desc_t->table_list[i].dest_eui64[v]); } - g_variant_builder_add (entry_builder, "(ayyqyqayy)", + g_variant_builder_add(entry_builder, "(ayyqyqayy)", eui64_builder, desc_t->table_list[i].source_endpoint, desc_t->table_list[i].cluster_id, @@ -1726,17 +1726,17 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt GVariant *v_entries = NULL; GVariantBuilder *entry_builder = - g_variant_builder_new (G_VARIANT_TYPE ("a(ayayyqyyyyy)")); + g_variant_builder_new(G_VARIANT_TYPE("a(ayayyqyyyyy)")); if (NULL == entry_builder) { Z_LOGE("Failed to create variant builder!"); break; } - for(i = 0; i < desc_t->table_list_count ; i++) { + for (i = 0; i < desc_t->table_list_count ; i++) { GVariantBuilder *ext_pan_builder = - g_variant_builder_new (G_VARIANT_TYPE ("ay")); + g_variant_builder_new(G_VARIANT_TYPE("ay")); GVariantBuilder *eui64_builder = - g_variant_builder_new (G_VARIANT_TYPE ("ay")); + g_variant_builder_new(G_VARIANT_TYPE("ay")); if (NULL == ext_pan_builder || NULL == eui64_builder) { Z_LOGE("Failed to create variant builder!"); @@ -1749,13 +1749,13 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt } for (v = 0; v < ZIGBEE_EUI64_SIZE; v++) { - g_variant_builder_add (ext_pan_builder, "y", + g_variant_builder_add(ext_pan_builder, "y", desc_t->table_list[i].extended_pan_id[v]); - g_variant_builder_add (eui64_builder, "y", + g_variant_builder_add(eui64_builder, "y", desc_t->table_list[i].eui64[v]); } - g_variant_builder_add (entry_builder, "(ayayyqyyyyy)", + g_variant_builder_add(entry_builder, "(ayayyqyyyyy)", ext_pan_builder, eui64_builder, desc_t->table_list[i].node_id, @@ -1785,14 +1785,14 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt GVariant *v_entries = NULL; GVariantBuilder *entry_builder = - g_variant_builder_new (G_VARIANT_TYPE ("a(qyyyyq)")); + g_variant_builder_new(G_VARIANT_TYPE("a(qyyyyq)")); if (NULL == entry_builder) { Z_LOGE("Failed to create variant builder!"); break; } - for(i = 0; i < desc_t->table_list_count ; i++) { - g_variant_builder_add (entry_builder, "(qyyyyq)", + for (i = 0; i < desc_t->table_list_count ; i++) { + g_variant_builder_add(entry_builder, "(qyyyyq)", desc_t->table_list[i].dest_addr, desc_t->table_list[i].status, desc_t->table_list[i].memory_constrained, @@ -1833,15 +1833,15 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt GVariant *v_entries = NULL; GVariantBuilder *entry_builder = - g_variant_builder_new (G_VARIANT_TYPE ("a(ayyyyyyy)")); + g_variant_builder_new(G_VARIANT_TYPE("a(ayyyyyyy)")); if (NULL == entry_builder) { Z_LOGE("Failed to create variant builder!"); break; } - for(i = 0; i < nwk_disc_t->table_list_count ; i++) { + for (i = 0; i < nwk_disc_t->table_list_count ; i++) { GVariantBuilder *ext_pan_builder = - g_variant_builder_new (G_VARIANT_TYPE ("ay")); + g_variant_builder_new(G_VARIANT_TYPE("ay")); if (NULL == ext_pan_builder) { Z_LOGE("Failed to create variant builder!"); g_variant_builder_unref(entry_builder); @@ -1849,11 +1849,11 @@ void zigbee_service_dbus_interface_zdo_dev_control_notification(ZigBeeServiceInt } for (v = 0; v < ZIGBEE_EUI64_SIZE; v++) { - g_variant_builder_add (ext_pan_builder, "y", + g_variant_builder_add(ext_pan_builder, "y", nwk_disc_t->table_list[i].extended_pan_id[v]); } - g_variant_builder_add (entry_builder, "(ayyyyyyy)", + g_variant_builder_add(entry_builder, "(ayyyyyyy)", ext_pan_builder, nwk_disc_t->table_list[i].logical_channel, nwk_disc_t->table_list[i].stack_profile, diff --git a/zigbee-daemon/zigbee-lib/src/zblib_driver.c b/zigbee-daemon/zigbee-lib/src/zblib_driver.c index 5032997..e1d36cd 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_driver.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_driver.c @@ -134,9 +134,8 @@ gboolean zblib_driver_set_free_hook(ZigBeeDriver *driver, ZblibDriverType_e zblib_driver_ref_driver_type(ZigBeeDriver *driver) { - if (NULL == driver) { + if (NULL == driver) return ZBLIB_DRIVER_TYPE_NONE; - } return driver->driver_type; } diff --git a/zigbee-daemon/zigbee-lib/src/zblib_request.c b/zigbee-daemon/zigbee-lib/src/zblib_request.c index 9a9c7bd..2df88f0 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_request.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_request.c @@ -3095,9 +3095,8 @@ static void __zblib_request_free_zcl_alarm_request_data(ZigBeeRequest *request, ZigbeeZclAlarmGetAlarmCount_t *req = NULL; req = (ZigbeeZclAlarmGetAlarmCount_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3105,9 +3104,8 @@ static void __zblib_request_free_zcl_alarm_request_data(ZigBeeRequest *request, ZigbeeZclAlarmResetAlarm_t *req = NULL; req = (ZigbeeZclAlarmResetAlarm_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3115,9 +3113,8 @@ static void __zblib_request_free_zcl_alarm_request_data(ZigBeeRequest *request, ZigbeeZclAlarmResetAllAlarm_t *req = NULL; req = (ZigbeeZclAlarmResetAllAlarm_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3125,9 +3122,8 @@ static void __zblib_request_free_zcl_alarm_request_data(ZigBeeRequest *request, ZigbeeZclAlarmAlarm_t *req = NULL; req = (ZigbeeZclAlarmAlarm_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3135,9 +3131,8 @@ static void __zblib_request_free_zcl_alarm_request_data(ZigBeeRequest *request, ZigbeeZclAlarmResetAlarmLogs_t *req = NULL; req = (ZigbeeZclAlarmResetAlarmLogs_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3162,9 +3157,8 @@ static void __zblib_request_free_custom_request_data(ZigBeeRequest *request, ZigbeeCustomApsSend_t *req = NULL; req = (ZigbeeCustomApsSend_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3172,9 +3166,8 @@ static void __zblib_request_free_custom_request_data(ZigBeeRequest *request, ZigbeeCustomZclSend_t *req = NULL; req = (ZigbeeCustomZclSend_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3182,9 +3175,8 @@ static void __zblib_request_free_custom_request_data(ZigBeeRequest *request, ZigbeeCustomSendToLocal_t *req = NULL; req = (ZigbeeCustomSendToLocal_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3205,9 +3197,8 @@ static void __zblib_request_free_zcl_door_lock_request_data(ZigBeeRequest *reque ZigbeeZclDoorLockSubscriberLockEvent_t *req = NULL; req = (ZigbeeZclDoorLockSubscriberLockEvent_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3215,9 +3206,8 @@ static void __zblib_request_free_zcl_door_lock_request_data(ZigBeeRequest *reque ZigbeeZclDoorLockSetDoorLockPin_t *req = NULL; req = (ZigbeeZclDoorLockSetDoorLockPin_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3225,9 +3215,8 @@ static void __zblib_request_free_zcl_door_lock_request_data(ZigBeeRequest *reque ZigbeeZclDoorLockSetDoorLock_t *req = NULL; req = (ZigbeeZclDoorLockSetDoorLock_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3235,9 +3224,8 @@ static void __zblib_request_free_zcl_door_lock_request_data(ZigBeeRequest *reque ZigbeeZclDoorLockGetDoorLock_t *req = NULL; req = (ZigbeeZclDoorLockGetDoorLock_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3258,9 +3246,8 @@ static void __zblib_request_free_zcl_fan_control_request_data(ZigBeeRequest *req ZigbeeZclFanControlSetFanMode_t *req = NULL; req = (ZigbeeZclFanControlSetFanMode_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3268,9 +3255,8 @@ static void __zblib_request_free_zcl_fan_control_request_data(ZigBeeRequest *req ZigbeeZclFanControlGetFanMode_t *req = NULL; req = (ZigbeeZclFanControlGetFanMode_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3278,9 +3264,8 @@ static void __zblib_request_free_zcl_fan_control_request_data(ZigBeeRequest *req ZigbeeZclFanControlSetFanModeSequence_t *req = NULL; req = (ZigbeeZclFanControlSetFanModeSequence_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3288,9 +3273,8 @@ static void __zblib_request_free_zcl_fan_control_request_data(ZigBeeRequest *req ZigbeeZclFanControlGetFanModeSequence_t *req = NULL; req = (ZigbeeZclFanControlGetFanModeSequence_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3311,9 +3295,8 @@ static void __zblib_request_free_zcl_level_control_request_data(ZigBeeRequest *r ZigbeeZclLevelControlMoveToLevel_t *req = NULL; req = (ZigbeeZclLevelControlMoveToLevel_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3321,9 +3304,8 @@ static void __zblib_request_free_zcl_level_control_request_data(ZigBeeRequest *r ZigbeeZclLevelControlMove_t *req = NULL; req = (ZigbeeZclLevelControlMove_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3331,9 +3313,8 @@ static void __zblib_request_free_zcl_level_control_request_data(ZigBeeRequest *r ZigbeeZclLevelControlStep_t *req = NULL; req = (ZigbeeZclLevelControlStep_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3341,9 +3322,8 @@ static void __zblib_request_free_zcl_level_control_request_data(ZigBeeRequest *r ZigbeeZclLevelControlMoveToLevelWithOnOff_t *req = NULL; req = (ZigbeeZclLevelControlMoveToLevelWithOnOff_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3351,9 +3331,8 @@ static void __zblib_request_free_zcl_level_control_request_data(ZigBeeRequest *r ZigbeeZclLevelControlMoveWithOnOff_t *req = NULL; req = (ZigbeeZclLevelControlMoveWithOnOff_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3361,9 +3340,8 @@ static void __zblib_request_free_zcl_level_control_request_data(ZigBeeRequest *r ZigbeeZclLevelControlStepWithOnOff_t *req = NULL; req = (ZigbeeZclLevelControlStepWithOnOff_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3371,9 +3349,8 @@ static void __zblib_request_free_zcl_level_control_request_data(ZigBeeRequest *r ZigbeeZclLevelControlStop_t *req = NULL; req = (ZigbeeZclLevelControlStop_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3394,9 +3371,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlStart_t *req = NULL; req = (ZigbeeMfglibControlStart_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3404,9 +3380,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlEnd_t *req = NULL; req = (ZigbeeMfglibControlEnd_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3414,9 +3389,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlStartTone_t *req = NULL; req = (ZigbeeMfglibControlStartTone_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3424,9 +3398,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlStopTone_t *req = NULL; req = (ZigbeeMfglibControlStopTone_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3434,9 +3407,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlStartStream_t *req = NULL; req = (ZigbeeMfglibControlStartStream_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3444,9 +3416,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlStopStream_t *req = NULL; req = (ZigbeeMfglibControlStopStream_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3454,9 +3425,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlSendPacket_t *req = NULL; req = (ZigbeeMfglibControlSendPacket_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3464,9 +3434,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlSetChannel_t *req = NULL; req = (ZigbeeMfglibControlSetChannel_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3474,9 +3443,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlGetChannel_t *req = NULL; req = (ZigbeeMfglibControlGetChannel_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3484,9 +3452,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlSetPower_t *req = NULL; req = (ZigbeeMfglibControlSetPower_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3494,9 +3461,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlGetPower_t *req = NULL; req = (ZigbeeMfglibControlGetPower_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3504,9 +3470,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlSetSynOffset_t *req = NULL; req = (ZigbeeMfglibControlSetSynOffset_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3514,9 +3479,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlGetSynOffset_t *req = NULL; req = (ZigbeeMfglibControlGetSynOffset_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3524,9 +3488,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlRxStart_t *req = NULL; req = (ZigbeeMfglibControlRxStart_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3534,9 +3497,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlRxStop_t *req = NULL; req = (ZigbeeMfglibControlRxStop_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3544,9 +3506,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlRxVerify_t *req = NULL; req = (ZigbeeMfglibControlRxVerify_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3554,9 +3515,8 @@ static void __zblib_request_free_mfglib_control_request_data(ZigBeeRequest *requ ZigbeeMfglibControlGetRssi_t *req = NULL; req = (ZigbeeMfglibControlGetRssi_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3577,9 +3537,8 @@ static void __zblib_request_free_zcl_on_off_request_data(ZigBeeRequest *request, ZigbeeZclOnOffSetOnOff_t *req = NULL; req = (ZigbeeZclOnOffSetOnOff_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3587,9 +3546,8 @@ static void __zblib_request_free_zcl_on_off_request_data(ZigBeeRequest *request, ZigbeeZclOnOffGetOnOffState_t *req = NULL; req = (ZigbeeZclOnOffGetOnOffState_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3618,9 +3576,8 @@ static void __zblib_request_free_service_request_data(ZigBeeRequest *request, ZigbeeServiceCoexStart_t *req = NULL; req = (ZigbeeServiceCoexStart_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3640,9 +3597,8 @@ static void __zblib_request_free_service_request_data(ZigBeeRequest *request, ZigbeeServicePermitJoin_t *req = NULL; req = (ZigbeeServicePermitJoin_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3650,9 +3606,8 @@ static void __zblib_request_free_service_request_data(ZigBeeRequest *request, ZigbeeServiceLeaveRequest_t *req = NULL; req = (ZigbeeServiceLeaveRequest_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3672,9 +3627,8 @@ static void __zblib_request_free_service_request_data(ZigBeeRequest *request, ZigbeeServiceGetEndpointList_t *req = NULL; req = (ZigbeeServiceGetEndpointList_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3682,9 +3636,8 @@ static void __zblib_request_free_service_request_data(ZigBeeRequest *request, ZigbeeServiceGetClusterList_t *req = NULL; req = (ZigbeeServiceGetClusterList_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3692,9 +3645,8 @@ static void __zblib_request_free_service_request_data(ZigBeeRequest *request, ZigbeeServiceGetNodeType_t *req = NULL; req = (ZigbeeServiceGetNodeType_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3715,9 +3667,8 @@ static void __zblib_request_free_zcl_thermostat_request_data(ZigBeeRequest *requ ZigbeeZclThermostatGetLocalTemp_t *req = NULL; req = (ZigbeeZclThermostatGetLocalTemp_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3725,9 +3676,8 @@ static void __zblib_request_free_zcl_thermostat_request_data(ZigBeeRequest *requ ZigbeeZclThermostatGetWeeklySchedule_t *req = NULL; req = (ZigbeeZclThermostatGetWeeklySchedule_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3735,9 +3685,8 @@ static void __zblib_request_free_zcl_thermostat_request_data(ZigBeeRequest *requ ZigbeeZclThermostatSetWeeklySchedule_t *req = NULL; req = (ZigbeeZclThermostatSetWeeklySchedule_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3745,9 +3694,8 @@ static void __zblib_request_free_zcl_thermostat_request_data(ZigBeeRequest *requ ZigbeeZclThermostatClearWeeklySchedule_t *req = NULL; req = (ZigbeeZclThermostatClearWeeklySchedule_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3755,9 +3703,8 @@ static void __zblib_request_free_zcl_thermostat_request_data(ZigBeeRequest *requ ZigbeeZclThermostatSetpointRaiseLower_t *req = NULL; req = (ZigbeeZclThermostatSetpointRaiseLower_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3778,9 +3725,8 @@ static void __zblib_request_free_zcl_basic_request_data(ZigBeeRequest *request, ZigbeeZclBasicResetFactoryDefault_t *req = NULL; req = (ZigbeeZclBasicResetFactoryDefault_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3889,9 +3835,8 @@ static void __zblib_request_free_zcl_global_control_request_data(ZigBeeRequest * ZigbeeZclGlobalControlDiscoverAttributes_t *req = NULL; req = (ZigbeeZclGlobalControlDiscoverAttributes_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3899,9 +3844,8 @@ static void __zblib_request_free_zcl_global_control_request_data(ZigBeeRequest * ZigbeeZclGlobalControlDiscoverAttributesExtended_t *req = NULL; req = (ZigbeeZclGlobalControlDiscoverAttributesExtended_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3909,9 +3853,8 @@ static void __zblib_request_free_zcl_global_control_request_data(ZigBeeRequest * ZigbeeZclGlobalControlDiscoverCommandsReceived_t *req = NULL; req = (ZigbeeZclGlobalControlDiscoverCommandsReceived_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3919,9 +3862,8 @@ static void __zblib_request_free_zcl_global_control_request_data(ZigBeeRequest * ZigbeeZclGlobalControlDiscoverCommandsGenerated_t *req = NULL; req = (ZigbeeZclGlobalControlDiscoverCommandsGenerated_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3942,9 +3884,8 @@ static void __zblib_request_free_zcl_ias_zone_request_data(ZigBeeRequest *reques ZigbeeZclIasZoneEnrollResponse_t *req = NULL; req = (ZigbeeZclIasZoneEnrollResponse_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3965,9 +3906,8 @@ static void __zblib_request_free_zcl_identify_request_data(ZigBeeRequest *reques ZigbeeZclIdentifyIdentify_t *req = NULL; req = (ZigbeeZclIdentifyIdentify_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3975,9 +3915,8 @@ static void __zblib_request_free_zcl_identify_request_data(ZigBeeRequest *reques ZigbeeZclIdentifyQuery_t *req = NULL; req = (ZigbeeZclIdentifyQuery_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -3998,9 +3937,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlMoveToHue_t *req = NULL; req = (ZigbeeZclColorControlMoveToHue_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4008,9 +3946,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlMoveHue_t *req = NULL; req = (ZigbeeZclColorControlMoveHue_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4018,9 +3955,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlStepHue_t *req = NULL; req = (ZigbeeZclColorControlStepHue_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4028,9 +3964,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlMoveToSaturation_t *req = NULL; req = (ZigbeeZclColorControlMoveToSaturation_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4038,9 +3973,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlMoveSaturation_t *req = NULL; req = (ZigbeeZclColorControlMoveSaturation_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4048,9 +3982,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlStepSaturation_t *req = NULL; req = (ZigbeeZclColorControlStepSaturation_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4058,9 +3991,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlMoveToHueAndSaturation_t *req = NULL; req = (ZigbeeZclColorControlMoveToHueAndSaturation_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4068,9 +4000,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlMoveToColor_t *req = NULL; req = (ZigbeeZclColorControlMoveToColor_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4078,9 +4009,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlMoveColor_t *req = NULL; req = (ZigbeeZclColorControlMoveColor_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4088,9 +4018,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlStepColor_t *req = NULL; req = (ZigbeeZclColorControlStepColor_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4098,9 +4027,8 @@ static void __zblib_request_free_zcl_color_control_request_data(ZigBeeRequest *r ZigbeeZclColorControlMoveColorTemperature_t *req = NULL; req = (ZigbeeZclColorControlMoveColorTemperature_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4121,9 +4049,8 @@ static void __zblib_request_free_zcl_group_request_data(ZigBeeRequest *request, ZigbeeZclGroupAddGroup_t *req = NULL; req = (ZigbeeZclGroupAddGroup_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4131,9 +4058,8 @@ static void __zblib_request_free_zcl_group_request_data(ZigBeeRequest *request, ZigbeeZclGroupViewGroup_t *req = NULL; req = (ZigbeeZclGroupViewGroup_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4152,9 +4078,8 @@ static void __zblib_request_free_zcl_group_request_data(ZigBeeRequest *request, ZigbeeZclGroupRemoveGroup_t *req = NULL; req = (ZigbeeZclGroupRemoveGroup_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4162,9 +4087,8 @@ static void __zblib_request_free_zcl_group_request_data(ZigBeeRequest *request, ZigbeeZclGroupRemoveAllGroup_t *req = NULL; req = (ZigbeeZclGroupRemoveAllGroup_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4172,9 +4096,8 @@ static void __zblib_request_free_zcl_group_request_data(ZigBeeRequest *request, ZigbeeZclGroupAddGroupIfIdentifying_t *req = NULL; req = (ZigbeeZclGroupAddGroupIfIdentifying_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4195,9 +4118,8 @@ static void __zblib_request_free_zcl_poll_control_request_data(ZigBeeRequest *re ZigbeeZclPollControlCheckInResponse_t *req = NULL; req = (ZigbeeZclPollControlCheckInResponse_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4205,9 +4127,8 @@ static void __zblib_request_free_zcl_poll_control_request_data(ZigBeeRequest *re ZigbeeZclPollControlFastPollStop_t *req = NULL; req = (ZigbeeZclPollControlFastPollStop_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4215,9 +4136,8 @@ static void __zblib_request_free_zcl_poll_control_request_data(ZigBeeRequest *re ZigbeeZclPollControlSetLongPollInterval_t *req = NULL; req = (ZigbeeZclPollControlSetLongPollInterval_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4225,9 +4145,8 @@ static void __zblib_request_free_zcl_poll_control_request_data(ZigBeeRequest *re ZigbeeZclPollControlSetShortPollInterval_t *req = NULL; req = (ZigbeeZclPollControlSetShortPollInterval_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4259,9 +4178,8 @@ static void __zblib_request_free_zcl_scene_request_data(ZigBeeRequest *request, ZigbeeZclSceneViewScene_t *req = NULL; req = (ZigbeeZclSceneViewScene_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4269,9 +4187,8 @@ static void __zblib_request_free_zcl_scene_request_data(ZigBeeRequest *request, ZigbeeZclSceneRemoveScene_t *req = NULL; req = (ZigbeeZclSceneRemoveScene_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4279,9 +4196,8 @@ static void __zblib_request_free_zcl_scene_request_data(ZigBeeRequest *request, ZigbeeZclSceneStoreScene_t *req = NULL; req = (ZigbeeZclSceneStoreScene_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4289,9 +4205,8 @@ static void __zblib_request_free_zcl_scene_request_data(ZigBeeRequest *request, ZigbeeZclSceneRecallScene_t *req = NULL; req = (ZigbeeZclSceneRecallScene_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4299,9 +4214,8 @@ static void __zblib_request_free_zcl_scene_request_data(ZigBeeRequest *request, ZigbeeZclSceneRemoveAllScene_t *req = NULL; req = (ZigbeeZclSceneRemoveAllScene_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4309,9 +4223,8 @@ static void __zblib_request_free_zcl_scene_request_data(ZigBeeRequest *request, ZigbeeZclSceneGetSceneMembership_t *req = NULL; req = (ZigbeeZclSceneGetSceneMembership_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4332,9 +4245,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlNwkAddrReq_t *req = NULL; req = (ZigbeeZdoDevControlNwkAddrReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4354,9 +4266,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlIeeeAddrReq_t *req = NULL; req = (ZigbeeZdoDevControlIeeeAddrReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4364,9 +4275,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlActiveEpReq_t *req = NULL; req = (ZigbeeZdoDevControlActiveEpReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4374,9 +4284,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlNodeDescriptorReq_t *req = NULL; req = (ZigbeeZdoDevControlNodeDescriptorReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4384,9 +4293,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlPowerDescriptorReq_t *req = NULL; req = (ZigbeeZdoDevControlPowerDescriptorReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4394,9 +4302,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlComplexDescriptorReq_t *req = NULL; req = (ZigbeeZdoDevControlComplexDescriptorReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4404,9 +4311,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlUserDescriptorReq_t *req = NULL; req = (ZigbeeZdoDevControlUserDescriptorReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4414,9 +4320,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlUserDescriptorSetReq_t *req = NULL; req = (ZigbeeZdoDevControlUserDescriptorSetReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4424,9 +4329,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlDeviceAnnounce_t *req = NULL; req = (ZigbeeZdoDevControlDeviceAnnounce_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4434,9 +4338,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlSimpleDescriptorReq_t *req = NULL; req = (ZigbeeZdoDevControlSimpleDescriptorReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4444,9 +4347,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlMgmtLqiReq_t *req = NULL; req = (ZigbeeZdoDevControlMgmtLqiReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4454,9 +4356,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlMgmtRtgReq_t *req = NULL; req = (ZigbeeZdoDevControlMgmtRtgReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4464,9 +4365,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlMgmtBindReq_t *req = NULL; req = (ZigbeeZdoDevControlMgmtBindReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4474,9 +4374,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlMgmtPermitJoinReq_t *req = NULL; req = (ZigbeeZdoDevControlMgmtPermitJoinReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4484,9 +4383,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlMgmtNwkUpdateReq_t *req = NULL; req = (ZigbeeZdoDevControlMgmtNwkUpdateReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4494,9 +4392,8 @@ static void __zblib_request_free_zdo_dev_control_request_data(ZigBeeRequest *req ZigbeeZdoDevControlMgmtNwkDiscoveryReq_t *req = NULL; req = (ZigbeeZdoDevControlMgmtNwkDiscoveryReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4517,9 +4414,8 @@ static void __zblib_request_free_zdo_bind_request_data(ZigBeeRequest *request, ZigbeeZdoBindBindReq_t *req = NULL; req = (ZigbeeZdoBindBindReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; @@ -4527,9 +4423,8 @@ static void __zblib_request_free_zdo_bind_request_data(ZigBeeRequest *request, ZigbeeZdoBindUnbindReq_t *req = NULL; req = (ZigbeeZdoBindUnbindReq_t *)request->request_data; - if (NULL != req) { + if (NULL != req) g_free(req); - } } break; diff --git a/zigbee-daemon/zigbee-lib/src/zblib_service.c b/zigbee-daemon/zigbee-lib/src/zblib_service.c index 72e26e7..df81d69 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_service.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_service.c @@ -429,9 +429,8 @@ gboolean zblib_service_load_plugins(ZigBeeService *service, const char *plugin_p /* Add new plug-in */ ret = zblib_service_add_plugin(service, plugin); - if (G_UNLIKELY(FALSE == ret)) { + if (G_UNLIKELY(FALSE == ret)) zblib_plugin_free(plugin); - } g_free(filename); } @@ -461,7 +460,7 @@ gboolean zblib_service_initialize_plugins(ZigBeeService *service) /* Register async initializer */ struct _zblib_async_init_info *info = g_try_new0(struct _zblib_async_init_info, 1); - if(NULL == info) { + if (NULL == info) { Z_LOGE("Fatal : Failed to allocate memory"); return FALSE; } -- 2.7.4 From be31bfb8a24c116ef5b46acfc226cbd8d4e5b421 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Thu, 11 May 2017 14:29:21 +0900 Subject: [PATCH 09/16] Fix svace issues Change-Id: I4f396cba56dfcf97505180131a7537c16320752b Signed-off-by: Jiwan Kim --- ...bee_service_dbus_interface_zcl_global_control.c | 42 ++++++++++++++++++++++ .../src/zigbee_service_dbus_interface_zcl_scene.c | 1 + ...zigbee_service_dbus_interface_zdo_dev_control.c | 2 ++ zigbee-daemon/zigbee-lib/src/zblib_service.c | 7 ++-- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c index 19eb958..9c5a0e8 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c @@ -216,6 +216,7 @@ static gboolean on_zclglobal_control_write_attributes_req(ZigbeeZcl_global_contr /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.write_records); return TRUE; } @@ -245,6 +246,7 @@ static gboolean on_zclglobal_control_write_attributes_req(ZigbeeZcl_global_contr /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.write_records); return TRUE; } @@ -254,6 +256,10 @@ static gboolean on_zclglobal_control_write_attributes_req(ZigbeeZcl_global_contr ZBLIB_ZCL_GLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_REQ, &req, sizeof(req), on_zclglobal_control_write_attributes_req_resp, resp_cb_data); + + /* Free resource */ + g_free(req.write_records); + if (FALSE == ret) { Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); @@ -330,6 +336,7 @@ static gboolean on_zclglobal_control_write_attributes_undivided_req(ZigbeeZcl_gl /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.write_records); return TRUE; } @@ -357,6 +364,7 @@ static gboolean on_zclglobal_control_write_attributes_undivided_req(ZigbeeZcl_gl /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.write_records); return TRUE; } @@ -366,6 +374,10 @@ static gboolean on_zclglobal_control_write_attributes_undivided_req(ZigbeeZcl_gl ZBLIB_ZCL_GLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_UNDIVIDED_REQ, &req, sizeof(req), on_zclglobal_control_write_attributes_undivided_req_resp, resp_cb_data); + + /* Free resource */ + g_free(req.write_records); + if (FALSE == ret) { Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); @@ -442,6 +454,7 @@ static gboolean on_zclglobal_control_write_attributes_no_resp(ZigbeeZcl_global_c /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.write_records); return TRUE; } @@ -469,6 +482,7 @@ static gboolean on_zclglobal_control_write_attributes_no_resp(ZigbeeZcl_global_c /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.write_records); return TRUE; } @@ -478,6 +492,10 @@ static gboolean on_zclglobal_control_write_attributes_no_resp(ZigbeeZcl_global_c ZBLIB_ZCL_GLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_NO_RESP, &req, sizeof(req), on_zclglobal_control_write_attributes_no_resp_resp, resp_cb_data); + + /* Free resource */ + g_free(req.write_records); + if (FALSE == ret) { Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); @@ -554,6 +572,7 @@ static gboolean on_zclglobal_control_write_attributes_structured(ZigbeeZcl_globa /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.write_records); return TRUE; } @@ -581,6 +600,7 @@ static gboolean on_zclglobal_control_write_attributes_structured(ZigbeeZcl_globa /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.write_records); return TRUE; } @@ -590,6 +610,10 @@ static gboolean on_zclglobal_control_write_attributes_structured(ZigbeeZcl_globa ZBLIB_ZCL_GLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_STRUCTURED, &req, sizeof(req), on_zclglobal_control_write_attributes_structured_resp, resp_cb_data); + + /* Free resource */ + g_free(req.write_records); + if (FALSE == ret) { Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); @@ -666,6 +690,7 @@ static gboolean on_zclglobal_control_read_attributes_structured(ZigbeeZcl_global /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.read_records); return TRUE; } @@ -693,6 +718,7 @@ static gboolean on_zclglobal_control_read_attributes_structured(ZigbeeZcl_global /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.read_records); return TRUE; } @@ -702,6 +728,10 @@ static gboolean on_zclglobal_control_read_attributes_structured(ZigbeeZcl_global ZBLIB_ZCL_GLOBAL_CONTROL_OPS_READ_ATTRIBUTES_STRUCTURED, &req, sizeof(req), on_zclglobal_control_read_attributes_structured_resp, resp_cb_data); + + /* Free resource */ + g_free(req.read_records); + if (FALSE == ret) { Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); @@ -778,6 +808,7 @@ static gboolean on_zclglobal_control_configure_reporting_req(ZigbeeZcl_global_co /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.read_records); return TRUE; } @@ -805,6 +836,7 @@ static gboolean on_zclglobal_control_configure_reporting_req(ZigbeeZcl_global_co /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.read_records); return TRUE; } @@ -814,6 +846,10 @@ static gboolean on_zclglobal_control_configure_reporting_req(ZigbeeZcl_global_co ZBLIB_ZCL_GLOBAL_CONTROL_OPS_CONFIGURE_REPORTING_REQ, &req, sizeof(req), on_zclglobal_control_configure_reporting_req_resp, resp_cb_data); + + /* Free resource */ + g_free(req.read_records); + if (FALSE == ret) { Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); @@ -890,6 +926,7 @@ static gboolean on_zclglobal_control_read_configure_reporting(ZigbeeZcl_global_c /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.read_records); return TRUE; } @@ -917,6 +954,7 @@ static gboolean on_zclglobal_control_read_configure_reporting(ZigbeeZcl_global_c /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.read_records); return TRUE; } @@ -926,6 +964,10 @@ static gboolean on_zclglobal_control_read_configure_reporting(ZigbeeZcl_global_c ZBLIB_ZCL_GLOBAL_CONTROL_OPS_READ_CONFIGURE_REPORTING, &req, sizeof(req), on_zclglobal_control_read_configure_reporting_resp, resp_cb_data); + + /* Free resource */ + g_free(req.read_records); + if (FALSE == ret) { Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c index a7c9832..655e1c7 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c @@ -133,6 +133,7 @@ static gboolean on_zcl_scene_add_scene(ZigbeeZcl_scene *zcl_scene_object, /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.ext_field_set); return TRUE; } diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c index 15f3fa2..6012740 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c @@ -230,6 +230,8 @@ static gboolean on_zdodev_control_matched_descriptor_req(ZigbeeZdo_dev_control * /* Send failure response */ ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + g_free(req.in_cl); + g_free(req.out_cl); return TRUE; } diff --git a/zigbee-daemon/zigbee-lib/src/zblib_service.c b/zigbee-daemon/zigbee-lib/src/zblib_service.c index df81d69..ff46159 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_service.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_service.c @@ -79,10 +79,10 @@ static void __on_zblib_init_async_finished(gboolean result, void *user_data) plugin = info->plugin; service = zblib_plugin_ref_service(plugin); - plugin_name = zblib_plugin_get_plugin_name(plugin); - zblib_check_null_ret("service", service); + plugin_name = zblib_plugin_get_plugin_name(plugin); + info->is_finished = TRUE; if (result) { Z_LOGD("Plugin [%s] succeeded async init", plugin_name); @@ -215,11 +215,12 @@ static gboolean __zblib_service_init_async_plugin(ZigBeePlugin *plugin, zblib_plugin_init_finished_cb callback, void *user_data) { const ZblibPluginDescriptor_t *descriptor = zblib_plugin_get_descriptor(plugin); - char *plugin_name = zblib_plugin_get_plugin_name(plugin); + char *plugin_name = NULL; zblib_check_null_ret_error("descriptor", descriptor, FALSE); zblib_check_null_ret_error("descriptor->init_async", descriptor->init_async, FALSE); + plugin_name = zblib_plugin_get_plugin_name(plugin); if (G_UNLIKELY(NULL != plugin_name)) plugin_name = g_strdup("NONAME"); -- 2.7.4 From ce9e8acb09307150ee2913eb60f8eedfa0e35037 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Fri, 12 May 2017 15:08:56 +0900 Subject: [PATCH 10/16] Fix build issue on 64bit environment Change-Id: I95653b356fe68d8125262b32b2d21c903d21f85b Signed-off-by: Jiwan Kim --- packaging/zigbee-manager.spec | 13 ++++++++----- zigbee-client/CMakeLists.txt | 4 ++-- zigbee-client/zigbee-client.pc.in | 2 +- zigbee-daemon/CMakeLists.txt | 4 ++-- zigbee-daemon/zigbee-lib/CMakeLists.txt | 2 +- zigbee-daemon/zigbee-lib/src/zblib_request.c | 6 +++--- zigbee-daemon/zigbee-lib/src/zblib_service.c | 2 +- zigbee-daemon/zigbee-lib/zigbee-lib.pc.in | 2 +- 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index 19fb9fc..79e1b2a 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -50,7 +50,10 @@ cp -a %{SOURCE2} . %endif %build -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DVERSION=%{version} \ +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DVERSION=%{version} \ + -DLIB_INSTALL_DIR=%{_libdir} \ + -DUNIT_INSTALL_DIR=%{_unitdir} \ make %{?_smp_mflags} @@ -58,8 +61,8 @@ make %{?_smp_mflags} %make_install # Do not execute daemon on boot time -#mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants -#ln -s %{_libdir}/systemd/system/zigbee-daemon.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service +#mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants +#ln -s %{_unitdir}/zigbee-daemon.service %{buildroot}%{_unitdir}/multi-user.target.wants/zigbee-daemon.service mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services/ mkdir -p %{buildroot}%{_datadir}/dbus-1/system.d/ @@ -76,8 +79,8 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %manifest zigbee-daemon.manifest %defattr(644,system,system,-) %attr(755,system,system) %{_bindir}/zigbee-daemon -%{_libdir}/systemd/system/zigbee-daemon.service -#%{_libdir}/systemd/system/multi-user.target.wants/zigbee-daemon.service +%{_unitdir}/zigbee-daemon.service +#%{_unitdir}/multi-user.target.wants/zigbee-daemon.service %{_datadir}/license/zigbee-daemon %attr(644,root,root) %{_datadir}/dbus-1/system-services/* %if %{CHECK_ZIGBEE_PRIVILEGE} == "True" diff --git a/zigbee-client/CMakeLists.txt b/zigbee-client/CMakeLists.txt index 8622e3d..aaeed6c 100644 --- a/zigbee-client/CMakeLists.txt +++ b/zigbee-client/CMakeLists.txt @@ -50,9 +50,9 @@ CONFIGURE_FILE(zigbee-client.pc.in zigbee-client.pc @ONLY) ### Install files ### INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/zigbee/client) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/common/include/ DESTINATION include/zigbee/common) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-client.pc DESTINATION lib/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-client.pc DESTINATION ${LIBDIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-client) -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT Runtime) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR} COMPONENT Runtime) IF (TIZEN_ENGINEER_MODE) ADD_SUBDIRECTORY(test_src) ENDIF (TIZEN_ENGINEER_MODE) diff --git a/zigbee-client/zigbee-client.pc.in b/zigbee-client/zigbee-client.pc.in index 75c7f4b..3634b35 100644 --- a/zigbee-client/zigbee-client.pc.in +++ b/zigbee-client/zigbee-client.pc.in @@ -1,6 +1,6 @@ prefix=@PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=@LIBDIR@ includedir=${prefix}/include Name: ZigBee Client Library diff --git a/zigbee-daemon/CMakeLists.txt b/zigbee-daemon/CMakeLists.txt index 4ac2665..09a577f 100644 --- a/zigbee-daemon/CMakeLists.txt +++ b/zigbee-daemon/CMakeLists.txt @@ -101,7 +101,7 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS} ${ZIGBEE_LIB_SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} zigbee-service zigbee-interface ${pkgs_LDFLAGS} "-ldl") ### Install files ### -INSTALL(TARGETS zigbee-lib DESTINATION lib COMPONENT Runtime) +INSTALL(TARGETS zigbee-lib DESTINATION ${LIBDIR} COMPONENT Runtime) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-daemon) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/zigbee-daemon.service DESTINATION /usr/lib/systemd/system) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/zigbee-daemon.service DESTINATION ${UNITDIR}) diff --git a/zigbee-daemon/zigbee-lib/CMakeLists.txt b/zigbee-daemon/zigbee-lib/CMakeLists.txt index 352d5c1..fb40778 100644 --- a/zigbee-daemon/zigbee-lib/CMakeLists.txt +++ b/zigbee-daemon/zigbee-lib/CMakeLists.txt @@ -39,6 +39,6 @@ CONFIGURE_FILE(zigbee-lib.pc.in zigbee-lib.pc @ONLY) ### Install files ### INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/zigbee/lib) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/common/include/ DESTINATION include/zigbee/common) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-lib.pc DESTINATION lib/pkgconfig) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-lib.pc DESTINATION ${LIBDIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-lib) #INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT Runtime) diff --git a/zigbee-daemon/zigbee-lib/src/zblib_request.c b/zigbee-daemon/zigbee-lib/src/zblib_request.c index 2df88f0..f23f3e5 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_request.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_request.c @@ -87,7 +87,7 @@ static ZigBeeRequest *__zblib_request_ref_request_by_by_request_id(ZigBeeService } /* Look-up requets_id in request hash table */ - request = (ZigBeeRequest *)g_hash_table_lookup(request_table, (gconstpointer)request_id); + request = (ZigBeeRequest *)g_hash_table_lookup(request_table, (gconstpointer)GUINT_TO_POINTER(request_id)); if (NULL == request) { Z_LOGE("No request available for request_id: [%d]", request_id); return NULL; @@ -125,7 +125,7 @@ static ZigBeeRequest *__zblib_request_ref_request_by_request_id(ZigBeeService *s } /* Look-up requets_id in request hash table */ - request = (ZigBeeRequest *)g_hash_table_lookup(request_table, (gconstpointer)request_id); + request = (ZigBeeRequest *)g_hash_table_lookup(request_table, (gconstpointer)GUINT_TO_POINTER(request_id)); if (NULL == request) { Z_LOGE("No request available for request_id: [%d]", request_id); return NULL; @@ -4597,7 +4597,7 @@ gint zblib_request_new(ZigBeeServiceInterface *service_interface, } /* Insert request to request table */ - g_hash_table_insert(request_table, (gpointer)(request->request_id), request); + g_hash_table_insert(request_table, GINT_TO_POINTER(request->request_id), request); return request->request_id; } diff --git a/zigbee-daemon/zigbee-lib/src/zblib_service.c b/zigbee-daemon/zigbee-lib/src/zblib_service.c index ff46159..045b651 100644 --- a/zigbee-daemon/zigbee-lib/src/zblib_service.c +++ b/zigbee-daemon/zigbee-lib/src/zblib_service.c @@ -256,7 +256,7 @@ static void __zblib_service_remove_request_table_iter(gpointer key, gpointer value, gpointer user_data) { ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data; - gint request_id = (gint)key; + gint request_id = GPOINTER_TO_INT(key); NOT_USED(value); diff --git a/zigbee-daemon/zigbee-lib/zigbee-lib.pc.in b/zigbee-daemon/zigbee-lib/zigbee-lib.pc.in index 444788e..4faa1b8 100644 --- a/zigbee-daemon/zigbee-lib/zigbee-lib.pc.in +++ b/zigbee-daemon/zigbee-lib/zigbee-lib.pc.in @@ -1,6 +1,6 @@ prefix=@PREFIX@ exec_prefix=${prefix} -libdir=${exec_prefix}/lib +libdir=@LIBDIR@ includedir=${prefix}/include Name: lib-zigbee -- 2.7.4 From 265aa3b0c41ee3c8d6e20be30b0c06334c05d7d8 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Wed, 7 Jun 2017 17:10:39 +0900 Subject: [PATCH 11/16] Add license documentation - add '%license' macro on build spec file Change-Id: I4923f05a6091ba38ed0571125c472ce770ce6880 Signed-off-by: Jiwan Kim --- packaging/zigbee-manager.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index 79e1b2a..57a94e4 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -1,6 +1,6 @@ %define major 0 %define minor 1 -%define patchlevel 0 +%define patchlevel 1 %define CHECK_ZIGBEE_PRIVILEGE False Name: zigbee-manager @@ -86,11 +86,13 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %if %{CHECK_ZIGBEE_PRIVILEGE} == "True" %{_datadir}/dbus-1/system.d/zigbee.conf %endif +%license LICENSE %files -n zigbee-lib %defattr(644,system,system,-) %{_libdir}/libzigbee-lib.so* %{_datadir}/license/zigbee-lib +%license LICENSE %files -n zigbee-lib-devel %defattr(644,system,system,-) -- 2.7.4 From 9d26ccbff0dc33114370c84022211bd8b966afef Mon Sep 17 00:00:00 2001 From: saerome kim Date: Wed, 7 Jun 2017 19:39:26 +0900 Subject: [PATCH 12/16] Remove codes to copy license files manually. Change-Id: Ie23c267824238098715726fc48ccfd17bd4aa8c0 Signed-off-by: saerome kim --- packaging/zigbee-manager.spec | 2 -- zigbee-client/CMakeLists.txt | 1 - zigbee-daemon/CMakeLists.txt | 1 - zigbee-daemon/zigbee-lib/CMakeLists.txt | 1 - 4 files changed, 5 deletions(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index 57a94e4..e0182d4 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -81,7 +81,6 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %attr(755,system,system) %{_bindir}/zigbee-daemon %{_unitdir}/zigbee-daemon.service #%{_unitdir}/multi-user.target.wants/zigbee-daemon.service -%{_datadir}/license/zigbee-daemon %attr(644,root,root) %{_datadir}/dbus-1/system-services/* %if %{CHECK_ZIGBEE_PRIVILEGE} == "True" %{_datadir}/dbus-1/system.d/zigbee.conf @@ -91,7 +90,6 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %files -n zigbee-lib %defattr(644,system,system,-) %{_libdir}/libzigbee-lib.so* -%{_datadir}/license/zigbee-lib %license LICENSE %files -n zigbee-lib-devel diff --git a/zigbee-client/CMakeLists.txt b/zigbee-client/CMakeLists.txt index aaeed6c..94a738d 100644 --- a/zigbee-client/CMakeLists.txt +++ b/zigbee-client/CMakeLists.txt @@ -51,7 +51,6 @@ CONFIGURE_FILE(zigbee-client.pc.in zigbee-client.pc @ONLY) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/zigbee/client) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/common/include/ DESTINATION include/zigbee/common) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-client.pc DESTINATION ${LIBDIR}/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-client) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR} COMPONENT Runtime) IF (TIZEN_ENGINEER_MODE) ADD_SUBDIRECTORY(test_src) diff --git a/zigbee-daemon/CMakeLists.txt b/zigbee-daemon/CMakeLists.txt index 09a577f..0a44dbf 100644 --- a/zigbee-daemon/CMakeLists.txt +++ b/zigbee-daemon/CMakeLists.txt @@ -103,5 +103,4 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} zigbee-service zigbee-interface ${pkgs_LDF ### Install files ### INSTALL(TARGETS zigbee-lib DESTINATION ${LIBDIR} COMPONENT Runtime) INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-daemon) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/zigbee-daemon.service DESTINATION ${UNITDIR}) diff --git a/zigbee-daemon/zigbee-lib/CMakeLists.txt b/zigbee-daemon/zigbee-lib/CMakeLists.txt index fb40778..d562c6f 100644 --- a/zigbee-daemon/zigbee-lib/CMakeLists.txt +++ b/zigbee-daemon/zigbee-lib/CMakeLists.txt @@ -40,5 +40,4 @@ CONFIGURE_FILE(zigbee-lib.pc.in zigbee-lib.pc @ONLY) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/zigbee/lib) INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/common/include/ DESTINATION include/zigbee/common) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zigbee-lib.pc DESTINATION ${LIBDIR}/pkgconfig) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME zigbee-lib) #INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT Runtime) -- 2.7.4 From a97323cf2c2b52e0612002dfdf2ca8412c825e62 Mon Sep 17 00:00:00 2001 From: "saerome.kim" Date: Wed, 9 Aug 2017 13:30:21 +0900 Subject: [PATCH 13/16] [SECSFV-22] Change uid/gid to network_fw Change-Id: Id0d20049720559123efbf87e7530f892f9b587ab Signed-off-by: saerome.kim --- packaging/org.tizen.zigbee.service | 3 ++- zigbee-daemon/resources/zigbee-daemon.service | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packaging/org.tizen.zigbee.service b/packaging/org.tizen.zigbee.service index 129767e..92a7f03 100644 --- a/packaging/org.tizen.zigbee.service +++ b/packaging/org.tizen.zigbee.service @@ -2,5 +2,6 @@ Name=org.tizen.zigbee.manager Exec=/bin/false -User=system +User=network_fw +Group=network_fw SystemdService=zigbee-daemon.service diff --git a/zigbee-daemon/resources/zigbee-daemon.service b/zigbee-daemon/resources/zigbee-daemon.service index 5353556..240ce7f 100644 --- a/zigbee-daemon/resources/zigbee-daemon.service +++ b/zigbee-daemon/resources/zigbee-daemon.service @@ -6,8 +6,8 @@ After=dbus.socket [Service] Type=dbus BusName=org.tizen.zigbee.manager -User=system -Group=system +User=network_fw +Group=network_fw SmackProcessLabel=System ExecStart=/usr/bin/zigbee-daemon Restart=on-failure -- 2.7.4 From 7cf5bbfcd00b7691535c4361a89c7d074fc5d4fd Mon Sep 17 00:00:00 2001 From: "jh8801.jung" Date: Tue, 12 Sep 2017 08:27:35 +0900 Subject: [PATCH 14/16] Apply coding rule (BRC_M_EUS, SPC_M_OPR, SPC_M_KWD) Signed-off-by: jh8801.jung Change-Id: I73373a0ec510f5bf2b98c6c636e5019879f21624 --- zigbee-client/include_private/zigbee_log.h | 12 ++++---- .../zigbee-lib/include/zblib_driver_custom.h | 6 ++-- .../include/zblib_driver_mfglib_control.h | 34 +++++++++++----------- .../zigbee-lib/include/zblib_driver_service.h | 28 +++++++++--------- .../zigbee-lib/include/zblib_driver_zcl_alarm.h | 12 ++++---- .../zigbee-lib/include/zblib_driver_zcl_basic.h | 2 +- .../include/zblib_driver_zcl_color_control.h | 22 +++++++------- .../include/zblib_driver_zcl_door_lock.h | 8 ++--- .../include/zblib_driver_zcl_fan_control.h | 8 ++--- .../include/zblib_driver_zcl_global_control.h | 24 +++++++-------- .../zigbee-lib/include/zblib_driver_zcl_group.h | 12 ++++---- .../zigbee-lib/include/zblib_driver_zcl_ias_zone.h | 2 +- .../zigbee-lib/include/zblib_driver_zcl_identify.h | 4 +-- .../include/zblib_driver_zcl_level_control.h | 14 ++++----- .../zigbee-lib/include/zblib_driver_zcl_on_off.h | 4 +-- .../include/zblib_driver_zcl_poll_control.h | 8 ++--- .../zigbee-lib/include/zblib_driver_zcl_scene.h | 14 ++++----- .../include/zblib_driver_zcl_thermostat.h | 10 +++---- .../zigbee-lib/include/zblib_driver_zdo_bind.h | 4 +-- .../include/zblib_driver_zdo_dev_control.h | 34 +++++++++++----------- zigbee-daemon/zigbee-lib/include/zblib_log.h | 14 ++++----- zigbee-daemon/zigbee-lib/include/zblib_types.h | 3 +- 22 files changed, 139 insertions(+), 140 deletions(-) diff --git a/zigbee-client/include_private/zigbee_log.h b/zigbee-client/include_private/zigbee_log.h index bc77f41..238b786 100644 --- a/zigbee-client/include_private/zigbee_log.h +++ b/zigbee-client/include_private/zigbee_log.h @@ -51,11 +51,11 @@ enum zigbee_log_priority { void zigbee_log(enum zigbee_log_type type, enum zigbee_log_priority priority, const char *tag, const char *fmt, ...); /* Logs would be available in system logs */ -#define Z_LOGI(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGM(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0) -#define Z_LOGD(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGW(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGE(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGF(fmt,args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGI(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGM(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0) +#define Z_LOGD(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGW(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGE(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGF(fmt, args...) do { zigbee_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) #endif /* __ZIGBEE_LOG_H__ */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_custom.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_custom.h index 79585cc..b21d1d5 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_custom.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_custom.h @@ -21,9 +21,9 @@ /**< ZigBee 'custom' driver operations */ typedef struct { - gboolean (*aps_send)(ZigBeeDriver *driver, guint request_id); - gboolean (*zcl_send)(ZigBeeDriver *driver, guint request_id); - gboolean (*send_to_local)(ZigBeeDriver *driver, guint request_id); + gboolean(*aps_send) (ZigBeeDriver *driver, guint request_id); + gboolean(*zcl_send) (ZigBeeDriver *driver, guint request_id); + gboolean(*send_to_local) (ZigBeeDriver *driver, guint request_id); } ZblibDriverCustomOps_t; /**< ZigBee 'custom' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_mfglib_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_mfglib_control.h index 251bfe4..b972eb3 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_mfglib_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_mfglib_control.h @@ -21,23 +21,23 @@ /**< ZigBee 'mfglib control' driver operations */ typedef struct { - gboolean (*start)(ZigBeeDriver *driver, guint request_id); - gboolean (*end)(ZigBeeDriver *driver, guint request_id); - gboolean (*start_tone)(ZigBeeDriver *driver, guint request_id); - gboolean (*stop_tone)(ZigBeeDriver *driver, guint request_id); - gboolean (*start_stream)(ZigBeeDriver *driver, guint request_id); - gboolean (*stop_stream)(ZigBeeDriver *driver, guint request_id); - gboolean (*send_packet)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_channel)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_channel)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_power)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_power)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_synoffset)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_synoffset)(ZigBeeDriver *driver, guint request_id); - gboolean (*rx_start)(ZigBeeDriver *driver, guint request_id); - gboolean (*rx_stop)(ZigBeeDriver *driver, guint request_id); - gboolean (*rx_verify)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_rssi)(ZigBeeDriver *driver, guint request_id); + gboolean(*start) (ZigBeeDriver *driver, guint request_id); + gboolean(*end) (ZigBeeDriver *driver, guint request_id); + gboolean(*start_tone) (ZigBeeDriver *driver, guint request_id); + gboolean(*stop_tone) (ZigBeeDriver *driver, guint request_id); + gboolean(*start_stream) (ZigBeeDriver *driver, guint request_id); + gboolean(*stop_stream) (ZigBeeDriver *driver, guint request_id); + gboolean(*send_packet) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_channel) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_channel) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_power) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_power) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_synoffset) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_synoffset) (ZigBeeDriver *driver, guint request_id); + gboolean(*rx_start) (ZigBeeDriver *driver, guint request_id); + gboolean(*rx_stop) (ZigBeeDriver *driver, guint request_id); + gboolean(*rx_verify) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_rssi) (ZigBeeDriver *driver, guint request_id); } ZblibDriverMfglibControlOps_t; /**< ZigBee 'mfglib control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_service.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_service.h index 21f31c6..d5c278b 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_service.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_service.h @@ -21,20 +21,20 @@ /**< ZigBee 'service' driver operations */ typedef struct { - gboolean (*zb_hw_reset)(ZigBeeDriver *driver, guint request_id); - gboolean (*form_network)(ZigBeeDriver *driver, guint request_id); - gboolean (*coex_start)(ZigBeeDriver *driver, guint request_id); - gboolean (*coex_stop)(ZigBeeDriver *driver, guint request_id); - gboolean (*leave_network)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_network_info)(ZigBeeDriver *driver, guint request_id); - gboolean (*permit_join)(ZigBeeDriver *driver, guint request_id); - gboolean (*leave_request)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_device_list)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_mac)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_device_info)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_endpoint_list)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_cluster_list)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_node_type)(ZigBeeDriver *driver, guint request_id); + gboolean(*zb_hw_reset) (ZigBeeDriver *driver, guint request_id); + gboolean(*form_network) (ZigBeeDriver *driver, guint request_id); + gboolean(*coex_start) (ZigBeeDriver *driver, guint request_id); + gboolean(*coex_stop) (ZigBeeDriver *driver, guint request_id); + gboolean(*leave_network) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_network_info) (ZigBeeDriver *driver, guint request_id); + gboolean(*permit_join) (ZigBeeDriver *driver, guint request_id); + gboolean(*leave_request) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_device_list) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_mac) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_device_info) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_endpoint_list) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_cluster_list) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_node_type) (ZigBeeDriver *driver, guint request_id); } ZblibDriverServiceOps_t; /**< ZigBee 'service' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_alarm.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_alarm.h index cbf4a68..f284422 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_alarm.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_alarm.h @@ -21,12 +21,12 @@ /**< ZigBee 'ZCL alarm' driver operations */ typedef struct { - gboolean (*get_alarm_count)(ZigBeeDriver *driver, guint request_id); - gboolean (*reset_alarm)(ZigBeeDriver *driver, guint request_id); - gboolean (*reset_all_alarm)(ZigBeeDriver *driver, guint request_id); - gboolean (*alarm)(ZigBeeDriver *driver, guint request_id); - gboolean (*reset_alarm_log)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_alarm)(ZigBeeDriver *driver, guint request_id); + gboolean(*get_alarm_count) (ZigBeeDriver *driver, guint request_id); + gboolean(*reset_alarm) (ZigBeeDriver *driver, guint request_id); + gboolean(*reset_all_alarm) (ZigBeeDriver *driver, guint request_id); + gboolean(*alarm) (ZigBeeDriver *driver, guint request_id); + gboolean(*reset_alarm_log) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_alarm) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclAlarmOps_t; /**< ZigBee 'ZCL alarm' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_basic.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_basic.h index 6faeceb..ec05d6b 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_basic.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_basic.h @@ -21,7 +21,7 @@ /**< ZigBee 'ZCL Basic' driver operations */ typedef struct { - gboolean (*reset_factory_default)(ZigBeeDriver *driver, guint request_id); + gboolean(*reset_factory_default) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclBasicOps_t; /**< ZigBee 'ZCL Basic' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_color_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_color_control.h index 2a01524..2863c5e 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_color_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_color_control.h @@ -21,17 +21,17 @@ /**< ZigBee 'ZCL color control' driver operations */ typedef struct { - gboolean (*move_to_hue)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_hue)(ZigBeeDriver *driver, guint request_id); - gboolean (*step_hue)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_to_saturation)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_saturation)(ZigBeeDriver *driver, guint request_id); - gboolean (*step_saturation)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_to_hue_and_saturation)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_to_color)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_color)(ZigBeeDriver *driver, guint request_id); - gboolean (*step_color)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_color_temperature)(ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_hue) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_hue) (ZigBeeDriver *driver, guint request_id); + gboolean(*step_hue) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_saturation) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_saturation) (ZigBeeDriver *driver, guint request_id); + gboolean(*step_saturation) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_hue_and_saturation) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_color) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_color) (ZigBeeDriver *driver, guint request_id); + gboolean(*step_color) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_color_temperature) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclColorControlOps_t; /**< ZigBee 'ZCL color control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_door_lock.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_door_lock.h index 08d0ef6..56b0395 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_door_lock.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_door_lock.h @@ -21,10 +21,10 @@ /**< ZigBee 'ZCL door lock' driver operations */ typedef struct { - gboolean (*subscribe_lock_event)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_door_lock_pin)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_door_lock)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_lock_state)(ZigBeeDriver *driver, guint request_id); + gboolean(*subscribe_lock_event) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_door_lock_pin) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_door_lock) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_lock_state) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclDoorLockOps_t; /**< ZigBee 'ZCL door lock' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_fan_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_fan_control.h index 8408032..4542a01 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_fan_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_fan_control.h @@ -21,10 +21,10 @@ /**< ZigBee 'ZCL fan control' driver operations */ typedef struct { - gboolean (*set_fan_mode)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_fan_mode)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_fan_mode_sequence)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_fan_mode_sequence)(ZigBeeDriver *driver, guint request_id); + gboolean(*set_fan_mode) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_fan_mode) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_fan_mode_sequence) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_fan_mode_sequence) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclFanControlOps_t; /**< ZigBee 'ZCL fan control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_global_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_global_control.h index 470157d..148ce58 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_global_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_global_control.h @@ -21,18 +21,18 @@ /**< ZigBee 'ZCL global control' driver operations */ typedef struct { - gboolean (*read_attributes_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*write_attributes_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*write_attributes_undivided_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*write_attributes_no_resp)(ZigBeeDriver *driver, guint request_id); - gboolean (*write_attributes_structured)(ZigBeeDriver *driver, guint request_id); - gboolean (*read_attributes_structured)(ZigBeeDriver *driver, guint request_id); - gboolean (*configure_reporting_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*read_configure_reporting)(ZigBeeDriver *driver, guint request_id); - gboolean (*discover_attributes)(ZigBeeDriver *driver, guint request_id); - gboolean (*discover_attributes_extended)(ZigBeeDriver *driver, guint request_id); - gboolean (*discover_commands_received)(ZigBeeDriver *driver, guint request_id); - gboolean (*discover_commands_generated)(ZigBeeDriver *driver, guint request_id); + gboolean(*read_attributes_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*write_attributes_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*write_attributes_undivided_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*write_attributes_no_resp) (ZigBeeDriver *driver, guint request_id); + gboolean(*write_attributes_structured) (ZigBeeDriver *driver, guint request_id); + gboolean(*read_attributes_structured) (ZigBeeDriver *driver, guint request_id); + gboolean(*configure_reporting_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*read_configure_reporting) (ZigBeeDriver *driver, guint request_id); + gboolean(*discover_attributes) (ZigBeeDriver *driver, guint request_id); + gboolean(*discover_attributes_extended) (ZigBeeDriver *driver, guint request_id); + gboolean(*discover_commands_received) (ZigBeeDriver *driver, guint request_id); + gboolean(*discover_commands_generated) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclGlobalControlOps_t; /**< ZigBee 'ZCL global control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_group.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_group.h index 24987a0..5172a48 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_group.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_group.h @@ -21,12 +21,12 @@ /**< ZigBee 'ZCL Group' driver operations */ typedef struct { - gboolean (*add_group)(ZigBeeDriver *driver, guint request_id); - gboolean (*view_group)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_group_membership)(ZigBeeDriver *driver, guint request_id); - gboolean (*remove_group)(ZigBeeDriver *driver, guint request_id); - gboolean (*remove_all_group)(ZigBeeDriver *driver, guint request_id); - gboolean (*add_group_if_identifying)(ZigBeeDriver *driver, guint request_id); + gboolean(*add_group) (ZigBeeDriver *driver, guint request_id); + gboolean(*view_group) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_group_membership) (ZigBeeDriver *driver, guint request_id); + gboolean(*remove_group) (ZigBeeDriver *driver, guint request_id); + gboolean(*remove_all_group) (ZigBeeDriver *driver, guint request_id); + gboolean(*add_group_if_identifying) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclGroupOps_t; /**< ZigBee 'ZCL Group' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_ias_zone.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_ias_zone.h index db8aaa6..13b9420 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_ias_zone.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_ias_zone.h @@ -21,7 +21,7 @@ /**< ZigBee 'ZCL IAS zone' driver operations */ typedef struct { - gboolean (*enroll_response)(ZigBeeDriver *driver, guint request_id); + gboolean(*enroll_response) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclIasZoneOps_t; /**< ZigBee 'ZCL IAS zone' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_identify.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_identify.h index 44eb123..b3d3dea 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_identify.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_identify.h @@ -21,8 +21,8 @@ /**< ZigBee 'ZCL Identify' driver operations */ typedef struct { - gboolean (*identify)(ZigBeeDriver *driver, guint request_id); - gboolean (*query)(ZigBeeDriver *driver, guint request_id); + gboolean(*identify) (ZigBeeDriver *driver, guint request_id); + gboolean(*query) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclIdentifyOps_t; /**< ZigBee 'ZCL Identify' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_level_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_level_control.h index c603b0e..7b90f07 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_level_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_level_control.h @@ -21,13 +21,13 @@ /**< ZigBee 'ZCL level control' driver operations */ typedef struct { - gboolean (*move_to_level)(ZigBeeDriver *driver, guint request_id); - gboolean (*move)(ZigBeeDriver *driver, guint request_id); - gboolean (*step)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_to_level_with_on_off)(ZigBeeDriver *driver, guint request_id); - gboolean (*move_with_on_off)(ZigBeeDriver *driver, guint request_id); - gboolean (*step_with_on_off)(ZigBeeDriver *driver, guint request_id); - gboolean (*stop)(ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_level) (ZigBeeDriver *driver, guint request_id); + gboolean(*move) (ZigBeeDriver *driver, guint request_id); + gboolean(*step) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_to_level_with_on_off) (ZigBeeDriver *driver, guint request_id); + gboolean(*move_with_on_off) (ZigBeeDriver *driver, guint request_id); + gboolean(*step_with_on_off) (ZigBeeDriver *driver, guint request_id); + gboolean(*stop) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclLevelControlOps_t; /**< ZigBee 'ZCL level control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_on_off.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_on_off.h index d06ef3b..22f8348 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_on_off.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_on_off.h @@ -21,8 +21,8 @@ /**< ZigBee 'ZCL on off' driver operations */ typedef struct { - gboolean (*set_on_off)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_on_off_state)(ZigBeeDriver *driver, guint request_id); + gboolean(*set_on_off) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_on_off_state) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclOnOffOps_t; /**< ZigBee 'ZCL on off' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_poll_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_poll_control.h index eb21717..9a50887 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_poll_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_poll_control.h @@ -21,10 +21,10 @@ /**< ZigBee 'ZCL poll control' driver operations */ typedef struct { - gboolean (*check_in_response)(ZigBeeDriver *driver, guint request_id); - gboolean (*fast_poll_stop)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_long_poll_interval)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_short_poll_interval)(ZigBeeDriver *driver, guint request_id); + gboolean(*check_in_response) (ZigBeeDriver *driver, guint request_id); + gboolean(*fast_poll_stop) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_long_poll_interval) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_short_poll_interval) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclPollControlOps_t; /**< ZigBee 'ZCL poll control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_scene.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_scene.h index e56304e..ee7a4b9 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_scene.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_scene.h @@ -21,13 +21,13 @@ /**< ZigBee 'ZCL scene' driver operations */ typedef struct { - gboolean (*add_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*view_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*remove_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*store_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*recall_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*remove_all_scene)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_scene_membership)(ZigBeeDriver *driver, guint request_id); + gboolean(*add_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*view_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*remove_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*store_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*recall_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*remove_all_scene) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_scene_membership) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclSceneOps_t; /**< ZigBee 'ZCL scene' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_thermostat.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_thermostat.h index dd73122..a230d49 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_thermostat.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zcl_thermostat.h @@ -21,11 +21,11 @@ /**< ZigBee 'ZCL thermostat' driver operations */ typedef struct { - gboolean (*get_local_temp)(ZigBeeDriver *driver, guint request_id); - gboolean (*get_weekly_schedule)(ZigBeeDriver *driver, guint request_id); - gboolean (*set_weekly_schedule)(ZigBeeDriver *driver, guint request_id); - gboolean (*clear_weekly_schedule)(ZigBeeDriver *driver, guint request_id); - gboolean (*setpoint_raise_lower)(ZigBeeDriver *driver, guint request_id); + gboolean(*get_local_temp) (ZigBeeDriver *driver, guint request_id); + gboolean(*get_weekly_schedule) (ZigBeeDriver *driver, guint request_id); + gboolean(*set_weekly_schedule) (ZigBeeDriver *driver, guint request_id); + gboolean(*clear_weekly_schedule) (ZigBeeDriver *driver, guint request_id); + gboolean(*setpoint_raise_lower) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZclThermostatOps_t; /**< ZigBee 'ZCL thermostat' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_bind.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_bind.h index 95d7f8c..27f0680 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_bind.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_bind.h @@ -21,8 +21,8 @@ /**< ZigBee 'ZDO bind' driver operations */ typedef struct { - gboolean (*bind_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*unbind_req)(ZigBeeDriver *driver, guint request_id); + gboolean(*bind_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*unbind_req) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZdoBindOps_t; /**< ZigBee 'ZDO bind' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_dev_control.h b/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_dev_control.h index ddd656b..09cb305 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_dev_control.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_driver_zdo_dev_control.h @@ -21,23 +21,23 @@ /**< ZigBee 'ZDO Dev control' driver operations */ typedef struct { - gboolean (*nwk_addr_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*matched_descriptor_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*ieee_addr_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*active_ep_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*node_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*power_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*complex_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*user_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*user_desc_set_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*device_announce)(ZigBeeDriver *driver, guint request_id); - gboolean (*simple_desc_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_lqi_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_rtg_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_bind_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_permit_join_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_nwk_update_req)(ZigBeeDriver *driver, guint request_id); - gboolean (*mgmt_nwk_disc_req)(ZigBeeDriver *driver, guint request_id); + gboolean(*nwk_addr_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*matched_descriptor_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*ieee_addr_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*active_ep_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*node_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*power_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*complex_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*user_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*user_desc_set_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*device_announce) (ZigBeeDriver *driver, guint request_id); + gboolean(*simple_desc_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_lqi_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_rtg_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_bind_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_permit_join_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_nwk_update_req) (ZigBeeDriver *driver, guint request_id); + gboolean(*mgmt_nwk_disc_req) (ZigBeeDriver *driver, guint request_id); } ZblibDriverZdoDevControlOps_t; /**< ZigBee 'ZDO Dev control' ops IDs */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_log.h b/zigbee-daemon/zigbee-lib/include/zblib_log.h index ff3aa79..7d3a767 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_log.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_log.h @@ -54,13 +54,13 @@ enum zblib_log_priority { void zblib_log(enum zblib_log_type type, enum zblib_log_priority priority, const char *tag, const char *fmt, ...); /* Logs would be available in system logs */ -#define Z_LOGI(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGM(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0) -#define Z_LOGD(fmt,args...) do { if(zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGW(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGE(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_LOGF(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGI(fmt, args...) do { if (zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGM(fmt, args...) do { if (zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_INFO, ZIGBEE_LOG_TAG, fmt "\n", ##args); } while (0) +#define Z_LOGD(fmt, args...) do { if (zblib_debug) zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_DEBUG, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGW(fmt, args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_WARN, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGE(fmt, args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_ERROR, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) +#define Z_LOGF(fmt, args...) do { zblib_log(ZIGBEE_LOG_TYPE_SYSTEM, ZIGBEE_LOG_FATAL, ZIGBEE_LOG_TAG, "<%s:%d> " fmt "\n", __func__, __LINE__, ##args); } while (0) -#define Z_TIME_CHECK(fmt,args...) do { zblib_log(ZIGBEE_LOG_TYPE_TIME_CHECK, ZIGBEE_LOG_INFO, "TIME_CHECK", fmt "\n", ##args); } while (0) +#define Z_TIME_CHECK(fmt, args...) do { zblib_log(ZIGBEE_LOG_TYPE_TIME_CHECK, ZIGBEE_LOG_INFO, "TIME_CHECK", fmt "\n", ##args); } while (0) #endif /* __ZIGBEE_LIB_LOG_H__ */ diff --git a/zigbee-daemon/zigbee-lib/include/zblib_types.h b/zigbee-daemon/zigbee-lib/include/zblib_types.h index 8ffd77e..16c26a8 100644 --- a/zigbee-daemon/zigbee-lib/include/zblib_types.h +++ b/zigbee-daemon/zigbee-lib/include/zblib_types.h @@ -24,8 +24,7 @@ * -------------------------------------------------------------------------------------*/ /* Enumeration for zigbee library error code. */ -typedef enum -{ +typedef enum { ZBLIB_ERROR_NONE = 0, /**< Successful */ ZBLIB_ERROR_INVALID_PARAMETER, /**< parameter error */ ZBLIB_ERROR_PARAMETER_OUT_OF_RANGE, /**< out of range error */ -- 2.7.4 From a5c459167cd501af2e56d215ff4e4ec9d828e487 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Mon, 18 Sep 2017 17:34:30 +0900 Subject: [PATCH 15/16] Remove re-start option Change-Id: I11d6ceac4b5ab02f211e9b30727c0dbab85c0a6b Signed-off-by: saerome kim --- zigbee-daemon/resources/zigbee-daemon.service | 3 --- 1 file changed, 3 deletions(-) diff --git a/zigbee-daemon/resources/zigbee-daemon.service b/zigbee-daemon/resources/zigbee-daemon.service index 240ce7f..8da1635 100644 --- a/zigbee-daemon/resources/zigbee-daemon.service +++ b/zigbee-daemon/resources/zigbee-daemon.service @@ -10,9 +10,6 @@ User=network_fw Group=network_fw SmackProcessLabel=System ExecStart=/usr/bin/zigbee-daemon -Restart=on-failure -RestartSec=0 -KillMode=none [Install] WantedBy=multi-user.target -- 2.7.4 From e60d428b6eb148c64a1d31df1644a20e8fa9ec88 Mon Sep 17 00:00:00 2001 From: saerome kim Date: Mon, 18 Sep 2017 17:43:21 +0900 Subject: [PATCH 16/16] Change zigbee-daemon'owner as network_fw Change-Id: Ia308c203f09ba0b34749ba88d03bf925278fc399 Signed-off-by: saerome kim --- packaging/zigbee-manager.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/zigbee-manager.spec b/packaging/zigbee-manager.spec index e0182d4..b9072ed 100644 --- a/packaging/zigbee-manager.spec +++ b/packaging/zigbee-manager.spec @@ -77,8 +77,8 @@ cp %{SOURCE2} %{buildroot}%{_datadir}/dbus-1/system.d/zigbee.conf %files %manifest zigbee-daemon.manifest -%defattr(644,system,system,-) -%attr(755,system,system) %{_bindir}/zigbee-daemon +%defattr(-,root,root,-) +%attr(755,network_fw,network_fw) %{_bindir}/zigbee-daemon %{_unitdir}/zigbee-daemon.service #%{_unitdir}/multi-user.target.wants/zigbee-daemon.service %attr(644,root,root) %{_datadir}/dbus-1/system-services/* -- 2.7.4