Code sync from local git
authorJiwan Kim <ji-wan.kim@samsung.com>
Tue, 6 Sep 2016 01:52:06 +0000 (10:52 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 11 May 2017 09:07:19 +0000 (18:07 +0900)
Change-Id: Ib0d0de83ebe7eb62b1b42e5e1373325159015cfc
Signed-off-by: Jiwan Kim <ji-wan.kim@samsung.com>
95 files changed:
CMakeLists.txt [new file with mode: 0644]
LICENSE.APLv2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
common/CMakeLists.txt [new file with mode: 0644]
common/zb-common.h [new file with mode: 0644]
common/zb-dbus.xml [new file with mode: 0644]
common/zb-log.h [new file with mode: 0644]
common/zb-utils.c [new file with mode: 0644]
common/zb-utils.h [new file with mode: 0644]
doc/ha/generic_devices/zb-ha-on-off-switch.h [new file with mode: 0644]
doc/ha/lighting_devices/zb-ha-on-off-light.h [new file with mode: 0644]
include/zb-custom.h [new file with mode: 0644]
include/zb-error.h [new file with mode: 0644]
include/zb-ha.h [new file with mode: 0644]
include/zb-type.h [new file with mode: 0644]
include/zb-zcl.h [new file with mode: 0644]
include/zb-zdo.h [new file with mode: 0644]
include/zcl/zb-zcl-alarm-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-attribute-ids.h [new file with mode: 0644]
include/zcl/zb-zcl-attribute-type.h [new file with mode: 0644]
include/zcl/zb-zcl-basic-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-cluster-ids.h [new file with mode: 0644]
include/zcl/zb-zcl-color-control-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-commands.h [new file with mode: 0644]
include/zcl/zb-zcl-door-lock-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-global-commands.h [new file with mode: 0644]
include/zcl/zb-zcl-groups-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-ias-zone-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-identify-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-level-control-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-on-off-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-poll-control-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-scenes-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-simple-metering-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-thermostat-cluster.h [new file with mode: 0644]
include/zcl/zb-zcl-type.h [new file with mode: 0644]
include/zdo/zb-zdo-bind-mgr.h [new file with mode: 0644]
include/zdo/zb-zdo-config.h [new file with mode: 0644]
include/zdo/zb-zdo-dev-disc.h [new file with mode: 0644]
include/zdo/zb-zdo-nwk-mgr.h [new file with mode: 0644]
include/zdo/zb-zdo-svc-disc.h [new file with mode: 0644]
include/zdo/zb-zdo-type.h [new file with mode: 0644]
include/zigbee.h [new file with mode: 0644]
lib/CMakeLists.txt [new file with mode: 0644]
lib/capi-network-zigbee.pc.in [new file with mode: 0644]
lib/zbl-custom.c [new file with mode: 0644]
lib/zbl-dbus.c [new file with mode: 0644]
lib/zbl-dbus.h [new file with mode: 0644]
lib/zbl-zcl-alarm.c [new file with mode: 0644]
lib/zbl-zcl-basic.c [new file with mode: 0644]
lib/zbl-zcl-color-control.c [new file with mode: 0644]
lib/zbl-zcl-door-lock.c [new file with mode: 0644]
lib/zbl-zcl-global-commands.c [new file with mode: 0644]
lib/zbl-zcl-groups.c [new file with mode: 0644]
lib/zbl-zcl-identify.c [new file with mode: 0644]
lib/zbl-zcl-isa-zone.c [new file with mode: 0644]
lib/zbl-zcl-level-control.c [new file with mode: 0644]
lib/zbl-zcl-on-off.c [new file with mode: 0644]
lib/zbl-zcl-poll-control.c [new file with mode: 0644]
lib/zbl-zcl-scenes.c [new file with mode: 0644]
lib/zbl-zcl-simple-metering.c [new file with mode: 0644]
lib/zbl-zcl-thermostat.c [new file with mode: 0644]
lib/zbl-zcl.c [new file with mode: 0644]
lib/zbl-zdo-bind-mgr.c [new file with mode: 0644]
lib/zbl-zdo-dev-disc.c [new file with mode: 0644]
lib/zbl-zdo-nwk-mgr.c [new file with mode: 0644]
lib/zbl-zdo-svc-disc.c [new file with mode: 0644]
lib/zbl-zdo.c [new file with mode: 0644]
lib/zbl.c [new file with mode: 0644]
lib/zbl.h [new file with mode: 0644]
packaging/capi-network-zigbee.manifest [new file with mode: 0644]
packaging/capi-network-zigbee.spec [new file with mode: 0644]
packaging/libcapi-network-zigbee-old.manifest [new file with mode: 0644]
packaging/test-capi-network-zigbee-old.manifest [new file with mode: 0644]
test/CMakeLists.txt [new file with mode: 0644]
test/custom.c [new file with mode: 0644]
test/main.c [new file with mode: 0644]
test/main.h [new file with mode: 0644]
test/menu.c [new file with mode: 0644]
test/menu.h [new file with mode: 0644]
test/test-zigbee.c [new file with mode: 0644]
test/test-zigbee.h [new file with mode: 0644]
test/zcl-cluster-alarm.c [new file with mode: 0644]
test/zcl-cluster-colorctrl.c [new file with mode: 0644]
test/zcl-cluster-group.c [new file with mode: 0644]
test/zcl-cluster-identity.c [new file with mode: 0644]
test/zcl-cluster-levelctrl.c [new file with mode: 0644]
test/zcl-cluster-onoff.c [new file with mode: 0644]
test/zcl-cluster-pollctrl.c [new file with mode: 0644]
test/zcl-cluster-scene.c [new file with mode: 0644]
test/zcl-cluster-thermostat.c [new file with mode: 0644]
test/zcl-global-cmd.c [new file with mode: 0644]
test/zdo-binding.c [new file with mode: 0644]
test/zdo-device.c [new file with mode: 0644]
test/zdo-network.c [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..cf9de3b
--- /dev/null
@@ -0,0 +1,30 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(zigbee C)
+
+INCLUDE(FindPkgConfig)
+
+#SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden -fsanitize=address")
+SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden")
+SET(CMAKE_C_FLAGS ${CMAKE_CFALGS} ${EXTRA_CFLAGS})
+
+SET(CAPI_NETWORK_ZIGBEE "capi-network-zigbee")
+SET(CLIENT ${PROJECT_NAME})
+SET(DAEMON "${PROJECT_NAME}-daemon")
+SET(DBUS_INTERFACE "org.tizen.${PROJECT_NAME}")
+SET(DBUS_OBJECT_PATH "/org/tizen/${PROJECT_NAME}")
+#SET(ZB_DBUS "zb-dbus")
+
+IF(TZ_VER_3)
+       ADD_DEFINITIONS("-DTZ_VER_3")
+       #ELSE(TZ_VER_3)
+       #       CONFIGURE_FILE(${CAPI_NETWORK_ZIGBEE}-old.manifest.in ${CAPI_NETWORK_ZIGBEE}.manifest @ONLY)
+ENDIF(TZ_VER_3)
+# enable client log
+ADD_DEFINITIONS("-DZB_ENABLE_CLIENT_LOG")
+IF(ZB_FEATURE_GLOBAL_RSP_SYNC)
+ADD_DEFINITIONS("-DZB_FEATURE_GLOBAL_RSP_SYNC")
+ENDIF(ZB_FEATURE_GLOBAL_RSP_SYNC)
+
+ADD_SUBDIRECTORY(common)
+ADD_SUBDIRECTORY(lib)
+ADD_SUBDIRECTORY(test)
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..26b7de6
--- /dev/null
@@ -0,0 +1,204 @@
+Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..eff0219
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache license, version 2 terms and conditions.
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1e7796a
--- /dev/null
@@ -0,0 +1,14 @@
+#FIND_PROGRAM(GDBUS_CODEGEN NAMES gdbus-codegen)
+
+#MESSAGE("KSR ${GDBUS_CODEGEN}")
+#ADD_CUSTOM_COMMAND(
+#      OUTPUT dbus
+#      COMMAND ${GDBUS_CODEGEN} --generate-c-code ${ZB_DBUS}
+#                      --interface-prefix org.tizen.zigbee.
+#                      --c-namespace zb
+#                      ${ZB_DBUS}.xml
+#      DEPENDS ${ZB_DBUS}.xml)
+
+#ADD_CUSTOM_TARGET(GENERATED_DBUS_CODE DEPENDS dbus)
+
+#MESSAGE("KSR ${dbus}")
diff --git a/common/zb-common.h b/common/zb-common.h
new file mode 100644 (file)
index 0000000..fb9c046
--- /dev/null
@@ -0,0 +1,423 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_INTERNAL_COMMON_H__
+#define __TIZEN_NETWORK_ZIGBEE_INTERNAL_COMMON_H__
+
+#include <zb-type.h>
+#include <zdo/zb-zdo-type.h>
+#include <zcl/zb-zcl-type.h>
+
+#ifndef ZIGBEE_DBUS_INTERFACE
+#define ZIGBEE_DBUS_INTERFACE "org.tizen.zigbee"
+#warning "ZIGBEE_DBUS_INTERFACE is redefined"
+#endif
+
+#ifndef ZIGBEE_DBUS_OBJPATH
+#define ZIGBEE_DBUS_OBJPATH "/org/tizen/zigbee"
+#warning "ZIGBEE_DBUS_OBJPATH is redefined"
+#endif
+
+#define ZIGBEE_SERVER_NAME "org.tizen.zigbee"
+#define ZIGBEE_OBJECT_PATH "/org/tizen/zigbee"
+
+#define ZIGBEE_SERVICE_INTERFACE "org.tizen.zigbee_service"
+#define ZIGBEE_ON_OFF_INTERFACE "org.tizen.zigbee_on_off"
+#define ZIGBEE_DOOR_LOCK_INTERFACE "org.tizen.zigbee_door_lock"
+#define ZIGBEE_THERMOSTAT_INTERFACE "org.tizen.zigbee_thermostat"
+#define ZIGBEE_LEVEL_CONTROL_INTERFACE "org.tizen.zigbee_level_control"
+#define ZIGBEE_ALARM_INTERFACE "org.tizen.zigbee_alarm"
+#define ZIGBEE_FAN_CONTROL_INTERFACE "org.tizen.zigbee_fan_control"
+#define ZIGBEE_MFGLIB_INTERFACE "org.tizen.zigbee_mfglib_control"
+#define ZIGBEE_ZCLGLB_INTERFACE "org.tizen.zigbee_zclglobal_control"
+#define ZIGBEE_ZDOGLB_INTERFACE "org.tizen.zigbee_zdodev_control"
+#define ZIGBEE_ZCLBASIC_INTERFACE "org.tizen.zigbee_zclbasic_control"
+#define ZIGBEE_ZCLIDENTIFY_INTERFACE "org.tizen.zigbee_zclidentify_control"
+#define ZIGBEE_ZCLIAS_INTERFACE "org.tizen.zigbee_zclias_control"
+#define ZIGBEE_ZCLPOLL_INTERFACE "org.tizen.zigbee_zcl_poll_control"
+#define ZIGBEE_ZCLGROUP_INTERFACE "org.tizen.zigbee_zcl_group"
+#define ZIGBEE_ZCLSCENE_INTERFACE "org.tizen.zigbee_zcl_scene"
+#define ZIGBEE_ZDOBIND_INTERFACE "org.tizen.zigbee_zdo_bind"
+#define ZIGBEE_ZCLCOLOR_INTERFACE "org.tizen.zigbee_zcl_color"
+#define ZIGBEE_CUSTOM_INTERFACE "org.tizen.zigbee_custom"
+
+#define ZIGBEE_BROADCAST_TIMEOUT (9.5 + 2) * 1000 /**< default timeout for gdbus */
+
+#define MAX_DEVICE_LIST 32 /**< maximum end-devices in device list */
+
+/**
+ * @brief Use this value as the return value to stop foreach function.
+ *
+ * @since_tizen 3.0
+ */
+#define ZIGBEE_FUNC_STOP false
+
+/**
+ * @brief Use this value as the return value to continue foreach function.
+ *
+ * @since_tizen 3.0
+ */
+#define ZIGBEE_FUNC_CONTINUE true
+
+/*---------------------------------------------------------------------------------------
+ * For ZDO
+ *--------------------------------------------------------------------------------------*/
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.39 Fields of the Simple Descriptor
+ * @details Device descriptions contained in node.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_zdo_simple_desc_s {
+       unsigned char ep; /**< Endpoint ID */
+       unsigned short profile_id; /**< Profile ID */
+       unsigned short device_id; /**< Device ID */
+       unsigned char device_ver; /**< Device Version */
+       unsigned char num_of_in_clusters; /**< Number of In-Cluster */
+       unsigned char num_of_out_clusters; /**< Number of Out-Cluster */
+       unsigned short in_clusters[32]; /**< In-Cluster list */
+       unsigned short out_clusters[32]; /**< Out-Cluster list */
+};
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.34 Fields of the Node Power Descriptor .
+ * @details Node power characteristics.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_zdo_node_power_descriptor_s {
+       unsigned char current_power_mode; /**< Current Power Mode */
+       unsigned char available_power_sources; /**< Available Power Source */
+       unsigned char current_power_source; /**< Current Power Source */
+       unsigned char current_power_source_level; /**< Current Power Source Level */
+};
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief structure for end-device information.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_end_device_info_s {
+       nwk_addr addr16; /**< 16bit network address */
+       ieee_addr addr64; /**< EUI64 ieee address */
+       unsigned char node_type; /**< node type : coordinator, router or end-device */
+       unsigned char capability; /**< mac capability is updated when device_annce received */
+       unsigned char num_of_ep; /**< number of endpoints */
+       unsigned char ep[32]; /**< end-point list */
+       struct zb_zdo_simple_desc_s **desc; /**< Simple Descriptor when get_simple_desc_rsp received */
+       GList *list; /**< list to next */
+};
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.29 Fields of the Node Descriptor
+ * @details Type and capabilities of the node.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_zdo_node_descriptor_s {
+       unsigned char logical_type; /**< Logical Role */
+       unsigned char complex_desciptor_available; /**< Complex Descriptor Available \n */
+       unsigned char user_descriptor_available; /**< User Descriptor Available */
+       unsigned char aps_flags; /**< APS Flags */
+       unsigned char frequency_band; /**< Frequency Band */
+       unsigned char mac_capability_flags; /**< MAC Capability Flags */
+       unsigned short manufacturer_code; /**< Manufacturer Code */
+       unsigned char maximum_buffer_size; /**< Maximum Buffer Size */
+       unsigned short maximum_incoming_transfer_size; /**< Maximum Incoming Transfer Size */
+       unsigned short server_mask; /**< Server Mask */
+       unsigned short maximum_outgoing_transfer_size; /**< Maximum Outgoing Transfer Size */
+       unsigned char descriptor_capability_field; /**< Descriptor Capability Field */
+};
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.125 NetworkList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_zdo_network_list_record_s {
+       ieee_addr extended_pan_id; /**< Extended PAN ID */
+       unsigned char logical_channel; /**< Logical Channel Number */
+       unsigned char stack_profile; /**< Stack Profile Version */
+       unsigned char zigbee_version; /**< Supported Zigbee Protocol Version */
+       unsigned char beacon_order; /**< Beacon Order (See. 802.15.4 PHY/MAC Specification) */
+       unsigned char superframe_order; /**< Superframe Order (See. 802.15.4 PHY/MAC Specification) */
+       unsigned char permit_joining; /**< Permit Joining Flag */
+#if 0
+       unsigned char router_capability;
+       unsigned char end_device_capability;
+#endif
+       GList *list; /**< list to next */
+};
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.127 NeighborTableList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_zdo_neighbor_table_desc_s {
+       ieee_addr extended_pan_id; /**< Extended PAN ID */
+       ieee_addr addr64; /**< IEEE Address */
+       nwk_addr addr16; /**< Network Address */
+       unsigned char device_type; /**< Device Type see #zb_zdo_logical_type_e */
+       unsigned char rx_on_when_idle; /**< Can Receive on Idle State */
+       unsigned char relationship; /**< Relationship (i.e. parent, children or sibling) */
+       unsigned char permit_joining; /**< Can handle join request */
+       unsigned char depth; /**< Depth from parent */
+       unsigned char lqi; /**< Link Quality Indicator */
+       GList *list; /**< list to next */
+};
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.129 RoutingTableList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_zdo_routing_table_s {
+       nwk_addr dst_addr; /**< Network Address */
+       unsigned char status; /**< Status */
+       unsigned char memory_constrained; /* Is memory constrained device */
+       unsigned char many_to_one; /* Can support many-to-on endpoint routing */
+       unsigned char route_record_required;  /* Route record required */
+       nwk_addr next_hop_addr; /* Next hop address */
+       GList *list; /**< list to next */
+};
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.131 BindingTableList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_zdo_binding_table_s {
+       ieee_addr src_addr64; /**< IEEE address */
+       unsigned char src_ep; /**< Source endpoint */
+       unsigned short cluster_id; /**< Cluster ID */
+       unsigned char dst_addr_mode; /**< Destination address mode */
+       nwk_addr dst_addr16; /**< Destination network address this is up-to dst_addr_mode */
+       ieee_addr dst_addr64; /**< Destination network address this is up-to dst_addr_mode */
+       unsigned char dst_ep; /**< Destination Endpoint */
+       GList *list; /**< next node */
+};
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.136 DiscoveryCacheList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+struct zb_zdo_discovery_cache_s {
+       ieee_addr addr64; /**< IEEE Address */
+       nwk_addr addr16; /**< Network Address */
+       GList *list; /**< next child */
+};
+
+/*---------------------------------------------------------------------------------------
+ * For ZCL Global Commands
+ *--------------------------------------------------------------------------------------*/
+
+/**
+ * @brief Format of Attribute Value Field for string
+ *
+ * @since_tizen 3.0
+ */
+struct attribute_str_s {
+       unsigned char n; /**< number of elements */
+       unsigned char *v; /**< element value */
+};
+
+/**
+ * @brief Format of Attribute Value Field for wide-string
+ *
+ * @since_tizen 3.0
+ */
+struct attribute_wstr_s {
+       unsigned short n; /**< number of elements */
+       wchar_t *v; /**< element value */
+};
+
+/**
+ * @brief Figure 2.8 Format of Attribute Value Field for an array, Set or Bag
+ *
+ * @since_tizen 3.0
+ */
+struct attribute_array_s {
+       unsigned char t; /**< element type */
+       unsigned short n; /**< number of elements */
+       zb_value_h v; /**< element value */
+};
+
+/**
+ * @brief Attribute value sequence
+ *
+ * @since_tizen 3.0
+ */
+struct attribute_element_value {
+       unsigned char t; /**< element type */
+       zb_value_h v; /**< element value */
+};
+
+/**
+ * @brief Figure 2.9 Format of the Attribute Value Field for a Structure
+ *
+ * @since_tizen 3.0
+ */
+struct attribute_struct_s {
+       unsigned short n; /**< number of elements */
+       struct attribute_element_value *ev; /**< element value */
+};
+
+/**
+ * @brief value format for the cluster attribute data
+ *
+ * @since_tizen 3.0
+ */
+struct zb_value_s {
+       unsigned char type; /**< value type */
+       unsigned short size; /**< size of value */
+       unsigned char val[16 + 1]; /**< value */
+       struct attribute_str_s *str; /**< for 1 byte string */
+       struct attribute_wstr_s *wstr; /**< for 2 byte string */
+};
+
+/**
+ * @brief Figure 2.7 Format of the Read Attribute Status Record Field
+ *
+ * @since_tizen 3.0
+ */
+struct read_attribute_status_record_s {
+       unsigned short id; /**< attribute identifier */
+       unsigned char status; /**< status */
+       unsigned char type; /**< data type */
+       unsigned char *value; /**< data value \n
+                        unsigned int 1~8-byte \n
+                                        signed int : 1~8-byte \n
+                                        enumeration : 1~2-byte \n
+                                        floating point : 2~4-byte \n
+                                        string : from char to MBS \n
+                                        time : 4-byte \n
+                                        identifier : 2~4-byte \n
+                                        miscellaneous : 8~16 byte \n */
+};
+
+/**
+ * @brief write attributes data structure
+ *
+ * @since_tizen 3.0
+ */
+struct write_attribute_record_s {
+       unsigned short id; /**< attribute identifier */
+       unsigned char type; /**< attribute data type */
+       unsigned char *value; /**< attribute data */
+};
+
+/**
+ * @brief For write attribute response command
+ *
+ * @since_tizen 3.0
+ */
+struct write_attribute_status_record_s {
+       unsigned char status; /**< attribute status */
+       unsigned short id; /**< attribute identifier */
+};
+
+/**
+ * @brief reporting configuration record structure
+ *
+ * @since_tizen 3.0
+ */
+struct reporting_configuration_record_s {
+       unsigned char dir; /*(< direction */
+       unsigned short id; /**< attribute identifier */
+       unsigned char type; /**< attribute data type */
+       unsigned short min_i; /**< minimum reporting interval */
+       unsigned short max_i; /**< maximum reporting interval */
+       unsigned char *change; /**< reportable change */
+       unsigned short to; /**< timeout period */
+};
+
+
+/**
+ * @brief Figure 2.18 Format of the Attribute Status Record Field
+ *
+ * @since_tizen 3.0
+ */
+struct reporting_configuration_response_record_s {
+       unsigned char status; /**< status */
+       unsigned char dir; /**< direction */
+       unsigned short id; /**< attribute identifier */
+};
+
+/**
+ * @brief Read reporting configuration record
+ *
+ * @since_tizen 3.0
+ */
+struct read_reporting_configuration_record_s {
+       unsigned char dir; /**< direction */
+       unsigned short id; /**< attribute identifier */
+};
+
+/**
+ * @brief Figure 2.24 Format of the Attribute Report Fields
+ *
+ * @since_tizen 3.0
+ */
+struct attribute_report_s {
+       unsigned short id; /**< attribute identifier */
+       unsigned char type; /**< attribute type */
+       unsigned char *value; /**< attribute value */
+};
+
+/**
+ * @brief Figure 2.28 Format of the Attribute Report Fields
+ *
+ * @since_tizen 3.0
+ */
+struct discover_attribute_info_record_s {
+       unsigned short id; /**< attribute identifier */
+       unsigned char type; /**< attribute data type */
+};
+
+/**
+ * @brief Figure 12.5 Format of the Extended Attribute Information Fields
+ *
+ * @since_tizen 3.0
+ */
+struct extended_attribute_infomation_s {
+       unsigned short id; /**< attribute identifier */
+       unsigned char type; /**< attribute data type */
+       unsigned char acl; /**< attribute access control */
+};
+
+/**
+ * @brief Events
+ *
+ * @since_tizen 3.0
+ */
+
+struct zbl_event_s {
+       unsigned char *data;
+       unsigned char len;
+};
+
+#endif /* __TIZTN_NETWORK_ZIGBEE_INTERNAL_COMMON_H__ */
diff --git a/common/zb-dbus.xml b/common/zb-dbus.xml
new file mode 100644 (file)
index 0000000..5cf15c7
--- /dev/null
@@ -0,0 +1,11 @@
+<node>
+       <interface name="org.tizen.zigbee.dbus">
+               <method name="zdo_start">
+                       <arg type="i" name="operation_mode" direction="in" />
+                       <arg type="i" name="success" direction="out" />
+               </method>
+               <method name="zdo_stop">
+                       <arg type="i" name="success" direction="out" />
+               </method>
+       </interface>
+</node>
diff --git a/common/zb-log.h b/common/zb-log.h
new file mode 100644 (file)
index 0000000..fc7bbbb
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_LOG_H__
+#define __TIZEN_NETWORK_ZIGBEE_LOG_H__
+
+#define IC_LOG_RED "\033[0;31m"
+#define IC_LOG_GREEN "\033[0;32m"
+#define IC_LOG_BROWN "\033[0;33m"
+#define IC_LOG_BLUE "\033[0;34m"
+#define IC_LOG_END "\033[0;m"
+
+#undef _DBG
+#undef _INFO
+#undef _WARN
+#undef _ERR
+
+#undef DBG
+#undef INFO
+#undef WARN
+#undef ERR
+
+#define TIZEN_DEBUG_ENABLE
+#define LOG_TAG "zigbee"
+#include <dlog.h>
+
+#ifdef ZB_ENABLE_DAEMON_LOG
+
+#define _DBG(fmt, arg...) SLOGD(IC_LOG_GREEN "<daemon>" IC_LOG_END fmt, ##arg)
+#define _INFO(fmt, arg...) SLOGI(IC_LOG_GREEN "<daemon>" IC_LOG_END fmt, ##arg)
+#define _WARN(fmt, arg...) SLOGW(IC_LOG_GREEN "<daemon>" IC_LOG_END fmt, ##arg)
+#define _ERR(fmt, arg...) SLOGE(IC_LOG_GREEN "<daemon>" IC_LOG_END fmt, ##arg)
+
+#else /* ZB_ENABLE_DAEMON_LOG */
+
+#define _DBG(fmt, arg...) SLOGD(fmt, ##arg)
+#define _INFO(fmt, arg...) SLOGI(fmt, ##arg)
+#define _WARN(fmt, arg...) SLOGW(fmt, ##arg)
+#define _ERR(fmt, arg...) SLOGE(fmt, ##arg)
+
+#endif /* ZB_ENABLE_DAEMON_LOG */
+
+#if 0 /* for console debugging */
+#define _DBG(fmt, arg...) \
+       printf("[zigbee]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
+#define _INFO(fmt, arg...) \
+       printf("[zigbee]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
+#define _WARN(fmt, arg...) \
+       printf("[zigbee]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
+#define _ERR(fmt, arg...) \
+       printf("[zigbee]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
+#endif
+
+#ifdef ZB_ENABLE_CLIENT_LOG
+
+#define FN_CALL _INFO(">>>>>>>> called")
+#define FN_END _INFO("<<<<<<<< ended")
+#define DBG(fmt, arg...) _DBG(fmt, ##arg)
+#define WARN(fmt, arg...) _WARN(IC_LOG_BROWN fmt IC_LOG_END, ##arg)
+#define ERR(fmt, arg...) _ERR(IC_LOG_RED fmt IC_LOG_END, ##arg)
+#define INFO(fmt, arg...) _INFO(IC_LOG_BLUE fmt IC_LOG_END, ##arg)
+#define SECURE_DBG(fmt, arg...) SECURE_SLOGD(fmt, ##arg)
+#define SECURE_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
+
+#else /* ZB_ENABLE_CLIENT_LOG */
+
+#define FN_CALL
+#define FN_END
+#define DBG(fmt, arg...)
+#define WARN(fmt, arg...)
+#define ERR(fmt, arg...) _ERR(fmt, ##arg)
+#define INFO(fmt, arg...)
+#define SECURE_DBG(fmt, arg...)
+#define SECURE_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
+
+#endif /* ZB_ENABLE_CLIENT_LOG */
+
+#define RET_IF(expr) \
+       do { \
+               if (expr) { \
+                       ERR("(%s)", #expr); \
+                       return; \
+               }\
+       } while(0)
+
+#define RETV_IF(expr, val) \
+       do {\
+               if (expr) { \
+                       ERR("(%s)", #expr); \
+                       return (val); \
+               } \
+       } while(0)
+
+#define RETM_IF(expr, fmt, arg...) \
+       do {\
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+                       return; \
+               }\
+       } while(0)
+
+#define RETVM_IF(expr, val, fmt, arg...) \
+       do {\
+               if (expr) { \
+                       ERR(fmt, ##arg); \
+                       return (val); \
+               } \
+       } while(0)
+
+#define ERR_IF(expr) \
+       do { \
+               if (expr) { \
+                       ERR("(%s)", #expr); \
+               } \
+       } while (0)
+
+#define WARN_IF(expr, fmt, arg...) \
+       do { \
+               if (expr) { \
+                       WARN(fmt, ##arg); \
+               } \
+       } while (0)
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_LOG_H__ */
diff --git a/common/zb-utils.c b/common/zb-utils.c
new file mode 100644 (file)
index 0000000..9e56ae5
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <zcl/zb-zcl-type.h>
+
+#include "zb-log.h"
+
+char* zb_utils_strdup(const char *src)
+{
+       char *dest = NULL;
+
+       RETV_IF(NULL == src, NULL);
+
+       errno = 0;
+       dest = strdup(src);
+       if (NULL == dest) {
+               ERR("strdup() Fiil(%d)\n", errno);
+               return NULL;
+       }
+
+       return dest;
+}
diff --git a/common/zb-utils.h b/common/zb-utils.h
new file mode 100644 (file)
index 0000000..0a78999
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_INTERNAL_UTIL_H__
+#define __TIZEN_NETWORK_ZIGBEE_INTERNAL_UTIL_H__
+
+char* zb_utils_strdup(const char *src);
+
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_INTERNAL_UTIL_H__ */
diff --git a/doc/ha/generic_devices/zb-ha-on-off-switch.h b/doc/ha/generic_devices/zb-ha-on-off-switch.h
new file mode 100644 (file)
index 0000000..f9d1339
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_HA_OCCUPANCY_SENSOR_H__
+#define __TIZEN_NETWORK_ZIGBEE_HA_OCCUPANCY_SENSOR_H__
+
+#include <zcl/zb-zcl-on-off-cluster.h>
+#include <zcl/zb-zcl-identify-cluster.h>
+
+/* Table 7.1 Clusters Common to All Devices
+ * +---------------------------------------------------------------------------+
+ * | Server Side                         |              Client Side (see 7.1.4)|
+ * +---------------------------------------------------------------------------+
+ * |                                 Mandatory                                 |
+ * +---------------------------------------------------------------------------+
+ * | Basic                               |                                None |
+ * | Identify                            |                                     |
+ * +---------------------------------------------------------------------------+
+ * |                                 Optional                                  |
+ * +---------------------------------------------------------------------------+
+ * | Clusters with reporting capability  |  Clusters with reporting capability |
+ * | Power Configuration                 |                                Time |
+ * | Device Temperature Configuration    |                        OTA Bootload |
+ * | Alarms                              |                                     |
+ * | Electrical Measurement              |                                     |
+ * | Poll Control                        |                                     |
+ * | Partition                           |                           Partition |
+ * | Manufacturer-specific               |               Manufacturer-specific |
+ * +---------------------------------------------------------------------------+
+ */
+
+/* Table 7.55 Example Features and Functions Supported by the On/Off Switch Device
+ * +----------------------------------------------------------------+----------+
+ * | Device Type/Feature or Function                                |Mandatory/|
+ * |                                                                |Optional  |
+ * +----------------------------------------------------------------+----------+
+ * | Join (end devices and routers only)                            |     M    |
+ * | Form Network (Coordinator only)                                |     M    |
+ * | Allow Others to Join Network (routers and Coordinators only)   |     M    |
+ * | Restore to Factory Fresh Settings                              |     M    |
+ * | Enable Identify Mode                                           |     O    |
+ * | Group Nodes (send out an Add Group If Identify)                |     O    |
+ * | Create Scene (Store Scene)                                     |     O    |
+ * | Service discovery (Match Descriptor Request)                   |     O    |
+ * | ZDP Bind Response                                              |     M    |
+ * | ZDP Unbind Response                                            |     M    |
+ * | End Device Annce/Device Annce                                  |     M    |
+ * | Service Discovery Response (Match Descriptor Response)         |     M    |
+ * | EZ-Mode Commissioning                                          |     M    |
+ * +----------------------------------------------------------------+----------+
+ */
+
+/* Table 7.5 Clusters Supported by the On/Off Switch Device
+ * +---------------------------------------------------------------------------+
+ * | Server Side                         |              Client Side (see 7.1.4)|
+ * +---------------------------------------------------------------------------+
+ * |                                 Mandatory                                 |
+ * +---------------------------------------------------------------------------+
+ * | None                                |          On/Off (suject to binding) |
+ * |                                     |                           Identify  |
+ * +---------------------------------------------------------------------------+
+ * |                                 Optional                                  |
+ * +---------------------------------------------------------------------------+
+ * |                                     |                              Scenes |
+ * |                                     |                              Groups |
+ * | On/Off Switch Configuration         |                                     |
+ * +---------------------------------------------------------------------------+
+ */
+
+/*--------------------------------------------------------------------------------------
+ * Basic Cluster (0x0000 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// Case 1. Add macros to guide how to use ZCL cluster functions.
+#define zb_ha_get_on_off_switch_zcl_version(node_id, dest_ep, cb, user_data) \
+       zb_zcl_basic_get_zcl_version(unsigned short node_id, unsigned char dest_ep, zb_zcl_8u_cb cb, void *user_data);
+#define zb_ha_get_on_off_switch_application_version(node_id, dest_ep, cb, user_data) \
+       zb_zcl_basic_get_application_version(unsigned short node_id, unsigned char dest_ep, zb_zcl_8u_cb cb, void *user_data);
+#define zb_ha_get_on_off_switch_stack_version(node_id, dest_ep, cb, user_data) \
+       zb_zcl_basic_get_stack_version(unsigned short node_id, unsigned char dest_ep, zb_zcl_8u_cb cb, void *user_data);
+#define zb_ha_get_on_off_switch_hw_version(node_id, dest_ep, cb, user_data) \
+       zb_zcl_basic_get_hw_version(unsigned short node_id, unsigned char dest_ep, zb_zcl_8u_cb cb, void *user_data);
+#define zb_ha_get_on_off_switch_manufacturer_name(node_id, dest_ep, cb, user_data) \
+       zb_zcl_basic_get_manufacturer_name(unsigned short node_id, unsigned char dest_ep, zb_zcl_string_cb cb, void *user_data);
+#define zb_ha_get_on_off_switch_model_identifier(node_id, dest_ep, cb, user_data) \
+       zb_zcl_basic_get_model_identifier(unsigned short node_id, unsigned char dest_ep, zb_zcl_string_cb cb, void *user_data);
+#define zb_ha_get_on_off_switch_date_cod(node_id, dest_ep, cb, user_data) \
+       zb_zcl_basic_get_date_code(unsigned short node_id, unsigned char dest_ep, zb_zcl_string_cb cb, void *user_data);
+#define zb_ha_get_on_off_switch_power_source(node_id, dest_ep, cb, user_data) \
+       zb_zcl_basic_get_power_source(unsigned short node_id, unsigned char dest_ep, zb_zcl_8u_cb cb, void *user_data);
+
+// Case 2. Just add comments & examples how to use general ZCL APIs
+/* Example :
+#include <zigbee.h>
+.
+.
+static void get_my_zcl_version_cb(unsigned short node_id, unsigned char src_ep, unsigned char ver, void *user_data)
+{
+       printf("Device ZCL version is %d\n", ver);
+}
+
+static void get_my_manufacturer_name_cb(unsigned short node_id, unsigned char src_ep, const char *name, void *user_data)
+{
+       char *buf = name;
+       printf("Device Manufacturer Name is %s\n", buf);
+}
+
+static void _get_basic_cluster_handler(unsigned short nodeid, unsigned char ep, int attribute_id) {
+       .
+       .
+       switch(attribute_id) {
+               case ZB_ZCL_VERSION_ATTRIBUTE_ID:
+               zb_zcl_basic_get_zcl_version(nodeid, ep, get_my_zcl_version_cb, NULL);
+               break;
+
+               case ZB_ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID:
+               zb_zcl_basic_get_manufacturer_name(nodeid, ep, get_my_manufacturer_name_cb, NULL);
+               break;
+               .
+               .
+       }
+       .
+       .
+       .
+}
+*/
+
+/*--------------------------------------------------------------------------------------
+ * Power Configuration Cluster (0x0001 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------------------
+ * Device Temperature Cluster (0x0002 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------------------
+ * Identify Cluster (0x0003 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// Case 1. Add macros to guide how to use ZCL cluster functions.
+#define zb_ha_on_off_switch_set_identify(node_id, dest_ep, identify_time) \
+    zb_zcl_identify_identify_query( (node_id), (dest_ep), (identif_time))
+
+#define zb_ha_on_off_switch_get_identify_query(node_id, dest_ep, cb, user_data) \
+    zb_zcl_identify_identify_query( (node_id), (dest_ep), (cb), (user_data) )
+
+// Case 2. Just add comments & examples how to use general ZCL APIs
+
+/*--------------------------------------------------------------------------------------
+ * Alarm Cluster (0x0009 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-alarm-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Electrical Measurement Cluster (0x0B04 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------------------
+ * Diagnostic Cluster (0x0B05 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-diagnostic-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Poll-Control Cluster (0x0020 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-poll-control-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Partition Cluster (0x0016 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// To-Do : docs-10-5685-00-zarc-public-telecom-services-specification.pdf
+
+/*--------------------------------------------------------------------------------------
+ * OTA Bootloader Cluster (0x0016 - OUT)
+ *--------------------------------------------------------------------------------------*/
+
+// To-Do : docs-09-5264-23-00zi-zigbee-ota-upgrade-cluster-specification.pdf
+
+/*--------------------------------------------------------------------------------------
+ * On/Off Cluster (0x0006 - OUT)
+ *--------------------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------------------
+ * On/Off Configuration Cluster (0x0007 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// Case 1. Add macros to guide how to use ZCL cluster functions.
+
+/* Attributes */
+#define zb_ha_get_on_off_switch_type(node_id, dest_ep, cb, user_data) \
+       zb_zcl_get_on_off_switch_type( (node_id), (dest_ep), (cb), (user_data) )
+#define zb_ha_get_on_off_switch_action(node_id, dest_ep, cb, user_data) \
+       zb_zcl_get_on_off_switch_action( (node_id), (dest_ep), (cb), (user_data) )
+#define zb_ha_set_on_off_switch_action(node_id, dest_ep, switch_action) \
+       zb_zcl_set_on_off_switch_action( (node_id), (dest_ep), (switch_action) )
+
+/* Commands
+ *  ZB_ZCL_OFF_COMMAND_ID = 0x00, // Ver.: always
+ *  ZB_ZCL_ON_COMMAND_ID = 0x01, // Ver.: always
+ *  ZB_ZCL_TOGGLE_COMMAND_ID = 0x02, // Ver.: always
+ */
+#define zb_ha_cmd_on_off(node_id, dest_ep, cmd_id) \
+       zb_zcl_cmd_on_off_cluster( (node_id), (dest_ep), (cmdid) )
+
+// Case 2. Just add comments & examples how to use general ZCL APIs
+
+/* Example.
+#include <zigbee.h>
+.
+.
+.
+void bulb_off(void)
+{
+       zb_zcl_cmd_on_off(0x1df4, 1, ZB_ZCL_OFF_COMMAND_ID);
+}
+
+void bulb_on(void)
+{
+       zb_zcl_cmd_on_off(0x1df4, 1, ZB_ZCL_ON_COMMAND_ID);
+}
+
+void bulb_toggle(void)
+{
+       zb_zcl_cmd_on_off(0x1df4, 1, ZB_ZCL_TOGGLE_COMMAND_ID);
+}
+*/
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_HA_OCCUPANCY_SENSOR_H__ */
diff --git a/doc/ha/lighting_devices/zb-ha-on-off-light.h b/doc/ha/lighting_devices/zb-ha-on-off-light.h
new file mode 100644 (file)
index 0000000..1ae878a
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_HA_COMBINED_INTERFACE_H__
+ #define __TIZEN_NETWORK_ZIGBEE_HA_COMBINED_INTERFACE_H__
+
+#include <zcl/zb-zcl-on-off-cluster.h>
+#include <zcl/zb-zcl-identify-cluster.h>
+
+/* Table 7.1 Clusters Common to All Devices
+ * +---------------------------------------------------------------------------+
+ * | Server Side                         |              Client Side (see 7.1.4)|
+ * +---------------------------------------------------------------------------+
+ * |                                 Mandatory                                 |
+ * +---------------------------------------------------------------------------+
+ * | Basic                               |                                None |
+ * | Identify                            |                                     |
+ * +---------------------------------------------------------------------------+
+ * |                                 Optional                                  |
+ * +---------------------------------------------------------------------------+
+ * | Clusters with reporting capability  |  Clusters with reporting capability |
+ * | Power Configuration                 |                                Time |
+ * | Device Temperature Configuration    |                        OTA Bootload |
+ * | Alarms                              |                                     |
+ * | Electrical Measurement              |                                     |
+ * | Poll Control                        |                                     |
+ * | Partition                           |                           Partition |
+ * | Manufacturer-specific               |               Manufacturer-specific |
+ * +---------------------------------------------------------------------------+
+ */
+
+/* Table 7.41 Example Features and Functions Supported by the On/Off Light Device
+ * +----------------------------------------------------------------+----------+
+ * | Device Type/Feature or Function                                |Mandatory/|
+ * |                                                                |Optional  |
+ * +----------------------------------------------------------------+----------+
+ * | Join (end devices and routers only)                            |     M    |
+ * | Form Network (Coordinator only)                                |     M    |
+ * | Allow Others to Join Network (routers and Coordinators only)   |     M    |
+ * | Restore to Factory Fresh Settings                              |     M    |
+ * | Enable Identify Mode                                           |     O    |
+ * | Group Nodes (send out an Add Group If Identify)                |     M    |
+ * | Create Scene (Store Scene)                                     |     O    |
+ * | Service discovery (Match Descriptor Request)                   |     M    |
+ * | ZDP Bind Response                                              |     M    |
+ * | ZDP Unbind Response                                            |     M    |
+ * | End Device Annce/Device Annce                                  |     M    |
+ * | Service Discovery Response (Match Descriptor Response)         |     M    |
+ * | EZ-Mode Commissioning                                          |     M    |
+ * +----------------------------------------------------------------+----------+
+ */
+
+/* Table 7.40 Clusters Supported by the On/Off Light Device
+ * +---------------------------------------------------------------------------+
+ * | Server Side                         |              Client Side (see 7.1.4)|
+ * +---------------------------------------------------------------------------+
+ * |                                 Mandatory                                 |
+ * +---------------------------------------------------------------------------+
+ * | On/Off                              |                                None |
+ * | Scenes                              |                                     |
+ * | Groups                              |                                     |
+ * +---------------------------------------------------------------------------+
+ * |                                 Optional                                  |
+ * +---------------------------------------------------------------------------+
+ * | None                                |                   Occupancy Sensing |
+ * +---------------------------------------------------------------------------+
+ */
+
+/*--------------------------------------------------------------------------------------
+ * Basic Cluster (0x0000 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail zb-zcl-basic-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Power Configuration Cluster (0x0001 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-power-configuration-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Device Temperature Cluster (0x0002 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-device-temperature-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Identify Cluster (0x0003 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-identify-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Alarm Cluster (0x0009 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-alarm-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Electrical Measurement Cluster (0x0B04 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------------------
+ * Diagnostic Cluster (0x0B05 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-diagnostic-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Poll-Control Cluster (0x0020 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-poll-control-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Partition Cluster (0x0016 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// To-Do : docs-10-5685-00-zarc-public-telecom-services-specification.pdf
+
+/*--------------------------------------------------------------------------------------
+ * OTA Bootloader Cluster (0x0016 - OUT)
+ *--------------------------------------------------------------------------------------*/
+
+// To-Do : docs-09-5264-23-00zi-zigbee-ota-upgrade-cluster-specification.pdf
+
+/*--------------------------------------------------------------------------------------
+ * On/Off Cluster (0x0006 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-on-off-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Groups Cluster (0x0004 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-group-cluster.h
+
+/*--------------------------------------------------------------------------------------
+ * Scenes Cluster (0x0005 - IN)
+ *--------------------------------------------------------------------------------------*/
+
+// See detail : zb-zcl-scene-cluster.h
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_HA_COMBINED_INTERFACE_H__ */
diff --git a/include/zb-custom.h b/include/zb-custom.h
new file mode 100644 (file)
index 0000000..3e68b0a
--- /dev/null
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_CUSTOM_H__
+#define __TIZEN_NETWORK_ZIGBEE_CUSTOM_H__
+
+/**
+ * @file zb-custom.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_CUSTOM_MODULE ZigBee Custom Commands
+ *
+ * @brief zigbee provides API for custom command.
+ *
+ * @section CAPI_NETWORK_ZIGBEE_CUSTOM_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_CUSTOM_MODULE_OVERVIEW Overview
+ * This API set consists of ZigBee custom command API
+ *
+ * @{
+ */
+
+/**
+ * @brief The response of custom command function
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] src_ep source end-point (ex. 1)
+ * @param[out] dst_ep destination end-point (ex. 1)
+ * @param[out] cluster_id ZCL cluster id
+ * @param[out] profile_id Profile id
+ * @param[out] payload_len Length of payload
+ * @param[out] payload Payload data
+ * @param[out] user_data User data
+ *
+ * @see zb_aps_send()
+ */
+typedef void (*zb_aps_send_rsp)(
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned short cluster_id,
+               unsigned short profile_id,
+               unsigned short payload_len,
+               unsigned char *payload,
+               void *user_data);
+
+/**
+ * @brief The response of custom command function
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] src_ep source end-point (ex. 1)
+ * @param[out] dst_ep destination end-point (ex. 1)
+ * @param[out] cluster_id ZCL cluster id
+ * @param[out] profile_id Profile id
+ * @param[out] payload_len Length of payload
+ * @param[out] payload Payload data
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_send()
+ */
+typedef void (*zb_zcl_send_rsp)(
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned short cluster_id,
+               unsigned short profile_id,
+               unsigned short payload_len,
+               unsigned char *payload,
+               void *user_data);
+
+/**
+ * @brief The response of custom command function
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] length The length of data
+ * @param[out] data Received data
+ * @param[out] user_data User data
+ *
+ * @see zb_send_to_local()
+ */
+typedef void (*zb_send_to_local_rsp)(
+               unsigned short length,
+               unsigned char *data,
+               void *user_data);
+
+/**
+ * @brief Send custom data
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle Handle of node descriptor
+ * @param[in] addr16 Network address
+ * @param[in] aps_frame_ctl APS Frame control bits. \n
+ *            - Delivery Mode : \n
+ *            #ZB_APS_DELIVERY_UNICAST \n
+ *            #ZB_APS_DELIVERY_INDIRECT \n
+ *            #ZB_APS_DELIVERY_BROADCAST \n
+ *            #ZB_APS_DELIVERY_MULTICAST \n
+ *            - ACK Request : \n
+ *            #ZB_APS_NO_ACK_REQUEST \n
+ *            #ZB_APS_ACK_REQUEST
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] profile_id Profile id
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE
+ * @param[in] mfg_code Manufacturer Code
+ * @param[in] payload_len Length of payload
+ * @param[in] payload Payload data
+ * @param[in] cb Callback function to get response.
+ * @param[in] user_data User data to be received from callback function.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_aps_send_rsp()
+ */
+int zb_aps_send(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char aps_frame_ctl,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned short cluster_id,
+               unsigned short profile_id,
+               unsigned char zcl_frame_ctl,
+               unsigned short mfg_code,
+               unsigned short payload_len,
+               unsigned char *payload,
+               zb_aps_send_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Send custom data
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle Handle of node descriptor
+ * @param[in] addr16 Network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE
+ * @param[in] cmd APL Command
+ * @param[in] payload_len Length of payload
+ * @param[in] payload Payload data
+ * @param[in] cb Callback function to get response.
+ * @param[in] user_data User data to be received from callback function.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_send_rsp()
+ */
+int zb_zcl_send(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned short cluster_id,
+               unsigned char zcl_frame_ctl,
+               unsigned char cmd,
+               unsigned short payload_len,
+               unsigned char *payload,
+               zb_zcl_send_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Send custom data
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] length The length of data
+ * @param[in] data Data to send
+ * @param[in] cb Callback function to get response.
+ * @param[in] user_data User data to be received from callback function.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_send_to_local_rsp()
+ */
+int zb_send_to_local(
+               zigbee_h handle,
+               unsigned short length,
+               unsigned char *data,
+               zb_send_to_local_rsp cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_CUSTOM_H__ */
diff --git a/include/zb-error.h b/include/zb-error.h
new file mode 100644 (file)
index 0000000..7f4f12f
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __CAPI_NETWORK_ZIGBEE_ERROR_H__
+#define __CAPI_NETWORK_ZIGBEE_ERROR_H__
+
+#include <tizen_error.h>
+
+#ifndef TIZEN_ERROR_ZIGBEE
+#define TIZEN_ERROR_ZIGBEE 0x02000000
+#endif
+
+/**
+ * @file zb-error.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_MODULE
+ * @brief Enumeration for zigbee error code.
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+typedef enum
+{
+       ZIGBEE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+       ZIGBEE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_ZIGBEE | 0x01, /**< parameter error */
+       ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE = TIZEN_ERROR_ZIGBEE | 0x03, /**< out of range error */
+       ZIGBEE_ERROR_INVALID_ENDPOINT = TIZEN_ERROR_ZIGBEE | 0x04, /**< endpoint 0 is reserved for ZDP */
+       ZIGBEE_ERROR_INVALID_ADDRESS = TIZEN_ERROR_ZIGBEE | 0x05, /**< wrong address */
+       ZIGBEE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_ZIGBEE | 0x6, /**< out of memory */
+       ZIGBEE_ERROR_INVALID_DATA = TIZEN_ERROR_ZIGBEE | 0x7, /**< Invalid data available */
+       ZIGBEE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< DBus error */
+       ZIGBEE_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */
+       ZIGBEE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< not supported */
+} zb_error_e;
+
+/**
+ * @}
+ */
+
+#endif /* __CAPI_NETWORK_ZIGBEE_ERROR_H__ */
diff --git a/include/zb-ha.h b/include/zb-ha.h
new file mode 100644 (file)
index 0000000..21a5274
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_HA_H__
+#define __TIZEN_NETWORK_ZIGBEE_HA_H__
+
+/**
+ * @brief HA profile id
+ *
+ * @since_tizen 3.0
+ */
+#define ZB_HA_PROFILE_ID 0x0104
+
+/**
+ * @brief Devices specified the HA profile
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       /* General devices */
+       ZB_HA_ON_OFF_SWITCH = 0x0000,
+       ZB_HA_LEVEL_CONTROL_SWITCH = 0x0001,
+       ZB_HA_ON_OFF_OUTPUT = 0x0002,
+       ZB_HA_LEVEL_CONTROLLABLE_OUTPUT = 0x0003,
+       ZB_HA_SCENE_SELECOTOR = 0x0004,
+       ZB_HA_CONFIGURATION_TOOL = 0x0005,
+       ZB_HA_REMOTE_CONTROL = 0x0006,
+       ZB_HA_COMBINED_INTERFACE = 0x0007,
+       ZB_HA_RANGE_EXTENDER = 0x0008,
+       ZB_HA_MAINS_POWER_OUTLET = 0x0009,
+       ZB_HA_DOOR_LOCK = 0x000A,
+       ZB_HA_DOOR_LOCK_CONTROLLER = 0x000B,
+       ZB_HA_SIMPLE_SENSOR = 0x000C,
+       ZB_HA_CONSUMPTION_AWARENESS_DEVICE = 0x000D,
+       ZB_HA_HOME_GATEWAY = 0x0050,
+       ZB_HA_SMART_PLUG = 0x0051,
+       ZB_HA_WHITE_GOODS = 0x0052,
+       ZB_HA_METER_INTERFACE = 0x0053,
+       /* Lighting devices */
+       ZB_HA_ON_OFF_LIGHT = 0x0100,
+       ZB_HA_DIMMABLE_LIGHT = 0x0101,
+       ZB_HA_COLOR_DIMMABLE_LIGHT = 0x0102,
+       ZB_HA_ON_OFF_LIGHT_SWITCH = 0x0103,
+       ZB_HA_DIMMER_SWITCH = 0x0104,
+       ZB_HA_COLOR_DIMMER_SWITCH = 0x0105,
+       ZB_HA_LIGHT_SENSOR = 0x0106,
+       ZB_HA_OCUPANCY_SENSOR = 0x0107,
+       /* Closures devices */
+       ZB_HA_SHADE = 0x0200,
+       ZB_HA_SHADE_CONTROLLER = 0x0201,
+       ZB_HA_WINDOW_COVERING_DEVICE = 0x0202,
+       ZB_HA_WINDOW_COVERING_CONTROLLER = 0x0203,
+       /* HVAC devices */
+       ZB_HA_HEATING_COLLING_UNIT = 0x0300,
+       ZB_HA_THERMOSTAT = 0x0301,
+       ZB_HA_TEMPERATURE_SENSOR = 0x0302,
+       ZB_HA_PUMP = 0x0303,
+       ZB_HA_PUMP_CONTROLLER = 0x0304,
+       ZB_HA_PRESSURE_SENSOR = 0x0305,
+       ZB_HA_FLOW_SENSOR = 0x0306,
+       ZB_HA_MINI_SPLIT_AC = 0x0307,
+       /* Intruder Alarms system */
+       ZB_HA_ISA_CONTROL_AND_INDICATING_EQUIPMENT = 0x0400,
+       ZB_HA_ISA_ANCILLARY_CONTROL_EQUIPMENT = 0x0401,
+       ZB_HA_ISA_ZONE = 0x0402,
+       ZB_HA_ISA_WARNIGN_DEVICE = 0x0403,
+} ha_device_id_e;
+
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_HA_H__ */
diff --git a/include/zb-type.h b/include/zb-type.h
new file mode 100644 (file)
index 0000000..52ef0f6
--- /dev/null
@@ -0,0 +1,411 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __CAPI_NETWORK_ZIGBEE_CONSTANT_H__
+#define __CAPI_NETWORK_ZIGBEE_CONSTANT_H__
+
+#include <tizen_type.h>
+
+/**
+ * @file zb-type.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_COMMON_MODULE Common
+ *
+ * @brief zigbee common types provides the set of definitions to use zigbee service
+ *
+ * @section CAPI_NETWORK_ZIGBEE_COMMON_MODULE_HEADER header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_COMMON_MODULE_HEADER_OVERVIEW overview
+ * This API set consists of data structures and types
+ *
+ * @{
+ */
+
+/**
+ * @brief Data type abbreviation : 8 bit value
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char v1;
+/**
+ * @brief Data type abbreviation : 16 bit value
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char v2[2];
+/**
+ * @brief Data type abbreviation : 24 bit value
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char v3[3];
+/**
+ * @brief Data type abbreviation : 32 bit value
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char v4[4];
+/**
+ * @brief Data type abbreviation : 40 bit value
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char v5[5];
+/**
+ * @brief Data type abbreviation : 48 bit value
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char v6[6];
+/**
+ * @brief Data type abbreviation : 56 bit value
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char v7[7];
+/**
+ * @brief Data type abbreviation : 64 bit value
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char v8[8];
+
+/**
+ * @brief Data type abbreviation : IEEE Address
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char ieee_addr[8];
+/**
+ * @brief Data type abbreviation : Network Address
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned short nwk_addr;
+
+/**
+ * @brief Data type abbreviation : 128 bit security key
+ *
+ * @since_tizen 3.0
+ */
+typedef unsigned char aes128_key[16];
+
+/**
+* @brief The handle of zigbee
+* @details a zigbee_h is an opaque data structure.\n
+* zigbee_h is a data type of zigbee's response which consists of result, handler and etc.
+*
+* @since_tizen 3.0
+*/
+typedef struct zbl_zigbee_s* zigbee_h;
+
+/**
+ * @brief Events for zb_event_cb
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_ENABLE_EVENT = 0x00, /**< This event is received after enabling zigbee system service */
+       ZB_ZDP_FORM_NETWORK_DONE = 0x01, /**< This event comes from coming network operation completed */
+       ZB_ZDP_JOIN_EVENT = 0x02, /**< This event takes place when new device joined */
+       ZB_ZDP_REJOIN_EVENT = 0x03, /**< This event takes place when existing device or devices which is(are) received 'leave_network' command is re-joined */
+       ZB_ZDP_CHILD_LEFT = 0x04, /**< This event takes place when a child device leave current network explicitly */
+       ZB_ZDP_LEAVE_DONE_EVENT = 0x05, /**< This event will take place after dismiss current network */
+       ZB_ZDP_UPDATED_NETWORK_NOTIFICATION_EVENT = 0x06, /**< A device updated its network information */
+       ZB_ZDP_BIND_RSP_EVENT = 0x07, /**< Binding end-points result */
+       ZB_ZDP_UNBIND_RSP_EVENT = 0x08, /**< Unbinding end-points result */
+       ZB_ZCL_GLOBAL_DEFAULT_RSP_EVENT = 0x10, /**< This event is used when global default response */
+       ZB_ZCL_GLOBAL_ATTRIBUTE_REPORT_EVENT = 0x11, /**< This event is took place when report attribute command received */
+       ZB_ZCL_ALARM_EVENT = 0x20, /**< Events related to alarm cluster */
+       ZB_ZCL_IAS_ZONE_ENROLL_REQUEST_EVENT = 0x21, /**< A Device which supports IAS zone cluster want to register its ability */
+       ZB_ZCL_IAS_ZONE_STATUS_CHANGE_NOTIFICATION_EVENT = 0x22, /**< A Device which supports IAS zone cluster notifies its status change */
+       ZB_ZCL_IAS_ZONE_STATUS_CHANGE_EXTENDED_NOTIFICATION_EVENT = 0x23, /**< A Device which supports IAS zone cluster notifies its status change */
+       ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_ATTRIBUTE_REPORT_EVENT = 0x30, /**< (Confusint) This event will be received after level control cluster attribute changed */
+       ZB_ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_REPORT_EVENT = 0x31, /**< This event will be received after color control cluster X attribute changed */
+       ZB_ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_REPORT_EVENT = 0x32, /**< This event will be received after color control cluster Y attribute changed */
+       ZB_ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_REPORT_EVENT = 0x33, /**< This event will be received after color control cluster hue attribute changed */
+       ZB_ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_REPORT_EVENT = 0x34, /**< This event will be received after color control cluster saturation attribute changed */
+       ZB_ZCL_COLOR_CONTROL_CURRENT_TEMPERATURE_ATTRIBUTE_REPORT_EVENT = 0x35, /**< This event will be received after color control cluster temperature attribute changed */
+       ZB_ZCL_DOOR_LOCK_OPERATIONAL_NOTIFICATION_EVENT = 0x40, /**< This event is received when door-lock operation has been finished */
+       ZB_ZCL_DOOR_LOCK_PROGRAMING_NOTIFICATION_EVENT = 0x41, /**< This event is received when door-lock programming has been changed */
+       ZB_ZCL_SIMPLE_METERING_REMOVE_MIRROR_EVENT = 0x51, /**< This event is used to request the ESP to remove its mirror of Metering */
+       ZB_ZCL_SIMPLE_METERING_REQUEST_MIRROR_EVENT = 0x52, /**< This event is used to request the ESP to mirror Metering Device data */
+} zb_event_e;
+
+/**
+ * @brief The structure type for the ZB_ZDP_ENABLE_EVENT callback data.
+ * @details The result of enabling zigbee system service.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char status; /**< Status of enabling zigbee system service */
+} zb_event_enable_s;
+
+/**
+ * @brief The structure type for the ZB_ZDP_FORM_NETWORK_DONE callback data.
+ * @details This event comes from coming network operation completed.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       nwk_addr pan_id; /**< Pan ID */
+} zb_event_form_network_s;
+
+/**
+ * @brief The structure type for the ZB_ZDP_JOIN_EVENT callback data.
+ * @details This event takes place when new device joined.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char count; /**< Number of endpoint list */
+       unsigned char ep[10]; /**< Endpoint list */
+} zb_event_join_s;
+
+/**
+ * @brief The structure type for the ZB_ZDP_CHILD_LEFT callback data.
+ * @details This event takes place when a child device leave current network explicitly.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char status; /**< Left status of child device */
+} zb_event_child_left_s;
+
+/**
+ * @brief The structure type for the ZB_ZCL_GLOBAL_DEFAULT_RSP_EVENT callback data.
+ * @details This event is used when global default response.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char ep;
+       unsigned short cluster_id;
+       unsigned char command_id;
+       unsigned char status;
+} zb_event_global_default_rsp_s;
+
+/**
+ * @brief The structure type for the ZB_ZCL_GLOBAL_ATTRIBUTE_REPORT_EVENT callback data.
+ * @details This event is took place when report attribute command received.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       void* records; /**< Array of attribute report record */
+       unsigned char count; /**< count of records */
+} zb_event_global_attr_report_s;
+
+/**
+ * @brief The structure type for the ZB_ZCL_ALARM_EVENT callback data.
+ * @details This event is related to alarm cluster.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned short count; /**< Alarm count */
+} zb_event_alarm_s;
+
+/**
+ * @brief The structure type for the ZB_ZCL_IAS_ZONE_ENROLL_REQUEST_EVENT callback data.
+ * @details A Device which supports IAS zone cluster want to register its ability.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char src_ep; /**< Source endpoint */
+       unsigned short zone_type; /**< Zone type 0x0000 : Standard CIE / Alarm1 - System Alarm, Alarm2 - N/A\n
+                                                               *  0x000d : Motion Sensor / Alarm1 - Intrusion indication, Alarm2 - Presence indication\n
+                                                               *  0x0015 : Contact switch / Alarm1 - 1st portal Open-Close, Alarm2 - 2nd portal Open-Close\n
+                                                               *  0x0028 : Fire sensor / Alarm1 - Fire indication, Alarm2 - N/A\n
+                                                               *  0x002a : Water sensor / Alarm1 - Water overflow indication, Alarm2 - N/A\n
+                                                               *  0x002b : Gas Sensor / Alarm1 - CO indication, Alarm2 - Cooking indication\n
+                                                               *  0x002c : Personal emergency Sensor / Alarm1 - Fall / Concussion, Alarm2 - Emergency button\n
+                                                               *  0x002d : Vibration or Movement Sensor / Alarm1 - Movement indication, Alarm2 - Vibration\n
+                                                               *  0x010f : Remote control / Alarm1 - Panic, Alarm2 - Emergency\n
+                                                               *  0x0115 : Key fob / Alarm1 - Panic, Alarm2 - Emergency\n
+                                                               *  0x021d : Keypad / Alarm1 - Panic, Alarm2 - Emergency\n
+                                                               *  0x0225 : Standard Warning Device (see. EN 50131 European Standards Series for Intruder Alarm Systems)
+                                                               *           / Alarm1 - N/A, Alarm2 -N/A\n
+                                                               *  0x8000~0xfffe : Reserved for manufacturer specific types / Alarm1 - N/A, Alarm2 - N/A\n
+                                                               *  0xffff : Invalid Zone Type / Alarm1 - N/A, Alarm2 - N/A\n */
+       unsigned char mfg_code; /**< Manufacturer Code */
+} zb_event_ias_enroll_request_s;
+
+/**
+ * @brief The structure type for the ZB_ZCL_IAS_ZONE_STATUS_CHANGE_NOTIFICATION_EVENT callback data.
+ * @details A Device which supports IAS zone cluster notifies its status change.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char src_ep; /**< Source endpoint */
+       unsigned short zone_status; /**<  zone_status Bit 0 : Alarm1 : 1 - opened or alarmed / 0 - closed or not alarmed\n
+                                                               *   Bit 1 : Alarm2 : 1 - opened or alarmed / 0 - closed or not alarmed\n
+                                                               *   Bit 2 : Temper : 1 - Tempered / 0 - Not tempered\n
+                                                               *   Bit 3 : Battery : 1 - Low batter / 0 - Battery OK\n
+                                                               *   Bit 4 : Supervision report : 1 - Report / 0 - Does not report\n
+                                                               *   Note 1: This bit indicates whether the Zone issues periodic Zone Status Change\n
+                                                               *   Notification commands. The CIE device may use these periodic reports as an\n
+                                                               *   indication that a zone is operational. Zones that do not implement the periodic\n
+                                                               *   reporting are required to set this bit to zero (the CIE will know not to interpret the\n
+                                                               *   lack of reports as a problem).\n
+                                                               *   Bit 5 : Restore reports : 1 - Reports restore / 0 - Does not report restore\n
+                                                               *   Note 2: This bit indicates whether or not a Zone Status Change Notification\n
+                                                               *   command will be sent to indicate that an alarm is no longer present. Some Zones\n
+                                                               *   do not have the ability to detect that alarm condition is no longer present, they\n
+                                                               *   only can tell that an alarm has occurred. These Zones must set the "Restore" bit to\n
+                                                               *   zero, indicating to the CIE not to look for alarm-restore notifications.\n
+                                                               *   Bit 6 : Trouble : 1 - Trouble/Failure / 0 - OK\n
+                                                               *   Bit 7 : AC(mains) : 1 - ACMains fault / 0 - AC/Mains OK\n */
+} zb_event_ias_noti_s;
+
+/**
+ * @brief The structure type for the ZB_ZCL_IAS_ZONE_STATUS_CHANGE_EXTENDED_NOTIFICATION_EVENT callback data.
+ * @details A Device which supports IAS zone cluster notifies its status change.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       unsigned char src_ep; /**< Source endpoint */
+       unsigned char extended_status; /**< Extended status */
+       unsigned short zone_status; /**< Zone status */
+       unsigned short delay; /**< Delay */
+       unsigned char zone_id; /**< Zone ID */
+} zb_event_ias_extended_noti_s;
+
+/**
+ * @brief The structure type for response data of zb_event_cb.
+ * @details This function can receive events from the devices in the network.
+ * ex) join, re-join, leave and attribute change report
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       union {
+               zb_event_enable_s *enable; /**< The result of enabling zigbee system service. */
+               zb_event_form_network_s *form_network; /**< This event comes from coming network operation completed. */
+               zb_event_join_s *join; /**< This event takes place when new device joined. */
+               zb_event_child_left_s *child_left; /**< This event takes place when a child device leave current network explicitly. */
+               zb_event_global_default_rsp_s *global_default_rsp; /**< This event is used when global default response. */
+               zb_event_global_attr_report_s *global_attr_report; /**< This event is took place when report attribute command received. */
+               zb_event_alarm_s *alarm; /**< This event is related to alarm cluster. */
+               zb_event_ias_enroll_request_s *ias_enroll_request; /**< A Device which supports IAS zone cluster want to register its ability. */
+               zb_event_ias_noti_s *ias_noti; /**< A Device which supports IAS zone cluster notifies its status change. */
+               zb_event_ias_extended_noti_s *ias_extended_noti; /**< A Device which supports IAS zone cluster notifies its status change. */
+       } data;
+} zb_event_data_s;
+
+/**
+ * @brief APS Delivery Mode
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_APS_DELIVERY_UNICAST = 0, /**< Unicast delivery */
+       ZB_APS_DELIVERY_INDIRECT = 1, /**< Indirect delivery */
+       ZB_APS_DELIVERY_BROADCAST = 2, /**< Broadcast delivery */
+       ZB_APS_DELIVERY_MULTICAST = 3 /**< Multicast delivery */
+} zb_aps_delivery_mode;
+
+/**
+ * @brief APS ACK Request
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_APS_NO_ACK_REQUEST = (0 << 6), /**< Not request ACK */
+       ZB_APS_ACK_REQUEST = (1 << 6), /**< Request ACK */
+} zb_aps_ack_request;
+
+/**
+ * @brief Frame type at ZCL Header
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_FC_GLOBALLY_USED = (0 << 0), /**< profile widely used */
+       ZB_APS_FC_CLUSTER_SPECIFIC = (1 << 0), /**< cluster specific */
+} zb_zcl_fc_type_e;
+
+/**
+ * @brief Manufacturer specific or not at ZCL Header
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_FC_NOT_MANUFACTURER = (0 << 2), /**< manufacturer code not present */
+       ZB_ZCL_FC_MANUFACTURER = (1 << 2), /**< manufacturer code present */
+} zb_zcl_fc_manufacturer_present_e;
+
+/**
+ * @brief Request or Response at ZCL Header
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_CLIENT_TO_SERVER = (0 << 3), /**< request */
+       ZB_ZCL_SERVER_TO_CLIENT = (1 << 3), /**< response */
+} zb_zcl_fc_direction_e;
+
+/**
+ * @brief Disable default response or not at ZCL Header
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_LEAVE_WELL_ALONE = (0 << 4), /**< enable default response */
+       ZB_ZCL_DISABLE_DEFAULT_RESPONSE = (1 << 4), /**< disable default response */
+} zb_zcl_fc_disable_default_response_e;
+
+/**
+ * @brief default ZCL frame control at APS Header
+ *
+ * @since_tizen 3.0
+ */
+#define ZB_ZCL_FC_DEFAULT 0x00 /**< Generally used / Not manufacture / Request / with Default Response */
+
+/**
+ * @brief Broadcast address to all router device
+ *
+ * @since_tizen 3.0
+ */
+#define ZB_BROADCAST_ADDRESS 0xFFFC /**< Broadcast to all routers. */
+
+/**
+ * @brief Broadcast address to devices which support 'rx_on_idle' feature
+ *
+ * @since_tizen 3.0
+ */
+#define ZB_RX_ON_WHEN_IDLE_BROADCAST_ADDRESS 0xFFFD /**< Broadcast to all non-sleepy devices. */
+
+/**
+ * @brief Broadcast address to all devices
+ *
+ * @since_tizen 3.0
+ */
+#define ZB_SLEEPY_BROADCAST_ADDRESS 0xFFFF /**< Broadcast to all devices, including sleepy end devices. */
+
+/**
+ * @}
+ */
+
+#endif /* __CAPI_NETWORK_ZIGBEE_CONSTANT_H__ */
diff --git a/include/zb-zcl.h b/include/zb-zcl.h
new file mode 100644 (file)
index 0000000..87f683a
--- /dev/null
@@ -0,0 +1,2658 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_H__
+
+/**
+ * @file zb-zcl.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE Zigbee Cluster Library
+ *
+ * @brief zigbee provides API for ZCL access.
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_MODULE_OVERVIEW Overview
+ * This API set consists of ZCL access API
+ *
+ * @{
+ */
+#include <zcl/zb-zcl-type.h>
+#include <zcl/zb-zcl-commands.h>
+#include <zcl/zb-zcl-cluster-ids.h>
+#include <zcl/zb-zcl-attribute-ids.h>
+#include <zcl/zb-zcl-attribute-type.h>
+#include <zcl/zb-zcl-global-commands.h>
+#include <zcl/zb-zcl-alarm-cluster.h>
+#include <zcl/zb-zcl-color-control-cluster.h>
+#include <zcl/zb-zcl-basic-cluster.h>
+#include <zcl/zb-zcl-groups-cluster.h>
+#include <zcl/zb-zcl-identify-cluster.h>
+#include <zcl/zb-zcl-level-control-cluster.h>
+#include <zcl/zb-zcl-on-off-cluster.h>
+#include <zcl/zb-zcl-poll-control-cluster.h>
+#include <zcl/zb-zcl-scenes-cluster.h>
+#include <zcl/zb-zcl-simple-metering-cluster.h>
+#include <zcl/zb-zcl-thermostat-cluster.h>
+#include <zcl/zb-zcl-ias-zone-cluster.h>
+
+/**
+ * @brief Return readable cluster name for human
+ * @details Return Zigbee Cluster name and ID
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] id ZigBee Cluster ID
+ *
+ * @return pointer of cluster name string
+ *
+ */
+const char* zb_get_cluster_name(int id);
+
+/**
+ * @brief Return measuring unit of attribute type
+ * @details this help to know measuring unit of attribute type
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] type attribute type
+ *
+ * @return #zb_zcl_data_category_e
+ * @retval #DATA_TYPE_NONE Data type none
+ * @retval #DATA_TYPE_DISCRETE Discrete data type
+ * @retval #DATA_TYPE_ANALOG Analog data type
+ *
+ */
+int zb_get_analog_or_discret(unsigned char type);
+
+/**
+ * @brief Return attribute size
+ * @details Return size of attribute data
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] type attribute type
+ *
+ * @return size of attribute data type
+ *
+ */
+int zb_get_data_size(unsigned char type);
+
+/**
+ * @brief create simple value data
+ * @details The simple value data shall contain the data type of the attribute value
+ * according to the data type in (see Table 2.16).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple data value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_destroy_value()
+ */
+int zb_create_value(
+               zb_value_h *handle);
+
+/**
+ * @brief destroy simple value data
+ * @details Remove allocated memory for simple value data
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple data value
+ *
+ * @return None
+ *
+ * @see zb_create_value()
+ */
+void zb_destroy_value(
+               zb_value_h handle);
+
+/**
+ * @brief set value from zb_value_h
+ * @details get data from zb_value_h, expected value type as follows : \n
+ * val : 16 byte buffer \n
+ * ieee_addr addr64 : 64-bit IEEE address \n
+ * aes128_key key16 : 128-bit key \n
+ * str :  for 1 byte string \n
+ *  -> 1st byte is string length, the other are string data.) \n
+ * wstr : for 2 byte string \n
+ *  -> 1st 2 byte are string length, the other are string data.) \n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of value structure
+ * @param[in] type data type : \n
+ * @param[in] value read buffer
+ * @param[in] count number of read buffer
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ */
+int zb_set_value(zb_value_h handle, unsigned char type, unsigned char *value, int count);
+
+/**
+ * @brief get value from zb_value_h
+ * @details get data from zb_value_h, expected value type as follows : \n
+ * val : 16 byte buffer \n
+ * struct attribute_str_s *str :  for 1 byte string \n
+ *  -> 1st byte is string length, the other are string data.) \n
+ * struct attribute_wstr_s *wstr : for 2 byte string \n
+ *  -> 1st 2 byte are string length, the other are string data.) \n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of value structure
+ * @param[out] type data type
+ * @param[out] value read buffer
+ * @param[out] count number of read buffer
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ */
+int zb_get_value(zb_value_h handle, unsigned char *type, unsigned char **value, int *count);
+
+/**
+ * @brief create read attribute status record
+ * @details This allocates heap for read attribute status record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ */
+int zb_create_read_attr_status_record(read_attr_status_record_h *handle);
+
+/**
+ * @brief destroy read attribute status record
+ * @details This destroys read attribute status record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ */
+void zb_destroy_read_attr_status_record(read_attr_status_record_h handle);
+
+/**
+ * @brief get identifier from read attribute status record
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that has been read (or of which an element has been read).
+ * \n\n This field shall contain the same value that was included in the corresponding a
+ * ttribute identifier field of the original read attributes or read attributes structured
+ * command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[out] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_set_id_to_read_attr_status_record()
+ * @see zb_set_status_to_read_attr_status_record()
+ * @see zb_set_type_to_read_attr_status_record()
+ * @see zb_set_value_to_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ */
+int zb_get_id_from_read_attr_status_record(
+               read_attr_status_record_h handle,
+               unsigned short* id);
+
+/**
+ * @brief set identifier to read attribute status record
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that has been read (or of which an element has been read).
+ * \n\n This field shall contain the same value that was included in the corresponding a
+ * ttribute identifier field of the original read attributes or read attributes structured
+ * command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[in] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_set_status_to_read_attr_status_record()
+ * @see zb_set_type_to_read_attr_status_record()
+ * @see zb_set_value_to_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ */
+int zb_set_id_to_read_attr_status_record(
+               read_attr_status_record_h handle,
+               unsigned short id);
+
+/**
+ * @brief get identifier from read attribute status record
+ * @details The status field is 8 bits in length and specifies the status of the read
+ * operation on this attribute. \n\n This field shall be set to SUCCESS, if the operation
+ * was successful, or an error code, as specified in zb_zcl_status_e if the operation was
+ * not successful.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[out] status error code @see #zb_zcl_status_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_set_id_to_read_attr_status_record()
+ * @see zb_set_status_to_read_attr_status_record()
+ * @see zb_set_type_to_read_attr_status_record()
+ * @see zb_set_value_to_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ */
+int zb_get_status_from_read_attr_status_record(
+               read_attr_status_record_h handle,
+               unsigned char* status);
+
+/**
+ * @brief set identifier to read attribute status record
+ * @details The status field is 8 bits in length and specifies the status of the read
+ * operation on this attribute. \n\n This field shall be set to SUCCESS, if the operation
+ * was successful, or an error code, as specified in zb_zcl_status_e if the operation was
+ * not successful.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[in] status error code @see #zb_zcl_status_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_set_id_to_read_attr_status_record()
+ * @see zb_set_type_to_read_attr_status_record()
+ * @see zb_set_value_to_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ */
+int zb_set_status_to_read_attr_status_record(
+               read_attr_status_record_h handle,
+               unsigned char status);
+
+
+/**
+ * @brief get identifier from read attribute status record
+ * @details The attribute data type field shall contain the data type of the attribute
+ * in the same read attributes status record (see Table 2.16). \n\n This field shall only
+ * be included in zb_zcl_data_type_e if the associated status field contains a value of
+ * SUCCESS.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[out] type data type in @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_set_id_to_read_attr_status_record()
+ * @see zb_set_status_to_read_attr_status_record()
+ * @see zb_set_type_to_read_attr_status_record()
+ * @see zb_set_value_to_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ */
+int zb_get_type_from_read_attr_status_record(
+               read_attr_status_record_h handle,
+               unsigned char *type);
+
+/**
+ * @brief set identifier to read attribute status record
+ * @details The attribute data type field shall contain the data type of the attribute
+ * in the same read attributes status record (see Table 2.16). \n\n This field shall only
+ * be included in zb_zcl_data_type_e if the associated status field contains a value of
+ * SUCCESS.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[in] type data type in @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_set_id_to_read_attr_status_record()
+ * @see zb_set_status_to_read_attr_status_record()
+ * @see zb_set_value_to_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ */
+int zb_set_type_to_read_attr_status_record(
+               read_attr_status_record_h handle,
+               unsigned char type);
+
+/**
+ * @brief get data value from read attribute status record
+ * @details The attribute value field is variable in length and shall contain the current
+ * value of this attribute. \n\n This field shall only be included if the associated
+ * status field contains a value of SUCCESS. \n\n
+ * For an attribute or element of simple type, this
+ * field has the format shown in the Table of Data Types (Table 2.16).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[in] type data type in #zb_zcl_data_type_e
+ * @param[out] value data value pointer
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_set_id_to_read_attr_status_record()
+ * @see zb_set_status_to_read_attr_status_record()
+ * @see zb_set_type_to_read_attr_status_record()
+ * @see zb_set_value_to_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ */
+int zb_get_value_from_read_attr_status_record(
+               read_attr_status_record_h handle,
+               unsigned char type,
+               zb_value_h value);
+
+/**
+ * @brief set data value to read attribute status record
+ * @details The attribute value field is variable in length and shall contain the current
+ * value of this attribute. \n\n This field shall only be included if the associated
+ * status field contains a value of SUCCESS. \n\n
+ * For an attribute or element of simple type, this
+ * field has the format shown in the Table of Data Types (Table 2.16).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[in] type data type in #zb_zcl_data_type_e
+ * @param[in] value data value pointer
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_create_read_attr_status_record()
+ * @see zb_destroy_read_attr_status_record()
+ * @see zb_set_id_to_read_attr_status_record()
+ * @see zb_set_status_to_read_attr_status_record()
+ * @see zb_set_type_to_read_attr_status_record()
+ * @see zb_zcl_global_read_attr_rsp()
+ * @see zb_get_id_from_read_attr_status_record()
+ * @see zb_get_status_from_read_attr_status_record()
+ * @see zb_get_type_from_read_attr_status_record()
+ * @see zb_get_value_from_read_attr_status_record()
+ */
+int zb_set_value_to_read_attr_status_record(
+               read_attr_status_record_h handle,
+               unsigned char type,
+               zb_value_h value);
+
+/**
+ * @brief create discover attribute infomation record
+ * @details This allocates heap for discover attribute infomation record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of discover attribute infomation record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_destroy_discover_attr_info()
+ * @see zb_get_id_from_discover_attr_info()
+ * @see zb_get_type_from_discover_attr_info()
+ * @see zb_zcl_global_discover_attr_rsp()
+ */
+int zb_create_discover_attr_info(discover_attr_info_record_h *handle);
+
+/**
+ * @brief destroy discover attribute infomation record
+ * @details This destroys discover attribute infomation record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of discover attribute infomation record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_discover_attr_info()
+ * @see zb_get_id_from_discover_attr_info()
+ * @see zb_get_type_from_discover_attr_info()
+ * @see zb_zcl_global_discover_attr_rsp()
+ */
+void zb_destroy_discover_attr_info(discover_attr_info_record_h handle);
+
+/**
+ * @brief get identifier from discover attribute info
+ * @details The attribute identifier field shall contain the identifier of a discovered
+ * attribute. \n\n Attributes shall be included in ascending order, starting with the
+ * lowest attribute identifier that is greater than or equal to the start attribute
+ * identifier field of the received discover attributes command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[out] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_discover_attr_info()
+ * @see zb_destroy_discover_attr_info()
+ * @see zb_get_type_from_discover_attr_info()
+ * @see zb_zcl_global_discover_attr_rsp()
+ */
+int zb_get_id_from_discover_attr_info(
+               discover_attr_info_record_h handle,
+               unsigned short *id);
+
+/**
+ * @brief set identifier to discover attribute info
+ * @details The attribute identifier field shall contain the identifier of a discovered
+ * attribute. \n\n Attributes shall be included in ascending order, starting with the
+ * lowest attribute identifier that is greater than or equal to the start attribute
+ * identifier field of the received discover attributes command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[in] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_discover_attr_info()
+ * @see zb_destroy_discover_attr_info()
+ * @see zb_get_type_from_discover_attr_info()
+ * @see zb_zcl_global_discover_attr_rsp()
+ */
+int zb_set_id_to_discover_attr_info(
+               discover_attr_info_record_h handle,
+               unsigned short id);
+
+/**
+ * @brief get data type from discover attribute info
+ * @details The attribute data type field shall contain the data type of the attribute in
+ * the same attribute report field (see Table 2.16)
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[out] type attribute data type @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_discover_attr_info()
+ * @see zb_destroy_discover_attr_info()
+ * @see zb_get_id_from_discover_attr_info()
+ * @see zb_zcl_global_discover_attr_rsp()
+ */
+int zb_get_type_from_discover_attr_info(
+               discover_attr_info_record_h handle,
+               unsigned char *type);
+
+/**
+ * @brief set data type to discover attribute info
+ * @details The attribute data type field shall contain the data type of the attribute in
+ * the same attribute report field (see Table 2.16)
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[in] type attribute data type @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_discover_attr_info()
+ * @see zb_destroy_discover_attr_info()
+ * @see zb_get_id_from_discover_attr_info()
+ * @see zb_zcl_global_discover_attr_rsp()
+ */
+int zb_set_type_to_discover_attr_info(
+               discover_attr_info_record_h handle,
+               unsigned char type);
+
+/**
+ * @brief create write attribute record
+ * @details Allocate memory for write attribute record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_zcl_global_write_attr()
+ * @see zb_zcl_global_write_attr_undivided()
+ * @see zb_zcl_global_write_attr_no_rep()
+ * @see zb_destroy_write_attr_record()
+ * @see zb_set_id_to_write_attr_record()
+ * @see zb_set_type_to_write_attr_record()
+ * @see zb_set_buf_to_write_attr_record()
+ * @see zb_set_value_to_write_attr_record()
+ */
+int zb_create_write_attr_record(
+               write_attr_record_h *handle);
+
+/**
+ * @brief destroy write attribute record
+ * @details Remove allocated memory for write attribute record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute record
+ *
+ * @return None
+ *
+ * @see zb_zcl_global_write_attr()
+ * @see zb_zcl_global_write_attr_undivided()
+ * @see zb_zcl_global_write_attr_no_rep()
+ * @see zb_create_write_attr_record()
+ * @see zb_set_id_to_write_attr_record()
+ * @see zb_set_type_to_write_attr_record()
+ * @see zb_set_buf_to_write_attr_record()
+ * @see zb_set_value_to_write_attr_record()
+ */
+void zb_destroy_write_attr_record(
+               write_attr_record_h handle);
+
+/**
+ * @brief set attribute identifier write attribute record
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that is to be written.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute record
+ * @param[in] id attribute identifier
+ *
+ * @return None
+ *
+ * @see zb_zcl_global_write_attr()
+ * @see zb_zcl_global_write_attr_undivided()
+ * @see zb_zcl_global_write_attr_no_rep()
+ * @see zb_create_write_attr_record()
+ * @see zb_destroy_write_attr_record()
+ * @see zb_set_type_to_write_attr_record()
+ * @see zb_set_buf_to_write_attr_record()
+ * @see zb_set_value_to_write_attr_record()
+ */
+int zb_set_id_to_write_attr_record(
+               write_attr_record_h handle,
+               unsigned short id);
+
+/**
+ * @brief set attribute data type write attribute record
+ * @details The attribute data type field shall contain the data type of the attribute
+ * that is to be written.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute record
+ * @param[in] type attribute data type
+ *
+ * @return None
+ *
+ * @see zb_zcl_global_write_attr()
+ * @see zb_zcl_global_write_attr_undivided()
+ * @see zb_zcl_global_write_attr_no_rep()
+ * @see zb_create_write_attr_record()
+ * @see zb_destroy_write_attr_record()
+ * @see zb_set_id_to_write_attr_record()
+ * @see zb_set_buf_to_write_attr_record()
+ * @see zb_set_value_to_write_attr_record()
+ */
+int zb_set_type_to_write_attr_record(
+               write_attr_record_h handle,
+               unsigned char type);
+
+/**
+ * @brief set attribute data write attribute record
+ * @details The attribute data type field shall contain the data type of the attribute
+ * that is to be written.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute record
+ * @param[in] type attribute type
+ * @param[in] value attribute data
+ * @param[in] count length of attribute data
+ *
+ * @return None
+ *
+ * @see zb_zcl_global_write_attr()
+ * @see zb_zcl_global_write_attr_undivided()
+ * @see zb_zcl_global_write_attr_no_rep()
+ * @see zb_create_write_attr_record()
+ * @see zb_destroy_write_attr_record()
+ * @see zb_set_id_to_write_attr_record()
+ * @see zb_set_type_to_write_attr_record()
+ * @see zb_set_buf_to_write_attr_record()
+ * @see zb_set_value_to_write_attr_record()
+ */
+int zb_set_buf_to_write_attr_record(
+               write_attr_record_h handle,
+               unsigned char type,
+               unsigned char *value,
+               int count);
+
+/**
+ * @brief set data value to write attribute status record
+ * @details The attribute data type field shall contain the data type of the attribute in
+ * the same attribute report field (see Table 2.16)
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] value attribute data value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_write_attr()
+ * @see zb_zcl_global_write_attr_undivided()
+ * @see zb_zcl_global_write_attr_no_rep()
+ * @see zb_create_write_attr_record()
+ * @see zb_destroy_write_attr_record()
+ * @see zb_set_id_to_write_attr_record()
+ * @see zb_set_type_to_write_attr_record()
+ * @see zb_set_buf_to_write_attr_record()
+ */
+int zb_set_value_to_write_attr_record(
+               write_attr_record_h handle,
+               zb_value_h value);
+
+/**
+ * @brief create write attribute status record
+ * @details This allocates heap for write attribute status record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_write_attr_rsp()
+ * @see zb_destroy_write_attr_status()
+ * @see zb_get_status_from_write_attr_status()
+ * @see zb_get_id_from_write_attr_status()
+ */
+int zb_create_write_attr_status(write_attr_status_record_h *handle);
+
+/**
+ * @brief destroy write attribute status record
+ * @details This destroys write attribute status record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_write_attr_rsp()
+ * @see zb_create_write_attr_status()
+ * @see zb_get_id_from_discover_attr_info()
+ * @see zb_get_type_from_discover_attr_info()
+
+ */
+void zb_destroy_write_attr_status(write_attr_status_record_h handle);
+
+/**
+ * @brief get status from write attribute status record
+ * @details The status field is 8 bits in length and specifies the status of the read
+ * operation on this attribute. \n\n This field shall be set to SUCCESS, if the operation
+ * was successful, or an error code, as specifed in zb_zcl_status_e if the operation was
+ * not successful.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[out] status error code @see #zb_zcl_status_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_write_attr_rsp()
+ * @see zb_get_id_from_write_attr_status()
+ */
+int zb_get_status_from_write_attr_status(
+               write_attr_status_record_h handle,
+               unsigned char *status);
+
+/**
+ * @brief set status to write attribute status record
+ * @details The status field is 8 bits in length and specifies the status of the read
+ * operation on this attribute. \n\n This field shall be set to SUCCESS, if the operation
+ * was successful, or an error code, as specifed in zb_zcl_status_e if the operation was
+ * not successful.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read attribute status record
+ * @param[in] status error code @see #zb_zcl_status_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_write_attr_rsp()
+ * @see zb_get_status_from_write_attr_status()
+ * @see zb_get_id_from_write_attr_status()
+ * @see zb_set_id_to_write_attr_status()
+ */
+int zb_set_status_to_write_attr_status(
+               write_attr_status_record_h handle,
+               unsigned char status);
+
+/**
+ * @brief get identifier from write attribute status record
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that has been write (or of which an element has been write).
+ * \n\n This field shall contain the same value that was included in the corresponding a
+ * ttribute identifier field of the original write attributes or write attributes
+ * structured command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_write_attr_rsp()
+ * @see zb_get_status_from_write_attr_status()
+ * @see zb_set_status_to_write_attr_status()
+ * @see zb_set_id_to_write_attr_status()
+ */
+int zb_get_id_from_write_attr_status(
+               write_attr_status_record_h handle,
+               unsigned short *id);
+
+/**
+ * @brief set identifier to write attribute status record
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that has been write (or of which an element has been write).
+ * \n\n This field shall contain the same value that was included in the corresponding a
+ * ttribute identifier field of the original write attributes or write attributes
+ * structured command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_write_attr_rsp()
+ * @see zb_get_status_from_write_attr_status()
+ * @see zb_set_status_to_write_attr_status()
+ * @see zb_get_id_from_write_attr_status()
+ */
+int zb_set_id_to_write_attr_status(
+               write_attr_status_record_h handle,
+               unsigned short id);
+
+/**
+ * @brief create reporting configuration record
+ * @details Allocate memory for reporting configuration record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of reporting configuration record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_create_report_config_record(
+               report_config_record_h *handle);
+
+/**
+ * @brief destroy reporting configuration record
+ * @details This destroys reporting configuration record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of reporting configuration record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+void zb_destroy_report_config_record(
+               report_config_record_h handle);
+
+/**
+ * @brief get direction from reporting configuration record
+ * @details The direction field specifies whether values of the attribute are be reported,
+ * or whether reports of the attribute are to be received. \n\n
+ * If this value is set to 0x00, then the attribute data type field, the minimum
+ * reporting interval field, the maximum reporting interval field and the reportable
+ * change field are included in the payload, and the timeout period field is omitted.
+ * The record is sent to a cluster server (or client) to configure how it sends reports to
+ * a client (or server) of the same cluster. \n\n
+ * If this value is set to 0x01, then the timeout period field is included in the payload,
+ * and the attribute data type field, the minimum reporting interval field, the
+ * maximum reporting interval field and the reportable change field are omitted. The
+ * record is sent to a cluster client (or server) to configure how it should expect
+ * reports from a server (or client) of the same cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] dir 00 : The receiver of the Configure Reporting command shall configure
+ *                     reporting to send to each destination as resolved by
+ *                   the bindings for the cluster hosting the attributes to be reported.\n
+ *                 01 : This indicates to the receiver of the Configure Reporting
+ *                     command that the sender has configured its reporting
+ *                     mechanism to transmit reports and that, based on the current
+ *                     state of the sender's bindings, the sender will send reports to the
+ *                     receiver.\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_dir_from_report_config_record(
+               report_config_record_h handle,
+               unsigned char *dir);
+
+/**
+ * @brief set direction to reporting configuration record
+ * @details The direction field specifies whether values of the attribute are be reported,
+ * or whether reports of the attribute are to be received. \n\n
+ * If this value is set to 0x00, then the attribute data type field, the minimum
+ * reporting interval field, the maximum reporting interval field and the reportable
+ * change field are included in the payload, and the timeout period field is omitted.
+ * The record is sent to a cluster server (or client) to configure how it sends reports to
+ * a client (or server) of the same cluster. \n\n
+ * If this value is set to 0x01, then the timeout period field is included in the payload,
+ * and the attribute data type field, the minimum reporting interval field, the
+ * maximum reporting interval field and the reportable change field are omitted. The
+ * record is sent to a cluster client (or server) to configure how it should expect
+ * reports from a server (or client) of the same cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] dir 00 : The receiver of the Configure Reporting command shall configure
+ *                     reporting to send to each destination as resolved by
+ *                   the bindings for the cluster hosting the attributes to be reported.\n
+ *                01 : This indicates to the receiver of the Configure Reporting
+ *                     command that the sender has configured its reporting
+ *                     mechanism to transmit reports and that, based on the current
+ *                     state of the sender's bindings, the sender will send reports to the
+ *                     receiver.\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_set_dir_to_report_config_record(
+               report_config_record_h handle,
+               unsigned char dir);
+
+/**
+ * @brief get attribute identifier from reporting configuration record
+ * @details If the direction field is 0x00, this field contains the identifier of the
+ * attribute that is to be reported. \n\n If instead the direction field is 0x01,
+ * the device shall expect reports of values of this attribute.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_id_from_report_config_record(
+               report_config_record_h handle,
+               unsigned short *id);
+
+/**
+ * @brief set attribute identifier to reporting configuration record
+ * @details If the direction field is 0x00, this field contains the identifier of the
+ * attribute that is to be reported. \n\n If instead the direction field is 0x01,
+ * the device shall expect reports of values of this attribute.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_set_id_to_report_config_record(
+               report_config_record_h handle,
+               unsigned short id);
+
+/**
+ * @brief get attribute data type from reporting configuration record
+ * @details The Attribute data type field contains the data type of the attribute that is
+ * to be reported.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] type attribute data type @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_type_from_report_config_record(
+               report_config_record_h handle,
+               unsigned char *type);
+
+/**
+ * @brief set attribute data type to reporting configuration record
+ * @details The Attribute data type field contains the data type of the attribute that is
+ * to be reported.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] type attribute data type @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_set_type_to_report_config_record(
+               report_config_record_h handle,
+               unsigned char type);
+
+/**
+ * @brief get minimum interval from reporting configuration record
+ * @details The minimum reporting interval field is 16 bits in length and shall contain
+ * the minimum interval, in seconds, between issuing reports of the specified attribute.
+ * \n\n
+ * If this value is set to 0x0000, then there is no minimum limit, unless one is
+ * imposed by the specification of the cluster using this reporting mechanism or by
+ * the applicable profile.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] min_i minimum interval time
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_min_i_from_report_config_record(
+               report_config_record_h handle,
+               unsigned short *min_i);
+
+/**
+ * @brief set minimum interval to reporting configuration record
+ * @details The minimum reporting interval field is 16 bits in length and shall contain
+ * the minimum interval, in seconds, between issuing reports of the specified attribute.
+ * \n\n
+ * If this value is set to 0x0000, then there is no minimum limit, unless one is
+ * imposed by the specification of the cluster using this reporting mechanism or by
+ * the applicable profile.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] min_i minimum interval time
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_set_min_i_to_report_config_record(
+               report_config_record_h handle,
+               unsigned short min_i);
+
+/**
+ * @brief get maximum interval from reporting configuration record
+ * @details The maximum reporting interval field is 16 bits in length and shall contain
+ * the maximum interval, in seconds, between issuing reports of the specified attribute.
+ * \n\n
+ * If this value is set to 0xffff, then the device shall not issue reports for the
+ * specified attribute, and the configuration information for that attribute need not be
+ * maintained. \n\n (Note: in an implementation using dynamic memory allocation, the
+ * memory space for that information may then be reclaimed).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] max_i maximum interval time
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_max_i_from_report_config_record(
+               report_config_record_h handle,
+               unsigned short *max_i);
+
+/**
+ * @brief set maximum interval to reporting configuration record
+ * @details The maximum reporting interval field is 16 bits in length and shall contain
+ * the maximum interval, in seconds, between issuing reports of the specified attribute.
+ * \n\n
+ * If this value is set to 0xffff, then the device shall not issue reports for the
+ * specified attribute, and the configuration information for that attribute need not be
+ * maintained. \n\n (Note: in an implementation using dynamic memory allocation, the
+ * memory space for that information may then be reclaimed).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] max_i maximum interval time
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_set_max_i_to_report_config_record(
+               report_config_record_h handle,
+               unsigned short max_i);
+
+/**
+ * @brief get timeout from reporting configuration record
+ * @details The timeout period field is 16 bits in length and shall contain the maximum
+ * expected time, in seconds, between received reports for the attribute specified in
+ * the attribute identifier field. If more time than this elapses between reports, this
+ * may be an indication that there is a problem with reporting. \n\n
+ * If this value is set to 0x0000, reports of the attribute are not subject to timeout.
+ * Note that, for a server/client connection to work properly using automatic
+ * reporting, the timeout value set for attribute reports to be received by the client (or
+ * server) cluster must be set somewhat higher than the maximum reporting interval
+ * set for the attribute on the server (or client) cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] timeout timeout
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_timeout_from_report_config_record(
+               report_config_record_h handle,
+               unsigned short *timeout);
+
+/**
+ * @brief set timeout to reporting configuration record
+ * @details The timeout period field is 16 bits in length and shall contain the maximum
+ * expected time, in seconds, between received reports for the attribute specified in
+ * the attribute identifier field. If more time than this elapses between reports, this
+ * may be an indication that there is a problem with reporting. \n\n
+ * If this value is set to 0x0000, reports of the attribute are not subject to timeout.
+ * Note that, for a server/client connection to work properly using automatic
+ * reporting, the timeout value set for attribute reports to be received by the client (or
+ * server) cluster must be set somewhat higher than the maximum reporting interval
+ * set for the attribute on the server (or client) cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] timeout timeout
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_set_timeout_to_report_config_record(
+               report_config_record_h handle,
+               unsigned short timeout);
+
+/**
+ * @brief get change from reporting configuration record
+ * @details The reportable change field shall contain the minimum change to the attribute
+ * that will result in a report being issued. This field is of variable length. \n\n
+ * For attributes with 'analog' data type (see Table 2.16) the field has the same data
+ * type as the attribute. \n\n The sign (if any) of the reportable change field is ignored.
+ * \n
+ * For attributes of 'discrete' data type (see Table 2.16) this field is omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] value data (only analog data type is allowed)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_change_from_report_config_record1(
+               report_config_record_h handle,
+               zb_value_h value);
+
+/**
+ * @brief set change to reporting configuration record
+ * @details The reportable change field shall contain the minimum change to the attribute
+ * that will result in a report being issued. This field is of variable length. \n\n
+ * For attributes with 'analog' data type (see Table 2.16) the field has the same data
+ * type as the attribute. \n\n The sign (if any) of the reportable change field is ignored.
+ * \n
+ * For attributes of 'discrete' data type (see Table 2.16) this field is omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] value data (only analog data type is allowed)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_set_change_to_report_config_record1(
+               report_config_record_h handle,
+               zb_value_h value);
+
+/**
+ * @brief get change from reporting configuration record
+ * @details The reportable change field shall contain the minimum change to the attribute
+ * that will result in a report being issued. This field is of variable length. \n\n
+ * For attributes with 'analog' data type (see Table 2.16) the field has the same data
+ * type as the attribute. \n\n The sign (if any) of the reportable change field is ignored.
+ * \n
+ * For attributes of 'discrete' data type (see Table 2.16) this field is omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] type attribute type
+ * @param[out] value attribute data which is allocated in library (only analog data type is allowed)
+ * @param[out] size attribute data size
+ *
+ * @remark value : generated from library you MUST free it
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_change_from_report_config_record2(
+               report_config_record_h handle,
+               unsigned char *type,
+               unsigned char **value,
+               int *size);
+
+/**
+ * @brief set change to reporting configuration record
+ * @details The reportable change field shall contain the minimum change to the attribute
+ * that will result in a report being issued. This field is of variable length. \n\n
+ * For attributes with 'analog' data type (see Table 2.16) the field has the same data
+ * type as the attribute. \n\n The sign (if any) of the reportable change field is ignored.
+ * \n
+ * For attributes of 'discrete' data type (see Table 2.16) this field is omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] type attribute type
+ * @param[in] value attribute data (only analog data type is allowed)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_set_change_to_report_config_record2(
+               report_config_record_h handle,
+               unsigned char type,
+               unsigned char *value);
+
+/**
+ * @brief get change from reporting configuration record
+ * @details The reportable change field shall contain the minimum change to the attribute
+ * that will result in a report being issued. This field is of variable length. \n\n
+ * For attributes with 'analog' data type (see Table 2.16) the field has the same data
+ * type as the attribute. \n\n The sign (if any) of the reportable change field is ignored.
+ * \n
+ * For attributes of 'discrete' data type (see Table 2.16) this field is omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] type attribute type
+ * @param[out] value attribute data (only analog data type is allowed)
+ * @param[out] size attribute data size
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_change_from_report_config_record2(
+               report_config_record_h handle,
+               unsigned char *type,
+               unsigned char **value,
+               int *size);
+
+/**
+ * @brief get change from reporting configuration record
+ * @details The reportable change field shall contain the minimum change to the attribute
+ * that will result in a report being issued. This field is of variable length. \n\n
+ * For attributes with 'analog' data type (see Table 2.16) the field has the same data
+ * type as the attribute. \n\n The sign (if any) of the reportable change field is ignored.
+ * \n
+ * For attributes of 'discrete' data type (see Table 2.16) this field is omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] type attribute type
+ * @param[out] value attribute data (only analog data type is allowed)
+ * @param[out] size attribute data size
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_read_report_config_rsp()
+ * @see zb_create_report_config_record()
+ * @see zb_destroy_report_config_record()
+ * @see zb_get_id_from_report_config_record()
+ * @see zb_set_id_to_report_config_record()
+ * @see zb_get_dir_from_report_config_record()
+ * @see zb_set_dir_to_report_config_record()
+ * @see zb_get_type_from_report_config_record()
+ * @see zb_set_type_to_report_config_record()
+ * @see zb_get_min_i_from_report_config_record()
+ * @see zb_set_min_i_to_report_config_record()
+ * @see zb_get_max_i_from_report_config_record()
+ * @see zb_set_max_i_to_report_config_record()
+ * @see zb_get_change_from_report_config_record1()
+ * @see zb_set_change_to_report_config_record1()
+ * @see zb_get_change_from_report_config_record2()
+ * @see zb_set_change_to_report_config_record2()
+ * @see zb_get_change_from_report_config_record3()
+ * @see zb_get_timeout_from_report_config_record()
+ * @see zb_set_timeout_to_report_config_record()
+ */
+int zb_get_change_from_report_config_record3(
+               report_config_record_h handle,
+               unsigned char *type,
+               unsigned char *value,
+               int *size);
+
+/**
+ * @brief create read reporting configuration record
+ * @details Allocate memory for read reporting configuration record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of read configuration record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_create_read_report_config_record()
+ * @see zb_destroy_read_report_config_record()
+ * @see zb_get_id_from_read_report_config_record()
+ * @see zb_set_id_to_read_report_config_record()
+ * @see zb_get_dir_from_read_report_config_record()
+ * @see zb_set_dir_to_read_report_config_record()
+ */
+int zb_create_read_report_config_record(
+               read_report_config_record_h *handle);
+
+/**
+ * @brief destroy read reporting configuration record
+ * @details Remove allocated memory for read reporting configuration record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute record
+ *
+ * @return None
+ *
+ * @see zb_create_read_report_config_record()
+ * @see zb_destroy_read_report_config_record()
+ * @see zb_get_id_from_read_report_config_record()
+ * @see zb_set_id_to_read_report_config_record()
+ * @see zb_get_dir_from_read_report_config_record()
+ * @see zb_set_dir_to_read_report_config_record()
+ */
+void zb_destroy_read_report_config_record(
+               read_report_config_record_h handle);
+
+/**
+ * @brief get direction from read reporting configuration record
+ * @details The direction field specifies whether values of the attribute are reported
+ * (0x00), or whether reports of the attribute are received (0x01). \n\n
+ * All other values of this field are reserved.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] dir direction
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_report_config_record()
+ * @see zb_destroy_read_report_config_record()
+ * @see zb_get_id_from_read_report_config_record()
+ * @see zb_set_id_to_read_report_config_record()
+ * @see zb_get_dir_from_read_report_config_record()
+ * @see zb_set_dir_to_read_report_config_record()
+ */
+int zb_get_dir_from_read_report_config_record(
+               read_report_config_record_h handle,
+               unsigned char *dir);
+
+/**
+ * @brief set direction to read reporting configuration record
+ * @details The direction field specifies whether values of the attribute are reported
+ * (0x00), or whether reports of the attribute are received (0x01). \n\n
+ * All other values of this field are reserved.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] dir direction
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_report_config_record()
+ * @see zb_destroy_read_report_config_record()
+ * @see zb_get_id_from_read_report_config_record()
+ * @see zb_set_id_to_read_report_config_record()
+ * @see zb_get_dir_from_read_report_config_record()
+ * @see zb_set_dir_to_read_report_config_record()
+ */
+int zb_set_dir_to_read_report_config_record(
+               read_report_config_record_h handle,
+               unsigned char dir);
+
+/**
+ * @brief get attribute idenitifier from read reporting configuration record
+ * @details The attribute identifier field shall contain the identifier of the attribute
+ * whose reporting configuration details are to be read.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_report_config_record()
+ * @see zb_destroy_read_report_config_record()
+ * @see zb_get_id_from_read_report_config_record()
+ * @see zb_set_id_to_read_report_config_record()
+ * @see zb_get_dir_from_read_report_config_record()
+ * @see zb_set_dir_to_read_report_config_record()
+ */
+int zb_get_id_from_read_report_config_record(
+               read_report_config_record_h handle,
+               unsigned short *id);
+
+/**
+ * @brief get attribute idenitifier from read reporting configuration record
+ * @details The attribute identifier field shall contain the identifier of the attribute
+ * whose reporting configuration details are to be read.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_create_read_report_config_record()
+ * @see zb_destroy_read_report_config_record()
+ * @see zb_get_id_from_read_report_config_record()
+ * @see zb_set_id_to_read_report_config_record()
+ * @see zb_get_dir_from_read_report_config_record()
+ * @see zb_set_dir_to_read_report_config_record()
+ */
+int zb_set_id_to_read_report_config_record(
+               read_report_config_record_h handle,
+               unsigned short id);
+
+/**
+ * @brief create reporting configuration response record
+ * @details Allocate memory for reporting configuration response record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of reporting configuration response record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_zcl_global_config_report_rsp()
+ * @see zb_create_report_config_response_record()
+ * @see zb_destroy_report_config_response_record()
+ * @see zb_get_status_from_report_config_response_record()
+ * @see zb_set_status_to_report_config_response_record()
+ * @see zb_get_dir_from_report_config_response_record()
+ * @see zb_set_dir_to_report_config_response_record()
+ * @see zb_get_id_from_report_config_response_record()
+ * @see zb_set_id_to_report_config_response_record()
+ */
+int zb_create_report_config_response_record(
+               report_config_response_record_h *handle);
+
+/**
+ * @brief destroy reporting configuration response record
+ * @details This destroys reporting configuration response record
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of reporting configuration response record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_config_report_rsp()
+ * @see zb_create_report_config_response_record()
+ * @see zb_destroy_report_config_response_record()
+ * @see zb_get_status_from_report_config_response_record()
+ * @see zb_set_status_to_report_config_response_record()
+ * @see zb_get_dir_from_report_config_response_record()
+ * @see zb_set_dir_to_report_config_response_record()
+ * @see zb_get_id_from_report_config_response_record()
+ * @see zb_set_id_to_report_config_response_record()
+ */
+void zb_destroy_report_config_response_record(
+               report_config_response_record_h handle);
+
+/**
+ * @brief get status from reporting configuration response record
+ * @details If the attribute is not implemented on the sender or receiver of the command,
+ * whichever is relevant (depending on direction), this field shall be set to
+ * UNSUPPORTED_ATTRIBUTE. \n If the attribute is supported, but is not capable of
+ * being reported, this field shall be set to UNREPORTABLE_ATTRIBUTE. \n
+ * Otherwise, this field shall be set to SUCCESS. \n
+ * If the status field is not set to SUCCESS, all fields except the direction and
+ * attribute identifier fields shall be omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] status status @see #zb_zcl_status_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_config_report_rsp()
+ * @see zb_create_report_config_response_record()
+ * @see zb_destroy_report_config_response_record()
+ * @see zb_get_status_from_report_config_response_record()
+ * @see zb_set_status_to_report_config_response_record()
+ * @see zb_get_dir_from_report_config_response_record()
+ * @see zb_set_dir_to_report_config_response_record()
+ * @see zb_get_id_from_report_config_response_record()
+ * @see zb_set_id_to_report_config_response_record()
+ */
+int zb_get_status_from_report_config_response_record(
+               report_config_response_record_h handle,
+               unsigned char *status);
+
+/**
+ * @brief set status to reporting configuration response record
+ * @details If the attribute is not implemented on the sender or receiver of the command,
+ * whichever is relevant (depending on direction), this field shall be set to
+ * UNSUPPORTED_ATTRIBUTE. \n If the attribute is supported, but is not capable of
+ * being reported, this field shall be set to UNREPORTABLE_ATTRIBUTE. \n
+ * Otherwise, this field shall be set to SUCCESS. \n
+ * If the status field is not set to SUCCESS, all fields except the direction and
+ * attribute identifier fields shall be omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] status status @see #zb_zcl_status_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_config_report_rsp()
+ * @see zb_create_report_config_response_record()
+ * @see zb_destroy_report_config_response_record()
+ * @see zb_get_status_from_report_config_response_record()
+ * @see zb_set_status_to_report_config_response_record()
+ * @see zb_get_dir_from_report_config_response_record()
+ * @see zb_set_dir_to_report_config_response_record()
+ * @see zb_get_id_from_report_config_response_record()
+ * @see zb_set_id_to_report_config_response_record()
+ */
+int zb_set_status_to_report_config_response_record(
+               report_config_response_record_h handle,
+               unsigned char status);
+
+/**
+ * @brief get direction from reporting configuration response record
+ * @details The direction field specifies whether values of the attribute are reported
+ * (0x00), or whether reports of the attribute are received (0x01). \n\n
+ * If this value is set to 0x00, then the attribute data type field, the minimum
+ * reporting interval field, the maximum reporting interval field and the reportable
+ * change field are included in the payload, and the timeout period field is omitted. If
+ * this value is set to 0x01, then the timeout period field is included in the payload,
+ * and the attribute data type field, the minimum reporting interval field, the
+ * maximum reporting interval field and the reportable change field are omitted. \n\n
+ * All other values of this field are reserved.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] dir direction 00 : Client-to-Server \n
+ *                           01 : server-to-Client \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_config_report_rsp()
+ * @see zb_create_report_config_response_record()
+ * @see zb_destroy_report_config_response_record()
+ * @see zb_get_status_from_report_config_response_record()
+ * @see zb_set_status_to_report_config_response_record()
+ * @see zb_get_dir_from_report_config_response_record()
+ * @see zb_set_dir_to_report_config_response_record()
+ * @see zb_get_id_from_report_config_response_record()
+ * @see zb_set_id_to_report_config_response_record()
+ */
+int zb_get_dir_from_report_config_response_record(
+               report_config_response_record_h handle,
+               unsigned char *dir);
+
+/**
+ * @brief set direction to reporting configuration response record
+ * @details The direction field specifies whether values of the attribute are reported
+ * (0x00), or whether reports of the attribute are received (0x01). \n\n
+ * If this value is set to 0x00, then the attribute data type field, the minimum
+ * reporting interval field, the maximum reporting interval field and the reportable
+ * change field are included in the payload, and the timeout period field is omitted. If
+ * this value is set to 0x01, then the timeout period field is included in the payload,
+ * and the attribute data type field, the minimum reporting interval field, the
+ * maximum reporting interval field and the reportable change field are omitted. \n\n
+ * All other values of this field are reserved.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] dir direction 00 : Client-to-Server \n
+ *                          01 : server-to-Client \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_config_report_rsp()
+ * @see zb_create_report_config_response_record()
+ * @see zb_destroy_report_config_response_record()
+ * @see zb_get_status_from_report_config_response_record()
+ * @see zb_set_status_to_report_config_response_record()
+ * @see zb_get_dir_from_report_config_response_record()
+ * @see zb_set_dir_to_report_config_response_record()
+ * @see zb_get_id_from_report_config_response_record()
+ * @see zb_set_id_to_report_config_response_record()
+ */
+int zb_set_dir_to_report_config_response_record(
+               report_config_response_record_h handle,
+               unsigned char dir);
+
+/**
+ * @brief get attribute identifier from reporting configuration response record
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that the reporting configuration details apply to.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_config_report_rsp()
+ * @see zb_create_report_config_response_record()
+ * @see zb_destroy_report_config_response_record()
+ * @see zb_get_status_from_report_config_response_record()
+ * @see zb_set_status_to_report_config_response_record()
+ * @see zb_get_dir_from_report_config_response_record()
+ * @see zb_set_dir_to_report_config_response_record()
+ * @see zb_get_id_from_report_config_response_record()
+ * @see zb_set_id_to_report_config_response_record()
+ */
+int zb_get_id_from_report_config_response_record(
+               report_config_response_record_h handle,
+               unsigned short *id);
+
+/**
+ * @brief set attribute identifier to reporting configuration response record
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that the reporting configuration details apply to.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_config_report_rsp()
+ * @see zb_create_report_config_response_record()
+ * @see zb_destroy_report_config_response_record()
+ * @see zb_get_status_from_report_config_response_record()
+ * @see zb_set_status_to_report_config_response_record()
+ * @see zb_get_dir_from_report_config_response_record()
+ * @see zb_set_dir_to_report_config_response_record()
+ * @see zb_get_id_from_report_config_response_record()
+ * @see zb_set_id_to_report_config_response_record()
+ */
+int zb_set_id_to_report_config_response_record(
+               report_config_response_record_h handle,
+               unsigned short id);
+
+/**
+ * @brief create reporting attribute
+ * @details Allocate memory for reporting attribute
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of reporting attribute
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_event_get_attr_report()
+ * @see zb_create_attr_report()
+ * @see zb_destroy_attr_report()
+ * @see zb_get_id_from_attr_report()
+ * @see zb_set_id_to_attr_report()
+ * @see zb_get_type_from_attr_report()
+ * @see zb_set_type_to_attr_report()
+ * @see zb_get_value_from_attr_report()
+ * @see zb_set_value_to_attr_report()
+ */
+int zb_create_attr_report(
+               attr_report_h *handle);
+
+/**
+ * @brief destroy reporting attribute
+ * @details This destroys reporting attribute
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of reporting attribute
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_event_get_attr_report()
+ * @see zb_create_attr_report()
+ * @see zb_destroy_attr_report()
+ * @see zb_get_id_from_attr_report()
+ * @see zb_set_id_to_attr_report()
+ * @see zb_get_type_from_attr_report()
+ * @see zb_set_type_to_attr_report()
+ * @see zb_get_value_from_attr_report()
+ * @see zb_set_value_to_attr_report()
+ */
+void zb_destroy_attr_report(
+               attr_report_h handle);
+
+/**
+ * @brief get attribute identifier from reporting attribute
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that the reporting configuration details apply to.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_event_get_attr_report()
+ * @see zb_create_attr_report()
+ * @see zb_destroy_attr_report()
+ * @see zb_get_id_from_attr_report()
+ * @see zb_set_id_to_attr_report()
+ * @see zb_get_type_from_attr_report()
+ * @see zb_set_type_to_attr_report()
+ * @see zb_get_value_from_attr_report()
+ * @see zb_set_value_to_attr_report()
+ */
+int zb_get_id_from_attr_report(
+               attr_report_h handle,
+               unsigned short *id);
+
+/**
+ * @brief set attribute identifier to reporting attribute
+ * @details The attribute identifier field is 16 bits in length and shall contain the
+ * identifier of the attribute that the reporting configuration details apply to.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_event_get_attr_report()
+ * @see zb_create_attr_report()
+ * @see zb_destroy_attr_report()
+ * @see zb_get_id_from_attr_report()
+ * @see zb_set_id_to_attr_report()
+ * @see zb_get_type_from_attr_report()
+ * @see zb_set_type_to_attr_report()
+ * @see zb_get_value_from_attr_report()
+ * @see zb_set_value_to_attr_report()
+ */
+int zb_set_id_to_attr_report(
+               attr_report_h handle,
+               unsigned short id);
+
+/**
+ * @brief get attribute type from reporting attribute
+ * @details The attribute data type field contains the data type of the attribute that is
+ * being reported.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] type attribute data type @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_event_get_attr_report()
+ * @see zb_create_attr_report()
+ * @see zb_destroy_attr_report()
+ * @see zb_get_id_from_attr_report()
+ * @see zb_set_id_to_attr_report()
+ * @see zb_get_type_from_attr_report()
+ * @see zb_set_type_to_attr_report()
+ * @see zb_get_value_from_attr_report()
+ * @see zb_set_value_to_attr_report()
+ */
+int zb_get_type_from_attr_report(
+               attr_report_h handle,
+               unsigned char *type);
+
+/**
+ * @brief set attribute type to reporting attribute
+ * @details The attribute data type field contains the data type of the attribute that is
+ * being reported.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] type attribute data type @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_event_get_attr_report()
+ * @see zb_create_attr_report()
+ * @see zb_destroy_attr_report()
+ * @see zb_get_id_from_attr_report()
+ * @see zb_set_id_to_attr_report()
+ * @see zb_get_type_from_attr_report()
+ * @see zb_set_type_to_attr_report()
+ * @see zb_get_value_from_attr_report()
+ * @see zb_set_value_to_attr_report()
+ */
+int zb_set_type_to_attr_report(
+               attr_report_h handle,
+               unsigned char type);
+
+/**
+ * @brief get attribute data from reporting attribute
+ * @details The attribute data field is variable in length and shall contain the actual
+ * value of the attribute being reported.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] value attribute value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_event_get_attr_report()
+ * @see zb_create_attr_report()
+ * @see zb_destroy_attr_report()
+ * @see zb_get_id_from_attr_report()
+ * @see zb_set_id_to_attr_report()
+ * @see zb_get_type_from_attr_report()
+ * @see zb_set_type_to_attr_report()
+ * @see zb_get_value_from_attr_report()
+ * @see zb_set_value_to_attr_report()
+ */
+int zb_get_value_from_attr_report(
+               attr_report_h handle,
+               zb_value_h value);
+
+/**
+ * @brief set attribute data to reporting attribute
+ * @details The attribute data field is variable in length and shall contain the actual
+ * value of the attribute being reported.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] value attribute value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_event_get_attr_report()
+ * @see zb_create_attr_report()
+ * @see zb_destroy_attr_report()
+ * @see zb_get_id_from_attr_report()
+ * @see zb_set_id_to_attr_report()
+ * @see zb_get_type_from_attr_report()
+ * @see zb_set_type_to_attr_report()
+ * @see zb_get_value_from_attr_report()
+ * @see zb_set_value_to_attr_report()
+ */
+int zb_set_value_to_attr_report(
+               attr_report_h handle,
+               zb_value_h value);
+
+/**
+ * @brief create extended attribute information
+ * @details Allocate memory for extended attribute information
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of extended attribute information
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ * @see zb_create_extended_attr_report()
+ * @see zb_destroy_extended_attr_report()
+ * @see zb_get_id_from_extended_attr_info()
+ * @see zb_set_id_to_extended_attr_info()
+ * @see zb_get_type_from_extended_attr_info()
+ * @see zb_set_type_to_extended_attr_info()
+ * @see zb_get_acl_from_extended_attr_info()
+ * @see zb_set_acl_to_extended_attr_info()
+ */
+int zb_create_extended_attr_info(
+               extended_attr_info_h *handle);
+
+/**
+ * @brief destroy extended attribute information
+ * @details This destroys extended attribute information
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of extended attribute information
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ * @see zb_create_extended_attr_report()
+ * @see zb_destroy_extended_attr_report()
+ * @see zb_get_id_from_extended_attr_info()
+ * @see zb_set_id_to_extended_attr_info()
+ * @see zb_get_type_from_extended_attr_info()
+ * @see zb_set_type_to_extended_attr_info()
+ * @see zb_get_acl_from_extended_attr_info()
+ * @see zb_set_acl_to_extended_attr_info()
+ */
+void zb_destroy_extended_attr_info(
+               extended_attr_info_h handle);
+
+/**
+ * @brief get attribute identifier from extended attribute information
+ * @details The attribute identifier field shall contain the identifier of a discovered
+ * attribute. \n
+ * Attributes shall be included in ascending order, starting with the lowest attribute
+ * identifier that is greater than or equal to the start attribute identifier field of the
+ * received discover attributes command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ * @see zb_create_extended_attr_report()
+ * @see zb_destroy_extended_attr_report()
+ * @see zb_get_id_from_extended_attr_info()
+ * @see zb_set_id_to_extended_attr_info()
+ * @see zb_get_type_from_extended_attr_info()
+ * @see zb_set_type_to_extended_attr_info()
+ * @see zb_get_acl_from_extended_attr_info()
+ * @see zb_set_acl_to_extended_attr_info()
+ */
+int zb_get_id_from_extended_attr_info(
+               extended_attr_info_h handle,
+               unsigned short *id);
+
+/**
+ * @brief set attribute identifier to extended attribute information
+ * @details The attribute identifier field shall contain the identifier of a discovered
+ * attribute. \n
+ * Attributes shall be included in ascending order, starting with the lowest attribute
+ * identifier that is greater than or equal to the start attribute identifier field of the
+ * received discover attributes command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] id attribute identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ * @see zb_create_extended_attr_report()
+ * @see zb_destroy_extended_attr_report()
+ * @see zb_get_id_from_extended_attr_info()
+ * @see zb_set_id_to_extended_attr_info()
+ * @see zb_get_type_from_extended_attr_info()
+ * @see zb_set_type_to_extended_attr_info()
+ * @see zb_get_acl_from_extended_attr_info()
+ * @see zb_set_acl_to_extended_attr_info()
+ */
+int zb_set_id_to_extended_attr_info(
+               extended_attr_info_h handle,
+               unsigned short id);
+
+/**
+ * @brief get attribute identifier type from extended attribute information
+ * @details The attribute data type field shall contain the data type of the attribute in
+ * the same attribute report field
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] type attribute data type @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ * @see zb_create_extended_attr_report()
+ * @see zb_destroy_extended_attr_report()
+ * @see zb_get_id_from_extended_attr_info()
+ * @see zb_set_id_to_extended_attr_info()
+ * @see zb_get_type_from_extended_attr_info()
+ * @see zb_set_type_to_extended_attr_info()
+ * @see zb_get_acl_from_extended_attr_info()
+ * @see zb_set_acl_to_extended_attr_info()
+ */
+int zb_get_type_from_extended_attr_info(
+               extended_attr_info_h handle,
+               unsigned char *type);
+
+/**
+ * @brief set attribute identifier type to extended attribute information
+ * @details The attribute data type field shall contain the data type of the attribute in
+ * the same attribute report field
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] type attribute data type @see #zb_zcl_data_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ * @see zb_create_extended_attr_report()
+ * @see zb_destroy_extended_attr_report()
+ * @see zb_get_id_from_extended_attr_info()
+ * @see zb_set_id_to_extended_attr_info()
+ * @see zb_get_type_from_extended_attr_info()
+ * @see zb_set_type_to_extended_attr_info()
+ * @see zb_get_acl_from_extended_attr_info()
+ * @see zb_set_acl_to_extended_attr_info()
+ */
+int zb_set_type_to_extended_attr_info(
+               extended_attr_info_h handle,
+               unsigned char type);
+
+/**
+ * @brief get access control field from extended attribute information
+ * @details The attribute access control field shall indicate whether the attribute is
+ * readable, writable, and/or reportable. This is an 8-bit bitmask field. \n
+ * The bits are in little endian order (bit 0 is listed first).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[out] acl ZB_ZCL_WRITABLE : Bit-0., Writable \n
+ *                 ZB_ZCL_REPORTABLE Bit-1 : Reportable \n See #zb_zcl_acl_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ * @see zb_create_extended_attr_report()
+ * @see zb_destroy_extended_attr_report()
+ * @see zb_get_id_from_extended_attr_info()
+ * @see zb_set_id_to_extended_attr_info()
+ * @see zb_get_type_from_extended_attr_info()
+ * @see zb_set_type_to_extended_attr_info()
+ * @see zb_get_acl_from_extended_attr_info()
+ * @see zb_set_acl_to_extended_attr_info()
+ */
+int zb_get_acl_from_extended_attr_info(
+               extended_attr_info_h handle,
+               unsigned char *acl);
+
+/**
+ * @brief set attribute access control field to extended attribute information
+ * @details The attribute access control field shall indicate whether the attribute is
+ * readable, writable, and/or reportable. This is an 8-bit bitmask field. \n
+ * The bits are in little endian order (bit 0 is listed first).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of write attribute status record
+ * @param[in] acl ZB_ZCL_WRITABLE : Bit-0., Writable \n
+ *                ZB_ZCL_REPORTABLE Bit-1 : Reportable \n See #zb_zcl_acl_type_e
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ * @see zb_create_extended_attr_report()
+ * @see zb_destroy_extended_attr_report()
+ * @see zb_get_id_from_extended_attr_info()
+ * @see zb_set_id_to_extended_attr_info()
+ * @see zb_get_type_from_extended_attr_info()
+ * @see zb_set_type_to_extended_attr_info()
+ * @see zb_get_acl_from_extended_attr_info()
+ * @see zb_set_acl_to_extended_attr_info()
+ */
+int zb_set_acl_to_extended_attr_info(
+               extended_attr_info_h handle,
+               unsigned char acl);
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_H__ */
diff --git a/include/zb-zdo.h b/include/zb-zdo.h
new file mode 100644 (file)
index 0000000..bcdb1a5
--- /dev/null
@@ -0,0 +1,2177 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZDO_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZDO_H__
+
+/**
+ * @file zb-zdo.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE Zigbee Device Object
+ *
+ * @brief zigbee provides API for ZDO access.
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_MODULE_OVERVIEW Overview
+ * This API set consists of ZDO access API
+ *
+ * @{
+ */
+
+#include <zdo/zb-zdo-type.h>
+#include <zdo/zb-zdo-config.h>
+#include <zdo/zb-zdo-nwk-mgr.h>
+#include <zdo/zb-zdo-dev-disc.h>
+#include <zdo/zb-zdo-svc-disc.h>
+#include <zdo/zb-zdo-bind-mgr.h>
+
+/**
+ * @brief Create simple descriptor
+ * @details Create simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] handle handle of simple descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_simple_desc_copy()
+ * @see zb_simple_desc_destroy()
+ */
+int zb_simple_desc_create(
+               zb_zdo_simple_desc_h *handle);
+
+/**
+ * @brief copy simple descriptor
+ * @details copy simple descriptor handle to another
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] src handle of source simple descriptor
+ * @param[out] dst handle of destination simple descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_copy()
+ * @see zb_simple_desc_destroy()
+ */
+int zb_simple_desc_copy(
+               zb_zdo_simple_desc_h src,
+               zb_zdo_simple_desc_h dst);
+
+/**
+ * @brief destroy simple descriptor handle
+ * @details destroy simple descriptor allocated memory
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_copy()
+ * @see zb_simple_desc_destroy()
+ */
+int zb_simple_desc_destroy(
+               zb_zdo_simple_desc_h handle);
+
+/**
+ * @brief get active endpoint number from simple descriptor handle
+ * @details get active endpoint number from simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[out] ep endpoint number
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_set_ep()
+ */
+int zb_simple_desc_get_ep(
+               zb_zdo_simple_desc_h handle,
+               unsigned char *ep);
+
+/**
+ * @brief set active endpoint number to simple descriptor handle
+ * @details set active endpoint number to simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[in] ep endpoint number
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_get_ep()
+ */
+int zb_simple_desc_set_ep(
+               zb_zdo_simple_desc_h handle,
+               unsigned char ep);
+
+/**
+ * @brief get profile id from simple descriptor handle
+ * @details get profile id from simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[out] profile_id profile id
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_set_profile_id()
+ */
+int zb_simple_desc_get_profile_id(
+               zb_zdo_simple_desc_h handle,
+               unsigned short *profile_id);
+
+/**
+ * @brief set profile id to simple descriptor handle
+ * @details set profile id to simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[in] profile_id profile id
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_get_device_id()
+ */
+int zb_simple_desc_set_profile_id(
+               zb_zdo_simple_desc_h handle,
+               unsigned short profile_id);
+
+/**
+ * @brief set device id from simple descriptor handle
+ * @details set device id from simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[out] device_id 16-bit device identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_set_device_id()
+ */
+int zb_simple_desc_get_device_id(
+               zb_zdo_simple_desc_h handle,
+               unsigned short *device_id);
+
+/**
+ * @brief set device id to simple descriptor handle
+ * @details set device id to simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[in] device_id 16-bit device identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_get_device_ver()
+ */
+int zb_simple_desc_set_device_id(
+               zb_zdo_simple_desc_h handle,
+               unsigned short device_id);
+
+/**
+ * @brief get device version from simple descriptor handle
+ * @details get device version from simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[out] device_ver device version
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_set_device_ver()
+ */
+int zb_simple_desc_get_device_ver(
+               zb_zdo_simple_desc_h handle,
+               unsigned short *device_ver);
+
+/**
+ * @brief set device version to simple descriptor handle
+ * @details set device version to simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[in] device_ver device version
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_set_device_ver()
+ */
+int zb_simple_desc_set_device_ver(
+               zb_zdo_simple_desc_h handle,
+               unsigned short device_ver);
+
+/**
+ * @brief get number of input clusters from simple descriptor handle
+ * @details get number of input clusters from simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[out] num_of_in_clusters number of input clusters
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_set_num_of_in_clusters()
+ */
+int zb_simple_desc_get_num_of_in_clusters(
+               zb_zdo_simple_desc_h handle,
+               unsigned char *num_of_in_clusters);
+
+/**
+ * @brief get number of input clusters to simple descriptor handle
+ * @details get number of input clusters to simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[in] num_of_in_clusters number of input clusters
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_get_num_of_in_clusters()
+ */
+int zb_simple_desc_set_num_of_in_clusters(
+               zb_zdo_simple_desc_h handle,
+               unsigned char num_of_in_clusters);
+
+/**
+ * @brief get number of output clusters from simple descriptor handle
+ * @details get number of output clusters from simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[out] num_of_out_clusters number of output clusters
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_set_num_of_out_clusters()
+ */
+int zb_simple_desc_get_num_of_out_clusters(
+               zb_zdo_simple_desc_h handle,
+               unsigned char *num_of_out_clusters);
+
+/**
+ * @brief set number of output clusters to simple descriptor handle
+ * @details set number of output clusters to simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[in] num_of_out_clusters number of output clusters
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_get_num_of_out_clusters()
+ */
+int zb_simple_desc_set_num_of_out_clusters(
+               zb_zdo_simple_desc_h handle,
+               unsigned char num_of_out_clusters);
+
+/**
+ * @brief get input cluster list from simple descriptor handle
+ * @details get input cluster list from simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[out] in_clusters input clusters
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_set_in_clusters()
+ */
+int zb_simple_desc_get_in_clusters(
+               zb_zdo_simple_desc_h handle,
+               unsigned short **in_clusters);
+
+/**
+ * @brief set input cluster list to simple descriptor handle
+ * @details set input cluster list to simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[in] in_clusters input clusters
+ * @param[in] num number of input clusters
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_get_in_clusters()
+ */
+int zb_simple_desc_set_in_clusters(
+               zb_zdo_simple_desc_h handle,
+               unsigned short *in_clusters,
+               int num);
+
+/**
+ * @brief get output cluster list from simple descriptor handle
+ * @details get output cluster list from simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[out] out_clusters output clusters
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_get_in_clusters()
+ */
+int zb_simple_desc_get_out_clusters(
+               zb_zdo_simple_desc_h handle,
+               unsigned short **out_clusters);
+
+/**
+ * @brief set output cluster list to simple descriptor handle
+ * @details set output cluster list to simple descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of simple descriptor
+ * @param[in] out_clusters output clusters
+ * @param[in] num number of output clusters
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_simple_desc_get_in_clusters()
+ */
+int zb_simple_desc_set_out_clusters(
+               zb_zdo_simple_desc_h handle,
+               unsigned short *out_clusters,
+               int num);
+
+/**
+ * @brief Create node power descriptor
+ * @details Create node power descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] handle handle of node power descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_node_power_desc_copy()
+ * @see zb_node_power_desc_destroy()
+ */
+int zb_node_power_desc_create(
+               zb_zdo_node_power_descriptor_h *handle);
+
+/**
+ * @brief copy node power descriptor
+ * @details copy node power descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] src handle of source node power descriptor
+ * @param[out] dst handle of destination node power descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_power_desc_create()
+ * @see zb_node_power_desc_destroy()
+ */
+int zb_node_power_desc_copy(
+       zb_zdo_node_power_descriptor_h src,
+       zb_zdo_node_power_descriptor_h dst);
+
+/**
+ * @brief destroy node power descriptor
+ * @details destroy node power descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_power_desc_copy()
+ * @see zb_node_power_desc_destroy()
+ */
+int zb_node_power_desc_destroy(
+               zb_zdo_node_power_descriptor_h handle);
+
+/**
+ * @brief get current power mode from node power descriptor
+ * @details The current power mode field of the node power descriptor is four bits in length
+ * and specifies the current sleep/power-saving mode of the node. \n\n The current power
+ * mode field shall be set to one of the non-reserved values
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ * @param[out] current_power_mode 0b0000 : Receiver synchronized with the receiver on when
+ *                                         idle sub-field of the node descriptor \n
+ *                                0b0001 : Receiver comes on periodically as defined by the
+ *                                         node power descriptor \n
+ *                                0b0010 : Receiver comes on when stimulated, e.g. by a
+ *                                         user pressing a button
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_power_desc_set_current_power_mode()
+ */
+int zb_node_power_desc_get_current_power_mode(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char* current_power_mode);
+
+/**
+ * @brief set current power mode from node power descriptor
+ * @details The current power mode field of the node power descriptor is four bits in length
+ * and specifies the current sleep/power-saving mode of the node. \n\n The current power
+ * mode field shall be set to one of the non-reserved values
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ * @param[in] current_power_mode  0b0000 : Receiver synchronized with the receiver on when
+ *                                         idle sub-field of the node descriptor \n
+ *                                0b0001 : Receiver comes on periodically as defined by the
+ *                                         node power descriptor \n
+ *                                0b0010 : Receiver comes on when stimulated, e.g. by a
+ *                                         user pressing a button
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_power_desc_get_current_power_mode()
+ */
+int zb_node_power_desc_set_current_power_mode(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char current_power_mode);
+
+/**
+ * @brief get available power mode from node power descriptor
+ * @details The available power sources field of the node power descriptor is four bits in
+ * length and specifies the power sources available on this node. \n\n For each power
+ * source supported on this node, the corresponding bit of the available power sources
+ * field, shall be set to 1. All other bits shall be set to 0.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ * @param[out] available_power_sources  0b0001 : Constant (mains) power \n
+ *                                      0b0010 : Rechargeable battery \n
+ *                                      0b0100 : Disposable battery \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_power_desc_set_available_power_sources()
+ */
+int zb_node_power_desc_get_available_power_sources(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char* available_power_sources);
+
+/**
+ * @brief set available power mode from node power descriptor
+ * @details The available power sources field of the node power descriptor is four bits in
+ * length and specifies the power sources available on this node. \n\n For each power
+ * source supported on this node, the corresponding bit of the available power sources
+ * field, shall be set to 1. All other bits shall be set to 0.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ * @param[in] available_power_sources  0b0001 : Constant (mains) power \n
+ *                                     0b0010 : Rechargeable battery \n
+ *                                     0b0100 : Disposable battery \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_power_desc_get_available_power_sources()
+ */
+int zb_node_power_desc_set_available_power_sources(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char available_power_sources);
+
+/**
+ * @brief get current power source from node power descriptor
+ * @details The current power source field of the node power descriptor is four bits in
+ * length and specifies the current power source being utilized by the node. \n]n
+ * For the current power source selected, the corresponding bit of the current power \n\n
+ * source field, shall be set to 1. All other bits shall be set to 0.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ * @param[in] current_power_source  0b0001 : Constant (mains) power \n
+ *                                  0b0010 : Rechargeable battery \n
+ *                                  0b0100 : Disposable battery \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_power_desc_set_current_power_source()
+ */
+int zb_node_power_desc_get_current_power_source(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char* current_power_source);
+
+/**
+ * @brief set available power mode from node power descriptor
+ * @details The current power source field of the node power descriptor is four bits in
+ * length and specifies the current power source being utilized by the node. \n]n
+ * For the current power source selected, the corresponding bit of the current power \n\n
+ * source field, shall be set to 1. All other bits shall be set to 0.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ * @param[in] current_power_source  0b0001 : Constant (mains) power \n
+ *                                  0b0010 : Rechargeable battery \n
+ *                                  0b0100 : Disposable battery \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_power_desc_get_current_power_source()
+ */
+int zb_node_power_desc_set_current_power_source(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char current_power_source);
+
+/**
+ * @brief get current power source level from node power descriptor
+ * @details The current power source level field of the node power descriptor is four bits
+ * in length and specifies the level of charge of the power source. \n\n The current power
+ * source level field shall be set to one of the non-reserved values
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ * @param[in] current_power_source_level  0b0000 : Citical \n
+ *                                        0b0100 : 33% \n
+ *                                        0b1000 : 66% \n
+ *                                        0b1100 : 100% \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_power_desc_set_current_power_source_level()
+ */
+int zb_node_power_desc_get_current_power_source_level(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char* current_power_source_level);
+
+/**
+ * @brief set current power source level from node power descriptor
+ * @details The current power source level field of the node power descriptor is four bits
+ * in length and specifies the level of charge of the power source. \n\n The current power
+ * source level field shall be set to one of the non-reserved values
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node power descriptor
+ * @param[in] current_power_source_level  0b0000 : Critical \n
+ *                                        0b0100 : 33% \n
+ *                                        0b1000 : 66% \n
+ *                                        0b1100 : 100% \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_power_desc_get_current_power_source_level()
+ */
+int zb_node_power_desc_set_current_power_source_level(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char current_power_source_level);
+
+/**
+ * @brief Create node descriptor
+ * @details Create node descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ *
+ * @see zb_node_desc_copy()
+ * @see zb_node_desc_destroy()
+ */
+int zb_node_desc_create(
+               zb_zdo_node_descriptor_h *handle);
+
+/**
+ * @brief copy node descriptor
+ * @details copy node descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] src handle of source node descriptor
+ * @param[in] dst handle of destination node descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_create()
+ * @see zb_node_desc_destroy()
+ */
+int zb_node_desc_copy(
+       zb_zdo_node_descriptor_h src,
+       zb_zdo_node_descriptor_h dst);
+
+/**
+ * @brief destroy node descriptor
+ * @details destroy node descriptor handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_create()
+ * @see zb_node_desc_copy()
+ */
+int zb_node_desc_destroy(
+               zb_zdo_node_descriptor_h handle);
+
+/**
+ * @brief get logical type from node descriptor
+ * @details The logical type field of the node descriptor is three bits in length and
+ * specifies the device type of the ZigBee node. \n\n The logical type field shall be set
+ *  to one of the non-reserved values.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] logical_type  0b000 : ZigBee coordinator \n
+ *                          0b001 : Zigbee router \n
+ *                          0b010 : Zigee end device \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_logical_type()
+ */
+int zb_node_desc_get_logical_type(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char* logical_type);
+
+/**
+ * @brief set logical type from to descriptor
+ * @details The logical type field of the node descriptor is three bits in length and
+ * specifies the device type of the ZigBee node. \n\n The logical type field shall be set
+ *  to one of the non-reserved values.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] logical_type  0b000 : ZigBee coordinator \n
+ *                          0b001 : ZigBee router \n
+ *                          0b010 : ZigBee end device \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_logical_type()
+ */
+int zb_node_desc_set_logical_type(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char logical_type);
+
+/**
+ * @brief get complex descriptor available from node descriptor
+ * @details The complex descriptor available field of the node descriptor is one bit in
+ * length and specifies whether a complex descriptor is available on this device. \n\n
+ * If this field is set to 1, a complex descriptor is available. \n\n
+ * If this field is set to 0, a complex descriptor is not available.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] complex_desciptor_available  1 : a complex descriptor is available \n
+ *                                          0 : a complex descriptor is not available \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_complex_descriptor_available()
+ */
+int zb_node_desc_get_complex_desciptor_available(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char* complex_desciptor_available);
+
+/**
+ * @brief set complex descriptor available to node descriptor
+ * @details The complex descriptor available field of the node descriptor is one bit in
+ * length and specifies whether a complex descriptor is available on this device. \n\n
+ * If this field is set to 1, a complex descriptor is available. \n\n
+ * If this field is set to 0, a complex descriptor is not available.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] complex_desciptor_available  1 : a complex descriptor is available \n
+ *                                         0 : a complex descriptor is not available \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_complex_desciptor_available()
+ */
+int zb_node_desc_set_complex_descriptor_available(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char complex_desciptor_available);
+
+/**
+ * @brief get user descriptor available from node descriptor
+ * @details The user descriptor available field of the node descriptor is one bit in
+ * length and specifies whether a user descriptor is available on this device. \n\n
+ * If this field is set to 1, a user descriptor is available.
+ * If this field is set to 0, a user descriptor is not available.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] user_descriptor_available  1 : a user descriptor is available \n
+ *                                       0 : a user descriptor is not available \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_user_descriptor_available()
+ */
+int zb_node_desc_get_user_descriptor_available(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char* user_descriptor_available);
+
+/**
+ * @brief set user descriptor available to node descriptor
+ * @details The user descriptor available field of the node descriptor is one bit in
+ * length and specifies whether a user descriptor is available on this device. \n\n
+ * If this field is set to 1, a user descriptor is available.
+ * If this field is set to 0, a user descriptor is not available.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] user_descriptor_available  1 : a user descriptor is available \n
+ *                                       0 : a user descriptor is not available \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_user_descriptor_available()
+ */
+int zb_node_desc_set_user_descriptor_available(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char user_descriptor_available);
+
+/**
+ * @brief get APS flags available from node descriptor
+ * @details The APS flags field of the node descriptor is three bits in length and
+ * specifies the application support sub-layer capabilities of the node. \n\n
+ * This field is currently not supported and shall be set to zero.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] aps_flags 0 : APS flags \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_aps_flags()
+ */
+int zb_node_desc_get_aps_flags(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char* aps_flags);
+/**
+ * @brief set APS flags available to node descriptor
+ * @details The APS flags field of the node descriptor is three bits in length and
+ * specifies the application support sub-layer capabilities of the node. \n\n
+ * This field is currently not supported and shall be set to zero.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] aps_flags 0 : APS flags \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_aps_flags()
+ */
+int zb_node_desc_set_aps_flags(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char aps_flags);
+
+/**
+ * @brief get frequency band from node descriptor
+ * @details The frequency band field of the node descriptor is five bits in length and
+ * specifies the frequency bands that are supported by the underlying IEEE 802.15.4 radio
+ * utilized by the node. \n\n For each frequency band supported by the underlying IEEE
+ * 802.15.4 radio, the corresponding bit of the frequency band field. \n\n
+ * shall be set to 1. All other bits shall be set to 0.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] frequency_band 0b00001 : 868-868,6MHz \n
+ *                            0b00010 : Reserved \n
+ *                            0b00100 : 902-928MHz \n
+ *                            0b01000 : 2400-2483.5MHz
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_frequency_band()
+ */
+int zb_node_desc_get_frequency_band(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char* frequency_band);
+
+/**
+ * @brief set frequency band to node descriptor
+ * @details The frequency band field of the node descriptor is five bits in length and
+ * specifies the frequency bands that are supported by the underlying IEEE 802.15.4 radio
+ * utilized by the node. \n\n For each frequency band supported by the underlying IEEE
+ * 802.15.4 radio, the corresponding bit of the frequency band field. \n\n
+ * shall be set to 1. All other bits shall be set to 0.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] frequency_band 0b00001 : 868-868,6MHz \n
+ *                           0b00010 : Reserved \n
+ *                           0b00100 : 902-928MHz \n
+ *                           0b01000 : 2400-2483.5MHz
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_frequency_band()
+ */
+int zb_node_desc_set_frequency_band(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char frequency_band);
+
+/**
+ * @brief get MAC capability from node descriptor
+ * @details The MAC capability flags field is eight bits in length and specifies the node
+ * capabilities, as required by the IEEE 802.15.4-2003 MAC sub-layer. \n\n The
+ * MAC capability flags field shall be formatted as illustrated in below table. \n\n
+ *
+ * The alternate PAN coordinator sub-field is one bit in length and shall be set to 1 if
+ * this node is capable of becoming a PAN coordinator. Otherwise, the alternative
+ * PAN coordinator sub-field shall be set to 0. \n\n
+ *
+ * The device type sub-field is one bit in length and shall be set to 1 if this node is a
+ * full function device (FFD). Otherwise, the device type sub-field shall be set to 0,
+ * indicating a reduced function device (RFD). \n\n
+ *
+ * The power source sub-field is one bit in length and shall be set to 1 if the current
+ * power source is mains power. Otherwise, the power source sub-field shall be set to
+ * 0. This information is derived from the node current power source field of the
+ * node power descriptor.\n\n
+ *
+ * The receiver on when idle sub-field is one bit in length and shall be set to 1 if the
+ * device does not disable its receiver to conserve power during idle periods.
+ * Otherwise, the receiver on when idle sub-field shall be set to 0 \n\n
+ *
+ * The security capability sub-field is one bit in length and shall be set to 1 if the
+ * device is capable of sending and receiving frames secured using the security suite
+ * specified in [B1]. Otherwise, the security capability sub-field shall be set to 0.
+ * The allocate address sub-field is one bit in length and shall be set to 0 or 1. \n\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] mac_capability_flags Bit 0 : Alternative PAN coordinator \n
+ *                                 Bit 1 : Device Type \n
+ *                                 Bit 2 : Power source \n
+ *                                 Bit 3 : Receiver on when idle \n
+ *                                 Bit 4-5 : Reserved \n
+ *                                 Bit 6 : Security capability \n
+ *                                 Bit 7 : Allocated address \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_mac_capability_flags()
+ */
+int zb_node_desc_get_mac_capability_flags(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char* mac_capability_flags);
+
+/**
+ * @brief set MAC capability to node descriptor
+ * @details The MAC capability flags field is eight bits in length and specifies the node
+ * capabilities, as required by the IEEE 802.15.4-2003 MAC sub-layer. \n\n The
+ * MAC capability flags field shall be formatted as illustrated in below table.\n\n
+ *
+ * The alternate PAN coordinator sub-field is one bit in length and shall be set to 1 if
+ * this node is capable of becoming a PAN coordinator. Otherwise, the alternative
+ * PAN coordinator sub-field shall be set to 0. \n\n
+ *
+ * The device type sub-field is one bit in length and shall be set to 1 if this node is a
+ * full function device (FFD). Otherwise, the device type sub-field shall be set to 0,
+ * indicating a reduced function device (RFD). \n\n
+ *
+ * The power source sub-field is one bit in length and shall be set to 1 if the current
+ * power source is mains power. Otherwise, the power source sub-field shall be set to
+ * 0. This information is derived from the node current power source field of the
+ * node power descriptor.\n\n
+ *
+ * The receiver on when idle sub-field is one bit in length and shall be set to 1 if the
+ * device does not disable its receiver to conserve power during idle periods.
+ * Otherwise, the receiver on when idle sub-field shall be set to 0 \n\n
+ *
+ * The security capability sub-field is one bit in length and shall be set to 1 if the
+ * device is capable of sending and receiving frames secured using the security suite
+ * specified in [B1]. Otherwise, the security capability sub-field shall be set to 0.
+ * The allocate address sub-field is one bit in length and shall be set to 0 or 1. \n\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] mac_capability_flags Bit 0 : Alternative PAN coordinator \n
+ *                                  Bit 1 : Device Type \n
+ *                                  Bit 2 : Power source \n
+ *                                  Bit 3 : Receiver on when idle \n
+ *                                  Bit 4-5 : Reserved \n
+ *                                  Bit 6 : Security capability \n
+ *                                  Bit 7 : Allocated address \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_get_mac_capability_flags()
+ */
+int zb_node_desc_set_mac_capability_flags(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char mac_capability_flags);
+
+/**
+ * @brief get manufacturer code from node descriptor
+ * @details The manufacturer code field of the node descriptor is sixteen bits in length
+ *  and specifies a manufacturer code that is allocated by the ZigBee Alliance, relating
+ * the manufacturer to the device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] manufacturer_code manufacturer code
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_manufacturer_code()
+ */
+int zb_node_desc_get_manufacturer_code(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short* manufacturer_code);
+
+/**
+ * @brief set manufacturer code to node descriptor
+ * @details The manufacturer code field of the node descriptor is sixteen bits in length
+ *  and specifies a manufacturer code that is allocated by the ZigBee Alliance, relating
+ * the manufacturer to the device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] manufacturer_code manufacturer code
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_get_frequency_band()
+ */
+int zb_node_desc_set_manufacturer_code(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short manufacturer_code);
+
+/**
+ * @brief get maximum buffer size from node descriptor
+ * @details The maximum buffer size field of the node descriptor is eight bits in length,
+ * with a valid range of 0x00-0x7f. \n\n This field specifies the maximum size, in octets,
+ * of the network sub-layer data unit (NSDU) for this node. This is the maximum size of
+ *  data or commands passed to or from the application by the application support
+ * sub-layer, before any fragmentation or re-assembly. \n\n
+ * This field can be used as a high-level indication for network management.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] maximum_buffer_size 0x00~0x7f
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_maximum_buffer_size()
+ */
+int zb_node_desc_get_maximum_buffer_size(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char* maximum_buffer_size);
+
+/**
+ * @brief set maximum buffer size to node descriptor
+ * @details The maximum buffer size field of the node descriptor is eight bits in length,
+ *  with a valid range of 0x00-0x7f. \n\n This field specifies the maximum size, in octets,
+ * of the network sub-layer data unit (NSDU) for this node. This is the maximum size of
+ *  data or commands passed to or from the application by the application support
+ * sub-layer, before any fragmentation or re-assembly. \n\n
+ * This field can be used as a high-level indication for network management.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] maximum_buffer_size 0x00~0x7f
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_maximum_buffer_size()
+ */
+int zb_node_desc_set_maximum_buffer_size(
+               zb_zdo_node_descriptor_h handle,
+               unsigned char maximum_buffer_size);
+
+/**
+ * @brief get maximum incoming transfer size from node descriptor
+ * @details The maximum transfer size field of the node descriptor is sixteen bits in
+ *  length, with a valid range of 0x0000-0x7fff. \n\n This field specifies the maximum
+ * size, in octets, of the application sub-layer data unit (ASDU) that can be transferred
+ * to this node in one single message transfer. \n\n This value can exceed the value of
+ * the node maximum buffer size field through the use of fragmentation.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] maximum_incoming_transfer_size 0x0000~0x7fff
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_maximum_buffer_size()
+ */
+int zb_node_desc_get_maximum_incoming_transfer_size(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short* maximum_incoming_transfer_size);
+
+/**
+ * @brief set maximum incoming transfer size to node descriptor
+ * @details The maximum transfer size field of the node descriptor is sixteen bits in
+ *  length, with a valid range of 0x0000-0x7fff. \n\n This field specifies the maximum
+ * size, in octets, of the application sub-layer data unit (ASDU) that can be transferred
+ * to this node in one single message transfer. \n\n This value can exceed the value of
+ * the node maximum buffer size field through the use of fragmentation.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] maximum_incoming_transfer_size 0x0000~0x7fff
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_maximum_buffer_size()
+ */
+int zb_node_desc_set_maximum_incoming_transfer_size(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short maximum_incoming_transfer_size);
+
+/**
+ * @brief get server mask from node descriptor
+ * @details The server mask field of the node descriptor is sixteen bits in length,
+ * with bit settings signifying the system server capabilities of this node. \n\n
+ * It is used to facilitate discovery of particular system servers by other nodes on the
+ *  system. \n\n The bit settings are defined in below table.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] server_mask Bit 0 : Primary Trust Center \n
+ *                         Bit 1 : Backup Trust Center \n
+ *                         Bit 2 : Primary Binding Table Cache \n
+ *                         Bit 3 : Backup Binding Table Cache \n
+ *                         Bit 4 : Primary Discovery Cache \n
+ *                         Bit 5 : Backup Discovery Cache \n
+ *                         Bit 6 : Network Manager \n
+ *                         Bit 7~15 : Reserved
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_server_mask()
+ */
+int zb_node_desc_get_server_mask(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short* server_mask);
+
+/**
+ * @brief set server mask to node descriptor
+ * @details The server mask field of the node descriptor is sixteen bits in length,
+ * with bit settings signifying the system server capabilities of this node. \n\n
+ * It is used to facilitate discovery of particular system servers by other nodes on the
+ *  system. \n\n The bit settings are defined in below table.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] server_mask Bit 0 : Primary Trust Center \n
+ *                         Bit 1 : Backup Trust Center \n
+ *                         Bit 2 : Primary Binding Table Cache \n
+ *                         Bit 3 : Backup Binding Table Cache \n
+ *                         Bit 4 : Primary Discovery Cache \n
+ *                         Bit 5 : Backup Discovery Cache \n
+ *                         Bit 6 : Network Manager \n
+ *                         Bit 7~15 : Reserved
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_server_mask()
+ */
+int zb_node_desc_set_server_mask(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short server_mask);
+
+/**
+ * @brief get maximum outgoing transfer size from node descriptor
+ * @details The maximum transfer size field of the node descriptor is sixteen bits in,
+ * length with a valid range of 0x0000-0x7fff. \n\n This field specifies the maximum size,
+ * in octets, of the application sub-layer data unit (ASDU) that can be transferred from
+ * this node in one single message transfer. \n\n This value can exceed the value of the
+ * node maximum buffer size field through the use of fragmentation.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] maximum_outgoing_transfer_size 0x0000~0x7ffff
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_server_mask()
+ */
+int zb_node_desc_get_maximum_outgoing_transfer_size(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short* maximum_outgoing_transfer_size);
+
+/**
+ * @brief set maximum outgoing transfer size to node descriptor
+ * @details The maximum transfer size field of the node descriptor is sixteen bits in,
+ * length with a valid range of 0x0000-0x7fff. \n\n This field specifies the maximum size,
+ * in octets, of the application sub-layer data unit (ASDU) that can be transferred from
+ * this node in one single message transfer. \n\n This value can exceed the value of the
+ * node maximum buffer size field through the use of fragmentation.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] maximum_outgoing_transfer_size 0x0000~0x7ffff
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_set_server_mask()
+ */
+int zb_node_desc_set_maximum_outgoing_transfer_size(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short maximum_outgoing_transfer_size);
+
+/**
+ * @brief get descriptor capability from node descriptor
+ * @details The descriptor capability field of the node descriptor is eight bits in length
+ * , with bit settings signifying the descriptor capabilities of this node. \n\n
+ * It is used to facilitate discovery of particular features of the descriptor fields by
+ * other nodes on the system. The bit settings are defined in Table.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] descriptor_capability_field Bit 0 : Extended Active Endpoint List Available \n
+ *                                         Bit 1 : Extended Simple Descriptor List Available \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_node_desc_set_descriptor_capability_field()
+ */
+int zb_node_desc_get_descriptor_capability_field(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short* descriptor_capability_field);
+
+/**
+ * @brief set descriptor capability to node descriptor
+ * @details The descriptor capability field of the node descriptor is eight bits in length
+ * , with bit settings signifying the descriptor capabilities of this node. \n\n
+ * It is used to facilitate discovery of particular features of the descriptor fields by
+ * other nodes on the system. The bit settings are defined in Table.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[in] descriptor_capability_field Bit 0 : Extended Active Endpoint List Available \n
+ *                                        Bit 1 : Extended Simple Descriptor List Available \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ *
+ * @see zb_node_desc_get_descriptor_capability_field()
+ */
+int zb_node_desc_set_descriptor_capability_field(
+               zb_zdo_node_descriptor_h handle,
+               unsigned short descriptor_capability_field);
+
+/**
+ * @brief get extended pan id from network list record
+ * @details When received zb_zdo_mgmt_nwk_disc_rsp callback (originally, ZigBee
+ * called Mgmt_NWK_Disc_rsp (ClusterID = 0x8030) ), it has a network_list_record. \n\n
+ * Therefore this function can help parsing parameter in network_list_record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] extended_pan_id The 64-bit extended PAN identifier of the discovered
+ *                             network.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_nwk_disc_rsp()
+ */
+int zb_network_list_record_get_extended_pan_id(
+               zb_zdo_network_list_record_h handle,
+               ieee_addr extended_pan_id);
+
+/**
+ * @brief get logical channel number from network list record
+ * @details When received zb_zdo_mgmt_nwk_disc_rsp callback (originally, ZigBee
+ * called Mgmt_NWK_Disc_rsp (ClusterID = 0x8030) ), it has multiple network_list_record.
+ * \n\n Therefore this function can help parsing parameter in network_list_record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] logical_channel The current logical channel occupied by the network. \n
+ *                             Selected from the available logical channels supported by
+ *                             the PHY.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_nwk_disc_rsp()
+ */
+int zb_network_list_record_get_logical_channel(
+               zb_zdo_network_list_record_h handle,
+               unsigned char* logical_channel);
+
+/**
+ * @brief get ZigBee version from network list record
+ * @details When received zb_zdo_mgmt_nwk_disc_rsp callback (originally, ZigBee
+ * called Mgmt_NWK_Disc_rsp (ClusterID = 0x8030) ), it has a network_list_record. \n\n
+ * Therefore this function can help parsing parameter in network_list_record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] zigbee_version 0x0~0xf : The version of the ZigBee protocol in use
+ *                             in the discovered network.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_nwk_disc_rsp()
+ */
+int zb_network_list_record_get_zigbee_version(
+               zb_zdo_network_list_record_h handle,
+               unsigned char* zigbee_version);
+
+/**
+ * @brief get stack profile from network list record
+ * @details When received zb_zdo_mgmt_nwk_disc_rsp callback (originally, ZigBee
+ * called Mgmt_NWK_Disc_rsp (ClusterID = 0x8030) ), it has a network_list_record. \n\n
+ * Therefore this function can help parsing parameter in network_list_record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] stack_profile 0x0~0xf : A ZigBee stack profile identifier indicating
+ *                             the stack profile in use in the discovered network.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_nwk_disc_rsp()
+ */
+int zb_network_list_record_get_stack_profile(
+               zb_zdo_network_list_record_h handle,
+               unsigned char* stack_profile);
+
+/**
+ * @brief get beacon order from network list record
+ * @details When received zb_zdo_mgmt_nwk_disc_rsp callback (originally, ZigBee
+ * called Mgmt_NWK_Disc_rsp (ClusterID = 0x8030) ), it has a network_list_record. \n\n
+ * Therefore this function can help parsing parameter in network_list_record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] beacon_order 0x0~0xf : This specifies how often the MAC sub-layer
+ * beacon is to be transmitted by a given device on the network. \n\n For a discussion of
+ * MAC sub-layer beacon order
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_nwk_disc_rsp()
+ */
+int zb_network_list_record_get_beacon_order(
+               zb_zdo_network_list_record_h handle,
+               unsigned char* beacon_order);
+
+/**
+ * @brief get superframe order from network list record
+ * @details When received zb_zdo_mgmt_nwk_disc_rsp callback (originally, ZigBee
+ * called Mgmt_NWK_Disc_rsp (ClusterID = 0x8030) ), it has a network_list_record. \n\n
+ * Therefore this function can help parsing parameter in network_list_record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] superframe_order 0x0~0xf : For beacon-oriented networks, i.e., beacon
+ * order < 15, this specifies the length of the active period of the superframe. \n\n
+ * For a discussion of MAC sub-layer superframe order.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_nwk_disc_rsp()
+ */
+int zb_network_list_record_get_superframe_order(
+               zb_zdo_network_list_record_h handle,
+               unsigned char* superframe_order);
+
+/**
+ * @brief get permit joining from network list record
+ * @details When received zb_zdo_mgmt_nwk_disc_rsp callback (originally, ZigBee
+ * called Mgmt_NWK_Disc_rsp (ClusterID = 0x8030) ), it has a network_list_record. \n\n
+ * Therefore this function can help parsing parameter in network_list_record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] permit_joining 0 or 1 : A value of TRUE indicates that at least one
+ * ZigBee router on the network currently permits joining, i.e., its NWK has been
+ * issued an NLME-PERMIT-JOINING primitive and the time limit, if given, has
+ * not yet expired.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_nwk_disc_rsp()
+ */
+int zb_network_list_record_get_permit_joining(
+               zb_zdo_network_list_record_h handle,
+               unsigned char* permit_joining);
+
+/**
+ * @brief get destination address from routing table record
+ * @details When received zb_zdo_mgmt_rtg_rsp callback (originally, The Mgmt_Rtg_rsp
+ * command (ClusterID=0x8032) ), it has a routing table record. \n\n
+ * Therefore this function can help parsing parameter in routing table records.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] dst_addr The destination address for the binding entry
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_rtg_rsp()
+ * @see zb_routing_table_get_dst_addr()
+ * @see zb_routing_table_get_dst_status()
+ * @see zb_routing_table_get_memory_constrained()
+ * @see zb_routing_table_get_many_to_one()
+ * @see zb_routing_table_get_route_record_required()
+ * @see zb_routing_table_get_next_hop_addr()
+ */
+int zb_routing_table_get_dst_addr(zb_zdo_routing_table_h handle,
+               nwk_addr* dst_addr);
+
+/**
+ * @brief get status bits (3bit) from routing table record
+ * @details When received zb_zdo_mgmt_rtg_rsp callback (originally, The Mgmt_Rtg_rsp
+ * command (ClusterID=0x8032) ), it has a routing table record. \n\n
+ * Therefore this function can help parsing parameter in routing table records.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] status 0x0=ACTIVE. \n
+ *                    0x1=DISCOVERY_UNDERWAY. \n
+ *                    0x2=DISCOVERY_FAILED. \n
+ *                    0x3=INACTIVE. \n
+ *                    0x4=VALIDATION_UNDERWAY \n
+ *                    0x5-0x7=RESERVED. \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_rtg_rsp()
+ * @see zb_routing_table_get_dst_addr()
+ * @see zb_routing_table_get_dst_status()
+ * @see zb_routing_table_get_memory_constrained()
+ * @see zb_routing_table_get_many_to_one()
+ * @see zb_routing_table_get_route_record_required()
+ * @see zb_routing_table_get_next_hop_addr()
+ */
+int zb_routing_table_get_dst_status(zb_zdo_routing_table_h handle,
+               unsigned char* status);
+
+/**
+ * @brief get memory constrained (1bit) from routing table record
+ * @details When received zb_zdo_mgmt_rtg_rsp callback (originally, The Mgmt_Rtg_rsp
+ * command (ClusterID=0x8032) ), it has a routing table record. \n\n
+ * Therefore this function can help parsing parameter in routing table records.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] memory_constrained A flag indicating whether the device is a memory
+ *                                constrained concentrator.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_rtg_rsp()
+ * @see zb_routing_table_get_dst_addr()
+ * @see zb_routing_table_get_dst_status()
+ * @see zb_routing_table_get_memory_constrained()
+ * @see zb_routing_table_get_many_to_one()
+ * @see zb_routing_table_get_route_record_required()
+ * @see zb_routing_table_get_next_hop_addr()
+ */
+int zb_routing_table_get_memory_constrained(
+               zb_zdo_routing_table_h handle, unsigned char* memory_constrained);
+
+/**
+ * @brief get many-to-one (1bit) from routing table record
+ * @details When received zb_zdo_mgmt_rtg_rsp callback (originally, The Mgmt_Rtg_rsp
+ * command (ClusterID=0x8032) ), it has a routing table record. \n\n
+ * Therefore this function can help parsing parameter in routing table records.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] many_to_one A flag indicating that the destination is a concentrator that
+ *                         issued a many-to-one request.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_rtg_rsp()
+ * @see zb_routing_table_get_dst_addr()
+ * @see zb_routing_table_get_dst_status()
+ * @see zb_routing_table_get_memory_constrained()
+ * @see zb_routing_table_get_many_to_one()
+ * @see zb_routing_table_get_route_record_required()
+ * @see zb_routing_table_get_next_hop_addr()
+ */
+int zb_routing_table_get_many_to_one(zb_zdo_routing_table_h handle,
+               unsigned char* many_to_one);
+
+/**
+ * @brief get routing record required (1bit) from routing table record
+ * @details When received zb_zdo_mgmt_rtg_rsp callback (originally, The Mgmt_Rtg_rsp
+ * command (ClusterID=0x8032) ), it has a routing table record. \n\n
+ * Therefore this function can help parsing parameter in routing table records.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] route_record_required A flag indicating that a route record command frame
+ *                                   should be sent to the destination prior to the next
+ *                                   data packet.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_rtg_rsp()
+ * @see zb_routing_table_get_dst_addr()
+ * @see zb_routing_table_get_dst_status()
+ * @see zb_routing_table_get_memory_constrained()
+ * @see zb_routing_table_get_many_to_one()
+ * @see zb_routing_table_get_route_record_required()
+ * @see zb_routing_table_get_next_hop_addr()
+ */
+int zb_routing_table_get_route_record_required(
+               zb_zdo_routing_table_h handle, unsigned char* route_record_required);
+
+/**
+ * @brief get next hop address from routing table record
+ * @details When received zb_zdo_mgmt_rtg_rsp callback (originally, The Mgmt_Rtg_rsp
+ * command (ClusterID=0x8032) ), it has a routing table record. \n\n
+ * Therefore this function can help parsing parameter in routing table records.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] next_hop_addr Next-hop address.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_rtg_rsp()
+ * @see zb_routing_table_get_dst_addr()
+ * @see zb_routing_table_get_dst_status()
+ * @see zb_routing_table_get_memory_constrained()
+ * @see zb_routing_table_get_many_to_one()
+ * @see zb_routing_table_get_route_record_required()
+ * @see zb_routing_table_get_next_hop_addr()
+ */
+int zb_routing_table_get_next_hop_addr(
+               zb_zdo_routing_table_h handle, nwk_addr* next_hop_addr);
+
+/**
+ * @brief get extended pan id from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] extended_pan_id The 64-bit extended PAN id of the neighboring device
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_extended_pan_id(
+               zb_zdo_neighbor_table_desc_h handle,
+               ieee_addr extended_pan_id);
+
+/**
+ * @brief get IEEE address from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] addr64 64-bit IEEE address that is unique to every device. \n
+ * If this value is unknown at the time of the request, this field shall be set to
+ * 0xffffffffffffffff.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_ieee_addr(
+               zb_zdo_neighbor_table_desc_h handle,
+               ieee_addr addr64);
+
+/**
+ * @brief get network address from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] addr16 16-bit network address that is unique to every device. \n
+ * If this value is unknown at the time of the request, this field shall be set to
+ * 0xffffffffffffffff.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_nwk_addr(
+               zb_zdo_neighbor_table_desc_h handle,
+               nwk_addr* addr16);
+
+/**
+ * @brief get device type from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] device_type The type of the neighbor device: \n
+ *                         0x0 = ZigBee coordinator \n
+ *                         0x1 = ZigBee router \n
+ *                         0x2 = ZigBee end device \n
+ *                         0x3 = Unknown \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_device_type(
+               zb_zdo_neighbor_table_desc_h handle,
+               unsigned char* device_type);
+
+/**
+ * @brief get RxOnWhenIdle value from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] rx_on_when_idle Indicates if neighbor's receiver is
+ *                             enabled during idle portions of the \n
+ *                             CAP: \n
+ *                             0x0 = Receiver is off \n
+ *                             0x1 = Receiver is on \n
+ *                             0x2 = unknown
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_rx_on_when_idle(
+               zb_zdo_neighbor_table_desc_h handle,
+               unsigned char* rx_on_when_idle);
+
+/**
+ * @brief get Relationship value from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] releationship The relationship between the
+ *                           neighbor and the current device: \n
+ *                           0x0 = neighbor is the parent \n
+ *                           0x1 = neighbor is a child \n
+ *                           0x2 = neighbor is a sibling \n
+ *                           0x3 = None of the above \n
+ *                           0x4 = previous child
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_relationship(
+               zb_zdo_neighbor_table_desc_h handle,
+               unsigned char* releationship);
+
+/**
+ * @brief get Permit joining value from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] permit_joining An indication of whether the
+ *                            neighbor device is accepting join requests: \n
+ *                            0x0 = neighbor is not accepting join requests \n
+ *                            0x1 = neighbor is accepting join requests \n
+ *                            0x2 = unknown
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_permit_joining(
+               zb_zdo_neighbor_table_desc_h handle,
+               unsigned char* permit_joining);
+
+/**
+ * @brief get Depth value from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] depth The 0x00~nwkcMaxDepth (See. Zigbee Spec.) \n
+ *                   tree depth of the neighbor device. \n
+ *                   A value of 0x00 indicates that the device is the ZigBee
+ *                   coordinator for the network.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_depth(
+               zb_zdo_neighbor_table_desc_h handle,
+               unsigned char* depth);
+
+/**
+ * @brief get LQI(Link-Quality Indicator) value from neighbor table list record
+ * @details When received zb_zdo_mgmt_lqi_rsp callback (originally, ZigBee
+ * called Mgmt_Lqi_rsp (ClusterID = 0x8031) ), it has multiple neigbor_table_list. \n\n
+ * Therefore this function can help parsing parameter in neigbor_table_list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] lqi The estimated link quality for RF transmissions from this device. \n
+ *                 See ZigBee specification for discussion of how this is calculated.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ * @see zb_neighbor_table_desc_get_extended_pan_id()
+ * @see zb_neighbor_table_desc_get_ieee_addr()
+ * @see zb_neighbor_table_desc_get_nwk_addr()
+ * @see zb_neighbor_table_desc_get_device_type()
+ * @see zb_neighbor_table_desc_get_rx_on_when_idle()
+ * @see zb_neighbor_table_desc_get_relationship()
+ * @see zb_neighbor_table_desc_get_permit_joining
+ * @see zb_neighbor_table_desc_get_depth()
+ * @see zb_neighbor_table_desc_get_lqi()
+ */
+int zb_neighbor_table_desc_get_lqi(
+               zb_zdo_neighbor_table_desc_h handle,
+               unsigned char* lqi);
+
+/**
+ * @brief get source MAC address from binding table record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Bind_rsp (ClusterID = 0x8033) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in binding_table structure.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] src_addr The source IEEE address for the binding entry.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_bind_rsp()
+ */
+int zb_binding_table_get_src_addr(
+               zb_zdo_binding_table_h handle,
+               ieee_addr src_addr);
+
+/**
+ * @brief get SrcEndpoint from binding table record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Bind_rsp (ClusterID = 0x8033) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in binding_table structure.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] src_ep The source endpoint for the binding entry.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_bind_rsp()
+ */
+int zb_binding_table_get_src_ep(
+               zb_zdo_binding_table_h handle,
+               unsigned char *src_ep);
+
+/**
+ * @brief get ClusterId from binding table record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Bind_rsp (ClusterID = 0x8033) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in binding_table structure.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] cluster_id The identifier of the cluster on the source device that is bound
+ *                        to the destination device.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_bind_rsp()
+ */
+int zb_binding_table_get_cluster_id(
+               zb_zdo_binding_table_h handle,
+               unsigned short *cluster_id);
+
+/**
+ * @brief get DstAddrMode from binding table record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Bind_rsp (ClusterID = 0x8033) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in binding_table structure.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] dst_addr_mode The addressing mode for the destination address. \n\n
+ *                       This field can take one of the non-reserved values
+ *                       from the following list: \n\n
+ *                       0x00 = reserved \n
+ *                       0x01 = 16-bit group address for DstAddr and DstEndpoint not
+ *                              present \n
+ *                       0x02 = reserved \n
+ *                       0x03 = 64-bit extended address for DstAddr and DstEndp present \n
+ *                       0x04 ? 0xff = reserved \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_bind_rsp()
+ */
+int zb_binding_table_get_dst_addr_mode(
+               zb_zdo_binding_table_h handle,
+               unsigned char *dst_addr_mode);
+
+/**
+ * @brief get DstAddr from binding table record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Bind_rsp (ClusterID = 0x8033) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in binding_table structure.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] addr16 The destination address for the binding entry. \n
+ *                    As specified by the DstAddrMode field.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No network address
+ *
+ * @see zb_zdo_mgmt_bind_rsp()
+ */
+int zb_binding_table_get_dst_addr16(
+               zb_zdo_binding_table_h handle,
+               nwk_addr *addr16);
+
+/**
+ * @brief get DstAddr from binding table record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Bind_rsp (ClusterID = 0x8033) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in binding_table structure.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] addr64 The destination address for the binding entry. \n
+ *                    As specified by the DstAddrMode field.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No IEEE address
+ *
+ * @see zb_zdo_mgmt_bind_rsp()
+ */
+int zb_binding_table_get_dst_addr64(
+               zb_zdo_binding_table_h handle,
+               ieee_addr addr64);
+
+/**
+ * @brief get DstEndPoint from binding table record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Bind_rsp (ClusterID = 0x8033) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in binding_table structure.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] dst_ep 0x01~0xff : This field shall be present only if the DstAddrMode
+ *                    field has a value of 0x03 and, if present, shall be the destination
+ *                    endpoint for the binding entry.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_bind_rsp()
+ */
+int zb_binding_table_get_dst_ep(
+               zb_zdo_binding_table_h handle,
+               unsigned char *dst_ep);
+
+/**
+ * @brief get ExtendedAddress from discovery cache record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Cache_rsp (ClusterID = 0x8037) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in discovery cache list record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] addr64 64-bit IEEE Address of the cached device.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_cache_rsp()
+ */
+int zb_discovery_cache_get_ieee_addr(
+               zb_zdo_discovery_cache_h handle,
+               ieee_addr addr64);
+
+/**
+ * @brief get NetworkAddress from discovery cache record
+ * @details When received zb_zdo_mgmt_bind_rsp callback (originally, ZigBee
+ * called Mgmt_Cache_rsp (ClusterID = 0x8037) ), it has multiple binding table. \n\n
+ * Therefore this function can help parsing parameter in discovery cache list record.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of node descriptor
+ * @param[out] addr16 16-bit network Address of the cached device.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_zdo_mgmt_cache_rsp()
+ */
+int zb_discovery_cache_get_nwk_addr(
+               zb_zdo_discovery_cache_h handle,
+               nwk_addr *addr16);
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZDO_H__ */
diff --git a/include/zcl/zb-zcl-alarm-cluster.h b/include/zcl/zb-zcl-alarm-cluster.h
new file mode 100644 (file)
index 0000000..431f65a
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_ALARM_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_ALARM_CLUSTER_H__
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-alarm-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_ALARM_CLUSTER_MODULE Alarm Cluster
+ *
+ * @brief zigbee alarm cluster commands
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_ALARM_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 3.57 Generated Command IDs for the Alarms Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Alarm                                |     M      |
+ * |             0x01               | Get alarm response                   |     O      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+#if 0 /* This will be handled by event-handler */
+/**
+ * @brief Command description for alarm notification
+ * @details The alarm command signals an alarm situation on the sending device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Destination endpoint
+ * @param[out] status Status code \n
+ *                    #ZB_ZCL_SUCCESS \n
+ *                    #ZB_ZCL_NOT_FOUND
+ * @param[out] alarm_code Alarm code (8bit enumeration)
+ * @                      Identifying code for the cause of the alarm,
+ * @                      as given in the specification of the cluster
+ * @                      whose attribute generated this alarm.
+ * @param[out] cluster_id Custer identifier
+ */
+typedef void (*zb_zcl_alarm_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char alarm_code,
+               unsigned short cluster_id);
+#endif
+
+/**
+ * @brief Command description for get alarm response
+ * @details The get alarm response command returns the results of a request to retrieve
+ * information from the alarm log, along with a time stamp indicating when the
+ * alarm situation was detected.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Destination endpoint
+ * @param[out] status Status code \n
+ *                    #ZB_ZCL_SUCCESS \n
+ *                    #ZB_ZCL_NOT_FOUND
+ * @param[out] alarm_code Alarm code (8bit enumeration)
+ * @                      Identifying code for the cause of the alarm,
+ * @                      as given in the specification of the cluster
+ * @                      whose attribute generated this alarm.
+ * @param[out] cluster_id Custer identifier
+ * @param[out] time_stamp Unsigned 32bit time stamp
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_alarm_get_alarm()
+ */
+typedef void (*zb_zcl_alarm_get_alarm_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char status,
+               unsigned char alarm_code,
+               unsigned short cluster_id,
+               unsigned int time_stamp,
+               void *user_data);
+
+/* Table 3.56 Received Command IDs for the Alarms Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Reset Alarm                          |     M      |
+ * |             0x01               | Reset all alarms                     |     M      |
+ * |             0x02               | Get Alarm                            |     O      |
+ * |             0x03               | Reset alarm log                      |     O      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for reset alarm
+ * @details This command resets a specific alarm. This is needed for some alarms that do
+ * not reset automatically. If the alarm condition being reset was in fact still active
+ * then a new notification will be generated and, where implemented, a new record added
+ * to the alarm log.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Destination endpoint
+ * @param[in] alarm_code Alarm code (8bit enumeration)
+ * @                     Identifying code for the cause of the alarm,
+ * @                     as given in the specification of the cluster
+ * @                     whose attribute generated this alarm.
+ * @param[in] cluster_id Custer identifier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ */
+int zb_zcl_alarm_reset_alarm(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char alarm_code,
+               unsigned short cluster_id);
+
+/**
+ * @brief Command description for reset all alarm
+ * @details This command resets all alarms. Any alarm conditions that were in fact still
+ * active will cause a new notification to be generated and, where implemented, a new
+ * record added to the alarm log.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Destination endpoint
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ */
+int zb_zcl_alarm_reset_all_alarm(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep);
+
+/**
+ * @brief Command description for get alarm
+ * @details This command causes the alarm with the earliest timestamp in the alarm table
+ * to be reported in a get alarm response command 3.11.2.5.2. This command enables
+ * the reading of logged alarm conditions from the alarm table. Once an alarm
+ * condition has been reported the corresponding entry in the table is removed.
+ * This command does not have a payload.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Destination endpoint
+ * @param[in] cb Response callback function pointer
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_alarm_get_alarm_rsp()
+ */
+int zb_zcl_alarm_get_alarm(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               zb_zcl_alarm_get_alarm_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for reset all alarm log
+ * @details This command causes the alarm table to be cleared, and does not have a payload.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Destination endpoint
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ */
+int zb_zcl_alarm_reset_all_alarm_log(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_ALARM_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-attribute-ids.h b/include/zcl/zb-zcl-attribute-ids.h
new file mode 100644 (file)
index 0000000..92ef295
--- /dev/null
@@ -0,0 +1,1057 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_IDS_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_IDS_H__
+
+/**
+ * @file zb-zcl-attribute-ids.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_IDENTIFIER_MODULE Cluster Attribute Identifier
+ *
+ * @brief zigbee cluster attribute type
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_IDENTIFIER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/**
+ * @brief Attribute types for cluster: Basic
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_VERSION_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_APPLICATION_VERSION_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_STACK_VERSION_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_HW_VERSION_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_MANUFACTURER_NAME_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_MODEL_IDENTIFIER_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_DATE_CODE_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_POWER_SOURCE_ATTRIBUTE_ID = 0x0007, /**< Ver.: always */
+       ZB_ZCL_APPLICATION_PROFILE_VERSION_ATTRIBUTE_ID = 0x0008, /**< Ver.: always */
+       ZB_ZCL_LOCATION_DESCRIPTION_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_PHYSICAL_ENVIRONMENT_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_DEVICE_ENABLED_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_ALARM_MASK_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_DISABLE_LOCAL_CONFIG_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+       ZB_ZCL_SW_BUILD_ID_ATTRIBUTE_ID = 0x4000, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_basic_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Power Configuration
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_MAINS_VOLTAGE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_MAINS_FREQUENCY_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_MAINS_ALARM_MASK_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_MAINS_VOLTAGE_MIN_THRESHOLD_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_MAINS_VOLTAGE_MAX_THRESHOLD_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_MAINS_VOLTAGE_DWELL_TRIP_POINT_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_BATTERY_VOLTAGE_ATTRIBUTE_ID = 0x0020, /**< Ver.: always */
+       ZB_ZCL_BATTERY_PERCENTAGE_REMAINING_ATTRIBUTE_ID = 0x0021, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_MANUFACTURER_ATTRIBUTE_ID = 0x0030, /**< Ver.: always */
+       ZB_ZCL_BATTERY_SIZE_ATTRIBUTE_ID = 0x0031, /**< Ver.: always */
+       ZB_ZCL_BATTERY_AHR_RATING_ATTRIBUTE_ID = 0x0032, /**< Ver.: always */
+       ZB_ZCL_BATTERY_QUANTITY_ATTRIBUTE_ID = 0x0033, /**< Ver.: always */
+       ZB_ZCL_BATTERY_RATED_VOLTAGE_ATTRIBUTE_ID = 0x0034, /**< Ver.: always */
+       ZB_ZCL_BATTERY_ALARM_MASK_ATTRIBUTE_ID = 0x0035, /**< Ver.: always */
+       ZB_ZCL_BATTERY_VOLTAGE_MIN_THRESHOLD_ATTRIBUTE_ID = 0x0036, /**< Ver.: always */
+       ZB_ZCL_BATTERY_VOLTAGE_THRESHOLD_1_ATTRIBUTE_ID = 0x0037, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_VOLTAGE_THRESHOLD_2_ATTRIBUTE_ID = 0x0038, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_VOLTAGE_THRESHOLD_3_ATTRIBUTE_ID = 0x0039, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_PERCENTAGE_MIN_THRESHOLD_ATTRIBUTE_ID = 0x003A, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_PERCENTAGE_THRESHOLD_1_ATTRIBUTE_ID = 0x003B, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_PERCENTAGE_THRESHOLD_2_ATTRIBUTE_ID = 0x003C, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_PERCENTAGE_THRESHOLD_3_ATTRIBUTE_ID = 0x003D, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_ALARM_STATE_ATTRIBUTE_ID = 0x003E, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_VOLTAGE_ATTRIBUTE_ID = 0x0040, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_PERCENTAGE_REMAINING_ATTRIBUTE_ID = 0x0041, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_MANUFACTURER_ATTRIBUTE_ID = 0x0050, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_SIZE_ATTRIBUTE_ID = 0x0051, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_AHR_RATING_ATTRIBUTE_ID = 0x0052, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_QUANTITY_ATTRIBUTE_ID = 0x0053, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_RATED_VOLTAGE_ATTRIBUTE_ID = 0x0054, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_ALARM_MASK_ATTRIBUTE_ID = 0x0055, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_VOLTAGE_MIN_THRESHOLD_ATTRIBUTE_ID = 0x0056, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_VOLTAGE_THRESHOLD_1_ATTRIBUTE_ID = 0x0057, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_VOLTAGE_THRESHOLD_2_ATTRIBUTE_ID = 0x0058, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_VOLTAGE_THRESHOLD_3_ATTRIBUTE_ID = 0x0059, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_PERCENTAGE_MIN_THRESHOLD_ATTRIBUTE_ID = 0x005A, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_PERCENTAGE_THRESHOLD_1_ATTRIBUTE_ID = 0x005B, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_PERCENTAGE_THRESHOLD_2_ATTRIBUTE_ID = 0x005C, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_PERCENTAGE_THRESHOLD_3_ATTRIBUTE_ID = 0x005D, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_2_ALARM_STATE_ATTRIBUTE_ID = 0x005E, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_VOLTAGE_ATTRIBUTE_ID = 0x0060, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_PERCENTAGE_REMAINING_ATTRIBUTE_ID = 0x0061, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_MANUFACTURER_ATTRIBUTE_ID = 0x0070, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_SIZE_ATTRIBUTE_ID = 0x0071, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_AHR_RATING_ATTRIBUTE_ID = 0x0072, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_QUANTITY_ATTRIBUTE_ID = 0x0073, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_RATED_VOLTAGE_ATTRIBUTE_ID = 0x0074, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_ALARM_MASK_ATTRIBUTE_ID = 0x0075, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_VOLTAGE_MIN_THRESHOLD_ATTRIBUTE_ID = 0x0076, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_VOLTAGE_THRESHOLD_1_ATTRIBUTE_ID = 0x0077, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_VOLTAGE_THRESHOLD_2_ATTRIBUTE_ID = 0x0078, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_VOLTAGE_THRESHOLD_3_ATTRIBUTE_ID = 0x0079, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_PERCENTAGE_MIN_THRESHOLD_ATTRIBUTE_ID = 0x007A, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_PERCENTAGE_THRESHOLD_1_ATTRIBUTE_ID = 0x007B, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_PERCENTAGE_THRESHOLD_2_ATTRIBUTE_ID = 0x007C, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_PERCENTAGE_THRESHOLD_3_ATTRIBUTE_ID = 0x007D, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_BATTERY_3_ALARM_STATE_ATTRIBUTE_ID = 0x007E, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_power_configuration_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Device Temperature Configuration
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_CURRENT_TEMPERATURE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_MIN_TEMP_EXPERIENCED_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_MAX_TEMP_EXPERIENCED_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_OVER_TEMP_TOTAL_DWELL_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_DEVICE_TEMP_ALARM_MASK_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_LOW_TEMP_THRESHOLD_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_HIGH_TEMP_THRESHOLD_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_LOW_TEMP_DWELL_TRIP_POINT_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_HIGH_TEMP_DWELL_TRIP_POINT_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+} zb_zcl_device_temperature_configuration_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Identify
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_COMMISSION_STATE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+} zb_zcl_identify_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Groups
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_GROUP_NAME_SUPPORT_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+} zb_zcl_group_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Scenes
+ * @details Cluster specification level: zcl-1.0-07-5123-03\n
+ *
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SCENE_COUNT_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_CURRENT_SCENE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_CURRENT_GROUP_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_SCENE_VALID_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_SCENE_NAME_SUPPORT_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_LAST_CONFIGURED_BY_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+} zb_zcl_scenes_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: On/off
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ON_OFF_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_SAMPLE_MFG_SPECIFIC_TRANSITION_TIME_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_GLOBAL_SCENE_CONTROL_ATTRIBUTE_ID = 0x4000, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ON_TIME_ATTRIBUTE_ID = 0x4001, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_OFF_WAIT_TIME_ATTRIBUTE_ID = 0x4002, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_on_off_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: On/off Switch Configuration
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SWITCH_TYPE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_SWITCH_ACTIONS_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+} zb_zcl_on_off_switc_configuration_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Level Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_CURRENT_LEVEL_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_LEVEL_CONTROL_REMAINING_TIME_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_ON_OFF_TRANSITION_TIME_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_ON_LEVEL_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_ON_TRANSITION_TIME_ATTRIBUTE_ID = 0x0012, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_OFF_TRANSITION_TIME_ATTRIBUTE_ID = 0x0013, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_DEFAULT_MOVE_RATE_ATTRIBUTE_ID = 0x0014, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_level_control_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Alarms
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ALARM_COUNT_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+} zb_zcl_alarms_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Time
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_TIME_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_TIME_STATUS_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_TIME_ZONE_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_DST_START_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_DST_END_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_DST_SHIFT_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_STANDARD_TIME_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_LOCAL_TIME_ATTRIBUTE_ID = 0x0007, /**< Ver.: always */
+       ZB_ZCL_LAST_SET_TIME_ATTRIBUTE_ID = 0x0008, /**< Ver.: always */
+       ZB_ZCL_VALID_UNTIL_TIME_ATTRIBUTE_ID = 0x0009, /**< Ver.: always */
+} zb_zcl_time_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: RSSI Location
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_LOCATION_TYPE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_LOCATION_METHOD_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_LOCATION_AGE_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_QUALITY_MEASURE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_NUMBER_OF_DEVICES_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_COORDINATE1_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_COORDINATE2_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_COORDINATE3_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_POWER_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_PATH_LOSS_EXPONENT_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+       ZB_ZCL_REPORTING_PERIOD_ATTRIBUTE_ID = 0x0015, /**< Ver.: always */
+       ZB_ZCL_CALCULATION_PERIOD_ATTRIBUTE_ID = 0x0016, /**< Ver.: always */
+       ZB_ZCL_NUMBER_RSSI_MEASUREMENTS_ATTRIBUTE_ID = 0x0017, /**< Ver.: always */
+} zb_zcl_rssi_location_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Binary Input (Basic)
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ACTIVE_TEXT_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_DESCRIPTION_ATTRIBUTE_ID = 0x001C, /**< Ver.: always */
+       ZB_ZCL_INACTIVE_TEXT_ATTRIBUTE_ID = 0x002E, /**< Ver.: always */
+       ZB_ZCL_OUT_OF_SERVICE_ATTRIBUTE_ID = 0x0051, /**< Ver.: always */
+       ZB_ZCL_POLARITY_ATTRIBUTE_ID = 0x0054, /**< Ver.: always */
+       ZB_ZCL_PRESENT_VALUE_ATTRIBUTE_ID = 0x0055, /**< Ver.: always */
+       ZB_ZCL_RELIABILITY_ATTRIBUTE_ID = 0x0067, /**< Ver.: always */
+       ZB_ZCL_STATUS_FLAGS_ATTRIBUTE_ID = 0x006F, /**< Ver.: always */
+       ZB_ZCL_APPLICATION_TYPE_ATTRIBUTE_ID = 0x0100, /**< Ver.: always */
+} zb_zcl_binary_input_basic_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Commissioning
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SHORT_ADDRESS_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_EXTENDED_PAN_ID_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_PAN_ID_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_CHANNEL_MASK_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_PROTOCOL_VERSION_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_STACK_PROFILE_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_STARTUP_CONTROL_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_TRUST_CENTER_ADDRESS_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_TRUST_CENTER_MASTER_KEY_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_NETWORK_KEY_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_USE_INSECURE_JOIN_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_PRECONFIGURED_LINK_KEY_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+       ZB_ZCL_NETWORK_KEY_SEQUENCE_NUMBER_ATTRIBUTE_ID = 0x0015, /**< Ver.: always */
+       ZB_ZCL_NETWORK_KEY_TYPE_ATTRIBUTE_ID = 0x0016, /**< Ver.: always */
+       ZB_ZCL_NETWORK_MANAGER_ADDRESS_ATTRIBUTE_ID = 0x0017, /**< Ver.: always */
+       ZB_ZCL_SCAN_ATTEMPTS_ATTRIBUTE_ID = 0x0020, /**< Ver.: always */
+       ZB_ZCL_TIME_BETWEEN_SCANS_ATTRIBUTE_ID = 0x0021, /**< Ver.: always */
+       ZB_ZCL_REJOIN_INTERVAL_ATTRIBUTE_ID = 0x0022, /**< Ver.: always */
+       ZB_ZCL_MAX_REJOIN_INTERVAL_ATTRIBUTE_ID = 0x0023, /**< Ver.: always */
+       ZB_ZCL_INDIRECT_POLL_RATE_ATTRIBUTE_ID = 0x0030, /**< Ver.: always */
+       ZB_ZCL_PARENT_RETRY_THRESHOLD_ATTRIBUTE_ID = 0x0031, /**< Ver.: always */
+       ZB_ZCL_CONCENTRATOR_FLAG_ATTRIBUTE_ID = 0x0040, /**< Ver.: always */
+       ZB_ZCL_CONCENTRATOR_RADIUS_ATTRIBUTE_ID = 0x0041, /**< Ver.: always */
+       ZB_ZCL_CONCENTRATOR_DISCOVERY_TIME_ATTRIBUTE_ID = 0x0042, /**< Ver.: always */
+} zb_zcl_commissioning_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Partition
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_PARTITION_MAXIMUM_INCOMING_TRANSFER_SIZE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_PARTITION_MAXIMUM_OUTGOING_TRANSFER_SIZE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_PARTIONED_FRAME_SIZE_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_LARGE_FRAME_SIZE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_NUMBER_OF_ACK_FRAME_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_NACK_TIMEOUT_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_INTERFRAME_DELAY_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_NUMBER_OF_SEND_RETRIES_ATTRIBUTE_ID = 0x0007, /**< Ver.: always */
+       ZB_ZCL_SENDER_TIMEOUT_ATTRIBUTE_ID = 0x0008, /**< Ver.: always */
+       ZB_ZCL_RECEIVER_TIMEOUT_ATTRIBUTE_ID = 0x0009, /**< Ver.: always */
+} zb_zcl_partition_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Over the Air Bootloading
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_UPGRADE_SERVER_ID_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_FILE_OFFSET_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_CURRENT_FILE_VERSION_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_CURRENT_ZIGBEE_STACK_VERSION_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_DOWNLOADED_FILE_VERSION_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_DOWNLOADED_ZIGBEE_STACK_VERSION_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_IMAGE_UPGRADE_STATUS_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_MANUFACTURER_ID_ATTRIBUTE_ID = 0x0007, /**< Ver.: always */
+       ZB_ZCL_IMAGE_TYPE_ID_ATTRIBUTE_ID = 0x0008, /**< Ver.: always */
+       ZB_ZCL_MINIMUM_BLOCK_REQUEST_PERIOD_ATTRIBUTE_ID = 0x0009, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_IMAGE_STAMP_ATTRIBUTE_ID = 0x000A, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_over_the_air_bootloading_client_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Power Profile
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_TOTAL_PROFILE_NUM_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_MULTIPLE_SCHEDULING_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_ENERGY_FORMATTING_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_ENERGY_REMOTE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_SCHEDULE_MODE_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+} zb_zcl_power_profile_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Appliance Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_START_TIME_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_FINISH_TIME_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_REMAINING_TIME_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+} zb_zcl_appliance_control_server_attributes_e;
+
+/**
+  * @brief Attribute types for cluster: Poll Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_CHECK_IN_INTERVAL_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_LONG_POLL_INTERVAL_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_SHORT_POLL_INTERVAL_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_FAST_POLL_TIMEOUT_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_CHECK_IN_INTERVAL_MIN_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_LONG_POLL_INTERVAL_MIN_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_FAST_POLL_TIMEOUT_MAX_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+} zb_zcl_poll_control_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Shade Configuration
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SHADE_CONFIG_PHYSICAL_CLOSED_LIMIT_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_SHADE_CONFIG_MOTOR_STEP_SIZE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_SHADE_CONFIG_STATUS_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_SHADE_CONFIG_CLOSED_LIMIT_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_SHADE_CONFIG_MODE_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+} zb_zcl_shade_configuration_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Door Lock
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_LOCK_STATE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_LOCK_TYPE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_ACTUATOR_ENABLED_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_DOOR_STATE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_DOOR_OPEN_EVENTS_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_DOOR_CLOSED_EVENTS_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_OPEN_PERIOD_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_NUM_LOCK_RECORDS_SUPPORTED_ATTRIBUTE_ID = 0x0010, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_NUM_TOTAL_USERS_SUPPORTED_ATTRIBUTE_ID = 0x0011, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_NUM_PIN_USERS_SUPPORTED_ATTRIBUTE_ID = 0x0012, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_NUM_RFID_USERS_SUPPORTED_ATTRIBUTE_ID = 0x0013, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_NUM_WEEKDAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID = 0x0014, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_NUM_YEARDAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID = 0x0015, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_NUM_HOLIDAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID = 0x0016, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_MAX_PIN_LENGTH_ATTRIBUTE_ID = 0x0017, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_MIN_PIN_LENGTH_ATTRIBUTE_ID = 0x0018, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_MAX_RFID_CODE_LENGTH_ATTRIBUTE_ID = 0x0019, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_MIN_RFID_CODE_LENGTH_ATTRIBUTE_ID = 0x001A, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_ENABLE_LOGGING_ATTRIBUTE_ID = 0x0020, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_LANGUAGE_ATTRIBUTE_ID = 0x0021, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_LED_SETTINGS_ATTRIBUTE_ID = 0x0022, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AUTO_RELOCK_TIME_ATTRIBUTE_ID = 0x0023, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SOUND_VOLUME_ATTRIBUTE_ID = 0x0024, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_OPERATING_MODE_ATTRIBUTE_ID = 0x0025, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SUPPORTED_OPERATING_MODES_ATTRIBUTE_ID = 0x0026, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_DEFAULT_CONFIGURATION_REGISTER_ATTRIBUTE_ID = 0x0027, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_ENABLE_LOCAL_PROGRAMMING_ATTRIBUTE_ID = 0x0028, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_ENABLE_ONE_TOUCH_LOCKING_ATTRIBUTE_ID = 0x0029, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_ENABLE_INSIDE_STATUS_LED_ATTRIBUTE_ID = 0x002A, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_ENABLE_PRIVACY_MODE_BUTTON_ATTRIBUTE_ID = 0x002B, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_WRONG_CODE_ENTRY_LIMIT_ATTRIBUTE_ID = 0x0030, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_USER_CODE_TEMPORARY_DISABLE_TIME_ATTRIBUTE_ID = 0x0031, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SEND_PIN_OVER_THE_AIR_ATTRIBUTE_ID = 0x0032, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_REQUIRE_PIN_FOR_RF_OPERATION_ATTRIBUTE_ID = 0x0033, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_ZIGBEE_SECURITY_LEVEL_ATTRIBUTE_ID = 0x0034, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_DOOR_LOCK_ALARM_MASK_ATTRIBUTE_ID = 0x0040, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_KEYPAD_OPERATION_EVENT_MASK_ATTRIBUTE_ID = 0x0041, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_RF_OPERATION_EVENT_MASK_ATTRIBUTE_ID = 0x0042, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_MANUAL_OPERATION_EVENT_MASK_ATTRIBUTE_ID = 0x0043, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_RFID_OPERATION_EVENT_MASK_ATTRIBUTE_ID = 0x0044, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_KEYPAD_PROGRAMMING_EVENT_MASK_ATTRIBUTE_ID = 0x0045, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_RF_PROGRAMMING_EVENT_MASK_ATTRIBUTE_ID = 0x0046, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_RFID_PROGRAMMING_EVENT_MASK_ATTRIBUTE_ID = 0x0047, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_door_lock_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Window Covering
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_COVERING_TYPE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_LIMIT_LIFT_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_LIMIT_TILT_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_CURRENT_LIFT_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_CURRENT_TILT_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_NUMBER_LIFT_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_NUMBER_TILT_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_CONFIG_STATUS_ATTRIBUTE_ID = 0x0007, /**< Ver.: always */
+       ZB_ZCL_CURRENT_LIFT_PERCENTAGE_ATTRIBUTE_ID = 0x0008, /**< Ver.: always */
+       ZB_ZCL_CURRENT_TILT_PERCENTAGE_ATTRIBUTE_ID = 0x0009, /**< Ver.: always */
+       ZB_ZCL_OPEN_LIMIT_LIFT_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_CLOSED_LIMIT_LIFT_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_OPEN_LIMIT_TILT_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_CLOSED_LIMIT_TILT_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_VELOCITY_LIFT_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+       ZB_ZCL_ACCELERATION_LIFT_ATTRIBUTE_ID = 0x0015, /**< Ver.: always */
+       ZB_ZCL_DECELERATION_LIFT_ATTRIBUTE_ID = 0x0016, /**< Ver.: always */
+       ZB_ZCL_MODE_ATTRIBUTE_ID = 0x0017, /**< Ver.: always */
+       ZB_ZCL_SETPOINTS_LIFT_ATTRIBUTE_ID = 0x0018, /**< Ver.: always */
+       ZB_ZCL_SETPOINTS_TILT_ATTRIBUTE_ID = 0x0019, /**< Ver.: always */
+} zb_zcl_window_covering_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Pump Configuration and Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_MAX_PRESSURE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_MAX_SPEED_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_MAX_FLOW_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_MIN_CONST_PRESSURE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_MAX_CONST_PRESSURE_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_MIN_COMP_PRESSURE_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_MAX_COMP_PRESSURE_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_MIN_CONST_SPEED_ATTRIBUTE_ID = 0x0007, /**< Ver.: always */
+       ZB_ZCL_MAX_CONST_SPEED_ATTRIBUTE_ID = 0x0008, /**< Ver.: always */
+       ZB_ZCL_MIN_CONST_FLOW_ATTRIBUTE_ID = 0x0009, /**< Ver.: always */
+       ZB_ZCL_MAX_CONST_FLOW_ATTRIBUTE_ID = 0x000A, /**< Ver.: always */
+       ZB_ZCL_MIN_CONST_TEMP_ATTRIBUTE_ID = 0x000B, /**< Ver.: always */
+       ZB_ZCL_MAX_CONST_TEMP_ATTRIBUTE_ID = 0x000C, /**< Ver.: always */
+       ZB_ZCL_PUMP_STATUS_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_EFFECTIVE_OPERATION_MODE_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_EFFECTIVE_CONTROL_MODE_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_CAPACITY_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_SPEED_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+       ZB_ZCL_LIFETIME_RUNNING_HOURS_ATTRIBUTE_ID = 0x0015, /**< Ver.: always */
+       ZB_ZCL_PUMP_POWER_ATTRIBUTE_ID = 0x0016, /**< Ver.: always */
+       ZB_ZCL_LIFETIME_ENERGY_CONSUMED_ATTRIBUTE_ID = 0x0017, /**< Ver.: always */
+       ZB_ZCL_OPERATION_MODE_ATTRIBUTE_ID = 0x0020, /**< Ver.: always */
+       ZB_ZCL_CONTROL_MODE_ATTRIBUTE_ID = 0x0021, /**< Ver.: always */
+       ZB_ZCL_PUMP_ALARM_MASK_ATTRIBUTE_ID = 0x0022, /**< Ver.: always */
+} zb_zcl_pump_configuration_and_control_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Thermostat
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_LOCAL_TEMPERATURE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_OUTDOOR_TEMPERATURE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_THERMOSTAT_OCCUPANCY_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_ABS_MIN_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_ABS_MAX_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_ABS_MIN_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_ABS_MAX_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_PI_COOLING_DEMAND_ATTRIBUTE_ID = 0x0007, /**< Ver.: always */
+       ZB_ZCL_PI_HEATING_DEMAND_ATTRIBUTE_ID = 0x0008, /**< Ver.: always */
+       ZB_ZCL_HVAC_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID = 0x0009, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_LOCAL_TEMPERATURE_CALIBRATION_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_OCCUPIED_COOLING_SETPOINT_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_OCCUPIED_HEATING_SETPOINT_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_UNOCCUPIED_COOLING_SETPOINT_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_UNOCCUPIED_HEATING_SETPOINT_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+       ZB_ZCL_MIN_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID = 0x0015, /**< Ver.: always */
+       ZB_ZCL_MAX_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID = 0x0016, /**< Ver.: always */
+       ZB_ZCL_MIN_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID = 0x0017, /**< Ver.: always */
+       ZB_ZCL_MAX_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID = 0x0018, /**< Ver.: always */
+       ZB_ZCL_MIN_SETPOINT_DEAD_BAND_ATTRIBUTE_ID = 0x0019, /**< Ver.: always */
+       ZB_ZCL_REMOTE_SENSING_ATTRIBUTE_ID = 0x001A, /**< Ver.: always */
+       ZB_ZCL_CONTROL_SEQUENCE_OF_OPERATION_ATTRIBUTE_ID = 0x001B, /**< Ver.: always */
+       ZB_ZCL_SYSTEM_MODE_ATTRIBUTE_ID = 0x001C, /**< Ver.: always */
+       ZB_ZCL_THERMOSTAT_ALARM_MASK_ATTRIBUTE_ID = 0x001D, /**< Ver.: always */
+       ZB_ZCL_THERMOSTAT_RUNNING_MODE_ATTRIBUTE_ID = 0x001E, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_START_OF_WEEK_ATTRIBUTE_ID = 0x0020, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_NUMBER_OF_WEEKLY_TRANSITIONS_ATTRIBUTE_ID = 0x0021, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_NUMBER_OF_DAILY_TRANSITIONS_ATTRIBUTE_ID = 0x0022, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_TEMPERATURE_SETPOINT_HOLD_ATTRIBUTE_ID = 0x0023, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_TEMPERATURE_SETPOINT_HOLD_DURATION_ATTRIBUTE_ID = 0x0024, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_THERMOSTAT_PROGRAMMING_OPERATION_MODE_ATTRIBUTE_ID = 0x0025, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_THERMOSTAT_RUNNING_STATE_ATTRIBUTE_ID = 0x0029, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SETPOINT_CHANGE_SOURCE_ATTRIBUTE_ID = 0x0030, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SETPOINT_CHANGE_AMOUNT_ATTRIBUTE_ID = 0x0031, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SETPOINT_CHANGE_SOURCE_TIMESTAMP_ATTRIBUTE_ID = 0x0032, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AC_TYPE_ATTRIBUTE_ID = 0x0040, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AC_CAPACITY_ATTRIBUTE_ID = 0x0041, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AC_REFRIGERANT_TYPE_ATTRIBUTE_ID = 0x0042, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AC_COMPRESSOR_ATTRIBUTE_ID = 0x0043, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AC_ERROR_CODE_ATTRIBUTE_ID = 0x0044, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AC_LOUVER_POSITION_ATTRIBUTE_ID = 0x0045, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AC_COIL_TEMPERATURE_ATTRIBUTE_ID = 0x0046, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_AC_CAPACITY_FORMAT_ATTRIBUTE_ID = 0x0047, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_thermostat_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Fan Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_FAN_CONTROL_FAN_MODE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+} zb_zcl_fan_control_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Dehumidification Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_RELATIVE_HUMIDITY_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_DEHUMIDIFICATION_COOLING_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_RH_DEHUMIDIFICATION_SETPOINT_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_RELATIVE_HUMIDITY_MODE_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_DEHUMIDIFICATION_LOCKOUT_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_DEHUMIDIFICATION_HYSTERESIS_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_DEHUMIDIFICATION_MAX_COOL_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+       ZB_ZCL_RELATIVE_HUMIDITY_DISPLAY_ATTRIBUTE_ID = 0x0015, /**< Ver.: always */
+} zb_zcl_dehumidification_control_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Thermostat User Interface Configuration
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_TEMPERATURE_DISPLAY_MODE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_KEYPAD_LOCKOUT_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_SCHEDULE_PROGRAMMING_VISIBILITY_ATTRIBUTE_ID = 0x0002, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_thermostat_user_interface_configuration_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Color Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_REMAINING_TIME_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_DRIFT_COMPENSATION_ATTRIBUTE_ID = 0x0005, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COMPENSATION_TEXT_ATTRIBUTE_ID = 0x0006, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_TEMPERATURE_ATTRIBUTE_ID = 0x0007, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_MODE_ATTRIBUTE_ID = 0x0008, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_NUMBER_OF_PRIMARIES_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_1_X_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_1_Y_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_1_INTENSITY_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_2_X_ATTRIBUTE_ID = 0x0015, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_2_Y_ATTRIBUTE_ID = 0x0016, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_2_INTENSITY_ATTRIBUTE_ID = 0x0017, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_3_X_ATTRIBUTE_ID = 0x0019, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_3_Y_ATTRIBUTE_ID = 0x001A, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_3_INTENSITY_ATTRIBUTE_ID = 0x001B, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_4_X_ATTRIBUTE_ID = 0x0020, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_4_Y_ATTRIBUTE_ID = 0x0021, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_4_INTENSITY_ATTRIBUTE_ID = 0x0022, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_5_X_ATTRIBUTE_ID = 0x0024, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_5_Y_ATTRIBUTE_ID = 0x0025, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_5_INTENSITY_ATTRIBUTE_ID = 0x0026, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_6_X_ATTRIBUTE_ID = 0x0028, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_6_Y_ATTRIBUTE_ID = 0x0029, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_PRIMARY_6_INTENSITY_ATTRIBUTE_ID = 0x002A, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_WHITE_POINT_X_ATTRIBUTE_ID = 0x0030, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_WHITE_POINT_Y_ATTRIBUTE_ID = 0x0031, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_R_X_ATTRIBUTE_ID = 0x0032, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_R_Y_ATTRIBUTE_ID = 0x0033, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_R_INTENSITY_ATTRIBUTE_ID = 0x0034, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_G_X_ATTRIBUTE_ID = 0x0036, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_G_Y_ATTRIBUTE_ID = 0x0037, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_G_INTENSITY_ATTRIBUTE_ID = 0x0038, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_B_X_ATTRIBUTE_ID = 0x003A, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_B_Y_ATTRIBUTE_ID = 0x003B, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_COLOR_POINT_B_INTENSITY_ATTRIBUTE_ID = 0x003C, /**< Ver.: always */
+       ZB_ZCL_COLOR_CONTROL_ENHANCED_CURRENT_HUE_ATTRIBUTE_ID = 0x4000, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_ENHANCED_COLOR_MODE_ATTRIBUTE_ID = 0x4001, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_COLOR_LOOP_ACTIVE_ATTRIBUTE_ID = 0x4002, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_COLOR_LOOP_DIRECTION_ATTRIBUTE_ID = 0x4003, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_COLOR_LOOP_TIME_ATTRIBUTE_ID = 0x4004, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_COLOR_LOOP_START_ENHANCED_HUE_ATTRIBUTE_ID = 0x4005, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_COLOR_LOOP_STORED_ENHANCED_HUE_ATTRIBUTE_ID = 0x4006, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_COLOR_CAPABILITIES_ATTRIBUTE_ID = 0x400A, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_COLOR_TEMP_PHYSICAL_MIN_ATTRIBUTE_ID = 0x400B, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_CONTROL_COLOR_TEMP_PHYSICAL_MAX_ATTRIBUTE_ID = 0x400C, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_color_control_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Ballast Configuration
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_PHYSICAL_MIN_LEVEL_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_PHYSICAL_MAX_LEVEL_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_BALLAST_STATUS_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_MIN_LEVEL_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_MAX_LEVEL_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_POWER_ON_LEVEL_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_POWER_ON_FADE_TIME_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_INTRINSIC_BALLAST_FACTOR_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+       ZB_ZCL_BALLAST_FACTOR_ADJUSTMENT_ATTRIBUTE_ID = 0x0015, /**< Ver.: always */
+       ZB_ZCL_LAMP_QUALITY_ATTRIBUTE_ID = 0x0020, /**< Ver.: always */
+       ZB_ZCL_LAMP_TYPE_ATTRIBUTE_ID = 0x0030, /**< Ver.: always */
+       ZB_ZCL_LAMP_MANUFACTURER_ATTRIBUTE_ID = 0x0031, /**< Ver.: always */
+       ZB_ZCL_LAMP_RATED_HOURS_ATTRIBUTE_ID = 0x0032, /**< Ver.: always */
+       ZB_ZCL_LAMP_BURN_HOURS_ATTRIBUTE_ID = 0x0033, /**< Ver.: always */
+       ZB_ZCL_LAMP_ALARM_MODE_ATTRIBUTE_ID = 0x0034, /**< Ver.: always */
+       ZB_ZCL_LAMP_BURN_HOURS_TRIP_POINT_ATTRIBUTE_ID = 0x0035, /**< Ver.: always */
+} zb_zcl_ballast_configuration_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Illuminance Measurement
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ILLUM_MEASURED_VALUE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_ILLUM_MIN_MEASURED_VALUE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_ILLUM_MAX_MEASURED_VALUE_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_ILLUM_TOLERANCE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_MEASUREMENT_LIGHT_SENSOR_TYPE_ATTRIBUTE_ID = 0x0004, /**< Ver.: always */
+} zb_zcl_illuminance_measurement_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Illuminance Level Sensing
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_LEVEL_STATUS_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_SENSING_LIGHT_SENSOR_TYPE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_ILLUMINANCE_TARGET_LEVEL_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+} zb_zcl_illuminance_level_sensing_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Temperature Measurement
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_TEMP_MEASURED_VALUE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_TEMP_MIN_MEASURED_VALUE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_TEMP_MAX_MEASURED_VALUE_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_TEMP_TOLERANCE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+} zb_zcl_temperature_measurement_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Pressure Measurement
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_PRESSURE_MEASURED_VALUE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_PRESSURE_MIN_MEASURED_VALUE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_PRESSURE_MAX_MEASURED_VALUE_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_PRESSURE_TOLERANCE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+       ZB_ZCL_PRESSURE_SCALED_VALUE_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_PRESSURE_MIN_SCALED_VALUE_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_PRESSURE_MAX_SCALED_VALUE_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_PRESSURE_SCALED_TOLERANCE_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+       ZB_ZCL_PRESSURE_SCALE_ATTRIBUTE_ID = 0x0014, /**< Ver.: always */
+} zb_zcl_pressure_measurement_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Flow Measurement
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_FLOW_MEASURED_VALUE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_FLOW_MIN_MEASURED_VALUE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_FLOW_MAX_MEASURED_VALUE_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_FLOW_TOLERANCE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+} zb_zcl_flow_measurement_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Relative Humidity Measurement
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_RELATIVE_HUMIDITY_MEASURED_VALUE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_RELATIVE_HUMIDITY_MIN_MEASURED_VALUE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_RELATIVE_HUMIDITY_MAX_MEASURED_VALUE_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_RELATIVE_HUMIDITY_TOLERANCE_ATTRIBUTE_ID = 0x0003, /**< Ver.: always */
+} zb_zcl_relative_humidity_measurement_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Occupancy Sensing
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_OCCUPANCY_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_OCCUPANCY_SENSOR_TYPE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_PIR_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_PIR_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_PIR_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_ULTRASONIC_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID = 0x0020, /**< Ver.: always */
+       ZB_ZCL_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID = 0x0021, /**< Ver.: always */
+       ZB_ZCL_ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID = 0x0022, /**< Ver.: always */
+} zb_zcl_occupancy_sensing_measurement_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: IAS Zone
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ZONE_STATE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_ZONE_TYPE_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_ZONE_STATUS_ATTRIBUTE_ID = 0x0002, /**< Ver.: always */
+       ZB_ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID = 0x0010, /**< Ver.: always */
+       ZB_ZCL_ZONE_ID_ATTRIBUTE_ID = 0x0011, /**< Ver.: always */
+       ZB_ZCL_NUMBER_OF_ZONE_SENSITIVITY_LEVELS_SUPPORTED_ATTRIBUTE_ID = 0x0012, /**< Ver.: always */
+       ZB_ZCL_CURRENT_ZONE_SENSITIVITY_LEVEL_ATTRIBUTE_ID = 0x0013, /**< Ver.: always */
+} zb_zcl_isa_zone_server_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: IAS WD
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_MAX_DURATION_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+} zb_zcl_isa_wd_server_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Electrical Measurement
+ * @details Cluster specification level: UNKNOWN
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_MEASUREMENT_TYPE_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_DC_VOLTAGE_ATTRIBUTE_ID = 0x0100, /**< Ver.: always */
+       ZB_ZCL_DC_VOLTAGE_MIN_ATTRIBUTE_ID = 0x0101, /**< Ver.: always */
+       ZB_ZCL_DC_VOLTAGE_MAX_ATTRIBUTE_ID = 0x0102, /**< Ver.: always */
+       ZB_ZCL_DC_CURRENT_ATTRIBUTE_ID = 0x0103, /**< Ver.: always */
+       ZB_ZCL_DC_CURRENT_MIN_ATTRIBUTE_ID = 0x0104, /**< Ver.: always */
+       ZB_ZCL_DC_CURRENT_MAX_ATTRIBUTE_ID = 0x0105, /**< Ver.: always */
+       ZB_ZCL_DC_POWER_ATTRIBUTE_ID = 0x0106, /**< Ver.: always */
+       ZB_ZCL_DC_POWER_MIN_ATTRIBUTE_ID = 0x0107, /**< Ver.: always */
+       ZB_ZCL_DC_POWER_MAX_ATTRIBUTE_ID = 0x0108, /**< Ver.: always */
+       ZB_ZCL_DC_VOLTAGE_MULTIPLIER_ATTRIBUTE_ID = 0x0200, /**< Ver.: always */
+       ZB_ZCL_DC_VOLTAGE_DIVISOR_ATTRIBUTE_ID = 0x0201, /**< Ver.: always */
+       ZB_ZCL_DC_CURRENT_MULTIPLIER_ATTRIBUTE_ID = 0x0202, /**< Ver.: always */
+       ZB_ZCL_DC_CURRENT_DIVISOR_ATTRIBUTE_ID = 0x0203, /**< Ver.: always */
+       ZB_ZCL_DC_POWER_MULTIPLIER_ATTRIBUTE_ID = 0x0204, /**< Ver.: always */
+       ZB_ZCL_DC_POWER_DIVISOR_ATTRIBUTE_ID = 0x0205, /**< Ver.: always */
+       ZB_ZCL_AC_FREQUENCY_ATTRIBUTE_ID = 0x0300, /**< Ver.: always */
+       ZB_ZCL_AC_FREQUENCY_MIN_ATTRIBUTE_ID = 0x0301, /**< Ver.: always */
+       ZB_ZCL_AC_FREQUENCY_MAX_ATTRIBUTE_ID = 0x0302, /**< Ver.: always */
+       ZB_ZCL_NEUTRAL_CURRENT_ATTRIBUTE_ID = 0x0303, /**< Ver.: always */
+       ZB_ZCL_TOTAL_ACTIVE_POWER_ATTRIBUTE_ID = 0x0304, /**< Ver.: always */
+       ZB_ZCL_TOTAL_REACTIVE_POWER_ATTRIBUTE_ID = 0x0305, /**< Ver.: always */
+       ZB_ZCL_TOTAL_APPARENT_POWER_ATTRIBUTE_ID = 0x0306, /**< Ver.: always */
+       ZB_ZCL_MEASURED_1ST_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x0307, /**< Ver.: always */
+       ZB_ZCL_MEASURED_3RD_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x0308, /**< Ver.: always */
+       ZB_ZCL_MEASURED_5TH_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x0309, /**< Ver.: always */
+       ZB_ZCL_MEASURED_7TH_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x030A, /**< Ver.: always */
+       ZB_ZCL_MEASURED_9TH_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x030B, /**< Ver.: always */
+       ZB_ZCL_MEASURED_11TH_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x030C, /**< Ver.: always */
+       ZB_ZCL_MEASURED_PHASE_1ST_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x030D, /**< Ver.: always */
+       ZB_ZCL_MEASURED_PHASE_3RD_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x030E, /**< Ver.: always */
+       ZB_ZCL_MEASURED_PHASE_5TH_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x030F, /**< Ver.: always */
+       ZB_ZCL_MEASURED_PHASE_7TH_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x0310, /**< Ver.: always */
+       ZB_ZCL_MEASURED_PHASE_9TH_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x0311, /**< Ver.: always */
+       ZB_ZCL_MEASURED_PHASE_11TH_HARMONIC_CURRENT_ATTRIBUTE_ID = 0x0312, /**< Ver.: always */
+       ZB_ZCL_AC_FREQUENCY_MULTIPLIER_ATTRIBUTE_ID = 0x0400, /**< Ver.: always */
+       ZB_ZCL_AC_FREQUENCY_DIVISOR_ATTRIBUTE_ID = 0x0401, /**< Ver.: always */
+       ZB_ZCL_POWER_MULTIPLIER_ATTRIBUTE_ID = 0x0402, /**< Ver.: always */
+       ZB_ZCL_POWER_DIVISOR_ATTRIBUTE_ID = 0x0403, /**< Ver.: always */
+       ZB_ZCL_HARMONIC_CURRENT_MULTIPLIER_ATTRIBUTE_ID = 0x0404, /**< Ver.: always */
+       ZB_ZCL_PHASE_HARMONIC_CURRENT_MULTIPLIER_ATTRIBUTE_ID = 0x0405, /**< Ver.: always */
+       ZB_ZCL_INSTANTANEOUS_VOLTAGE_ATTRIBUTE_ID = 0x0500, /**< Ver.: always */
+       ZB_ZCL_INSTANTANEOUS_LINE_CURRENT_ATTRIBUTE_ID = 0x0501, /**< Ver.: always */
+       ZB_ZCL_INSTANTANEOUS_ACTIVE_CURRENT_ATTRIBUTE_ID = 0x0502, /**< Ver.: always */
+       ZB_ZCL_INSTANTANEOUS_REACTIVE_CURRENT_ATTRIBUTE_ID = 0x0503, /**< Ver.: always */
+       ZB_ZCL_INSTANTANEOUS_POWER_ATTRIBUTE_ID = 0x0504, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_ATTRIBUTE_ID = 0x0505, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_MIN_ATTRIBUTE_ID = 0x0506, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_MAX_ATTRIBUTE_ID = 0x0507, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_ATTRIBUTE_ID = 0x0508, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_MIN_ATTRIBUTE_ID = 0x0509, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_MAX_ATTRIBUTE_ID = 0x050A, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_ATTRIBUTE_ID = 0x050B, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_MIN_ATTRIBUTE_ID = 0x050C, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_MAX_ATTRIBUTE_ID = 0x050D, /**< Ver.: always */
+       ZB_ZCL_REACTIVE_POWER_ATTRIBUTE_ID = 0x050E, /**< Ver.: always */
+       ZB_ZCL_APPARENT_POWER_ATTRIBUTE_ID = 0x050F, /**< Ver.: always */
+       ZB_ZCL_AC_POWER_FACTOR_ATTRIBUTE_ID = 0x0510, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_VOLTAGE_MEASUREMENT_PERIOD_ATTRIBUTE_ID = 0x0511, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_ATTRIBUTE_ID = 0x0513, /**< Ver.: always */
+       ZB_ZCL_RMS_EXTREME_OVER_VOLTAGE_PERIOD_ATTRIBUTE_ID = 0x0514, /**< Ver.: always */
+       ZB_ZCL_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_ATTRIBUTE_ID = 0x0515, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_SAG_PERIOD_ATTRIBUTE_ID = 0x0516, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_SWELL_PERIOD_ATTRIBUTE_ID = 0x0517, /**< Ver.: always */
+       ZB_ZCL_AC_VOLTAGE_MULTIPLIER_ATTRIBUTE_ID = 0x0600, /**< Ver.: always */
+       ZB_ZCL_AC_VOLTAGE_DIVISOR_ATTRIBUTE_ID = 0x0601, /**< Ver.: always */
+       ZB_ZCL_AC_CURRENT_MULTIPLIER_ATTRIBUTE_ID = 0x0602, /**< Ver.: always */
+       ZB_ZCL_AC_CURRENT_DIVISOR_ATTRIBUTE_ID = 0x0603, /**< Ver.: always */
+       ZB_ZCL_AC_POWER_MULTIPLIER_ATTRIBUTE_ID = 0x0604, /**< Ver.: always */
+       ZB_ZCL_AC_POWER_DIVISOR_ATTRIBUTE_ID = 0x0605, /**< Ver.: always */
+       ZB_ZCL_DC_OVERLOAD_ALARMS_MASK_ATTRIBUTE_ID = 0x0700, /**< Ver.: always */
+       ZB_ZCL_DC_VOLTAGE_OVERLOAD_ATTRIBUTE_ID = 0x0701, /**< Ver.: always */
+       ZB_ZCL_DC_CURRENT_OVERLOAD_ATTRIBUTE_ID = 0x0702, /**< Ver.: always */
+       ZB_ZCL_AC_OVERLOAD_ALARMS_MASK_ATTRIBUTE_ID = 0x0800, /**< Ver.: always */
+       ZB_ZCL_AC_VOLTAGE_OVERLOAD_ATTRIBUTE_ID = 0x0801, /**< Ver.: always */
+       ZB_ZCL_AC_CURRENT_OVERLOAD_ATTRIBUTE_ID = 0x0802, /**< Ver.: always */
+       ZB_ZCL_AC_POWER_OVERLOAD_ATTRIBUTE_ID = 0x0803, /**< Ver.: always */
+       ZB_ZCL_AC_REACTIVE_POWER_OVERLOAD_ATTRIBUTE_ID = 0x0804, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_OVER_VOLTAGE_ATTRIBUTE_ID = 0x0805, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_UNDER_VOLTAGE_ATTRIBUTE_ID = 0x0806, /**< Ver.: always */
+       ZB_ZCL_RMS_EXTREME_OVER_VOLTAGE_ATTRIBUTE_ID = 0x0807, /**< Ver.: always */
+       ZB_ZCL_RMS_EXTREME_UNDER_VOLTAGE_ATTRIBUTE_ID = 0x0808, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_SAG_ATTRIBUTE_ID = 0x0809, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_SWELL_ATTRIBUTE_ID = 0x080A, /**< Ver.: always */
+       ZB_ZCL_LINE_CURRENT_PHASE_B_ATTRIBUTE_ID = 0x0901, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_CURRENT_PHASE_B_ATTRIBUTE_ID = 0x0902, /**< Ver.: always */
+       ZB_ZCL_REACTIVE_CURRENT_PHASE_B_ATTRIBUTE_ID = 0x0903, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_PHASE_B_ATTRIBUTE_ID = 0x0905, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_MIN_PHASE_B_ATTRIBUTE_ID = 0x0906, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_MAX_PHASE_B_ATTRIBUTE_ID = 0x0907, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_PHASE_B_ATTRIBUTE_ID = 0x0908, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_MIN_PHASE_B_ATTRIBUTE_ID = 0x0909, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_MAX_PHASE_B_ATTRIBUTE_ID = 0x090A, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_PHASE_B_ATTRIBUTE_ID = 0x090B, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_MIN_PHASE_B_ATTRIBUTE_ID = 0x090C, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_MAX_PHASE_B_ATTRIBUTE_ID = 0x090D, /**< Ver.: always */
+       ZB_ZCL_REACTIVE_POWER_PHASE_B_ATTRIBUTE_ID = 0x090E, /**< Ver.: always */
+       ZB_ZCL_APPARENT_POWER_PHASE_B_ATTRIBUTE_ID = 0x090F, /**< Ver.: always */
+       ZB_ZCL_POWER_FACTOR_PHASE_B_ATTRIBUTE_ID = 0x0910, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_VOLTAGE_MEASUREMENT_PERIOD_PHASE_B_ATTRIBUTE_ID = 0x0911, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_OVER_VOLTAGE_COUNTER_PHASE_B_ATTRIBUTE_ID = 0x0912, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_PHASE_B_ATTRIBUTE_ID = 0x0913, /**< Ver.: always */
+       ZB_ZCL_RMS_EXTREME_OVER_VOLTAGE_PERIOD_PHASE_B_ATTRIBUTE_ID = 0x0914, /**< Ver.: always */
+       ZB_ZCL_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_PHASE_B_ATTRIBUTE_ID = 0x0915, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_SAG_PERIOD_PHASE_B_ATTRIBUTE_ID = 0x0916, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_SWELL_PERIOD_PHASE_B_ATTRIBUTE_ID = 0x0917, /**< Ver.: always */
+       ZB_ZCL_LINE_CURRENT_PHASE_C_ATTRIBUTE_ID = 0x0A01, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_CURRENT_PHASE_C_ATTRIBUTE_ID = 0x0A02, /**< Ver.: always */
+       ZB_ZCL_REACTIVE_CURRENT_PHASE_C_ATTRIBUTE_ID = 0x0A03, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_PHASE_C_ATTRIBUTE_ID = 0x0A05, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_MIN_PHASE_C_ATTRIBUTE_ID = 0x0A06, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_MAX_PHASE_C_ATTRIBUTE_ID = 0x0A07, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_PHASE_C_ATTRIBUTE_ID = 0x0A08, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_MIN_PHASE_C_ATTRIBUTE_ID = 0x0A09, /**< Ver.: always */
+       ZB_ZCL_RMS_CURRENT_MAX_PHASE_C_ATTRIBUTE_ID = 0x0A0A, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_PHASE_C_ATTRIBUTE_ID = 0x0A0B, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_MIN_PHASE_C_ATTRIBUTE_ID = 0x0A0C, /**< Ver.: always */
+       ZB_ZCL_ACTIVE_POWER_MAX_PHASE_C_ATTRIBUTE_ID = 0x0A0D, /**< Ver.: always */
+       ZB_ZCL_REACTIVE_POWER_PHASE_C_ATTRIBUTE_ID = 0x0A0E, /**< Ver.: always */
+       ZB_ZCL_APPARENT_POWER_PHASE_C_ATTRIBUTE_ID = 0x0A0F, /**< Ver.: always */
+       ZB_ZCL_POWER_FACTOR_PHASE_C_ATTRIBUTE_ID = 0x0A10, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_VOLTAGE_MEASUREMENT_PERIOD_PHASE_C_ATTRIBUTE_ID = 0x0A11, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_OVER_VOLTAGE_COUNTER_PHASE_C_ATTRIBUTE_ID = 0x0A12, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_PHASE_C_ATTRIBUTE_ID = 0x0A13, /**< Ver.: always */
+       ZB_ZCL_RMS_EXTREME_OVER_VOLTAGE_PERIOD_PHASE_C_ATTRIBUTE_ID = 0x0A14, /**< Ver.: always */
+       ZB_ZCL_RMS_EXTREME_UNDER_VOLTAGE_PERIOD_PHASE_C_ATTRIBUTE_ID = 0x0A15, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_SAG_PERIOD_PHASE_C_ATTRIBUTE_ID = 0x0A16, /**< Ver.: always */
+       ZB_ZCL_RMS_VOLTAGE_SWELL_PERIOD_PHASE_C_ATTRIBUTE_ID = 0x0A17, /**< Ver.: always */
+} zb_zcl_electrical_measurement_server_attributes_e;
+
+/**
+ * @brief Attribute types for cluster: Diagnostics
+ * @details Cluster specification level: UNKNOWN
+ * @pre Server attributes
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_NUMBER_OF_RESETS_ATTRIBUTE_ID = 0x0000, /**< Ver.: always */
+       ZB_ZCL_PERSISTENT_MEMORY_WRITES_ATTRIBUTE_ID = 0x0001, /**< Ver.: always */
+       ZB_ZCL_MAC_RX_BCAST_ATTRIBUTE_ID = 0x0100, /**< Ver.: always */
+       ZB_ZCL_MAC_TX_BCAST_ATTRIBUTE_ID = 0x0101, /**< Ver.: always */
+       ZB_ZCL_MAC_RX_UCAST_ATTRIBUTE_ID = 0x0102, /**< Ver.: always */
+       ZB_ZCL_MAC_TX_UCAST_ATTRIBUTE_ID = 0x0103, /**< Ver.: always */
+       ZB_ZCL_MAC_TX_UCAST_RETRY_ATTRIBUTE_ID = 0x0104, /**< Ver.: always */
+       ZB_ZCL_MAC_TX_UCAST_FAIL_ATTRIBUTE_ID = 0x0105, /**< Ver.: always */
+       ZB_ZCL_APS_RX_BCAST_ATTRIBUTE_ID = 0x0106, /**< Ver.: always */
+       ZB_ZCL_APS_TX_BCAST_ATTRIBUTE_ID = 0x0107, /**< Ver.: always */
+       ZB_ZCL_APS_RX_UCAST_ATTRIBUTE_ID = 0x0108, /**< Ver.: always */
+       ZB_ZCL_APS_UCAST_SUCCESS_ATTRIBUTE_ID = 0x0109, /**< Ver.: always */
+       ZB_ZCL_APS_TX_UCAST_RETRY_ATTRIBUTE_ID = 0x010A, /**< Ver.: always */
+       ZB_ZCL_APS_TX_UCAST_FAIL_ATTRIBUTE_ID = 0x010B, /**< Ver.: always */
+       ZB_ZCL_ROUTE_DISC_INITIATED_ATTRIBUTE_ID = 0x010C, /**< Ver.: always */
+       ZB_ZCL_NEIGHBOR_ADDED_ATTRIBUTE_ID = 0x010D, /**< Ver.: always */
+       ZB_ZCL_NEIGHBOR_REMOVED_ATTRIBUTE_ID = 0x010E, /**< Ver.: always */
+       ZB_ZCL_NEIGHBOR_STALE_ATTRIBUTE_ID = 0x010F, /**< Ver.: always */
+       ZB_ZCL_JOIN_INDICATION_ATTRIBUTE_ID = 0x0110, /**< Ver.: always */
+       ZB_ZCL_CHILD_MOVED_ATTRIBUTE_ID = 0x0111, /**< Ver.: always */
+       ZB_ZCL_NWK_FC_FAILURE_ATTRIBUTE_ID = 0x0112, /**< Ver.: always */
+       ZB_ZCL_APS_FC_FAILURE_ATTRIBUTE_ID = 0x0113, /**< Ver.: always */
+       ZB_ZCL_APS_UNAUTHORIZED_KEY_ATTRIBUTE_ID = 0x0114, /**< Ver.: always */
+       ZB_ZCL_NWK_DECRYPT_FAILURE_ATTRIBUTE_ID = 0x0115, /**< Ver.: always */
+       ZB_ZCL_APS_DECRYPT_FAILURE_ATTRIBUTE_ID = 0x0116, /**< Ver.: always */
+       ZB_ZCL_PACKET_BUFFER_ALLOC_FAILURES_ATTRIBUTE_ID = 0x0117, /**< Ver.: always */
+       ZB_ZCL_RELAYED_UNICAST_ATTRIBUTE_ID = 0x0118, /**< Ver.: always */
+       ZB_ZCL_PHY_TO_MAC_QUEUE_LIMIT_REACHED_ATTRIBUTE_ID = 0x0119, /**< Ver.: always */
+       ZB_ZCL_PACKET_VALIDATE_DROP_COUNT_ATTRIBUTE_ID = 0x011A, /**< Ver.: always */
+       ZB_ZCL_AVERAGE_MAC_RETRY_PER_APS_MSG_SENT_ATTRIBUTE_ID = 0x011B, /**< Ver.: always */
+       ZB_ZCL_LAST_MESSAGE_LQI_ATTRIBUTE_ID = 0x011C, /**< Ver.: always */
+       ZB_ZCL_LAST_MESSAGE_RSSI_ATTRIBUTE_ID = 0x011D, /**< Ver.: always */
+} zb_zcl_diagnostics_server_attributes_e;
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_IDS_H__ */
diff --git a/include/zcl/zb-zcl-attribute-type.h b/include/zcl/zb-zcl-attribute-type.h
new file mode 100644 (file)
index 0000000..b9c258f
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_TYPE_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_TYPE_H__
+
+/**
+ * @file zb-zcl-attribute-type.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_DATA_TYPE_MODULE Cluster Attribute Data Type
+ *
+ * @brief zigbee cluster attribute data type
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_DATA_TYPE_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/**
+ * @brief ZCL attribute types (See Table 2.16 Data type)
+ * @details ZigBee devices, such as thermostats, lamps, etc., are defined in terms of the
+ * attributes they contain, which can be written, read or reported using the
+ * commands defined in clause 2.4. Table 2.16 details the data types and formats that
+ * can be used for these attributes. Note that individual clusters, which may use
+ * different or new types, show valid values, ranges, and units for the attributes they
+ * represent. \n\n
+ *
+ * Each data type is allocated an 8-bit data type ID. The most significant 5 bits of this
+ * ID is used to divide the types into 32 type classes, and the least significant 3 bits
+ * specify a specific data type within this class. \n\n
+ *
+ * Table 2.16 also indicates for each data type whether it is considered to be 'analog'
+ * or 'discrete'. Values of analog types may be added to or subtracted from other
+ * values of the same type, and are typically used to measure the value of properties
+ * in the real world that vary continuously over a range. Values of discrete data types
+ * only have meaning as individual values, and may not be added or subtracted.
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_NO_DATA_ATTRIBUTE_TYPE = 0x00, /**< No data */
+       ZB_ZCL_8_BIT_DATA = 0x08, /**< 8-bit data, 1-byte */
+       ZB_ZCL_16_BIT_DATA = 0x09, /**< 16-bit data, 2-byte */
+       ZB_ZCL_24_BIT_DATA = 0x0a, /**< 24-bit data, 3-byte */
+       ZB_ZCL_32_BIT_DATA = 0x0b, /**< 32-bit data, 4-byte */
+       ZB_ZCL_40_BIT_DATA = 0x0c, /**< 40-bit data, 5-byte */
+       ZB_ZCL_48_BIT_DATA = 0x0d, /**< 48-bit data, 6-byte */
+       ZB_ZCL_56_BIT_DATA = 0x0e, /**< 56-bit data, 7-byte */
+       ZB_ZCL_64_BIT_DATA = 0x0f, /**< 64-bit data, 8-byte */
+       ZB_ZCL_BOOLEAN = 0x10, /**< Boolean, 1-byte */
+       ZB_ZCL_8_BIT_BITMAP = 0x18, /**< 8-bit bitmap, 1-byte */
+       ZB_ZCL_16_BIT_BITMAP = 0x19, /**< 16-bit bitmap, 2-byte */
+       ZB_ZCL_24_BIT_BITMAP = 0x1a, /**< 24-bit bitmap, 3-byte */
+       ZB_ZCL_32_BIT_BITMAP = 0x1b, /**< 32-bit bitmap, 4-byte */
+       ZB_ZCL_40_BIT_BITMAP = 0x1c, /**< 40-bit bitmap, 5-byte */
+       ZB_ZCL_48_BIT_BITMAP = 0x1d, /**< 48-bit bitmap, 6-byte */
+       ZB_ZCL_56_BIT_BITMAP = 0x1e, /**< 56-bit bitmap, 7-byte */
+       ZB_ZCL_64_BIT_BITMAP = 0x1f, /**< 64-bit bitmap, 8-byte */
+       ZB_ZCL_UNSIGNED_8_BIT_INTEGER = 0x20, /**< unsigned 8-bit integer, 1-byte */
+       ZB_ZCL_UNSIGNED_16_BIT_INTEGER = 0x21, /**< unsigned 16-bit integer, 2-byte */
+       ZB_ZCL_UNSIGNED_24_BIT_INTEGER = 0x22, /**< unsigned 24-bit integer, 3-byte */
+       ZB_ZCL_UNSIGNED_32_BIT_INTEGER = 0x23, /**< unsigned 32-bit integer, 4-byte */
+       ZB_ZCL_UNSIGNED_40_BIT_INTEGER = 0x24, /**< unsigned 40-bit integer, 5-byte */
+       ZB_ZCL_UNSIGNED_48_BIT_INTEGER = 0x25, /**< unsigned 48-bit integer, 6-byte */
+       ZB_ZCL_UNSIGNED_56_BIT_INTEGER = 0x26, /**< unsigned 56-bit integer, 7-byte */
+       ZB_ZCL_UNSIGNED_64_BIT_INTEGER = 0x27, /**< unsigned 64-bit integer, 8-byte */
+       ZB_ZCL_SIGNED_8_BIT_INTEGER = 0x28, /**< signed 8-bit integer, 1-byte */
+       ZB_ZCL_SIGNED_16_BIT_INTEGER = 0x29, /**< signed 16-bit integer, 2-byte */
+       ZB_ZCL_SIGNED_24_BIT_INTEGER = 0x2a, /**< signed 24-bit integer, 3-byte */
+       ZB_ZCL_SIGNED_32_BIT_INTEGER = 0x2b, /**< signed 32-bit integer, 4-byte */
+       ZB_ZCL_SIGNED_40_BIT_INTEGER = 0x2c, /**< signed 40-bit integer, 5-byte */
+       ZB_ZCL_SIGNED_48_BIT_INTEGER = 0x2d, /**< signed 48-bit integer, 6-byte */
+       ZB_ZCL_SIGNED_56_BIT_INTEGER = 0x2e, /**< signed 56-bit integer, 7-byte */
+       ZB_ZCL_SIGNED_64_BIT_INTEGER = 0x2f, /**< signed 64-bit integer, 8-byte */
+       ZB_ZCL_8_BIT_ENUMERATION = 0x30, /**< 8-bit enumeration, 1-byte */
+       ZB_ZCL_16_BIT_ENUMERATION = 0x31, /**< 16-bit enumeration, 2-byte */
+       ZB_ZCL_SEMI_PRECISION = 0x38, /**< foating point, 2-byte */
+       ZB_ZCL_SINGLE_PRECISION = 0x39, /**< foating point, 4-byte */
+       ZB_ZCL_DOUBLE_PRECISION = 0x3a, /**< foating point, 8-byte */
+       /**< Octat string, Defined in first two octat */
+       ZB_ZCL_OCTAT_STRING = 0x41,
+       /**< Character string, Defined in first two octat */
+       ZB_ZCL_CHRACTER_STRING = 0x42,
+       /**< Long octat string, Defined in first two octat */
+       ZB_ZCL_LONG_OCTAT_STRING = 0x43,
+       /**< Long character string, Defined in first 2-byte */
+       ZB_ZCL_LONG_CHRACTER_STRING = 0x44,
+       /**< Array 2(0xffff)+Sum of lengths of contents, but we ignore 2-byte prefix */
+       ZB_ZCL_ARRAY = 0x48,
+       /**< Structure 2(0xffff)+Sum of lengths of contents, but we ignore 2-byte prefix */
+       ZB_ZCL_STRUCTURE = 0x4c,
+       ZB_ZCL_SET = 0x50, /**< Set, Sum of lengths of contents */
+       ZB_ZCL_BAG = 0x51, /**< Bag, Sum of lengths of contents */
+       ZB_ZCL_TIME_OF_DAY = 0xe0, /**< Time of day, 4-byte */
+       ZB_ZCL_DATE = 0xe1, /**< Date, 4 byte */
+       ZB_ZCL_UTC_TIME = 0xe2, /**< UTC Time, 4-byte */
+       ZB_ZCL_CLUSTER_ID = 0xe8, /**< Cluster ID, 2-byte */
+       ZB_ZCL_ATTRIBUTE_ID = 0xe9, /**< Attribute ID, 2-byte */
+       ZB_ZCL_BACNET_OID = 0xea, /**< BACnet OID 4 byte */
+       ZB_ZCL_IEEE_ADDRESS = 0xf0, /**< IEEE address, 8-byte */
+       ZB_ZCL_128_BIT_SECURITY_KEY = 0xf1, /**< 128-bit security key, 16-byte */
+} zb_zcl_data_type_e;
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_ATTRIBUTE_TYPE_H__ */
diff --git a/include/zcl/zb-zcl-basic-cluster.h b/include/zcl/zb-zcl-basic-cluster.h
new file mode 100644 (file)
index 0000000..4a3d48b
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_BASIC_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_BASIC_CLUSTER_H__
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-basic-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_BASIC_CLUSTER_MODULE Basic Cluster
+ *
+ * @brief zigbee basic cluster commands
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_BASIC_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/**
+ * @brief Command description for setting configure reporting
+ * @details This function is aim to reset end-device as factory default settings.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] handle handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep target endpoint
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_write_attr_rsp()
+ */
+int zb_zcl_basic_reset_factory_default(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_BASIC_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-cluster-ids.h b/include/zcl/zb-zcl-cluster-ids.h
new file mode 100644 (file)
index 0000000..346b248
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_CLUSTER_IDS_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_CLUSTER_IDS_H__
+
+/**
+ * @file zb-zcl-cluster-ids.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_CLUSTER_ID_MODULE Cluster IDs
+ *
+ * @brief Zigbee Cluster IDs
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_CLUSTER_ID_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_CLUSTER_ID_MODULE_OVERVIEW Overview
+ * Cluster domain specification levels: \n\n
+ * - General: zcl-1.0-07-5123-03 \n
+ * - HA: ha-1.2.1-05-3520-30 \n
+ * - Closures: zcl-1.0-07-5123-03 \n
+ * - HVAC: zcl-1.0-07-5123-03 \n
+ * - Lighting: zcl-1.0-07-5123-03 \n
+ * - Measurement & Sensing: zcl-1.0-07-5123-03 \n
+ * - Security & Safety: zcl-1.0-07-5123-03 \n
+ * - Home Automation: UNKNOWN \n
+ * - CBA: cba-1.0-05-3516-12 \n
+ * - SE: se-1.2-12-0517-08 \n
+ * - ZLL: zll-1.0-11-0037-10 \n
+ * - Telecom Applications: ta-1.0-07-5307-07 \n
+ * - Protocol Interfaces: ta-1.0-07-5307-07 \n
+ * - Telecommunication: ta-1.0-07-5307-07 \n
+ * - Financial: ta-1.0-07-5307-07 \n
+ * - Ember: UNKNOWN \n
+ * - HC: hc-1.0-07-5360-15 \n
+ *
+ * @{
+ *
+ */
+
+/**
+ * @brief Zigbee Cluster IDs for reference
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_BASIC_CLUSTER_ID = 0x0000, /**< Basic Cluster */
+       ZB_ZCL_POWER_CONFIG_CLUSTER_ID = 0x0001, /**< Power Configuration Cluster */
+       ZB_ZCL_DEVICE_TEMP_CLUSTER_ID = 0x0002, /**< Device Temperature Cluster */
+       ZB_ZCL_IDENTIFY_CLUSTER_ID = 0x0003, /**< Identify Cluster */
+       ZB_ZCL_GROUPS_CLUSTER_ID = 0x0004, /**< Group Cluster */
+       ZB_ZCL_SCENES_CLUSTER_ID = 0x0005, /**< Scene Cluster */
+       ZB_ZCL_ON_OFF_CLUSTER_ID = 0x0006, /**< On/Off Cluster */
+       ZB_ZCL_ON_OFF_SWITCH_CONFIG_CLUSTER_ID  = 0x0007, /**< On/Off Switch Cluster */
+       ZB_ZCL_LEVEL_CONTROL_CLUSTER_ID = 0x0008, /**< Level Control Cluster */
+       ZB_ZCL_ALARM_CLUSTER_ID = 0x0009, /**< Alarm Cluster */
+       ZB_ZCL_TIME_CLUSTER_ID = 0x000A, /**< Time Cluster */
+       ZB_ZCL_RSSI_LOCATION_CLUSTER_ID= 0x000B, /**< RSSI Location Cluster */
+       ZB_ZCL_BINARY_INPUT_BASIC_CLUSTER_ID = 0x000F, /**< Binary Input Basic Cluster */
+       ZB_ZCL_COMMISSIONING_CLUSTER_ID = 0x0015, /**< Commissioning Cluster */
+       ZB_ZCL_PARTITION_CLUSTER_ID = 0x0016, /**< Partition Cluster */
+       ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID = 0x0019, /**< OTA Bootload Cluster */
+       ZB_ZCL_POWER_PROFILE_CLUSTER_ID = 0x001A, /**< Power Profile Cluster */
+       ZB_ZCL_APPLIANCE_CONTROL_CLUSTER_ID = 0x001B, /**< Application Control Cluster */
+       ZB_ZCL_POLL_CONTROL_CLUSTER_ID = 0x0020, /**< Poll Control Cluster */
+       ZB_ZCL_SHADE_CONFIG_CLUSTER_ID = 0x0100, /**< Shade Config Cluster */
+       ZB_ZCL_DOOR_LOCK_CLUSTER_ID = 0x0101, /**< Door Lock Cluster */
+       ZB_ZCL_WINDOW_COVERING_CLUSTER_ID = 0x0102, /**< Window Covering Cluster */
+       ZB_ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID = 0x0200, /**< Pump Configuration Cluster */
+       ZB_ZCL_THERMOSTAT_CLUSTER_ID = 0x0201, /**< Thermostat Cluster */
+       ZB_ZCL_FAN_CONTROL_CLUSTER_ID = 0x0202, /**< Fan Control Cluster */
+       ZB_ZCL_DEHUMID_CONTROL_CLUSTER_ID = 0x0203, /**< Dehumid Control Cluster */
+       ZB_ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_ID = 0x0204, /**< Thermostat UI Cluster */
+       ZB_ZCL_COLOR_CONTROL_CLUSTER_ID = 0x0300, /**< Color Control Cluster */
+       ZB_ZCL_BALLAST_CONFIGURATION_CLUSTER_ID = 0x0301, /**< Ballast Configuration Cluster */
+       ZB_ZCL_ILLUM_MEASUREMENT_CLUSTER_ID = 0x0400, /**< Illuminance Measurement Cluster */
+       ZB_ZCL_ILLUM_LEVEL_SENSING_CLUSTER_ID = 0x0401, /**< Illuminance Level Sensing Cluster */
+       ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID = 0x0402, /**< Temperature Measurement Cluster */
+       ZB_ZCL_PRESSURE_MEASUREMENT_CLUSTER_ID = 0x0403, /**< Pressure Measurement Cluster */
+       ZB_ZCL_FLOW_MEASUREMENT_CLUSTER_ID = 0x0404, /**< Flow Measurement Cluster */
+       ZB_ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID = 0x0405, /**< Relative Humidity Measurement Cluster */
+       ZB_ZCL_OCCUPANCY_SENSING_CLUSTER_ID = 0x0406, /**< Occupancy Sensing Cluster */
+       ZB_ZCL_IAS_ZONE_CLUSTER_ID = 0x0500, /**< IAS Zone Cluster */
+       ZB_ZCL_IAS_ACE_CLUSTER_ID = 0x0501, /**< IAS Ace Cluster */
+       ZB_ZCL_IAS_WD_CLUSTER_ID = 0x0502, /**< IAS WD Cluster */
+       ZB_ZCL_GENERIC_TUNNEL_CLUSTER_ID = 0x0600, /**< Generic Tunnel Cluster */
+       ZB_ZCL_BACNET_PROTOCOL_TUNNEL_CLUSTER_ID = 0x0601, /**< Bacnet Protocol Tunnel Cluster */
+       ZB_ZCL_11073_PROTOCOL_TUNNEL_CLUSTER_ID = 0x0614, /**< 11073 Protocol Tunnel Cluster */
+       ZB_ZCL_ISO7816_PROTOCOL_TUNNEL_CLUSTER_ID = 0x0615, /**< ISO7816 Protocol Tunnel Cluster */
+       ZB_ZCL_PRICE_CLUSTER_ID = 0x0700, /**< Price Cluster */
+       ZB_ZCL_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_ID = 0x0701, /**< Demand Response Load Control Cluster */
+       ZB_ZCL_SIMPLE_METERING_CLUSTER_ID = 0x0702, /**< Simple Metering Cluster */
+       ZB_ZCL_MESSAGING_CLUSTER_ID = 0x0703, /**< Messaging Cluster */
+       ZB_ZCL_TUNNELING_CLUSTER_ID = 0x0704, /**< Tunneling Cluster */
+       ZB_ZCL_PREPAYMENT_CLUSTER_ID = 0x0705, /**< Prepayment Cluster */
+       ZB_ZCL_ENERGY_MANAGEMENT_CLUSTER_ID = 0x0706, /**< Energy Management Cluster */
+       ZB_ZCL_TOU_CALENDAR_CLUSTER_ID = 0x0707, /**< Calendar Cluster */
+       ZB_ZCL_DEVICE_MANAGEMENT_CLUSTER_ID = 0x0708, /**< Device Management Cluster */
+       ZB_ZCL_EVENTS_CLUSTER_ID = 0x0709, /**< Events Cluster */
+       ZB_ZCL_MDU_PAIRING_CLUSTER_ID = 0x070A, /**< MDU Paring Cluster */
+       ZB_ZCL_KEY_ESTABLISHMENT_CLUSTER_ID = 0x0800, /**< Key Establishment Cluster */
+       ZB_ZCL_INFORMATION_CLUSTER_ID = 0x0900, /**< Information Cluster */
+       ZB_ZCL_DATA_SHARING_CLUSTER_ID = 0x0901, /**< Data Sharing Cluster */
+       ZB_ZCL_GAMING_CLUSTER_ID = 0x0902, /**< Gaming Cluster */
+       ZB_ZCL_DATA_RATE_CONTROL_CLUSTER_ID = 0x0903, /**< Data Rate Control Cluster */
+       ZB_ZCL_VOICE_OVER_ZIGBEE_CLUSTER_ID = 0x0904, /**< Voice Over Zigbee Cluster */
+       ZB_ZCL_CHATTING_CLUSTER_ID = 0x0905, /**< Chatting Cluster */
+       ZB_ZCL_PAYMENT_CLUSTER_ID = 0x0A01, /**< Payment Cluster */
+       ZB_ZCL_BILLING_CLUSTER_ID = 0x0A02, /**< Billing Cluster */
+       ZB_ZCL_APPLIANCE_IDENTIFICATION_CLUSTER_ID = 0x0B00, /**< Appliance Identification Cluster */
+       ZB_ZCL_METER_IDENTIFICATION_CLUSTER_ID = 0x0B01, /**< Meter Identification Cluster */
+       ZB_ZCL_APPLIANCE_EVENTS_AND_ALERT_CLUSTER_ID = 0x0B02, /**< Appliance Events and Alert Cluster */
+       ZB_ZCL_APPLIANCE_STATISTICS_CLUSTER_ID = 0x0B03, /**< Appliance Statistics Cluster */
+       ZB_ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID = 0x0B04, /**< Electrical Measurement Cluster */
+       ZB_ZCL_DIAGNOSTICS_CLUSTER_ID = 0x0B05, /**< Diagnostics Cluster */
+       ZB_ZCL_ZLL_COMMISSIONING_CLUSTER_ID = 0x1000, /**< ZLL Commissioning Cluster */
+} zb_zcl_cluster_ids_e;
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_CLUSTER_IDS_H__ */
diff --git a/include/zcl/zb-zcl-color-control-cluster.h b/include/zcl/zb-zcl-color-control-cluster.h
new file mode 100644 (file)
index 0000000..5355fce
--- /dev/null
@@ -0,0 +1,503 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_COLOR_CONTROL_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_COLOR_CONTROL_CLUSTER_H__
+
+#include <zb-type.h>
+
+/**
+ * @file zb-zcl-color-control-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_COLOR_CONTROL_CLUSTER_MODULE Color Control Cluster
+ *
+ * @brief zigbee color control cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_COLOR_CONTROL_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 5.9 Command IDs for the Color Control Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Move to Hue                          |     O      |
+ * |             0x01               | Move Hue                             |     O      |
+ * |             0x02               | Step Hue                             |     O      |
+ * |             0x03               | Move to Saturation                   |     O      |
+ * |             0x04               | Move Saturation                      |     O      |
+ * |             0x05               | Step Saturation                      |     O      |
+ * |             0x06               | Move to Hue and Saturation           |     O      |
+ * |             0x07               | Move to Color                        |     M      |
+ * |             0x08               | Move Color                           |     M      |
+ * |             0x09               | Step Color                           |     M      |
+ * |             0x0a               | Move to Color Temperature            |     O      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for move to hue
+ * @details On receipt of this command, a device shall also set the ColorMode attribute to the
+ * value 0x00 and then shall move from its current hue to the value given in the Hue
+ * field. \n\n
+ * The movement shall be continuous, i.e. not a step function, and the time taken to
+ * move to the new hue shall be equal to the Transition time field.\n\n
+ * As hue is effectively measured on a circle, the new hue may be moved to in either
+ * direction. The direction of hue change is given by the Direction field. If Direction
+ * is 'Shortest distance', the direction is taken that involves the shortest path round
+ * the circle. This case corresponds to expected normal usage. If Direction is
+ * 'Longest distance', the direction is taken that involves the longest path round the
+ * circle. This case can be used for 'rainbow effects'. In both cases, if both distances
+ * are the same, the Up direction shall be taken.\n\n
+ * Note that if the target color specified is not achievable by the hardware then the
+ * command shall not be carried out, and a ZCL default response command shall be
+ * generated, where not disabled, with status code equal to INVALID_VALUE.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] hue The Hue field specifies the hue to be moved to.
+ * @param[in] direction The direction field shall be one of the non-reserved values\n
+ *                      0x00 : Shortest distance\n
+ *                      0x01 : Longest distance\n
+ *                      0x02 : Up\n
+ *                      0x03 : Down\n
+ * @param[in] transition_time The Transition time field specifies, in 1/10ths of a second,
+ *                            the time that shall be taken to move to the new hue
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_move_to_hue(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char hue,
+               unsigned char direction,
+               unsigned short transition_time);
+
+/**
+ * @brief Command description for move hue
+ * @details On receipt of this command, a device shall set the ColorMode attribute to the
+ * value 0x00 and shall then move from its current hue in an up or down direction in
+ * a continuous fashion.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] move_mode The Move mode field shall be one of the non-reserved values.\n
+ *                      0x00 : Stop\n
+ *                      0x01 : Up\n
+ *                      0x02 : Reserved\n
+ *                      0x03 : Down\n
+ * @param[in] rate The Rate field specifies the rate of movement in steps per second.\n
+ *                 A step is a change in the device's hue of one unit.
+ *                 If the Rate field has a value of zero, the command has no effect and
+ *                 a default response command is sent in response, with the status code
+ *                 set to INVALID_FIELD.\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_move_hue(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char move_mode,
+               unsigned char rate);
+
+/**
+ * @brief Command description for step hue
+ * @details On receipt of this command, a device shall set the ColorMode attribute to the
+ * value 0x00 and shall then move from its current hue in an up or down direction by
+ * one step.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] step_mode The Step mode field shall be one of the non-reserved values.\n
+ *                      0x00 : Reserved\n
+ *                      0x01 : Up\n
+ *                      0x02 : Reserved\n
+ *                      0x03 : Down\n
+ * @param[in] step_size The change to be added to (or subtracted from) the current value \n
+ *                      of the device's hue.
+ * @param[in] transition_time The Transition time field specifies, in 1/10ths of a second,
+ *                            the time that shall be taken to perform the step.
+ *                            A step is a change in the device's hue of 'Step size' units.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_step_hue(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char step_mode,
+               unsigned char step_size,
+               unsigned char transition_time);
+
+/**
+ * @brief Command description for move to saturation
+ * @details On receipt of this command, a device set the ColorMode attribute to the value
+ * 0x00 and shall then move from its current saturation to the value given in the
+ * Saturation field.\n\n
+ * The movement shall be continuous, i.e. not a step function, and the time taken to
+ * move to the new saturation shall be equal to the Transition time field, in 1/10ths of
+ * a second.n\n
+ * Note that if the target color specified is not achievable by the hardware then the
+ * command shall not be carried out and a ZCL default response command shall be
+ * generated, where not disabled, with status code equal to INVALID_VALUE.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] saturation The target saturation value
+ * @param[in] transition_time The Transition time field specifies, in 1/10ths of a second,
+ *                            the time that shall be taken to perform the step.
+ *                            A step is a change in the device's hue of 'Step size' units.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_move_to_saturation(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char saturation,
+               unsigned short transition_time);
+
+/**
+ * @brief Command description for move saturation
+ * @details On receipt of this command, a device shall set the ColorMode attribute to the
+ * value 0x00 and shall then move from its current saturation in an up or down
+ * direction in a continuous fashion.\n]n
+ * Note that if the target color specified is not achievable by the hardware then the
+ * command shall not be carried out and a ZCL default response command shall be
+ * generated, where not disabled, with status code equal to INVALID_VALUE
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] move_mode The Move mode field shall be one of the non-reserved values.\n
+ *                      0x00 : Stop\n
+ *                      0x01 : Up\n
+ *                      0x02 : Reserved\n
+ *                      0x03 : Down\n
+ * @param[in] rate The Rate field specifies the rate of movement in steps per second.\n
+ *                 A step is a change in the device's hue of one unit.
+ *                 If the Rate field has a value of zero, the command has no effect and
+ *                 a default response command is sent in response, with the status code
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_move_saturation(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char move_mode,
+               unsigned char rate);
+
+/**
+ * @brief Command description for step saturation
+ * @details On receipt of this command, a device shall set the ColorMode attribute to the
+ * value 0x00 and shall then move from its current saturation in an up or down
+ * direction in a continuous fashion.\n]n
+ * Note that if the target color specified is not achievable by the hardware then the
+ * command shall not be carried out and a ZCL default response command shall be
+ * generated, where not disabled, with status code equal to INVALID_VALUE
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] step_mode The Step mode field shall be one of the non-reserved values.\n
+ *                      0x00 : Reserved\n
+ *                      0x01 : Up\n
+ *                      0x02 : Reserved\n
+ *                      0x03 : Down\n
+ * @param[in] step_size The change to be added to (or subtracted from) the current value \n
+ *                      of the device's hue.
+ * @param[in] transition_time The Transition time field specifies, in 1/10ths of a second,
+ *                            the time that shall be taken to perform the step.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_step_saturation(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char step_mode,
+               unsigned char step_size,
+               unsigned char transition_time);
+
+/**
+ * @brief Command description for move to hue and saturation
+ * @details On receipt of this command, a device shall set the ColorMode attribute to the
+ * value 0x00 and shall then move from its current hue and saturation to the values
+ * given in the Hue and Saturation fields.\n\n
+ * The movement shall be continuous, i.e. not a step function, and the time taken to
+ * move to the new color shall be equal to the Transition time field, in 1/10ths of a
+ * second.\n\n
+ * The path through color space taken during the transition is not specified, but it is
+ * recommended that the shortest path is taken though hue/saturation space, i.e.
+ * movement is 'in a straight line' across the hue/saturation disk.\n\n
+ * Note that if the target color specified is not achievable by the hardware then the
+ * command shall not be carried out and a ZCL default response command shall be
+ * generated, where not disabled, with status code equal to INVALID_VALUE
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] hue The Hue field specifies the hue to be moved to.
+ * @param[in] saturation The target saturation value
+ * @param[in] transition_time The Transition time field specifies, in 1/10ths of a second,
+ *                            the time that shall be taken to perform the step.
+ *                            A step is a change in the device's hue of 'Step size' units.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_move_to_hue_and_saturation(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char hue,
+               unsigned char saturation,
+               unsigned short transition_time);
+
+/**
+ * @brief Command description for move to color
+ * @details On receipt of this command, a device shall set the value of the ColorMode
+ * attribute, where implemented, to 0x01, and shall then move from its current color
+ * to the color given in the ColorX and ColorY fields.\n\n
+ * The movement shall be continuous, i.e. not a step function, and the time taken to
+ * move to the new color shall be equal to the Transition time field, in 1/10ths of a
+ * second.\n\n
+ * The path through color space taken during the transition is not specified, but it is
+ * recommended that the shortest path is taken though color space, i.e. movement is
+ * 'in a straight line' across the CIE xyY Color Space.\n\n
+ * Note that if the target color specified is not achievable by the hardware then the
+ * command shall not be carried out, and a ZCL default response command shall be
+ * generated, where not disabled, with status code equal to INVALID_VALUE\n\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] color_x Target color position x
+ * @param[in] color_y Target color position y
+ * @param[in] transition_time The Transition time field specifies, in 1/10ths of a second,
+ *                            the time that shall be taken to perform the step.
+ *                            A step is a change in the device's hue of 'Step size' units.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_move_to_color(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short color_x,
+               unsigned short color_y,
+               unsigned short transition_time);
+
+/**
+ * @brief Command description for move color
+ * @details On receipt of this command, a device shall set the value of the ColorMode
+ * attribute, where implemented, to 0x01, and shall then move from its current color
+ * in a continuous fashion according to the rates specified. This movement shall
+ * continue until the target color for the next step cannot be implemented on this
+ * device.\n\n
+ * If both the RateX and RateY fields contain a value of zero, no movement shall be
+ * carried out, and the command execution shall have no effect other than stopping
+ * the operation of any previously received command of this cluster. This command
+ * can thus be used to stop the operation of any other command of this cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] rate_x The RateX field specifies the rate of movement in steps per second.
+ *                   A step is a change in the device's CurrentX attribute of one unit.
+ * @param[in] rate_y The RateY field specifies the rate of movement in steps per second.
+ *                   A step is a change in the device's CurrentY attribute of one unit.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_move_color(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short rate_x,
+               unsigned short rate_y);
+
+/**
+ * @brief Command description for step color
+ * @details On receipt of this command, a device shall set the value of the ColorMode
+ * attribute, where implemented, to 0x01, and shall then move from its current color
+ * by the color step indicated.\n\n
+ * The movement shall be continuous, i.e. not a step function, and the time taken to
+ * move to the new color shall be equal to the Transition time field, in 1/10ths of a
+ * second.\n\n
+ * The path through color space taken during the transition is not specified, but it is
+ * recommended that the shortest path is taken though color space, i.e. movement is
+ * 'in a straight line' across the CIE xyY Color Space.\n\n
+ * Note that if the target color specified is not achievable by this hardware then
+ * command shall not be carried out, and a ZCL default response command shall be
+ * generated, where not disabled, with status code equal to INVALID_VALUE\n\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] step_x The StepX and StepY fields specify the change to be added to the device's
+ *                   CurrentX attribute and CurrentY attribute respectively.
+ * @param[in] step_y The StepX and StepY fields specify the change to be added to the device's
+ *                   CurrentX attribute and CurrentY attribute respectively.
+ * @param[in] transition_time The Transition time field specifies, in 1/10ths of a second,
+ *                            the time that shall be taken to perform the step.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_step_color(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short step_x,
+               unsigned short step_y,
+               unsigned short transition_time);
+
+/**
+ * @brief Command description for move to color temperature
+ * @details On receipt of this command, a device shall set the value of the ColorMode
+ * attribute, where implemented, to 0x02, and shall then move from its current color
+ * to the color given by the Color Temperature field.\n\n
+ * The movement shall be continuous, i.e. not a step function, and the time taken to
+ * move to the new color shall be equal to the Transition time field, in 1/10ths of a
+ * second.\n\n
+ * By definition of this color mode, the path through color space taken during the
+ * transition is along the 'Black Body Line'.\n\n
+ * Note that if the target color specified is not achievable by the hardware then the
+ * command shall not be carried out, and a ZCL default response command shall be
+ * generated, where not disabled, with status code equal to INVALID_VALUE.\n\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] color_temperature The target color temperature value
+ * @param[in] transition_time The Transition time field specifies, in 1/10ths of a second,
+ *                            the time that shall be taken to perform the step.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_ccontrol_move_to_color_temperature(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short color_temperature,
+               unsigned short transition_time);
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_COLOR_CONTROL_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-commands.h b/include/zcl/zb-zcl-commands.h
new file mode 100644 (file)
index 0000000..ebce6ce
--- /dev/null
@@ -0,0 +1,735 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_COMMAND_IDS_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_COMMAND_IDS_H__
+
+/**
+ * @file zb-zcl-color-control-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE Cluster Commands
+ *
+ * @brief zigbee color control cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/**
+ * @brief Global commands (Either direction)
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_READ_ATTRIBUTES_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_READ_ATTRIBUTES_RESPONSE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_WRITE_ATTRIBUTES_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_WRITE_ATTRIBUTES_UNDIVIDED_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_WRITE_ATTRIBUTES_RESPONSE_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_WRITE_ATTRIBUTES_NO_RESPONSE_COMMAND_ID = 0x05, /**< Ver.: always */
+       ZB_ZCL_CONFIGURE_REPORTING_COMMAND_ID = 0x06, /**< Ver.: always */
+       ZB_ZCL_CONFIGURE_REPORTING_RESPONSE_COMMAND_ID = 0x07, /**< Ver.: always */
+       ZB_ZCL_READ_REPORTING_CONFIGURATION_COMMAND_ID = 0x08, /**< Ver.: always */
+       ZB_ZCL_READ_REPORTING_CONFIGURATION_RESPONSE_COMMAND_ID = 0x09, /**< Ver.: always */
+       ZB_ZCL_REPORT_ATTRIBUTES_COMMAND_ID = 0x0A, /**< Ver.: always */
+       ZB_ZCL_DEFAULT_RESPONSE_COMMAND_ID = 0x0B, /**< Ver.: always */
+       ZB_ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID = 0x0C, /**< Ver.: always */
+       ZB_ZCL_DISCOVER_ATTRIBUTES_RESPONSE_COMMAND_ID = 0x0D, /**< Ver.: always */
+       ZB_ZCL_READ_ATTRIBUTES_STRUCTURED_COMMAND_ID = 0x0E, /**< Ver.: always */
+       ZB_ZCL_WRITE_ATTRIBUTES_STRUCTURED_COMMAND_ID = 0x0F, /**< Ver.: always */
+       ZB_ZCL_WRITE_ATTRIBUTES_STRUCTURED_RESPONSE_COMMAND_ID = 0x10, /**< Ver.: always */
+       ZB_ZCL_DISCOVER_COMMANDS_RECEIVED_COMMAND_ID = 0x11, /**< Ver.: always */
+       ZB_ZCL_DISCOVER_COMMANDS_RECEIVED_RESPONSE_COMMAND_ID = 0x12, /**< Ver.: always */
+       ZB_ZCL_DISCOVER_COMMANDS_GENERATED_COMMAND_ID = 0x13, /**< Ver.: always */
+       ZB_ZCL_DISCOVER_COMMANDS_GENERATED_RESPONSE_COMMAND_ID = 0x14, /**< Ver.: always */
+       ZB_ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID = 0x15, /**< Ver.: always */
+       ZB_ZCL_DISCOVER_ATTRIBUTES_EXTENDED_RESPONSE_COMMAND_ID = 0x16, /**< Ver.: always */
+} zb_zcl_global_commands_e;
+
+/**
+ * @brief Command types for cluster: Basic
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_RESET_TO_FACTORY_DEFAULTS_COMMAND_ID = 0x00, /**< Ver.: always */
+} zb_zcl_basic_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Identify
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID = 0x00, /**< Ver.: always */
+} zb_zcl_identify_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Identify
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_IDENTIFY_COMMAND_ID  = 0x00, /**< Ver.: always */
+       ZB_ZCL_IDENTIFY_QUERY_COMMAND_ID  = 0x01, /**< Ver.: always */
+       ZB_ZCL_E_Z_MODE_INVOKE_COMMAND_ID  = 0x02, /**< Ver.: always */
+       ZB_ZCL_UPDATE_COMMISSION_STATE_COMMAND_ID  = 0x03, /**< Ver.: always */
+       ZB_ZCL_TRIGGER_EFFECT_COMMAND_ID = 0x40, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_identify_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Groups
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ADD_GROUP_RESPONSE_COMMAND_ID  = 0x00, /**< Ver.: always */
+       ZB_ZCL_VIEW_GROUP_RESPONSE_COMMAND_ID  = 0x01, /**< Ver.: always */
+       ZB_ZCL_GET_GROUP_MEMBERSHIP_RESPONSE_COMMAND_ID  = 0x02, /**< Ver.: always */
+       ZB_ZCL_REMOVE_GROUP_RESPONSE_COMMAND_ID  = 0x03, /**< Ver.: always */
+} zb_zcl_group_server_commands_e;
+
+// Client to server
+typedef enum {
+       ZB_ZCL_ADD_GROUP_COMMAND_ID  = 0x00, /**< Ver.: always */
+       ZB_ZCL_VIEW_GROUP_COMMAND_ID  = 0x01, /**< Ver.: always */
+       ZB_ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID  = 0x02, /**< Ver.: always */
+       ZB_ZCL_REMOVE_GROUP_COMMAND_ID  = 0x03, /**< Ver.: always */
+       ZB_ZCL_REMOVE_ALL_GROUPS_COMMAND_ID  = 0x04, /**< Ver.: always */
+       ZB_ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID  = 0x05, /**< Ver.: always */
+} zb_zcl_group_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Scenes
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ADD_SCENE_RESPONSE_COMMAND_ID  = 0x00, /**< Ver.: always */
+       ZB_ZCL_VIEW_SCENE_RESPONSE_COMMAND_ID  = 0x01, /**< Ver.: always */
+       ZB_ZCL_REMOVE_SCENE_RESPONSE_COMMAND_ID  = 0x02, /**< Ver.: always */
+       ZB_ZCL_REMOVE_ALL_SCENES_RESPONSE_COMMAND_ID  = 0x03, /**< Ver.: always */
+       ZB_ZCL_STORE_SCENE_RESPONSE_COMMAND_ID  = 0x04, /**< Ver.: always */
+       ZB_ZCL_GET_SCENE_MEMBERSHIP_RESPONSE_COMMAND_ID  = 0x06, /**< Ver.: always */
+       ZB_ZCL_ENHANCED_ADD_SCENE_RESPONSE_COMMAND_ID = 0x40, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ENHANCED_VIEW_SCENE_RESPONSE_COMMAND_ID = 0x41, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COPY_SCENE_RESPONSE_COMMAND_ID = 0x42, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_scenes_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Scenes
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ADD_SCENE_COMMAND_ID  = 0x00, /**< Ver.: always */
+       ZB_ZCL_VIEW_SCENE_COMMAND_ID  = 0x01, /**< Ver.: always */
+       ZB_ZCL_REMOVE_SCENE_COMMAND_ID  = 0x02, /**< Ver.: always */
+       ZB_ZCL_REMOVE_ALL_SCENES_COMMAND_ID  = 0x03, /**< Ver.: always */
+       ZB_ZCL_STORE_SCENE_COMMAND_ID  = 0x04, /**< Ver.: always */
+       ZB_ZCL_RECALL_SCENE_COMMAND_ID  = 0x05, /**< Ver.: always */
+       ZB_ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID  = 0x06, /**< Ver.: always */
+       ZB_ZCL_ENHANCED_ADD_SCENE_COMMAND_ID = 0x40, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ENHANCED_VIEW_SCENE_COMMAND_ID = 0x41, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COPY_SCENE_COMMAND_ID = 0x42, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_scenes_client_commands_e;
+
+/**
+ * @brief Command types for cluster: On/off
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_OFF_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_ON_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_TOGGLE_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_OFF_WITH_EFFECT_COMMAND_ID = 0x40, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ON_WITH_RECALL_GLOBAL_SCENE_COMMAND_ID = 0x41, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ON_WITH_TIMED_OFF_COMMAND_ID = 0x42, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_SAMPLE_MFG_SPECIFIC_OFF_WITH_TRANSITION_COMMAND_ID = 0x00, /**< Ver.: always mfgCode: 0x1002 */
+       ZB_ZCL_SAMPLE_MFG_SPECIFIC_ON_WITH_TRANSITION_COMMAND_ID = 0x01, /**< Ver.: always mfgCode: 0x1002 */
+       ZB_ZCL_SAMPLE_MFG_SPECIFIC_TOGGLE_WITH_TRANSITION_COMMAND_ID = 0x02, /**< Ver.: always mfgCode: 0x1002 */
+} zb_zcl_on_off_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Level Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_MOVE_TO_LEVEL_COMMAND_ID  = 0x00, /**< Ver.: always */
+       ZB_ZCL_MOVE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_STEP_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_STOP_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_MOVE_WITH_ON_OFF_COMMAND_ID = 0x05, /**< Ver.: always */
+       ZB_ZCL_STEP_WITH_ON_OFF_COMMAND_ID = 0x06, /**< Ver.: always */
+       ZB_ZCL_STOP_WITH_ON_OFF_COMMAND_ID = 0x07, /**< Ver.: always */
+} zb_zcl_level_control_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Alarms
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+ typedef enum {
+       ZB_ZCL_ALARM_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_GET_ALARM_RESPONSE_COMMAND_ID = 0x01, /**< Ver.: always */
+} zb_zcl_alarms_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Alarms
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_RESET_ALARM_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_RESET_ALL_ALARMS_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_GET_ALARM_COMMAND_ID  = 0x02, /**< Ver.: always */
+       ZB_ZCL_RESET_ALARM_LOG_COMMAND_ID = 0x03, /**< Ver.: always */
+} zb_zcl_alarms_client_commands_e;
+
+/**
+ * @brief Command types for cluster: RSSI Location
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_DEVICE_CONFIGURATION_RESPONSE_COMMAND_ID  = 0x00, /**< Ver.: always */
+       ZB_ZCL_LOCATION_DATA_RESPONSE_COMMAND_ID  = 0x01, /**< Ver.: always */
+       ZB_ZCL_LOCATION_DATA_NOTIFICATION_COMMAND_ID  = 0x02, /**< Ver.: always */
+       ZB_ZCL_COMPACT_LOCATION_DATA_NOTIFICATION_COMMAND_ID  = 0x03, /**< Ver.: always */
+       ZB_ZCL_RSSI_PING_COMMAND_ID  = 0x04, /**< Ver.: always */
+       ZB_ZCL_RSSI_REQUEST_COMMAND_ID  = 0x05, /**< Ver.: always */
+       ZB_ZCL_REPORT_RSSI_MEASUREMENTS_COMMAND_ID  = 0x06, /**< Ver.: always */
+       ZB_ZCL_REQUEST_OWN_LOCATION_COMMAND_ID  = 0x07, /**< Ver.: always */
+} zb_zcl_rssi_location_server_commands_e;
+
+/**
+ * @brief Command types for cluster: RSSI Location
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SET_ABSOLUTE_LOCATION_COMMAND_ID  = 0x00, /**< Ver.: always */
+       ZB_ZCL_SET_DEVICE_CONFIGURATION_COMMAND_ID  = 0x01, /**< Ver.: always */
+       ZB_ZCL_GET_DEVICE_CONFIGURATION_COMMAND_ID  = 0x02, /**< Ver.: always */
+       ZB_ZCL_GET_LOCATION_DATA_COMMAND_ID  = 0x03, /**< Ver.: always */
+       ZB_ZCL_RSSI_RESPONSE_COMMAND_ID  = 0x04, /**< Ver.: always */
+       ZB_ZCL_SEND_PINGS_COMMAND_ID  = 0x05, /**< Ver.: always */
+       ZB_ZCL_ANCHOR_NODE_ANNOUNCE_COMMAND_ID  = 0x06, /**< Ver.: always */
+} zb_zcl_rssi_location_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Commissioning
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_RESTART_DEVICE_RESPONSE_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_SAVE_STARTUP_PARAMETERS_RESPONSE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_RESTORE_STARTUP_PARAMETERS_RESPONSE_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_RESET_STARTUP_PARAMETERS_RESPONSE_COMMAND_ID = 0x03, /**< Ver.: always */
+} zb_zcl_commissioning_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Commissioning
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_RESTART_DEVICE_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_SAVE_STARTUP_PARAMETERS_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_RESTORE_STARTUP_PARAMETERS_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_RESET_STARTUP_PARAMETERS_COMMAND_ID = 0x03, /**< Ver.: always */
+} zb_zcl_commissioning_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Partition
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_MULTIPLE_ACK_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_READ_HANDSHAKE_PARAM_RESPONSE_COMMAND_ID = 0x01, /**< Ver.: always */
+} zb_zcl_partition_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Partition
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_TRANSFER_PARTITIONED_FRAME_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_READ_HANDSHAKE_PARAM_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_WRITE_HANDSHAKE_PARAM_COMMAND_ID = 0x02, /**< Ver.: always */
+} zb_zcl_partition_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Over the Air Bootloading
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_IMAGE_NOTIFY_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_QUERY_NEXT_IMAGE_RESPONSE_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_IMAGE_BLOCK_RESPONSE_COMMAND_ID = 0x05, /**< Ver.: always */
+       ZB_ZCL_UPGRADE_END_RESPONSE_COMMAND_ID = 0x07, /**< Ver.: always */
+       ZB_ZCL_QUERY_SPECIFIC_FILE_RESPONSE_COMMAND_ID = 0x09, /**< Ver.: always */
+} zb_zcl_over_the_air_bootloading_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Over the Air Bootloading
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_QUERY_NEXT_IMAGE_REQUEST_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_IMAGE_BLOCK_REQUEST_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_IMAGE_PAGE_REQUEST_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_UPGRADE_END_REQUEST_COMMAND_ID = 0x06, /**< Ver.: always */
+       ZB_ZCL_QUERY_SPECIFIC_FILE_REQUEST_COMMAND_ID = 0x08, /**< Ver.: always */
+} zb_zcl_over_the_air_bootloading_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Power Profile
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_POWER_PROFILE_NOTIFICATION_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_POWER_PROFILE_RESPONSE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_POWER_PROFILE_STATE_RESPONSE_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_GET_POWER_PROFILE_PRICE_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_POWER_PROFILES_STATE_NOTIFICATION_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_GET_OVERALL_SCHEDULE_PRICE_COMMAND_ID = 0x05, /**< Ver.: always */
+       ZB_ZCL_ENERGY_PHASES_SCHEDULE_REQUEST_COMMAND_ID = 0x06, /**< Ver.: always */
+       ZB_ZCL_ENERGY_PHASES_SCHEDULE_STATE_RESPONSE_COMMAND_ID = 0x07, /**< Ver.: always */
+       ZB_ZCL_ENERGY_PHASES_SCHEDULE_STATE_NOTIFICATION_COMMAND_ID = 0x08, /**< Ver.: always */
+       ZB_ZCL_POWER_PROFILE_SCHEDULE_CONSTRAINTS_NOTIFICATION_COMMAND_ID = 0x09, /**< Ver.: always */
+       ZB_ZCL_POWER_PROFILE_SCHEDULE_CONSTRAINTS_RESPONSE_COMMAND_ID = 0x0A, /**< Ver.: always */
+       ZB_ZCL_GET_POWER_PROFILE_PRICE_EXTENDED_COMMAND_ID = 0x0B, /**< Ver.: always */
+} zb_zcl_power_profile_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Power Profile
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_POWER_PROFILE_REQUEST_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_POWER_PROFILE_STATE_REQUEST_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_GET_POWER_PROFILE_PRICE_RESPONSE_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_GET_OVERALL_SCHEDULE_PRICE_RESPONSE_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_ENERGY_PHASES_SCHEDULE_NOTIFICATION_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_ENERGY_PHASES_SCHEDULE_RESPONSE_COMMAND_ID = 0x05, /**< Ver.: always */
+       ZB_ZCL_POWER_PROFILE_SCHEDULE_CONSTRAINTS_REQUEST_COMMAND_ID = 0x06, /**< Ver.: always */
+       ZB_ZCL_ENERGY_PHASES_SCHEDULE_STATE_REQUEST_COMMAND_ID = 0x07, /**< Ver.: always */
+       ZB_ZCL_GET_POWER_PROFILE_PRICE_EXTENDED_RESPONSE_COMMAND_ID = 0x08, /**< Ver.: always */
+} zb_zcl_power_profile_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Appliance Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SIGNAL_STATE_RESPONSE_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_SIGNAL_STATE_NOTIFICATION_COMMAND_ID = 0x01, /**< Ver.: always */
+} zb_zcl_appliance_control_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Appliance Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_EXECUTION_OF_A_COMMAND_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_SIGNAL_STATE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_WRITE_FUNCTIONS_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_OVERLOAD_PAUSE_RESUME_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_OVERLOAD_PAUSE_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_OVERLOAD_WARNING_COMMAND_ID = 0x05, /**< Ver.: always */
+} zb_zcl_appliance_control_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Poll Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_CHECK_IN_COMMAND_ID = 0x00, /**< Ver.: always */
+} zb_zcl_poll_control_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Poll Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_CHECK_IN_RESPONSE_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_FAST_POLL_STOP_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_SET_LONG_POLL_INTERVAL_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_SET_SHORT_POLL_INTERVAL_COMMAND_ID = 0x03, /**< Ver.: always */
+} zb_zcl_poll_control_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Door Lock
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_LOCK_DOOR_RESPONSE_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_UNLOCK_DOOR_RESPONSE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_TOGGLE_RESPONSE_COMMAND_ID = 0x02, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_UNLOCK_WITH_TIMEOUT_RESPONSE_COMMAND_ID = 0x03, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_LOG_RECORD_RESPONSE_COMMAND_ID = 0x04, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_PIN_RESPONSE_COMMAND_ID = 0x05, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_PIN_RESPONSE_COMMAND_ID = 0x06, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_PIN_RESPONSE_COMMAND_ID = 0x07, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_ALL_PINS_RESPONSE_COMMAND_ID = 0x08, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_USER_STATUS_RESPONSE_COMMAND_ID = 0x09, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_USER_STATUS_RESPONSE_COMMAND_ID = 0x0A, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x0B, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x0C, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_WEEKDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x0D, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x0E, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x0F, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_YEARDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x10, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x11, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x12, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_HOLIDAY_SCHEDULE_RESPONSE_COMMAND_ID = 0x13, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_USER_TYPE_RESPONSE_COMMAND_ID = 0x14, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_USER_TYPE_RESPONSE_COMMAND_ID = 0x15, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_RFID_RESPONSE_COMMAND_ID = 0x16, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_RFID_RESPONSE_COMMAND_ID = 0x17, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_RFID_RESPONSE_COMMAND_ID = 0x18, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_ALL_RFIDS_RESPONSE_COMMAND_ID = 0x19, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_OPERATION_EVENT_NOTIFICATION_COMMAND_ID = 0x20, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_PROGRAMMING_EVENT_NOTIFICATION_COMMAND_ID = 0x21, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_door_lock_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Door Lock
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_LOCK_DOOR_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_UNLOCK_DOOR_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_DOOR_TOGGLE_COMMAND_ID = 0x02, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_UNLOCK_WITH_TIMEOUT_COMMAND_ID = 0x03, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_LOG_RECORD_COMMAND_ID  = 0x04, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_PIN_COMMAND_ID = 0x05, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_PIN_COMMAND_ID = 0x06, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_PIN_COMMAND_ID = 0x07, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_ALL_PINS_COMMAND_ID = 0x08, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_USER_STATUS_COMMAND_ID = 0x09, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_USER_STATUS_COMMAND_ID = 0x0A, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_WEEKDAY_SCHEDULE_COMMAND_ID = 0x0B, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_WEEKDAY_SCHEDULE_COMMAND_ID = 0x0C, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_WEEKDAY_SCHEDULE_COMMAND_ID = 0x0D, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_YEARDAY_SCHEDULE_COMMAND_ID = 0x0E, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_YEARDAY_SCHEDULE_COMMAND_ID = 0x0F, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_YEARDAY_SCHEDULE_COMMAND_ID = 0x10, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_HOLIDAY_SCHEDULE_COMMAND_ID = 0x11, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_HOLIDAY_SCHEDULE_COMMAND_ID = 0x12, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_HOLIDAY_SCHEDULE_COMMAND_ID = 0x13, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_USER_TYPE_COMMAND_ID = 0x14, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_USER_TYPE_COMMAND_ID = 0x15, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_SET_RFID_COMMAND_ID = 0x16, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_RFID_COMMAND_ID = 0x17, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_RFID_COMMAND_ID = 0x18, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_ALL_RFIDS_COMMAND_ID = 0x19, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_door_lock_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Window Covering
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_WINDOW_COVERING_UP_OPEN_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_WINDOW_COVERING_DOWN_CLOSE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_WINDOW_COVERING_STOP_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_WINDOW_COVERING_GO_TO_LIFT_VALUE_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_WINDOW_COVERING_GO_TO_LIFT_PERCENTAGE_COMMAND_ID = 0x05, /**< Ver.: always */
+       ZB_ZCL_WINDOW_COVERING_GO_TO_TILT_VALUE_COMMAND_ID = 0x07, /**< Ver.: always */
+       ZB_ZCL_WINDOW_COVERING_GO_TO_TILT_PERCENTAGE_COMMAND_ID = 0x08, /**< Ver.: always */
+} zb_zcl_window_covering_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Thermostat
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_CURRENT_WEEKLY_SCHEDULE_COMMAND_ID = 0x00, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_RELAY_STATUS_LOG_COMMAND_ID = 0x01, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_thermostat_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Thermostat
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SETPOINT_RAISE_LOWER_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_SET_WEEKLY_SCHEDULE_COMMAND_ID = 0x01, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_WEEKLY_SCHEDULE_COMMAND_ID = 0x02, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_CLEAR_WEEKLY_SCHEDULE_COMMAND_ID = 0x03, /**< Ver.: since ha-1.2-05-3520-29 */
+       ZB_ZCL_GET_RELAY_STATUS_LOG_COMMAND_ID = 0x04, /**< Ver.: since ha-1.2-05-3520-29 */
+} zb_zcl_thermostat_client_commands_e;
+
+/**
+ * @brief Command types for cluster: Color Control
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_MOVE_TO_HUE_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_MOVE_HUE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_STEP_HUE_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_MOVE_TO_SATURATION_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_MOVE_SATURATION_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_STEP_SATURATION_COMMAND_ID = 0x05, /**< Ver.: always */
+       ZB_ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID = 0x06, /**< Ver.: always */
+       ZB_ZCL_MOVE_TO_COLOR_COMMAND_ID = 0x07, /**< Ver.: always */
+       ZB_ZCL_MOVE_COLOR_COMMAND_ID = 0x08, /**< Ver.: always */
+       ZB_ZCL_STEP_COLOR_COMMAND_ID = 0x09, /**< Ver.: always */
+       ZB_ZCL_MOVE_TO_COLOR_TEMPERATURE_COMMAND_ID = 0x0A, /**< Ver.: always */
+       ZB_ZCL_ENHANCED_MOVE_TO_HUE_COMMAND_ID = 0x40, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ENHANCED_MOVE_HUE_COMMAND_ID = 0x41, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ENHANCED_STEP_HUE_COMMAND_ID = 0x42, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ENHANCED_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID = 0x43, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_COLOR_LOOP_SET_COMMAND_ID = 0x44, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_STOP_MOVE_STEP_COMMAND_ID = 0x47, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_MOVE_COLOR_TEMPERATURE_COMMAND_ID = 0x4B, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_STEP_COLOR_TEMPERATUE_COMMAND_ID = 0x4C, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_color_control_client_commands_e;
+
+/**
+ * @brief Command types for cluster: IAS Zone
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ZONE_STATUS_CHANGE_NOTIFICATION_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_ZONE_ENROLL_REQUEST_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_INITIATE_NORMAL_OPERATION_MODE_RESPONSE_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_INITIATE_TEST_MODE_RESPONSE_COMMAND_ID = 0x03, /**< Ver.: always */
+} zb_zcl_ias_zone_server_commands_e;
+
+/**
+ * @brief Command types for cluster: IAS Zone
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ZONE_ENROLL_RESPONSE_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_INITIATE_NORMAL_OPERATION_MODE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_INITIATE_TEST_MODE_COMMAND_ID = 0x02, /**< Ver.: always */
+} zb_zcl_ias_zone_client_commands_e;
+
+/**
+ * @brief Command types for cluster: IAS ACE
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ARM_RESPONSE_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_GET_ZONE_ID_MAP_RESPONSE_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_GET_ZONE_INFORMATION_RESPONSE_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_ZONE_STATUS_CHANGED_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_PANEL_STATUS_CHANGED_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_GET_PANEL_STATUS_RESPONSE_COMMAND_ID = 0x05, /**< Ver.: since ha-1.2.1-05-3520-30 */
+       ZB_ZCL_SET_BYPASSED_ZONE_LIST_COMMAND_ID = 0x06, /**< Ver.: since ha-1.2.1-05-3520-30 */
+       ZB_ZCL_BYPASS_RESPONSE_COMMAND_ID = 0x07, /**< Ver.: since ha-1.2.1-05-3520-30 */
+       ZB_ZCL_GET_ZONE_STATUS_RESPONSE_COMMAND_ID = 0x08, /**< Ver.: since ha-1.2.1-05-3520-30 */
+} zb_zcl_ias_ace_server_commands_e;
+
+/**
+ * @brief Command types for cluster: IAS ACE
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_ARM_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_BYPASS_COMMAND_ID = 0x01, /**< Ver.: always */
+       ZB_ZCL_EMERGENCY_COMMAND_ID = 0x02, /**< Ver.: always */
+       ZB_ZCL_FIRE_COMMAND_ID = 0x03, /**< Ver.: always */
+       ZB_ZCL_PANIC_COMMAND_ID = 0x04, /**< Ver.: always */
+       ZB_ZCL_GET_ZONE_ID_MAP_COMMAND_ID = 0x05, /**< Ver.: always */
+       ZB_ZCL_GET_ZONE_INFORMATION_COMMAND_ID = 0x06, /**< Ver.: always */
+       ZB_ZCL_GET_PANEL_STATUS_COMMAND_ID = 0x07, /**< Ver.: since ha-1.2.1-05-3520-30 */
+       ZB_ZCL_GET_BYPASSED_ZONE_LIST_COMMAND_ID = 0x08, /**< Ver.: since ha-1.2.1-05-3520-30 */
+       ZB_ZCL_GET_ZONE_STATUS_COMMAND_ID = 0x09, /**< Ver.: since ha-1.2.1-05-3520-30 */
+} zb_zcl_ias_ace_client_commands_e;
+
+/**
+ * @brief Command types for cluster: IAS WD
+ * @details Cluster specification level: zcl-1.0-07-5123-03
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_START_WARNING_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_SQUAWK_COMMAND_ID = 0x01, /**< Ver.: always */
+} zb_zcl_ias_wd_client_commands_e;
+
+
+/**
+ * @brief Command types for cluster: Electrical Measurement
+ * @details Cluster specification level: UNKNOWN
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_GET_PROFILE_INFO_RESPONSE_COMMAND_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_GET_MEASUREMENT_PROFILE_RESPONSE_COMMAND_COMMAND_ID = 0x01, /**< Ver.: always */
+} zb_zcl_electrical_measurement_server_commands_e;
+
+/**
+ * @brief Command types for cluster: Electrical Measurement
+ * @details Cluster specification level: UNKNOWN
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_GET_PROFILE_INFO_COMMAND_COMMAND_ID = 0x00, /**< Ver.: always */
+       ZB_ZCL_GET_MEASUREMENT_PROFILE_COMMAND_COMMAND_ID = 0x01, /**< Ver.: always */
+} zb_zcl_electrical_measurement_client_commands_e;
+
+/**
+ * @brief Command types for cluster: ZLL Commissioning
+ * @details Cluster specification level: zll-1.0-11-0037-10
+ * @remark Direction : Server to Client
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SCAN_RESPONSE_COMMAND_ID = 0x01, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_DEVICE_INFORMATION_RESPONSE_COMMAND_ID = 0x03, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_NETWORK_START_RESPONSE_COMMAND_ID = 0x11, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_NETWORK_JOIN_ROUTER_RESPONSE_COMMAND_ID = 0x13, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_NETWORK_JOIN_END_DEVICE_RESPONSE_COMMAND_ID  = 0x15, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_ENDPOINT_INFORMATION_COMMAND_ID = 0x40, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_GET_GROUP_IDENTIFIERS_RESPONSE_COMMAND_ID = 0x41, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_GET_ENDPOINT_LIST_RESPONSE_COMMAND_ID = 0x42, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_zll_commissioning_server_commands_e;
+
+/**
+ * @brief Command types for cluster: ZLL Commissioning
+ * @details Cluster specification level: zll-1.0-11-0037-10
+ * @remark Direction : Client to Server
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SCAN_REQUEST_COMMAND_ID = 0x00, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_DEVICE_INFORMATION_REQUEST_COMMAND_ID = 0x02, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_IDENTIFY_REQUEST_COMMAND_ID = 0x06, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_RESET_TO_FACTORY_NEW_REQUEST_COMMAND_ID = 0x07, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_NETWORK_START_REQUEST_COMMAND_ID = 0x10, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_NETWORK_JOIN_ROUTER_REQUEST_COMMAND_ID = 0x12, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_NETWORK_JOIN_END_DEVICE_REQUEST_COMMAND_ID = 0x14, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_NETWORK_UPDATE_REQUEST_COMMAND_ID  = 0x16, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_GET_GROUP_IDENTIFIERS_REQUEST_COMMAND_ID = 0x41, /**< Ver.: since zll-1.0-11-0037-10 */
+       ZB_ZCL_GET_ENDPOINT_LIST_REQUEST_COMMAND_ID = 0x42, /**< Ver.: since zll-1.0-11-0037-10 */
+} zb_zcl_zll_commissioning_client_commands_e;
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_COMMAND_IDS_H__ */
\ No newline at end of file
diff --git a/include/zcl/zb-zcl-door-lock-cluster.h b/include/zcl/zb-zcl-door-lock-cluster.h
new file mode 100644 (file)
index 0000000..37405f7
--- /dev/null
@@ -0,0 +1,1488 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_DOOR_LOCK_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_DOOR_LOCK_CLUSTER_H__
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-on-off-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_DOOR_LOCK_CLUSTER_MODULE Door Lock Cluster
+ *
+ * @brief zigbee door lock cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_DOOR_LOCK_CLUSTER_MODULEE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 10.13 Commands Generated by the Server Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Lock Door Response                   |     M      |
+ * |             0x01               | Unlock Door Response                 |     M      |
+ * |             0x02               | Toogle Response                      |     O      |
+ * |             0x03               | Unlock with Timeout Response         |     O      |
+ * |             0x04               | Get Log Record Response              |     O      |
+ * |             0x05               | Set PIN Code Response                |     O      |
+ * |             0x06               | Get PIN Code Response                |     O      |
+ * |             0x07               | Clear PIN Code                       |     O      |
+ * |             0x09               | Set User Status Response             |     O      |
+ * |             0x0a               | Get User Status Response             |     O      |
+ * |             0x0b               | Set Week Day Schedule Response       |     O      |
+ * |             0x0c               | Get Week Day Schedule Response       |     O      |
+ * |             0x0d               | Clear Week Day Schedule Response     |     O      |
+ * |             0x0e               | Set Year Day Schedule Response       |     O      |
+ * |             0x0f               | Get Year Day Schedule Response       |     O      |
+ * |             0x10               | Clear Year Day Schedule Response     |     O      |
+ * |             0x11               | Set Holiday Schedule Response        |     O      |
+ * |             0x12               | Get Holiday Schedule Response        |     O      |
+ * |             0x13               | Set User Type Response               |     O      |
+ * |             0x14               | Get User Type Response               |     O      |
+ * |             0x15               | Set RFID Code Response               |     O      |
+ * |             0x16               | Get RFID Code Response               |     O      |
+ * |             0x17               | Clear RFID Code Response             |     O      |
+ * |             0x18               | Clear All RFID Codes Response        |     O      |
+ * |             0x19               | Move to Level                        |     O      |
+ * |             0x20               | Operation Event Notification         |     O      |
+ * |             0x21               | Programming Event Notification       |     O      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for lock response
+ * @details This command is sent in response to a commands with one status byte payload.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] status 0=Success \n
+ *                    1=General failure \n
+ *                    2=Memory full \n
+ *                    3=Duplicate code error
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_door_lock_lock()
+ */
+typedef void (*zb_zcl_doorlock_rsp)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned char status,
+       void *user_data);
+
+
+/**
+ * @brief Command description for get log record response
+ * @details Returns the specified log record. If an invalid log entry ID was requested,
+ * it is set to 0 and the most recent log entry will be returned.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] log_entry_id the index into the log table where this log entry is stored.\n
+ *                         If the log entry requested is 0, the most recent log is returned
+ *                         with the appropriate log entry ID.
+ * @param[out] timestamp A ZigBee LocalTime used to timestamp all events and alarms on the
+ *                       door lock.
+ * @param[out] event_type Indicate the type of event that took place on the door lock.\n\n
+ *                        0x00 = Operation\n
+ *                        0x01 = Programming\n
+ *                        0x02 = Alarm\n
+ * @param[out] alarm A source value where a available sources are :\n\n
+ *                   0x00 = Keypad\n
+ *                   0x01 = RF\n
+ *                   0x02 = Manual\n
+ *                   0x02 = RFID\n
+ *                   0xff = Indeterminate\n
+ * @param[out] event_id A one byte value indicating the type of event that took place on
+ *                      the door lock depending on the event code table provided for
+ *                      a given event type and source.
+ * @param[out] user_id A two byte value indicating the ID of the user who generated the
+ *                     event on the door lock if one is available. If none is available,
+ *                     0xffff has to be used.
+ * @param[out] pin A ZigBee string indicating the PIN code or RFID code that was used to
+ *                 create the event on the door lock if one is available.
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_door_lock_get_log_record()
+ */
+typedef void (*zb_zcl_doorlock_get_log_record_rsp)(
+       zigbee_h handle,
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned short log_entry_id,
+       unsigned int timestamp,
+       unsigned char event_type,
+       unsigned char source,
+       unsigned char event_id,
+       unsigned char user_id,
+       const char *pin,
+       void *user_data);
+
+/**
+ * @brief Command description for get pin code response
+ * @details Returns the PIN for the specified user ID
+ * If the requested user ID is valid and the Code doesn't exist, Get RFID Code
+ * Response shall have the following format:\n\n
+ * UserId = requested UserId\n
+ * UserStatus = 0 (available)\n
+ * UserType = 0xFF (not supported)\n
+ * RFID = 0 (zero length)\n\n
+ * If requested user ID is invalid, send Default Response with an error status not
+ * equal to ZCL_SUCCESS(0x00).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] user_id Requested user ID
+ * @param[out] user_status Used to indicate what the status is for a specific user ID.
+ *                         0 - Available\n
+ *                         1 - Occupied / Enabled\n
+ *                         2 - Reserved\n
+ *                         3 - Occupied / Disable\n
+ *                         0xff - Not supported\n
+ * @param[out] user_type Used to indicate what the type is for a specific user ID.\n
+ *                       0 - Unrestricted User (default)\n
+ *                       1 - Year Day Schedule User\n
+ *                       2 - Week Day Schedule User\n
+ *                       3 - Master User\n
+ *                       4 - Non Access User\n
+ *                       0xff - Not supported\n
+ * Cf) User Type
+ * - Unrestricted User\n
+ * User has access 24/7 provided proper PIN is supplied (e.g., owner). Unrestricted
+ * user type is the default user type.
+ * - Year Day Schedule User\n
+ * User has ability to open lock within a specific time period (e.g., guest).
+ * - Week Day Schedule User\n
+ * User has ability to open lock based on specific time period within a reoccurring
+ * weekly schedule (e.g., cleaning worker).
+ * - Master User\n
+ * User has ability to both program and operate the door lock. This user can manage
+ * the users and user schedules. In all other respects this user matches the
+ * unrestricted (default) user. Master user is the only user that can disable the user
+ * interface (keypad, RF, etc...).
+ * - Non Access User\n
+ * User is recognized by the lock but does not have the ability to open the lock. This
+ * user will only cause the lock to generate the appropriate event notification to any
+ * bound devices.
+ * @param[out] code PIN code
+ * @param[out] user_data User data
+ *
+ * @see zb_zcldoor_lock_get_pin_code()
+ */
+typedef void (*zb_zcl_doorlock_get_pin_code_rsp)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned short user_id,
+       unsigned char user_status,
+       unsigned char user_type,
+       const char* code,
+       void *user_data);
+
+/**
+ * @brief Command description for get user status response
+ * @details Returns the user status for the specified user ID.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] user_id User ID
+ * @param[out] user_status Used to indicate what the status is for a specific user ID.
+ *                         0 - Available\n
+ *                         1 - Occupied / Enabled\n
+ *                         2 - Reserved\n
+ *                         3 - Occupied / Disable\n
+ *                         0xff - Not supported\n
+ * @param[out] user_data User data
+ *
+ * @see zb_zcldoor_lock_get_user_status()
+ */
+typedef void (*zb_zcl_doorlock_get_user_status_rsp)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned short user_id,
+       unsigned char user_status,
+       void *user_data);
+
+/**
+ * @brief Command description for get week day schedule response
+ * @details Returns the weekly repeating schedule data for the specified schedule ID.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] schedule_id Requested Schedule ID
+ * @param[out] user_id Requested User ID
+ * @param[out] status #ZB_ZCL_SUCCESS (0x00) if both Schedule ID and User ID are valid and
+ *                    there is a corresponding schedule entry.\n
+ *                    #ZB_ZCL_INVALID_FIELD (0x85) if either Schedule ID and/or User ID
+ *                    values are not within valid range.\n
+ *                    #ZB_ZCL_NOT_FOUND (0x8B) if both Schedule ID and User ID are within
+ *                    the valid range, however, there is not corresponding schedule entry
+ *                    found. Only if the status is ZCL SUCCESS that other remaining fields
+ *                    are included. For other (error) status values, only the fields up to
+ *                    the status field SHALL be present.
+ * @param[out] days_mask Days mask is a bitmask of the effective days in the order
+ *                       [E]SMT WTFS. Bit 7 indicates the enabled status of the schedule ID,
+ *                       with the lower 7 bits indicating the effective days mask.\n\n
+ *                       Bit 0 : Sat\n
+ *                       Bit 1 : Fri\n
+ *                       Bit 2 : Thu\n
+ *                       Bit 3 : Wed\n
+ *                       Bit 4 : Tue\n
+ *                       Bit 5 : Mon\n
+ *                       Bit 6 : Sun\n
+ *                       Bit 7 : En\n
+ * @param[out] start_hour The Start Hour of the Week Day Schedule: 0-23
+ * @param[out] start_minute The Start Min of the Week Day Schedule: 0-59
+ * @param[out] end_hour The End Hour of the Week Day Schedule: 0-23, must be greater than Start Hour
+ * @param[out] end_minute The End Min of the Week Day Schedule: 0-59
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_doorlock_set_week_day_schedule()
+ */
+typedef void (*zb_zcl_doorlock_get_week_day_schedule_rsp)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned char schedule_id,
+       unsigned short user_id,
+       unsigned char status,
+       unsigned char days_mask,
+       unsigned char start_hour,
+       unsigned char start_minute,
+       unsigned char end_hour,
+       unsigned char end_minute,
+       void *user_data);
+
+/**
+ * @brief Command description for get year day schedule response
+ * @details Returns pass/fail of the command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] schedule_id The requested schedule ID
+ * @param[out] user_id The requested user ID
+ * @param[out] status #ZB_ZCL_SUCCESS (0x00) if both Schedule ID and User ID are valid and
+ *                    there is a corresponding schedule entry.\n
+ *                    #ZB_ZCL_INVALID_FIELD (0x85) if either Schedule ID and/or User ID
+ *                    values are not within valid range.\n
+ *                    #ZB_ZCL_NOT_FOUND (0x8B) if both Schedule ID and User ID are within
+ *                    the valid range, however, there is not corresponding schedule entry
+ *                    found. Only if the status is ZCL SUCCESS that other remaining fields
+ *                    are included. For other (error) status values, only the fields up to
+ *                    the status field SHALL be present.
+ * @param[out] zigbee_local_start_time Start Time of the Year Day Schedule representing by
+ *                                     ZigBee LocalTime.
+ * @param[out] zigbee_local_end_time End Time of the Year Day Schedule representing by
+ *                                   ZigBee LocalTime.
+ * @param[out] operating_mode_during_holiday Operating Mode is valid enumeration value as
+ *                                           listed in operating mode attribute
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_doorlock_get_year_day_schedule()
+ */
+typedef void (*zb_zcl_doorlock_get_year_day_schedule_rsp)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned char schedule_id,
+       unsigned short user_id,
+       unsigned char status,
+       unsigned int zigbee_local_start_time,
+       unsigned int zigbee_local_end_time,
+       unsigned char operating_mode_during_holiday,
+       void *user_data);
+
+/**
+ * @brief Command description for get holiday schedule response
+ * @details Returns the Holiday Schedule Entry for the specified Holiday ID.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] schedule_id The requested Holiday Schedule ID
+ * @param[out] status
+ *   ZCL SUCCESS (0x00) : if both Schedule ID and User ID are valid and there is a
+ *   corresponding schedule entry.\n
+ *   ZCL INVALID_FIELD (0x85) : if either Schedule ID and/or User ID values are
+ *   not within valid range\n
+ *   ZCL NOT_FOUND (0x8B) : if both Schedule ID and User ID are within the valid
+ *   range, however, there is not corresponding schedule entry found.\n\n
+ *   Only if the status is ZCL SUCCESS that other remaining fields are included.\n For
+ *   other (error) status values, only the fields up to the status field SHALL be present.
+ * @param[out] status 0=pass, 1=fail
+ * @param[out] local_start_time Start Time of the Year Day Schedule representing by ZigBee
+ *                              LocalTime.
+ * @param[out] local_end_time End Time of the Year Day Schedule representing by ZigBee
+ *                            LocalTime.
+ * @param[out] operating_mode Operating Mode is valid enumeration value as listed in
+ *                            operating mode attribute\n\n
+ *                            0 : Normal mode supported\n
+ *                            1 : Vacation mode supported\n
+ *                            2 : Privacy mode supported\n
+ *                            3 : No RF Lock or Unlock mode supported\n
+ *                            4 : Passage mdoe supported
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_doorlock_get_holiday_schedule()
+ */
+typedef void (*zb_zcl_doorlock_get_holiday_schedule_rsp)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned char schedule_id,
+       unsigned char status,
+       unsigned int local_start_time,
+       unsigned int local_end_time,
+       unsigned char operating_mode,
+       void *user_data);
+
+/**
+ * @brief Command description for get user type response
+ * @details Returns the user type for the specified user ID.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] user_id Requested user ID
+ * @param[out] user_type Used to indicate what the type is for a specific user ID.\n
+ *                       0 - Unrestricted User (default)\n
+ *                       1 - Year Day Schedule User\n
+ *                       2 - Week Day Schedule User\n
+ *                       3 - Master User\n
+ *                       4 - Non Access User\n
+ *                       0xff - Not supported\n
+ * Cf) User Type
+ * - Unrestricted User\n
+ * User has access 24/7 provided proper PIN is supplied (e.g., owner). Unrestricted
+ * user type is the default user type.
+ * - Year Day Schedule User\n
+ * User has ability to open lock within a specific time period (e.g., guest).
+ * - Week Day Schedule User\n
+ * User has ability to open lock based on specific time period within a reoccurring
+ * weekly schedule (e.g., cleaning worker).
+ * - Master User\n
+ * User has ability to both program and operate the door lock. This user can manage
+ * the users and user schedules. In all other respects this user matches the
+ * unrestricted (default) user. Master user is the only user that can disable the user
+ * interface (keypad, RF, etc...).
+ * - Non Access User\n
+ * User is recognized by the lock but does not have the ability to open the lock. This
+ * user will only cause the lock to generate the appropriate event notification to any
+ * bound devices.
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_doorlock_set_user_type()
+ */
+typedef void (*zb_zcl_doorlock_get_user_type_rsp)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned short user_id,
+       unsigned char user_type,
+       void *user_data);
+
+/**
+ * @brief Command description for get RFID code response
+ * @details Returns the RFID code for the specified user ID:
+ * If the requested user ID is valid and the Code doesn't exist, Get RFID Code
+ * Response shall have the following format:\n
+ * UserId = requested UserId\n
+ * UserStatus = 0 (available)\n
+ * UserType = 0xFF (not supported)\n
+ * RFID = 0 (zero length)\n\n
+ * If requested user ID is invalid, send Default Response with an error status not
+ * equal to ZCL_SUCCESS(0x00).\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] user_id Requested user ID
+ * @param[out] user_type Used to indicate what the type is for a specific user ID.\n
+ *                       0 - Unrestricted User (default)\n
+ *                       1 - Year Day Schedule User\n
+ *                       2 - Week Day Schedule User\n
+ *                       3 - Master User\n
+ *                       4 - Non Access User\n
+ *                       0xff - Not supported\n
+ * Cf) User Type
+ * - Unrestricted User\n
+ * User has access 24/7 provided proper PIN is supplied (e.g., owner). Unrestricted
+ * user type is the default user type.
+ * - Year Day Schedule User\n
+ * User has ability to open lock within a specific time period (e.g., guest).
+ * - Week Day Schedule User\n
+ * User has ability to open lock based on specific time period within a reoccurring
+ * weekly schedule (e.g., cleaning worker).
+ * - Master User\n
+ * User has ability to both program and operate the door lock. This user can manage
+ * the users and user schedules. In all other respects this user matches the
+ * unrestricted (default) user. Master user is the only user that can disable the user
+ * interface (keypad, RF, etc...).
+ * - Non Access User\n
+ * User is recognized by the lock but does not have the ability to open the lock. This
+ * user will only cause the lock to generate the appropriate event notification to any
+ * bound devices.
+ * @param[out] rfid_code RFID code string
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_doorlock_get_rfid_code()
+ */
+typedef void (*zb_zcl_doorlock_get_rfid_code_rsp)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned short user_id,
+       unsigned char user_type,
+       const char *rfid_code,
+       void *user_data);
+
+#if 1
+/**
+ * @brief Description for operation event notification
+ * @details The door lock server sends out operation event notification when the event is
+ * triggered by the various event sources. The specific operation event will only be
+ * sent out if the associated bitmask is enabled in the various attributes in the Event
+ * Masks Attribute Set. \n
+ * All events are optional.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] operation_event_source This field indicates where the event was triggered from\n
+ *                                    0x00 - Keypad\n
+ *                                    0x01 - RF\n
+ *                                    0x02 - Manual\n
+ *                                    0x03 - RFID\n
+ *                                    0x04 - Indetermine\n
+ * @param[out] operation_event_code
+ *   The door lock optionally sends out notifications (if they are enabled) whenever
+ *   there is a significant operational event on the lock. When combined with a source
+ *   from the Event Source table above, the following operational event codes
+ *   constitute an event on the door lock that can be both logged and sent to a bound
+ *   device using the Operation Event Notification command.\n
+ *   Not all operation event codes are applicable to each of the event source.\n
+ *   Below table marks each event code with ( Keypad / RF / Manuel / RFID)
+ *   if the event code is applicable to the event source.\n\n
+ *    0x00 - UnknownOrMfgSpeficific (Keypad / RF / Manual / RFID)\n
+ *    0x01 - Lock (Keypad / RF / Manual / RFID)\n
+ *    0x02 - Unlock (Keypad / RF / Manual / RFID)\n
+ *    0x03 - LockFailureInvalidPINorID (Keypad / RF / - / RFID)\n
+ *    0x04 - LockFailureInvalidSchedule (Keypad / RF / - / RFID)\n
+ *    0x05 - UnlockFailureInvalidPINorID (Keypad / RF / - / RFID)\n
+ *    0x06 - UnlockFailureInvaidSchedule (Keypad / RF / - / RFID)\n
+ *    0x07 - OneTouchLock ( - / - / Manual / - )\n
+ *    0x08 - KeyLock ( - / - / Manual / - )\n
+ *    0x09 - KeyUnlock ( - / - / Manual / - )\n
+ *    0x0A - AutoLock ( - / - / Manual / - )\n
+ *    0x0B - ScheduleLock ( - / - / Manual / - )\n
+ *    0x0C - ScheduleUnlock ( - / - / Manual / - )\n
+ *    0x0D - Manuel Lock (Key or Thumbturn) (( - / - / Manual / - )\n
+ *    0x0E - Manuel Unlock (Key or Thumbturn) ( - / - / Manual / - )\n
+ *    0x0F - Non-Access User Operational Event (Keypad / - / - / - )\n\n
+ *
+ * @param[out] user_id The User ID who performed the event
+ * @param[out] pin The PIN that is assoicated with the User ID who performed the event
+ * @param[out] local_time The ZigBee LocalTime that indicates when the event is triggered.
+ *             If time is not supported, the field SHALL be populated with default not
+ *             used value 0xFFFFFFFF.
+ * @param[out] data The operation event notification command contains a variable string,
+ *                  which can be used to pass data associated with a particular event.\n
+ *                  Generally this field will be left empty. \n
+ *                  However, manufacturer can choose to use this field to store/display
+ *                  manufacturer-specific information.
+ *
+ */
+typedef void (*zb_zcl_doorlock_operational_event_noti)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned char operation_event_source,
+       unsigned char operation_event_code,
+       unsigned short user_id,
+       unsigned char pin,
+       unsigned int local_time,
+       const char *data,
+       void *user_data);
+
+/**
+ * @brief Description for programming event notification
+ * @details The door lock server sends out a programming event notification whenever a
+ * programming event takes place on the door lock.\n
+ * As with operational events, all programming events can be turned on and off by
+ * flipping bits in the associated event mask.\n
+ * The programming event notification command includes an optional string of data
+ * that can be used by the manufacturer to pass some manufacturer-specific
+ * information if that is required
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] programming_event_source This field indicates where the event was triggered from\n
+ *                                    0x00 - Keypad\n
+ *                                    0x01 - RF\n
+ *                                    0x02 - Manual\n
+ *                                    0x03 - RFID\n
+ *                                    0x04 - Indetermine\n
+ * @param[out] programming_event_code
+ *   The door lock optionally sends out notifications (if they are enabled) whenever
+ *   there is a significant operational event on the lock. When combined with a source
+ *   from the Event Source table above, the following operational event codes
+ *   constitute an event on the door lock that can be both logged and sent to a bound
+ *   device using the Programming Event Notification command.\n
+ *   Not all operation event codes are applicable to each of the event source.\n
+ *   Below table marks each event code with ( Keypad / RF / Manuel / RFID)
+ *   if the event code is applicable to the event source.\n\n
+ *    0x00 - UnknownOrMfgSpeficific (Keypad / RF / RFID)\n
+ *    0x01 - MasterCodeChanged (Keypad / RF / RFID)\n
+ *    0x02 - PINCodeAdded (Keypad / - / - )\n
+ *    0x03 - PINCodeDeleted (Keypad / RF / - )\n
+ *    0x04 - PINCodeChanged (Keypad / RF / - )\n
+ *    0x05 - RFIDCodeAdded (- / - / RFID)\n
+ *    0x06 - RFIDCodeDeleted (- / - / RFID)\n
+ *
+ * @param[out] user_id The User ID who performed the event
+ * @param[out] pin The PIN that is assoicated with the User ID who performed the event
+ * @param[out] The User Status that is associated with the User ID who performed the event
+ * @param[out] local_time The ZigBee LocalTime that indicates when the event is triggered.
+ *             If time is not supported, the field SHALL be populated with default not
+ *             used value 0xFFFFFFFF.
+ * @param[out] data The operation event notification command contains a variable string,
+ *                  which can be used to pass data associated with a particular event.\n
+ *                  Generally this field will be left empty. \n
+ *                  However, manufacturer can choose to use this field to store/display
+ *                  manufacturer-specific information.
+
+ *
+ */
+typedef void (*zb_zcl_doorlock_programming_event_noti)(
+       nwk_addr addr16,
+       unsigned char ep,
+       unsigned char programming_event_source,
+       unsigned char programming_event_code,
+       unsigned short user_id,
+       unsigned char pin,
+       unsigned char status,
+       unsigned int local_time,
+       const char *data,
+       void *user_data);
+#endif
+
+/* Table 10.10 Commands Received by the Server Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Lock Door                            |     M      |
+ * |             0x01               | Unlock Door                          |     M      |
+ * |             0x02               | Toogle                               |     O      |
+ * |             0x03               | Unlock with Timeout                  |     O      |
+ * |             0x04               | Get Log Record                       |     O      |
+ * |             0x05               | Set PIN Code                         |     O      |
+ * |             0x06               | Get PIN Code                         |     O      |
+ * |             0x07               | Clear PIN Code                       |     O      |
+ * |             0x09               | Set User Status                      |     O      |
+ * |             0x0a               | Get User Status                      |     O      |
+ * |             0x0b               | Set Week Day Schedule                |     O      |
+ * |             0x0c               | Get Week Day Schedule                |     O      |
+ * |             0x0d               | Clear Week Day Schedule              |     O      |
+ * |             0x0e               | Set Year Day Schedule                |     O      |
+ * |             0x0f               | Get Year Day Schedule                |     O      |
+ * |             0x10               | Clear Year Day Schedule              |     O      |
+ * |             0x11               | Set Holiday Schedule                 |     O      |
+ * |             0x12               | Get Holiday Schedule                 |     O      |
+ * |             0x13               | Clear Holiday Schedule               |     O      |
+ * |             0x14               | Set User Type                        |     O      |
+ * |             0x15               | Get User Type                        |     O      |
+ * |             0x16               | Set RFID Code                        |     O      |
+ * |             0x17               | Get RFID Code                        |     O      |
+ * |             0x18               | Clear RFID Code                      |     O      |
+ * |             0x19               | Clear All RFID Codes                 |     O      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Description for lock door command
+ * @details This command causes the lock device to lock the door. As of HA 1.2, this
+ * command includes an optional code for the lock. The door lock MAY require a
+ * PIN depending on the value of the [Require PIN for RF Operation attribute]
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] pin_or_rfid_code PIN/RFID code
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_lock(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        const char *pin_or_rfid_code,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for unlock door command
+ * @details This command causes the lock device to unlock the door. As of HA 1.2, this
+ * command includes an optional code for the lock. The door lock MAY require a
+ * code depending on the value of the [Require PIN for RF Operation attribute].\n\n
+ * Note: If the attribute AutoRelockTime is supported the lock will close when the
+ * auto relock time has expired.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] pin_or_rfid_code PIN/RFID code
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_unlock(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        const char *pin_or_rfid_code,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for toggle command
+ * @details Request the status of the lock. As of HA 1.2, this command includes an optional
+ * code for the lock. The door lock MAY require a code depending on the value of
+ * the [Require PIN for RF Operation attribute].
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] pin_or_rfid_code PIN/RFID code
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_toggle(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        const char *pin_or_rfid_code,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for unlock with timeout command
+ * @details This command causes the lock device to unlock the door with a timeout
+ * parameter. After the time in seconds specified in the timeout field, the lock device
+ * will relock itself automatically. This timeout parameter is only temporary for this
+ * message transition only and overrides the default relock time as specified in the
+ * [Auto Relock Time attribute] attribute. If the door lock device is not capable of or
+ * does not want to support temporary Relock Timeout, it SHOULD not support this
+ * optional command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] timeout Timeout in seconds
+ * @param[in] pin_or_rfid_code PIN/RFID code
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_unlock_with_timeout(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short timeout,
+        const char *pin_or_rfid_code,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for get log record command
+ * @details Request a log record. Log number is between 1 ? [Number of Log Records
+ * Supported attribute]. If log number 0 is requested then the most recent log entry is
+ * returned.\n
+ * Log record format: The log record format is defined in the description of the
+ * GetLogRecordResponse command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] log_index index in log repository
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_get_log_record(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short log_index,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for set PIN code command
+ * @details Set a PIN into the lock\n\n
+ * User ID is between 0 - [# of PIN Users Supported attribute]. Only the values 1
+ * (Occupied/Enabled) and 3 (Occupied/Disabled) are allowed for User Status.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id Requested user ID
+ * @param[in] user_status Used to indicate what the status is for a specific user ID.\n
+ *                         1 - Occupied / Enabled\n
+ *                         3 - Occupied / Disable\n
+ * @param[in] user_type Used to indicate what the type is for a specific user ID.\n
+ *                       0 - Unrestricted User (default)\n
+ *                       1 - Year Day Schedule User\n
+ *                       2 - Week Day Schedule User\n
+ *                       3 - Master User\n
+ *                       4 - Non Access User\n
+ *                       0xff - Not supported\n
+ * Cf) User Type
+ * - Unrestricted User\n
+ * User has access 24/7 provided proper PIN is supplied (e.g., owner). Unrestricted
+ * user type is the default user type.
+ * - Year Day Schedule User\n
+ * User has ability to open lock within a specific time period (e.g., guest).
+ * - Week Day Schedule User\n
+ * User has ability to open lock based on specific time period within a reoccurring
+ * weekly schedule (e.g., cleaning worker).
+ * - Master User\n
+ * User has ability to both program and operate the door lock. This user can manage
+ * the users and user schedules. In all other respects this user matches the
+ * unrestricted (default) user. Master user is the only user that can disable the user
+ * interface (keypad, RF, etc...).
+ * - Non Access User\n
+ * User is recognized by the lock but does not have the ability to open the lock. This
+ * user will only cause the lock to generate the appropriate event notification to any
+ * bound devices.
+ * @param[in] pin PIN code string
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_set_pin_code(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        unsigned char user_status,
+        unsigned char user_type,
+        const char *pin,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for get PIN code command
+ * @details Retrieve a PIN Code. User ID is between 0 - [# of PIN Users Supported attribute].
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id Requested user ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_get_pin_code_rsp()
+ */
+int zb_zcl_doorlock_get_pin_code(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        zb_zcl_doorlock_get_pin_code_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for clear PIN code command
+ * @details Delete a PIN. User ID is between 0 - [# of PIN Users Supported attribute].\n\n
+ * Note: If you delete a PIN Code and this user didn't have a RFID Code, the user
+ * status is set to "0 Available", the user type is set to the default value and all
+ * schedules are also set to the default values.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id Requested user ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_clear_pin_code(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for clear all PIN code command
+ * @details Clear out all PINs on the lock.\n\n
+ * Note: On the server, the clear all PIN codes command should have the same effect
+ * as the Clear PIN Code command with respect to the setting of user status, user
+ * type and schedules.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_clear_all_pin_code(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for set user status command
+ * @details Set the status of a user ID. User Status value of 0x00 is not allowed.
+ * In order to clear a user id, the Clear ID Command SHALL be used. For user status value
+ * please refer to User Status Value.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id Requested user ID
+ * @param[in] user_status Used to indicate what the status is for a specific user ID.
+ *                         0 - Available\n
+ *                         1 - Occupied / Enabled\n
+ *                         2 - Reserved\n
+ *                         3 - Occupied / Disable\n
+ *                         0xff - Not supported\n
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_set_user_status(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        unsigned char user_status,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for set week day command
+ * @details Set a weekly repeating schedule for a specified user.\n
+ * When the Server Device receives the command, the Server Device MAY change
+ * the user type to the specific schedule user type.\n
+ * Process for Creating a New User with Schedule at the beginning of this cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] schedule_id number is between 0-[# of Week Day Schedules Per User attribute].
+ * @param[in] user_id is between 0 - [# of Total Users Supported attribute].
+ * @param[in] days_mask bitmask of the effective days in the order XSFTWTMS.\n\n
+ *                      Bit 0 : Sun\n
+ *                      Bit 1 : Mon\n
+ *                      Bit 2 : Tue\n
+ *                      Bit 3 : Wed\n
+ *                      Bit 4 : Thur\n
+ *                      Bit 5 : Fri\n
+ *                      Bit 6 : Sat\n
+ *                      Bit 7 : Reserved\n\n
+ * Days mask is listed as bitmask for flexibility to set same schedule across multiple
+ * days. For the door lock that does not support setting schedule across multiple days
+ * within one command, it SHOULD respond with ZCL INVALID_FIELD (0x85)
+ * status when received the set schedule command days bitmask field has multiple
+ * days selected.
+ * @param[in] start_hour in decimal format represented by 0x00-0x17 (00 to 23 hours).
+ * @param[in] start_minute in decimal format represented by 0x00-0x3B (00 to 59 mins).
+ * @param[in] end_hour in decimal format represented by 0x00-0x17 (00 to 23 hours).\n
+ *                     End Hour SHALL be equal or greater than Start Hour.
+ * @param[in] end_minute in decimal format represented by 0x00-0x3B (00 to 59 mins).
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_set_week_day_schedule(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned char schedule_id,
+        unsigned short user_id,
+        unsigned char days_mask,
+        unsigned char start_hour,
+        unsigned char start_minute,
+        unsigned char end_hour,
+        unsigned char end_minute,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for get week day schedule command
+ * @details Retrieve the specific weekly schedule for the specific user.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] schedule_id Requested schedule ID
+ * @param[in] user_id Requested user ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_get_week_day_schedule_rsp()
+ */
+int zb_zcl_doorlock_get_week_day_schedule(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned char schedule_id,
+        unsigned short user_id,
+        zb_zcl_doorlock_get_week_day_schedule_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for set year day command
+ * @details Set a time-specific schedule ID for a specified user.
+ * When the Server Device receives the command, the Server Device MAY change
+ * the user type to the specific schedule user type.
+ * Process for Creating a New User with Schedule at the beginning of this cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] schedule_id number is between 0-[# of Week Day Schedules Per User attribute].
+ * @param[in] user_id is between 0 - [# of Total Users Supported attribute].
+ * @param[in] zigbee_local_start_time Start time and end time are given in ZigBee LocalTime.
+ * @param[in] zigbee_local_end_time Start time and end time are given in ZigBee LocalTime.
+ *                                  End time must be greater than the start time
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_set_year_day_schedule(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned char schedule_id,
+        unsigned short user_id,
+        unsigned int zigbee_local_start_time,
+        unsigned int zigbee_local_end_time,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for get year day schedule command
+ * @details Retrieve the specific year schedule for the specific user.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] schedule_id Requested schedule ID
+ * @param[in] user_id Requested user ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_get_year_day_schedule_rsp()
+ */
+int zb_zcl_doorlock_get_year_day_schedule(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned char schedule_id,
+        unsigned short user_id,
+        zb_zcl_doorlock_get_year_day_schedule_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for set holiday schedule command
+ * @details Set the holiday Schedule by specifying ZigBee local start time and ZigBee
+ * local end time with respect to any Lock Operating Mode.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] holiday_schedule_id number is between 0-[# of Holiday Schedules Supported attribute].
+ * @param[in] zigbee_local_start_time Start time and end time are given in ZigBee LocalTime.
+ * @param[in] zigbee_local_end_time Start time and end time are given in ZigBee LocalTime.
+ *                                  End time must be greater than the start time
+ * @param[in] operating_mode_during_holiday is valid enumeration value as listed in operating mode attribute\n
+ *                                          Bit0 - Normal Mode Supported\n
+ *                                          Bit1 - Vacation Mode Supported\n
+ *                                          Bit2 - Privacy Mode Supported\n
+ *                                          Bit3 - No RF Lock or Unlock Mode Mode Supported\n
+ *                                          Bit4 - Passage Mode Supported\n
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_set_holiday_schedule(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned char holiday_schedule_id,
+        unsigned int zigbee_local_start_time,
+        unsigned int zigbee_local_end_time,
+        unsigned char operating_mode_during_holiday,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for get holiday schedule command
+ * @details Get the holiday Schedule by specifying Holiday ID.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] holiday_schedule_id Requested holiday schedule ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_door_lock_get_holiday_schedule_rsp()
+ */
+int zb_zcl_doorlock_get_holiday_schedule(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned char holiday_schedule_id,
+        zb_zcl_doorlock_get_holiday_schedule_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for clear holiday schedule command
+ * @details Clear the holiday Schedule by specifying Holiday ID.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] holiday_schedule_id Requested holiday schedule ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_clear_holiday_schedule(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned char holiday_schedule_id,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for set user type command
+ * @details Set the type byte for a specified user. \n
+ * For user type value please refer to User Type Value.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id Targget user ID
+ * @param[in] user_type Used to indicate what the type is for a specific user ID.\n
+ *                       0 - Unrestricted User (default)\n
+ *                       1 - Year Day Schedule User\n
+ *                       2 - Week Day Schedule User\n
+ *                       3 - Master User\n
+ *                       4 - Non Access User\n
+ *                       0xff - Not supported\n
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_set_user_type(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        unsigned char user_type,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for get user type command
+ * @details Retrieve the type byte for a specific user.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id Requested user ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_door_lock_get_user_type_rsp()
+ */
+int zb_zcl_doorlock_get_user_type(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        zb_zcl_doorlock_get_user_type_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for set RFID code command
+ * @details Retrieve an ID. User ID is between 0 - [# of RFID Users Supported attribute].
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id is between 0 - [# of RFID Users Supported attribute]
+ * @param[in] user_status Used to indicate what the status is for a specific user ID.
+ *                         1 - Occupied / Enabled\n
+ *                         3 - Occupied / Disable\n
+ * @param[in] user_type Used to indicate what the type is for a specific user ID.\n
+ *                       0 - Unrestricted User (default)\n
+ *                       1 - Year Day Schedule User\n
+ *                       2 - Week Day Schedule User\n
+ *                       3 - Master User\n
+ *                       4 - Non Access User\n
+ *                       0xff - Not supported\n
+ * @param[in] rfid_code RFID code string
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_set_rfid_code(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        unsigned char user_status,
+        unsigned char user_type,
+        const char *rfid_code,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+
+/**
+ * @brief Description for get RFID code command
+ * @details Retrieve an ID. User ID is between 0 - [# of RFID Users Supported attribute].
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id Requested user ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_door_lock_get_rfid_code_rsp()
+ */
+int zb_zcl_doorlock_get_rfid_code(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        zb_zcl_doorlock_get_rfid_code_rsp cb,
+        void *user_data);
+
+
+/**
+ * @brief Description for clear RFID code command
+ * @details Delete an ID. User ID is between 0 - [# of RFID Users Supported attribute]. If you
+ * delete a RFID code and this user didn't have a PIN code, the user status has to be
+ * set to "0 Available", the user type has to be set to the default value, and all
+ * schedules which are supported have to be set to the default values.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] user_id Requested user ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_clear_rfid_code(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        unsigned short user_id,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Description for clear all RFID code command
+ * @details Clear out all RFIDs on the lock. If you delete all RFID codes and this user didn't
+ * have a PIN code, the user status has to be set to "0 Available", the user type has to
+ * be set to the default value, and all schedules which are supported have to be set to
+ * the default values.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] cb Response callback
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_doorlock_rsp()
+ */
+int zb_zcl_doorlock_clear_all_rfid_code(
+               zigbee_h handle,
+               nwk_addr addr16,
+        unsigned char ep,
+        zb_zcl_doorlock_rsp cb,
+        void *user_data);
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_DOOR_LOCK_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-global-commands.h b/include/zcl/zb-zcl-global-commands.h
new file mode 100644 (file)
index 0000000..be27217
--- /dev/null
@@ -0,0 +1,794 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_GLOBAL_COMMAND_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_GLOBAL_COMMAND_H__
+
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-global-commands.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_GLOBAL_COMMAND_MODULE Global Commands
+ *
+ * @brief zigbee global commands description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_GLOBAL_COMMAND_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/**
+ * @brief Global response callback
+ * @details This function is used for global response corresponding.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 source network address
+ * @param[out] ep where is sent from (ex. 1)
+ * @param[out] cluster_id ZCL cluster id
+ * @param[out] records Response record
+ * @param[out] records_len Length of attribute status record
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_global_read_attr()
+ * @see zb_zcl_global_write_attr()
+ * @see zb_zcl_global_write_attr_undivided()
+ * @see zb_zcl_global_config_report()
+ * @see zb_zcl_global_read_config_report()
+ * @see zb_zcl_global_read_attr_structured()
+ * @see zb_zcl_global_write_attr_structured()
+ */
+typedef void (*zb_zcl_global_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short cluster_id,
+               zb_global_record_data_s *records,
+               int records_len,
+               void *user_data);
+
+/**
+ * @brief Read Attributes
+ * @details This function to read attributes in devices.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] attribute_ids Attributes_ids-list
+ * @param[in] attribute_ids_len Length of attribte_ids-list
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @post This function invokes zb_zcl_global_rsp() for each application context.
+ *
+ * @see zb_zcl_global_rsp()
+ */
+int zb_zcl_global_read_attr(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               unsigned short *attribute_ids,
+               int attribute_ids_len,
+               zb_zcl_global_rsp cb,
+               void *user_data);
+
+/**
+ * @brief write Attributes
+ * @details This function to write attributes to other devices.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] records structure for write_attribute_record_s
+ * @param[in] records_len Length of attribte_ids-list
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_rsp()
+ */
+int zb_zcl_global_write_attr(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               write_attr_record_h *records,
+               int records_len,
+               zb_zcl_global_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for write attributes undivided
+ * @details This function to write attributes without fragmentation to other devices.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] records structure for write_attribute_record_s
+ * @param[in] records_len Length of attribte_ids-list
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_rsp()
+ */
+int zb_zcl_global_write_attr_undivided(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               write_attr_record_h *records,
+               int records_len,
+               zb_zcl_global_rsp cb,
+               void *user_data);
+
+/**
+ * @brief write Attributes
+ * @details This function to write attributes to other devices without any response.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] records structure for write_attribute_record_s
+ * @param[in] records_len Length of attribte_ids-list
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_global_write_attr_no_rsp(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               write_attr_record_h *records,
+               int records_len);
+
+/**
+ * @brief Command description for setting configure reporting
+ * @details This function to set configuration about attribute status changing reporting.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] records structure for report_config_records
+ * @param[in] records_len Length of report_config_records structure
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_rsp()
+ */
+int zb_zcl_global_config_report(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               report_config_record_h *records,
+               int records_len,
+               zb_zcl_global_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for reading configure reporting
+ * @details This function to read configuration about attribute status changing reporting.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] records structure for report_config_records
+ * @param[in] records_len Length of report_config_records structure
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_rsp()
+ */
+int zb_zcl_global_read_config_report(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               read_report_config_record_h *records,
+               int records_len,
+               zb_zcl_global_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Discover attribute callback
+ * @details The discover attributes response command is generated in response to a discover
+ * attributes command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 source network address
+ * @param[out] ep where is sent from (ex. 1)
+ * @param[out] cluster_id ZCL cluster id
+ * @param[out] records Discover attribute information record
+ * @param[out] records_len Length of Discover attribute information record
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_global_discover_attr()
+ */
+typedef void (*zb_zcl_global_discover_attr_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short cluster_id,
+               unsigned char discovery_complete,
+               discover_attr_info_record_h *records,
+               int records_len,
+               void *user_data);
+
+/**
+ * @brief Command description for discovering attributes
+ * @details The discover attributes command is generated when a remote device wishes to
+ * discover the identifiers and types of the attributes on a device which are supported
+ * within the cluster to which this command is directed.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] start_id The value of the identifier at which to begin the attribute discovery.
+ * @param[in] max_attribute_ids The maximum number of attribute identifiers
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_rsp()
+ */
+int zb_zcl_global_discover_attr(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               unsigned short start_id,
+               unsigned char max_attribute_ids,
+               zb_zcl_global_discover_attr_rsp cb,
+               void *user_data);
+
+/**
+ * @brief The read attributes structured command frame shall be formatted
+ * details The read attributes command is generated when a device wishes to determine the
+ * values of one or more attributes, or elements of attributes, located on another
+ * device. Each attribute identifier field shall contain the identifier of the attribute
+ * to be read.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] records The combination of attribute identifier and selector .
+ * @param[in] records_len The maximum number of read_structured_attribute_record
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_rsp()
+ */
+int zb_zcl_global_read_attr_structured(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               read_structured_attr_record_h *records,
+               int records_len,
+               zb_zcl_global_rsp cb,
+               void *user_data);
+
+/**
+ * @brief The write attributes structured command frame shall be formatted
+ * @details When writing an element to an array or structure, the Indicator subfield indicates
+ * the number of index fields that follow it. This number is limited to the range 0 - 15
+ * (i.e. the upper 4 bits of the Indicator field are set to zero). It may be further limited
+ * by any relevant profile or application.
+ * If the Indicator subfield is 0, there are no index fields, and the whole of the
+ * attribute value is to be written.
+ * If this subfield is 1 or greater, the index fields indicate which element is to be
+ * written, nested to a depth of m. For example, if the attribute is an array of arrays
+ * (or structures), then if m = 2, index 1 = 5 and index 2 = 3, the third element of the
+ * fifth element of the attribute will be written.
+ * Note that elements are numbered from 1 upwards for both arrays and structures.
+ * The zeroth element of an array or structure has type 16 bit unsigned integer, and
+ * holds the number of elements in the array or structure. The zeroth element of an
+ * array may optionally be written (this is application dependent) and has the effect
+ * of changing the number of elements of the array. If the number is reduced, the
+ * array is truncated. If the number is increased, the content of new elements is
+ * application dependent.
+ * The zeroth element of a structure may not be written to. Writing to an element
+ * with an index greater than the number of elements in an array or structure is
+ * always an error.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] records The combination of attribute identifier and selector .
+ * @param[in] records_len The maximum number of write_structured_attribute_record
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see zb_zcl_global_rsp()
+ */
+int zb_zcl_global_write_attr_structured(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               write_attr_structured_record_h *records,
+               int records_len,
+               zb_zcl_global_rsp cb,
+               void *user_data);
+
+/**
+ * @brief The response of zb_zcl_global_discover_commands_received() and
+ *        zb_zcl_global_discover_cmds_generated()
+ * @details The ZCL provides the facility to discover the commands that a cluster
+ * instance on a remote device can receive and generate. This is useful since an
+ * individual cluster instance may not be able to receive or generate all of the commands
+ * that are theoretically supported by the cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 source network address
+ * @param[out] ep where is sent from (ex. 1)
+ * @param[out] cluster_id ZCL cluster id
+ * @param[out] discovery_complete which indicates whether the Command Discovery is
+ *             complete, i.e. whether there are any commands remaining to be discovered:\n
+ *             - TRUE - all commands have been discovered\n
+ *             - FALSE - there are further commands to be discovered\n
+ * @param[out] command_ids Discovered commands list
+ * @param[out] command_ids_len The number of discovered commands reported in this response
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_global_discover_cmd_received()
+ */
+typedef void (*zb_zcl_global_discover_cmds_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short cluster_id,
+               unsigned char discovery_complete,
+               unsigned char *command_ids,
+               int command_ids_len,
+               void *user_data);
+
+/**
+ * @brief This function to know remote cluster on remote device can handle specific commands
+ * @details The ZCL provides the facility to discover the commands that a cluster
+ * instance on a remote device can receive and generate. This is useful since an
+ * individual cluster instance may not be able to receive or generate all of the commands
+ *  that are theoretically supported by the cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] start_command_id Start command id .
+ * @param[in] max_command_ids Last command id
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_discover_cmd_received_rsp()
+ */
+int zb_zcl_global_discover_cmds_received(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+           unsigned char start_command_id,
+           unsigned char max_command_ids,
+           zb_zcl_global_discover_cmds_rsp cb,
+           void *user_data);
+
+/**
+ * @brief This function to know remote cluster on remote device can generate specific commands
+ * @details The ZCL provides the facility to discover the commands that a cluster
+ * instance on a remote device can receive and generate. This is useful since an
+ * individual cluster instance may not be able to receive or generate all of the commands
+ *  that are theoretically supported by the cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] start_command_id Start command id .
+ * @param[in] max_command_ids Last command id
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_discover_cmds_rsp()
+ */
+int zb_zcl_global_discover_cmds_generated(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               unsigned char start_command_id,
+               unsigned char max_command_ids,
+               zb_zcl_global_discover_cmds_rsp cb,
+               void *user_data);
+
+/**
+ * @brief The response of zb_zcl_global_discover_attr_extended()
+ * @details The ZCL provides the facility to discover the commands that a cluster
+ * instance on a remote device can receive and generate. This is useful since an
+ * individual cluster instance may not be able to receive or generate all of the commands
+ *  that are theoretically supported by the cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 source network address
+ * @param[out] ep where is sent from (ex. 1)
+ * @param[out] cluster_id ZCL cluster id
+ * @param[out] discovery_complete which indicates whether the Command Discovery is
+ *             complete, i.e. whether there are any commands remaining to be discovered:\n
+ *             - TRUE - all commands have been discovered\n
+ *             - FALSE - there are further commands to be discovered\n
+ * @param[out] records Discovered attribute information list
+ * @param[out] records_len Len The number of discovered information\n
+ *                             reported in this response
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_global_discover_attr_extended()
+ */
+typedef void (*zb_zcl_global_discover_attr_extended_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short cluster_id,
+               unsigned char discovery_complete,
+               extended_attr_info_h *records,
+               unsigned short records_len,
+               void *user_data);
+
+/**
+ * @brief This function to know remote cluster on remote device has extended commands
+ * @details The ZCL provides the facility to discover the commands that a cluster
+ * instance on a remote device can receive and generate. This is useful since an
+ * individual cluster instance may not be able to receive or generate all of the commands
+ *  that are theoretically supported by the cluster.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 target network address
+ * @param[in] src_ep source end-point (ex. 1)
+ * @param[in] dst_ep destination end-point (ex. 1)
+ * @param[in] zcl_frame_ctl frame control bits (default 0x00). \n
+ *            Only OR operation is allowed in ZCL header \n
+ *            - Frame Type : \n
+ *            #ZB_ZCL_FC_GLOBALLY_USED (default) \n
+ *            #ZB_APS_FC_CLUSTER_SPECIFIC \n
+ *            - Manufacturer Specific : \n
+ *            - Direction : \n
+ *            #ZB_ZCL_CLIENT_TO_SERVER (default) \n
+ *            #ZB_ZCL_SERVER_TO_CLIENT \n
+ *            - Disable Default Response : \n
+ *            #ZB_ZCL_LEAVE_WELL_ALONE (default) \n
+ *            #ZB_ZCL_DISABLE_DEFAULT_RESPONSE \n
+ * @param[in] cluster_id ZCL cluster id
+ * @param[in] start_id Start id .
+ * @param[in] max_attribute_ids Last command id
+ * @param[in] cb Response callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_discover_attr_extended_rsp()
+ */
+int zb_zcl_global_discover_attr_extended(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned char dst_ep,
+               unsigned char zcl_frame_ctl,
+               unsigned short cluster_id,
+               unsigned short start_id,
+               unsigned char max_attribute_ids,
+               zb_zcl_global_discover_attr_extended_rsp cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_GLOBAL_COMMAND_H__ */
diff --git a/include/zcl/zb-zcl-groups-cluster.h b/include/zcl/zb-zcl-groups-cluster.h
new file mode 100644 (file)
index 0000000..148ce0e
--- /dev/null
@@ -0,0 +1,363 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_GROUPS_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_GROUPS_CLUSTER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-groups-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_GROUP_CLUSTER_MODULE Group Cluster
+ *
+ * @brief zigbee group cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_GROUP_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 3.33 Generated Command IDs for the Groups Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Add group response                   |     M      |
+ * |             0x01               | View group response                  |     M      |
+ * |             0x02               | Get group membership response        |     M      |
+ * |             0x03               | Remove group response                |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for add group response
+ * @details The add group response is sent by the groups cluster server in response to an\n
+ *  add group command.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_DUPLICATE_EXISTS \n
+ *             #ZB_ZCL_INSUFFICIENT_SPACE
+ * @param[out] group_id Group id
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_add_group()
+ */
+typedef void (*zb_zcl_group_add_group_rsp)(
+        nwk_addr addr16,
+        unsigned char ep,
+        unsigned char status,
+        unsigned short group_id,
+        void *user_data);
+
+/**
+ * @brief Command description for view group response
+ * @details The view group response command is sent by the groups cluster server in\n
+ * response to a view group command.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_NOT_FOUND
+ * @param[out] group_id Group id
+ * @param[out] group_name Group name
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_view_group()
+ */
+typedef void (*zb_zcl_group_view_group_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char status,
+               unsigned short group_id,
+               const char *group_name,
+               void *user_data);
+
+/**
+ * @brief Command description for view group membership response
+ * @details The get group membership response command is sent by the groups cluster server\n
+ * in response to a get group membership command.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] capacity How many we can add to this group
+ * @param[out] group_count The number of groups contained in the group_list
+ * @param[out] group_list the identifiers either of all the groups in the group table
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_view_group_membership()
+ */
+ typedef void (*zb_zcl_group_get_group_membership_rsp)(
+        nwk_addr addr16,
+        unsigned char ep,
+        unsigned char capacity,
+        unsigned char group_count,
+        unsigned short *group_list,
+        void *user_data);
+
+/**
+ * @brief Command description for remove group response
+ * @details The add group response is sent by the groups cluster server in response to an\n
+ *  remove group command.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_NOT_FOUND
+ * @param[out] group_id Group id
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_add_group()
+ */
+typedef void (*zb_zcl_group_remove_group_rsp)(
+        nwk_addr addr16,
+        unsigned char ep,
+        unsigned char status,
+        unsigned short group_id,
+        void *user_data);
+
+/* Table 3.32 Received Command IDs for the Groups Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Add group                            |     M      |
+ * |             0x01               | View group                           |     M      |
+ * |             0x02               | Get group membership                 |     M      |
+ * |             0x03               | Remove group                         |     M      |
+ * |             0x04               | Remove all group                     |     M      |
+ * |             0x05               | Add group if identifying             |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for add groups
+ * @details The add group command allows the sending device to add group membership in a\n
+ * particular group for one or more endpoints on the receiving device.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Target endpoint
+ * @param[in] group_id Group ID
+ * @param[in] group_name Group name
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_group_add_group_rsp()
+ */
+int zb_zcl_group_add_group(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short group_id,
+               const char *group_name,
+               zb_zcl_group_add_group_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for view group command
+ * @details The view group command allows the sending device to request that the receiving\n
+ * entity or entities respond with a view group response command containing the\n
+ * application name string for a particular group.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Target endpoint
+ * @param[in] group_id Group ID
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_group_view_group_rsp()
+ */
+int zb_zcl_group_view_group(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+        unsigned short group_id,
+        zb_zcl_group_view_group_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Command description for get group membership
+ * @details The get group membership command allows the sending device to inquire about\n
+ * the group membership of the receiving device and endpoint in a number of ways.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Target endpoint
+ * @param[in] group_count Group count
+ * @param[in] group_list Group list
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_group_get_group_membership_rsp()
+ */
+int zb_zcl_group_get_group_membership(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+        unsigned char group_count,
+        unsigned short *group_list,
+        zb_zcl_group_get_group_membership_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Command description for remove group
+ * @details The remove group command allows the sender to request that the receiving entity\n
+ * or entities remove their membership, if any, in a particular group.\n
+ * Note that if a group is removed the scenes associated with that group should be\n
+ * removed.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Target endpoint
+ * @param[in] group_id Group ID
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_group_remove_group_rsp()
+ */
+int zb_zcl_group_remove_group(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+        unsigned short group_id,
+        zb_zcl_group_remove_group_rsp cb,
+        void *user_data);
+
+/**
+ * @brief Command description for remove group
+ * @details The remove all groups command allows the sending device to direct the receiving\n
+ * entity or entities to remove all group associations.\n
+ * \n
+ * Note that removing all groups necessitates the removal of all associated scenes as\n
+ * well. (Note: scenes not associated with a group need not be removed).\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Target endpoint
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_group_remove_all_group(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep);
+
+/**
+ * @brief Command description for remove group if identifying
+ * @details The add group if identifying command allows the sending device to add group\n
+ * membership in a particular group for one or more endpoints on the receiving\n
+ * device, on condition that it is identifying itself. Identifying functionality is\n
+ * controlled using the identify cluster.\n
+ * This command might be used to assist configuring group membership in the\n
+ * absence of a commissioning tool.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Target endpoint
+ * @param[in] group_id Group ID
+ * @param[in] group_name Group name
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_group_add_group_if_identifying(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+        unsigned short group_id,
+        const char *group_name);
+
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_ON_OFF_CLUSTER_H__ */
+
diff --git a/include/zcl/zb-zcl-ias-zone-cluster.h b/include/zcl/zb-zcl-ias-zone-cluster.h
new file mode 100644 (file)
index 0000000..f26e1cf
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_IAS_ZONE_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_IAS_ZONE_CLUSTER_H__
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-ias-zone-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_IAS_ZONE_CLUSTER_MODULE IAS zone Cluster
+ *
+ * @brief zigbee IAS zone cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_IAS_ZONE_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 8.10 Generated Command IDs for the IAS Zone Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Zone Status Change Notification      |     M      |
+ * |             0x01               | Zone Enroll Request                  |     M      |
+ * |             0x11               | Zone Status Change Notification (Ext)|     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+
+/* Table 8.8 Received Command IDs for the IAS Zone Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Zone Enroll Respnse                  |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Table 8.9 Values of the Enroll Response Code
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_IAS_ZONE_ENROLL_SUCCESS = 0x00, /**< Success */
+       ZB_ZCL_IAS_ZONE_ENROLL_NOT_SUPPORT = 0x01, /**< This specific Zone type is not known
+                                                    to the CIE and is not supported */
+       ZB_ZCL_IAS_ZONE_ENROLL_NO_ENROLL_PERMIT = 0x02, /**< CIE does not permit new zones to
+                                                         enroll at this time. */
+       ZB_ZCL_IAS_ZONE_ENROLL_TOO_MANY_ZONE = 0x03, /**< CIE reached its limit of number of
+                                                      enrolled zones */
+} zb_ias_zone_enroll_response_e;
+
+/**
+ * @brief Command description for zone enroll response
+ * @details On receipt, the device embodying the Zone server is notified that it is now
+ * enrolled as an active alarm device\n
+ * The device embodying the Zone server must authenticate received messages by
+ * checking the address of their sender against IAS_CIE_Address. This is to ensure
+ * that only messages from the correct CIE are accepted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] enroll_response_code #ZB_ZCL_IAS_ZONE_ENROLL_SUCCESS
+ *                                 #ZB_ZCL_IAS_ZONE_ENROLL_NOT_SUPPORT
+ *                                 #ZB_ZCL_IAS_ZONE_ENROLL_NO_ENROLL_PERMIT
+ *                                 #ZB_ZCL_IAS_ZONE_ENROLL_TOO_MANY_ZONE
+ * @param[in] zone_id The Zone ID field is the index into the zone table of the CIE. This
+ *                    field is only relevant if the response code is success.\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_zone_enroll_response(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char enroll_response_code,
+               unsigned char zone_id);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_IAS_ZONE_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-identify-cluster.h b/include/zcl/zb-zcl-identify-cluster.h
new file mode 100644 (file)
index 0000000..6290f8e
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_IDENTIFY_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_IDENTIFY_CLUSTER_H__
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-identify-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_IDENTITY_CLUSTER_MODULE Identity Cluster
+ *
+ * @brief zigbee identity cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_IDENTITY_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/**
+ * @brief Make devices as Identify mode within specific time
+ * @details The identify command starts or stops the receiving device identifying itself.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep endpoint number
+ * @param[in] identify_time Identify time
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_identify(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short identify_time);
+
+/**
+ * @brief Identify query response from devices keep identifying mode
+ * @details The identify query command allows the sending device to request the target or
+ * targets to respond if they are currently identifying themselves.\n
+ * This command has no payload.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] identify_time Identify time
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_identify_query()
+ */
+typedef void (*zb_zcl_identify_query_cb)(
+               nwk_addr addr16,
+               unsigned short identify_time,
+               void *user_data);
+
+/**
+ * @brief Find devices which sustains identify mode
+ * @details The identify query command allows the sending device to request the target or
+ * targets to respond if they are currently identifying themselves.\n
+ * This command has no payload.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep endpoint number
+ * @param[in] cb response callback function
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_global_write_attr_rsp()
+ */
+int zb_zcl_identify_query(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               zb_zcl_identify_query_cb cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_IDENTIFY_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-level-control-cluster.h b/include/zcl/zb-zcl-level-control-cluster.h
new file mode 100644 (file)
index 0000000..0d45101
--- /dev/null
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_LEVEL_CONTROL_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_LEVEL_CONTROL_CLUSTER_H__
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-on-off-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_LEVEL_CONTROL_CLUSTER_MODULE Level Control Cluster
+ *
+ * @brief zigbee level control cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_LEVEL_CONTROL_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 3.48 Command IDs for the Level Control Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Move to Level                        |     M      |
+ * |             0x01               | Move                                 |     M      |
+ * |             0x02               | Step                                 |     M      |
+ * |             0x03               | Stop                                 |     M      |
+ * |             0x04               | Move to Level (with On/Off)          |     M      |
+ * |             0x05               | Move (with On/Off)                   |     M      |
+ * |             0x06               | Step (with On/Off)                   |     M      |
+ * |             0x07               | Stop                                 |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command for move to level
+ * @details On receipt of this command, a device shall move from its current level to the
+ * value given in the Level field. The meaning of 'level' is device dependent ? e.g.
+ * for a light it may mean brightness level.\n\n
+ * The movement shall be as continuous as technically practical, i.e. not a step
+ * function, and the time taken to move to the new level shall be equal to the value of
+ * the Transition time field, in tenths of a second, or as close to this as the device is
+ * able.\n\n
+ * If the Transition time field takes the value 0xffff then the time taken to move to
+ * the new level shall instead be determined by the OnOffTransitionTime attribute. If
+ * OnOffTransitionTime , which is an optional attribute, is not present, the device
+ * shall move to its new level as fast as it is able.\n\n
+ * If the device is not able to move at a variable rate, the Transition time field may be
+ * disregarded.\n\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] level Brightness level
+ * @param[in] transition_time The Transition time field, in tenths of a second, \n
+ *                            or as close to this as the device is able
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_levelctrl_move_to_level(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char level,
+               unsigned short transition_time);
+
+/**
+ * @brief Command for move
+ * @details On receipt of this command, a device shall move from its current level in an
+ * up or down direction in a continuous fashion
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] move_mode The Move mode field shall be one of the non-reserved values\n
+ *                      0x00 : Up\n
+ *                      0x01 : Down\n
+ * @param[in] rate The Rate field specifies the rate of movement in units per second. \n
+ *                 The actual rate of movement should be as close to this rate as the device is able.\n
+ *                 If the Rate field is 0xff the device should move as fast as it is able.\n
+ *                 If the device is not able to move at a variable rate, this field may be disregarded.\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_levelctrl_move(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char move_mode,
+               unsigned char rate);
+
+/**
+ * @brief Command for step
+ * @details On receipt of this command, a device shall move from its current level in an
+ * up or down direction in a continuous fashion
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] step_mode The Step mode field shall be one of the non-reserved values\n
+ *                      0x00 : Up\n
+ *                      0x01 : Down\n
+ * @param[in] step_size Step size
+ * @param[in] transition_time The Transition time field specifies the time that shall be taken to perform the step,\n
+ *                            in tenths of a second. A step is a change in the CurrentLevel of 'Step size' units.\n
+ *                            The actual time taken should be as close to this as the device is able. If the\n
+ *                            Transition time field is 0xffff the device should move as fast as it is able.\n
+ *                            If the device is not able to move at a variable rate, the Transition time field may be\n
+ *                            disregarded.\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_levelctrl_step(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char step_mode,
+               unsigned char step_size,
+               unsigned short transition_time);
+
+/**
+ * @brief Command for stop
+ * @details This command has no payload. Upon receipt of this command, any Move to
+ * Level, Move or Step command (and their 'with On/Off' variants) currently in
+ * process shall be terminated. The value of CurrentLevel shall be left at its value
+ * upon receipt of the Stop command, and RemainingTime shall be set to zero.
+ * This command has two entries in Table 3.1, one for the Move to Level, Move and
+ * Set commands, and one for their 'with On/Off' counterparts. This is solely for
+ * symmetry, to allow easy choice of one or other set of commands ? the Stop
+ * commands are identical.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_levelctrl_stop(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep);
+
+/**
+ * @brief Command for move to level with on/off
+ * @details On receipt of this command, a device shall move from its current level to the
+ * value given in the Level field. The meaning of 'level' is device dependent ? e.g.
+ * for a light it may mean brightness level.\n\n
+ * The movement shall be as continuous as technically practical, i.e. not a step
+ * function, and the time taken to move to the new level shall be equal to the value of
+ * the Transition time field, in tenths of a second, or as close to this as the device is
+ * able.\n\n
+ * If the Transition time field takes the value 0xffff then the time taken to move to
+ * the new level shall instead be determined by the OnOffTransitionTime attribute. If
+ * OnOffTransitionTime , which is an optional attribute, is not present, the device
+ * shall move to its new level as fast as it is able.\n\n
+ * If the device is not able to move at a variable rate, the Transition time field may be
+ * disregarded.\n\n
+ * The Move to Level (with On/Off), Move (with On/Off) and Step (with On/Off)
+ * commands have identical payloads to the Move to Level, Move and Step
+ * commands respectively. The also have the same effects, except for the following
+ * additions.
+ * * Before commencing any command that has the effect of increasing
+ * CurrentLevel, the OnOff attribute of the On/Off cluster on the same endpoint, if
+ * implemented, shall be set to On.
+ * * If any command that decreases CurrentLevel reduces it to the minimum level
+ * allowed by the device, the OnOff attribute of the On/Off cluster on the same
+ * endpoint, if implemented, shall be set to Off.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] level Brightness level
+ * @param[in] transition_time The Transition time field, in tenths of a second, \n
+ *                             or as close to this as the device is able
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_levelctrl_move_to_level_with_on_off(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char level,
+               unsigned short transition_time);
+
+/**
+ * @brief Command for move with on/off
+ * @details On receipt of this command, a device shall move from its current level in an
+ * up or down direction in a continuous fashion\n
+ * The Move to Level (with On/Off), Move (with On/Off) and Step (with On/Off)
+ * commands have identical payloads to the Move to Level, Move and Step
+ * commands respectively. The also have the same effects, except for the following
+ * additions.
+ * * Before commencing any command that has the effect of increasing
+ * CurrentLevel, the OnOff attribute of the On/Off cluster on the same endpoint, if
+ * implemented, shall be set to On.
+ * * If any command that decreases CurrentLevel reduces it to the minimum level
+ * allowed by the device, the OnOff attribute of the On/Off cluster on the same
+ * endpoint, if implemented, shall be set to Off.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] move_mode The Move mode field shall be one of the non-reserved values\n
+ *                      0x00 : Up\n
+ *                      0x01 : Down\n
+ * @param[in] rate The Rate field specifies the rate of movement in units per second. \n
+ *  The actual rate of movement should be as close to this rate as the device is able.\n
+ *  If the Rate field is 0xff the device should move as fast as it is able.\n
+ *  If the device is not able to move at a variable rate, this field may be disregarded.\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_levelctrl_move_with_on_off(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char move_mode,
+               unsigned char rate);
+
+/**
+ * @brief Command for step with on/off
+ * @details On receipt of this command, a device shall move from its current level in an
+ * up or down direction in a continuous fashion. \n\n
+ * The Move to Level (with On/Off), Move (with On/Off) and Step (with On/Off)
+ * commands have identical payloads to the Move to Level, Move and Step
+ * commands respectively. The also have the same effects, except for the following
+ * additions. \n\n
+ * * Before commencing any command that has the effect of increasing
+ * CurrentLevel, the OnOff attribute of the On/Off cluster on the same endpoint, if
+ * implemented, shall be set to On. \n\n
+ * * If any command that decreases CurrentLevel reduces it to the minimum level
+ * allowed by the device, the OnOff attribute of the On/Off cluster on the same
+ * endpoint, if implemented, shall be set to Off.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] step_mode The Step mode field shall be one of the non-reserved values\n
+ *                      0x00 : Up\n
+ *                      0x01 : Down\n
+ * @param[in] step_size Step size
+ * @param[in] transition_time The Transition time field specifies the time that shall be
+ *  taken to perform the step, in tenths of a second. A step is a change in the
+ *  CurrentLevel of 'Step size' units.\n\n
+ *  The actual time taken should be as close to this as the device is able. If the
+ *  Transition time field is 0xffff the device should move as fast as it is able. \n\n
+ *  If the device is not able to move at a variable rate, the Transition time field may be
+ *  disregarded.\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_levelctrl_step_with_on_off(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char step_mode,
+               unsigned char step_size,
+               unsigned short transition_time);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_LEVEL_CONTROL_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-on-off-cluster.h b/include/zcl/zb-zcl-on-off-cluster.h
new file mode 100644 (file)
index 0000000..e214d69
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_ON_OFF_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_ON_OFF_CLUSTER_H__
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-on-off-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_ON_OFF_CLUSTER_MODULE On/Off Cluster
+ *
+ * @brief zigbee on/off cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_ON_OFF_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 3.40 Command IDs for the On/Off Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Off                                  |     M      |
+ * |             0x01               | On                                   |     M      |
+ * |             0x02               | Toggle                               |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief On/Off value
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_OFF = 0x00, /**< off */
+       ZB_ZCL_ON = 0x01, /**< on */
+       ZB_ZCL_TOGGLE = 0x02, /**< toggle */
+} zb_zcl_onoff_e;
+
+/**
+ * @brief Command for on
+ * @details On receipt of 'on' command, a device shall enter its 'Off' state.
+ * This state is device dependent, but it is recommended that it is used for power off or\n
+ * similar functions.\n
+ * On receipt of 'off' command, a device shall enter its 'On' state. This state is\n
+ * device dependent, but it is recommended that it is used for power on or similar
+ * functions.\n
+ * On receipt of this command, if a device is in its 'Off' state it shall enter\n
+ * its 'On' state. Otherwise, if it is in its 'On' state it shall enter its 'Off' state\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] on_off_type #ZB_ZCL_OFF \n
+ *                        #ZB_ZCL_ON \n
+ *                        #ZB_ZCL_TOGGLE \n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_onoff_control(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               zb_zcl_onoff_e on_off_type);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_ON_OFF_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-poll-control-cluster.h b/include/zcl/zb-zcl-poll-control-cluster.h
new file mode 100644 (file)
index 0000000..fd47808
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_POLL_CONTROL_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_POLL_CONTROL_CLUSTER_H__
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-poll-control-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_POLL_CONTROL_CLUSTER_MODULE Poll Control Cluster
+ *
+ * @brief zigbee poll control cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_POLL_CONTROL_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+
+/* Table 9.28 Commands Generated by the Poll Control Server
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Check-in                             |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for check-in response
+ * @details The Poll Control Cluster server sends out a Check-in command to the devices to
+ * which it is paired based on the server's Check-inInterval attribute. It does this to
+ * find out if any of the Poll Control Cluster Clients with which it is paired are
+ * interested in having it enter fast poll mode so that it can be managed. This request
+ * is sent out based on either the Check-inInterval, or the next Check-in value in the
+ * Fast Poll Stop Request generated by the Poll Control Cluster Client.\n
+ * The Check-in command expects a Check-in Response command to be sent back
+ * from the Poll Control Client. If the Poll Control Server does not receive a Check-
+ * in response back from the Poll Control Client up to7.68 seconds it is free to return
+ * to polling according to the LongPollInterval.\n
+ * \n
+ * The Poll Control Cluster is used on end devices that may be battery powered. In
+ * order to conserve battery life, it is important that the Poll Control Server maintain
+ * certain boundaries for the setting of the Check-inInterval, LongPollInterval and
+ * the ShortPollInterval. Therefore, while these attributes are all Read/Write, it is
+ * possible that a battery-powered device might maintain its own boundary for the
+ * min and max of each of these attributes. The end device implementing the Poll
+ * Control Cluster Server may define its own boundaries for these attributes in order
+ * to protect itself against a power drain due to improper configuration.
+ * For instance a battery powered device may not allow another device to set its
+ * Check-inInterval to too short a value or its FastPollTimeout to too long an interval
+ * because it might cause the device to send too frequent check-in messages on the
+ * network and stay in fast poll mode for too long a time resulting in a drain on the
+ * battery.\n
+ * The Check-inInterval, LongPollInterval and ShortPollInterval should be set such
+ * that:\n
+ * \n
+ * - Check-in Interval >= Long Poll Interval >= Short Poll Interval\n
+ * - The default values chosen for this cluster are:\n
+ * - Check-in Interval = 1 hour = 0x3840 quarterseconds.\n
+ * - Long Poll Interval = 5 seconds = 0x14 quarterseconds.\n
+ * - Short Poll Interval = 2 quarterseconds = 0x02 quarterseconds.\n
+ * - Fast Poll Timeout = 10 seconds = 0x28 quarterseconds.\n
+ * \n
+ * It should be noted that for the Check-in Interval, 0 is a special value and does not\n
+ * apply to this equation.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_pollctrl_set_long_poll_interval()
+ * @see zb_zcl_pollctrl_set_short_poll_interval()
+ */
+typedef void (*zb_zcl_pollctrl_check_in)(
+               nwk_addr addr16,
+               unsigned char ep,
+               void *user_data);
+
+/* Table 9.29 Commands Generated by the Poll Control Client
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Check-in Response                    |     M      |
+ * |             0x00               | Fast Poll Stop                       |     M      |
+ * |             0x00               | Set Long Poll Interval               |     O      |
+ * |             0x00               | Set Short Poll Interval              |     O      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for check-in response
+ * @details The Check-in Response is sent in response to the receipt of a Check-in command.\n
+ * The Check-in Response is used by the Poll Control Client to indicate whether it
+ * would like the device implementing the Poll Control Cluster Server to go into a
+ * fast poll mode and for how long. If the Poll Control Cluster Client indicates that it
+ * would like the device to go into a fast poll mode, it is responsible for telling the
+ * device to stop fast polling when it is done sending messages to the fast polling
+ * device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] start_fast_polling This Boolean value indicates whether or not the Poll
+ *                               Control Server device should begin fast polling or not.\n
+ *                               If the Start Fast Polling value is true, the server device
+ *                               is expected to begin fast polling until the Fast Poll
+ *                               Timeout has expired. If the Start Fast Polling argument
+ *                               is false, the Poll Control Server may continue in normal
+ *                               operation and is not required to go into fast poll mode.\n
+ * @param[in] fast_poll_timeout The Fast Poll Timeout value indicates the number of
+ *                              quarterseconds during which the device should continue
+ *                              fast polling. If the Fast Poll Timeout value is 0, the
+ *                              device is expected to continue fast polling until the
+ *                              amount of time indicated it the FastPollTimeout attribute
+ *                              has elapsed or it receives a Fast Poll Stop command\n
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_pollctrl_check_in_response(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char start_fast_polling,
+               unsigned short fast_poll_timeout);
+
+/**
+ * @brief Command description for fast poll stop
+ * @details The Fast Poll Stop command is used to stop the fast poll mode initiated by the\n
+ * Check-in response. The Fast Poll Stop command has no payload.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_pollctrl_fast_poll_stop(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep);
+
+/**
+ * @brief Command description for set long poll interval
+ * @details The Set Long Poll Interval command is used to set the read only LongPollInterval
+ * attribute.\n
+ * When the Poll Control Server receives the Set Long Poll Interval Command, it
+ * should check its internal minimal limit and the attributes relationship defined in
+ * 9.6.4.2 if the new Long Poll Interval is acceptable. If the new value is acceptable,
+ * the new value shall be saved to the LongPollInterval attribute.If the new value is
+ * not acceptable, the Poll Control Server shall send a default response of
+ * INVALID_VALUE (0x87) and the LongPollInterval attribute value is not updated.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] new_long_poll_interval long poll interval
+ * @param[in] cb Resopnse callback function
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_pollctrl_check_in()
+ *
+ */
+int zb_zcl_pollctrl_set_long_poll_interval(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned int new_long_poll_interval,
+               zb_zcl_pollctrl_check_in cb,
+               void *user_data);
+
+/**
+ * @brief Command description for set short poll interval
+ * @details The Set Short Poll Interval command is used to set the read only
+ * ShortPollInterval attribute.\n
+ * When the Poll Control Server receives the Set Short Poll Interval Command, it
+ * should check its internal minimal limit and the attributes relationship defined in
+ * 9.6.4.2 if the new Short Poll Interval is acceptable. If the new value is acceptable,
+ * the new value shall be saved to the ShortPollInterval attribute. If the new value is
+ * not acceptable, the Poll Control Server shall send a default response of
+ * INVALID_VALUE (0x87) and the ShortPollInterval attribute value is not updated.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] new_short_poll_interval long poll interval
+ * @param[in] cb Resopnse callback function
+ * @param[in] user_data user_data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_pollctrl_check_in()
+ */
+int zb_zcl_pollctrl_set_short_poll_interval(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned int new_short_poll_interval,
+               zb_zcl_pollctrl_check_in cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_POLL_CONTROL_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-scenes-cluster.h b/include/zcl/zb-zcl-scenes-cluster.h
new file mode 100644 (file)
index 0000000..bc9cf6c
--- /dev/null
@@ -0,0 +1,521 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_SCENES_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_SCENES_CLUSTER_H__
+
+#include <zb-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zcl-scenes-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_SCENE_CLUSTER_MODULE Scene Cluster
+ *
+ * @brief zigbee scene cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_SCENE_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 3.38 Generated Command IDs for the Scenes Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Add scene response                   |     M      |
+ * |             0x01               | View scene response                  |     M      |
+ * |             0x02               | Remove scene response                |     M      |
+ * |             0x03               | Remove all scene response            |     M      |
+ * |             0x04               | Store scene response                 |     M      |
+ * |             0x05               | Reserved                             |     -      |
+ * |             0x06               | Get scene membership response        |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for add scene response
+ * @details This command is generated in response to a received Add Scene command.
+ * The Status field is set to SUCCESS, INSUFFICIENT_SPACE or
+ * INVALID_FIELD (the group is not present in the Group Table) as appropriate.
+ * The Group ID and Scene ID fields are set to the corresponding fields of the
+ * received Add Scene command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_NOT_FOUND \n
+ *             #ZB_ZCL_INVALID_FIELD
+ * @param[out] group_id Group id
+ * @param[out] scene_id Scene id
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_add_scene()
+ */
+typedef void (*zb_zcl_scene_add_scene_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char status,
+               unsigned short group_id,
+               unsigned char scene_id,
+               void *user_data);
+
+/**
+ * @brief Command description for view scene response
+ * @details This command is generated in response to a received View Scene command
+ * The entry in the Scene Table with Scene ID and Group ID given in the received
+ * View Scene command is located (if possible). The Status field is set to SUCCESS,
+ * NOT_FOUND (the scene is not present in the Scene Table) or INVALID_FIELD
+ * (the group is not present in the Group Table) as appropriate. The Group ID and
+ * Scene ID fields are set to the corresponding fields in the received View Scene
+ * command.
+ * If the status is SUCCESS, the Transition time, Scene Name and Extension field
+ * fields are copied from the corresponding fields in the table entry, otherwise they
+ * are omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_NOT_FOUND \n
+ *             #ZB_ZCL_INVALID_FIELD
+ * @param[out] group_id Group id
+ * @param[out] scene_id Scene id
+ * @param[out] transition_time Transition time
+ * @param[out] scene_name Scene name
+ * @param[out] extension_field_sets Extension field sets, one per cluster\n
+ *                                  Extension field sets =\n
+ *                                  {{ClusterID 1, length 1, {extension field set 1}},\n
+ *                                   {ClusterID 2, length 2, {extension field set 2}}, ... }.
+ * @param[out] ext_len length of extension fields set
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_view_scene()
+ */
+typedef void (*zb_zcl_scene_view_scene_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char status,
+               unsigned short group_id,
+               unsigned char scene_id,
+               unsigned short transition_time,
+               const char *scene_name,
+               const char *extension_field_set,
+               unsigned short ext_len,
+               void *user_data);
+
+/**
+ * @brief Command description for remove scene response
+ * @details This command is generated in response to a received Remove Scene command.
+ * The Status field is set to SUCCESS, NOT_FOUND (the scene is not
+ * present in the Scene Table) or INVALID_FIELD (the group is not present in the
+ * Group Table) as appropriate. The Group ID and Scene ID fields are set to the
+ * corresponding fields of the received Remove Scene command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_INVALID_FIELD \n
+ * @param[out] group_id Group id
+ * @param[out] scene_id Scene id
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_remove_scene()
+ */
+typedef void (*zb_zcl_scene_remove_scene_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char status,
+               unsigned short group_id,
+               unsigned char scene_id,
+               void *user_data);
+
+/**
+ * @brief Command description for remove all scene response
+ * @details This command is generated in response to a received Remove All Scenes
+ * command. The Status field is set to SUCCESS or INVALID_FIELD
+ * (the group is not present in the Group Table) as appropriate. The Group ID field is
+ * set to the corresponding field of the received Remove All Scenes command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_INVALID_FIELD \n
+ * @param[out] group_id Group id
+ * @param[out] scene_id Scene id
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_remove_all_scene()
+ */
+typedef void (*zb_zcl_scene_remove_all_scene_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char status,
+               unsigned short group_id,
+               void *user_data);
+
+/**
+ * @brief Command description for store scene response
+ * @details This command is generated in response to a received Store Scene command.
+ * The Status field is set to SUCCESS, INSUFFICIENT_SPACE or
+ * INVALID_FIELD (the group is not present in the Group Table) as appropriate.
+ * The Group ID and Scene ID fields are set to the corresponding fields of the
+ * received Store Scene command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_INVALID_FIELD \n
+ *             #ZB_ZCL_INSUFFICIENT_SPACE
+ * @param[out] group_id Group id
+ * @param[out] scene_id Scene id
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_group_store_scene()
+ */
+typedef void (*zb_zcl_scene_store_scene_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char status,
+               unsigned short group_id,
+               unsigned char scene_id,
+               void *user_data);
+
+/**
+ * @brief Command description for get all scene membership response
+ * @details This command is generated in response to a received Get Scene Membership
+ * command
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint number
+ * @param[out] status Status code see zb-zcl-type.h\n
+ *             #ZB_ZCL_SUCCESS \n
+ *             #ZB_ZCL_INVALID_FIELD \n
+ * @param[out] capacity The Capacity field shall contain the remaining capacity of the \n
+ *                      scene table of the device. (for all groups). The following values\n
+ *                      apply:\n
+ *                      0 : No further scenes may be added.\n
+ *                      0 < Capacity < 0xfeCapacity holds the number of scenes that may be added\n
+ *                      0xfe : At least 1 further scene may be added (exact number is unknown)\n
+ *                      0xff : It is unknown if any further scenes may be added\n
+ * @param[out] group_id Group id
+ * @param[out] scene_count The Scene count field shall contain the number of scenes \n
+ *                         contained in the Scene list field.
+ * @param[out] scene_list The Scene list field shall contain the identifiers of all the \n
+ *                        scenes in the scene table with the corresponding Group ID.
+ * @param[out] user_data user data
+ *
+ * @see zb_zcl_scene_get_scene_membership()
+ */
+typedef void (*zb_zcl_scene_get_scene_membership_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char status,
+               unsigned char capacity,
+               unsigned short group_id,
+               unsigned char scene_count,
+               unsigned char *scene_list,
+               void *user_data);
+
+/* Table 3.37 Received Command IDs for the Scenes Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Add scene                            |     M      |
+ * |             0x01               | View scene                           |     M      |
+ * |             0x02               | Remove scene                         |     M      |
+ * |             0x03               | Remove all scene                     |     M      |
+ * |             0x04               | Store scene                          |     M      |
+ * |             0x05               | Recall scene                         |     M      |
+ * |             0x06               | Get scene membership                 |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/* Reference : Extension field sets =
+ *  {{ClusterID 1, length 1, {extension field set 1}}, {ClusterID 2, length 2,
+ *  {extension field set 2}}, ... }.
+ */
+
+/**
+ * @brief Command description for add scenes
+ * @details The Add Scene command shall be addressed to a single device (not a group)
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] group_id Group ID
+ * @param[in] scene_id Scene ID
+ * @param[in] transition_time Transition time
+ * @param[in] scene_name Scene name
+ * @param[in] ext_field_len length of extension fields sets
+ * @param[in] extension_field_sets Extension field sets, one per cluster\n
+ *                                 Extension field sets = \n
+ *                                 {{ClusterID 1, length 1, {extension field set 1}}, \n
+ *                                  {ClusterID 2, length 2, {extension field set 2}}, ... }.
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_scene_add_scene_rsp()
+ */
+int zb_zcl_scene_add_scene(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short group_id,
+               unsigned char scene_id,
+               unsigned short transition_time,
+               const char *scene_name,
+               unsigned short ext_field_len,
+               const char *extension_field_sets,
+               zb_zcl_scene_add_scene_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for view scenes
+ * @details The View Scene command shall be addressed to a single device (not a group)
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] group_id Group ID
+ * @param[in] scene_id Scene ID
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_scene_view_scene_rsp()
+ */
+int zb_zcl_scene_view_scene(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short group_id,
+               unsigned char scene_id,
+               zb_zcl_scene_view_scene_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for remove scenes command
+ * @details The Remove Scene command may be addressed to a single device or to a group.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] group_id Group ID
+ * @param[in] scene_id Scene ID
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_scene_view_scene_rsp()
+ */
+int zb_zcl_scene_remove_scene(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short group_id,
+               unsigned char scene_id,
+               zb_zcl_scene_remove_scene_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for remove all scenes command
+ * @details The Remove All Scenes may be addressed to a single device or to a group.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] group_id Group ID
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_scene_remove_all_scene_rsp()
+ */
+int zb_zcl_scene_remove_all_scene(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short group_id,
+               zb_zcl_scene_remove_all_scene_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for remove scenes command
+ * @details The Store Scene command may be addressed to a single device or to a group.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] group_id Group ID
+ * @param[in] scene_id Scene ID
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_scene_store_scene_rsp()
+ */
+int zb_zcl_scene_store_scene(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short group_id,
+               unsigned char scene_id,
+               zb_zcl_scene_store_scene_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for recall scenes command
+ * @details The Recall Scene command may be addressed to a single device or to a group.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] group_id Group ID
+ * @param[in] scene_id Scene ID
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ */
+int zb_zcl_scene_recall_scene(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short group_id,
+               unsigned char scene_id);
+
+/**
+ * @brief Command description to get scenes membership
+ * @details The Get Scene Membership command can be used to find an unused scene
+ * number within the group when no commissioning tool is in the network, or for a
+ * commissioning tool to get used scenes for a group on a single device or on all
+ * devices in the group.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] group_id Group ID
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_scene_store_scene_rsp()
+ */
+int zb_zcl_scene_get_scene_membership(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned short group_id,
+               zb_zcl_scene_get_scene_membership_rsp cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_SCENES_CLUSTER_H__ */
+
diff --git a/include/zcl/zb-zcl-simple-metering-cluster.h b/include/zcl/zb-zcl-simple-metering-cluster.h
new file mode 100644 (file)
index 0000000..a8b4ca1
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_SIMPLE_METERING_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_SIMPLE_METERING_CLUSTER_H__
+
+#include <zb-type.h>
+
+/**
+ * @file zb-zcl-simple-metering-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_SIMPLE_METERING_CLUSTER_MODULE Simple Metering Cluster
+ *
+ * @brief zigbee simple metering cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_SIMPLE_METERING_CLUSTER_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table D.22 Generated Command IDs for the Simple Metering Server
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Get Profile Response                 |     O      |
+ * |             0x01               | Request Mirror                       |     O      |
+ * |             0x02               | Remove Mirror                        |     O      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for get profile response
+ * @details This command is generated when the Client command GetProfile is received.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 Network address
+ * @param[out] ep Endpoint ID
+ * @param[out] end_time EndTime:
+ *    32 bit value (in UTC) representing the end time of the most
+ *    chronologically recent interval being requested. Example: Data collected from
+ *    2:00 PM to 3:00 PM would be specified as a 3:00 PM interval (end time).\n\n It is
+ *    important to note that the current interval accumulating is not included in most
+ *    recent block but can be retrieved using the CurrentPartialProfileIntervalValue
+ *                              attribute.
+ * @param[out] status Status: below lists the valid values returned in the Status field.\n
+ *                           0x00 : Success\n
+ *                           0x01 : Undefined Interval Channel requested\n
+ *                           0x02 : Interval Channel not supported\n
+ *                           0x03 : Invalid End Time\n
+ *                           0x04 : More periods requested than can be returned\n
+ *                           0x05 : No intervals available for the requested time\n
+ * @param[out] profile_interval_period ProfileIntervalPeriod:
+ *    Represents the interval or time frame used to capture
+ *    metered Energy, Gas, and Water consumption for profiling purposes.
+ *    ProfileIntervalPeriod is an enumerated field representing the following
+ *    timeframes listed in below :\n\n
+ *                                    0 : Daily\n
+ *                                    1 : 60 minutes\n
+ *                                    2 : 30 minutes\n
+ *                                    3 : 15 minutes\n
+ *                                    4 : 10 minutes\n
+ *                                    5 : 7.5 minutes\n
+ *                                    6 : 5 minutes\n
+ *                                    7 : 2.5 minutes\n
+ * @param[out] number_of_period_delivered NumberofPeriodsDelivered:
+ *    Represents the number of intervals the device is returning.
+ *    Please note the number of periods returned in the Get Profile Response
+ *    command can be calculated when the packets are received and can replace the
+ *    usage of this field. The intent is to provide this information as a convenience.
+ * @param[out] interval Intervals (24bit integer array) :
+ *    Series of interval data captured using the period specified by the
+ *    ProfileIntervalPeriod field. The content of the interval data depend of the type of
+ *    information requested using the Channel field in the Get Profile Command. Data
+ *    is organized in a reverse chronological order, the most recent interval is
+ *    transmitted first and the oldest interval is transmitted last. Invalid intervals
+ *    should be marked as 0xFFFFFF.
+ * @param[out] user_data User data
+ *
+ * @see zb_zcl_simple_metering_get_profile()
+ *
+ */
+typedef void (*zb_zcl_smetering_get_profile_rsp)(
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned int end_time,
+               unsigned char status,
+               unsigned char profile_interval_period,
+               unsigned char number_of_period_delivered,
+               unsigned char *interval,
+               void *user_data);
+
+/* Table 3.56 Received Command IDs for the Alarms Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Get Profile                          |     O      |
+ * |             0x01               | Request Mirror Response              |     O      |
+ * |             0x02               | Removed Mirror                       |     O      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for get profile
+ * @details The GetProfile command is generated when a client device wishes to retrieve a
+ * list of captured Energy, Gas or water consumption for profiling purposes.\n\n Due to
+ * the potentially large amount of profile data available, the client device should
+ * store previously gathered data and only request the most current data.\n\n When
+ * initially gathering significant amounts of historical interval data, the GetProfile
+ * command should not be issued any more frequently than 7.5 seconds to prevent
+ * overwhelming the ZigBee network.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] interval_channel Enumerated value used to select the quantity of interest
+ *                             returned by the Get Profile Response Command. The Interval
+ *                             Channel values are listed in \n\n
+ *                             Bit 0 : Consumption Delivered
+ *                             Bit 1 : Consumption Received
+ * @param[in] end_time 32 bit value (in UTCTime) used to select an Intervals block from
+ *   all the Intervals blocks available. The Intervals block returned is the
+ *   most recentblock with its EndTime equal or older to the one provided.\n\n
+ *   The most recent Intervals block is requested using an End Time set to 0x00000000,
+ *   subsequent Intervals block are requested using an End time set to the EndTime of the
+ *   previous block - (number of intervals of the previous block * ProfileIntervalPeriod).
+ * @param[in] number_of_periods Represents the number of intervals being requested. This
+ *   value can't exceed the size stipulated in the MaxNumberOfPeriodsDelivered
+ *   attribute. If more intervals are requested than can be delivered, the
+ *   GetProfileResponse will return the number of intervals equal to
+ *   MaxNumberOfPeriodsDelivered. If fewer intervals available for the time period,
+ *   only those available are returned.
+ * @param[in] cb Resopnse callback function
+ * @param[in] user_data User data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zcl_smetering_get_profile_rsp()
+ */
+int zb_zcl_smetering_get_profile(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char interval_channel,
+               unsigned char end_time,
+               unsigned char number_of_periods,
+               zb_zcl_smetering_get_profile_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Command description for request mirror response
+ * @details The Request Mirror Response Command allows the ESP to inform a sleepy
+ * Metering Device it has the ability to store and mirror its data.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] src_ep Endpoint ID
+ * @param[in] endpoint_id 16 Bit Unsigned Integer indicating the End Point ID to contain
+ *   the Metering Devices meter data. Valid End Point ID values are 0x0001 to 0x00F0. If
+ *   the ESP is unable to mirror the Metering Device data, EndPoint ID shall be
+ *   returned as 0xFFFF. All other EndPoint ID values are reserved. If valid, the
+ *   Metering device shall use the EndPoint ID to forward its metered data.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_smetering_request_mirror_rsp(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned short endpoint_id);
+
+/**
+ * @brief Command description for mirror removed
+ * @details The Mirror Removed Command allows the ESP to inform a sleepy Metering
+ * Device mirroring support has been removed or halted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] src_ep Endpoint ID
+ * @param[in] removed_endpoint_id 16 Bit Unsigned Integer indicating the End Point ID
+ *                                previously containing the Metering Devices meter data.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_smetering_mirror_removed(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char src_ep,
+               unsigned short removed_endpoint_id);
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_SIMPLE_METERING_CLUSTER_H__ */
diff --git a/include/zcl/zb-zcl-thermostat-cluster.h b/include/zcl/zb-zcl-thermostat-cluster.h
new file mode 100644 (file)
index 0000000..85fd563
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_THERMOSTAT_CLUSTER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_THERMOSTAT_CLUSTER_H__
+
+#include <zb-type.h>
+
+/**
+ * @file zb-zcl-thermostat-cluster.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_COMMAND_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZCL_THERMOSTAT_MODULE Thermostat Cluster
+ *
+ * @brief zigbee thermostat cluster description
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZCL_THERMOSTAT_MODULE_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/* Table 6.18 Command IDs for the Thermostat Cluster
+ * +--------------------------------+--------------------------------------+------------+
+ * |Command Identifier Field Value  |              Description             | Mandatory/ |
+ * |                                |                                      | Optional   |
+ * +--------------------------------+--------------------------------------+------------+
+ * |             0x00               | Setpoint Raise/Lower                 |     M      |
+ * +--------------------------------+--------------------------------------+------------+
+ */
+
+/**
+ * @brief Command description for setpoint raise/lower
+ * @details The attributes for the indicated setpoint(s) shall be increased by the amount
+ * specified in the Amount field.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address
+ * @param[in] ep Endpoint ID
+ * @param[in] mode The mode field shall be set to one of the non-reserved values in below. It
+ *                 specifies which setpoint is to be configured. If it is set to auto, then both setpoints
+ *                 shall be adjusted.\n
+ *                 0x00 : Heat (adjust Heat setpoint)\n
+ *                 0x01 : Cool (adjust Cool setpoint)\n
+ *                 0x02 : Both (adjust Heat and Cool setpoint)\n
+ * @param[in] amount The amount field is a signed 8-bit integer that specifies the amount the setpoint(s)
+ *                   are to be a increased (or decreased) by, in steps of 0.1C
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE Out of range error
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_zcl_thermostat_adjust_setpoint(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char mode,
+               unsigned char amount);
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_THERMOSTAT_CLUSTER_H__ */
+
diff --git a/include/zcl/zb-zcl-type.h b/include/zcl/zb-zcl-type.h
new file mode 100644 (file)
index 0000000..4073a7e
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZCL_TYPE_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZCL_TYPE_H__
+
+#include <wchar.h>
+#include <zb-type.h>
+
+/**
+ * @file zb-zcl-type.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief ACL type
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_WRITABLE = 1, /**< Writable */
+       ZB_ZCL_REPORTABLE = 2, /**< Reportable */
+} zb_zcl_acl_type_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief data measuring type
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       DATA_TYPE_NONE = 0, /**< Data type none */
+       DATA_TYPE_DISCRETE = 1, /**< Discrete data type */
+       DATA_TYPE_ANALOG = 2 /**< Analog data type */
+} zb_zcl_data_category_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Table 2.138 ZCL Enumerations Description
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZCL_SUCCESS = 0x00, /**< Operation was successful */
+       ZB_ZCL_FAILURE = 0x01, /**< Operation was not successful. */
+       /**< The sender of the command does not have authorization to carry out this command. */
+       ZB_ZCL_NOT_AUTHORIZED = 0x7E,
+       /**< reserved field/subfield/bit contains a non-zero value. */
+       ZB_ZCL_RESERVED_FIELD_NOT_ZERO = 0x7F,
+       /**< The command appears to contain the wrong fields, as
+               detected either by the presence of one or more invalid
+               field entries or by there being missing fields. Command
+               not carried out. Implementer has discretion as to
+               whether to return this error or INVALID_FIELD. */
+       ZB_ZCL_MALFORMED_COMMAND = 0x80,
+       /**< The specified cluster command is not supported on the device. */
+       ZB_ZCL_UNSUP_CLUSTER_COMMAND = 0x81,
+       /**< The specified general ZCL command is not supported on the device. */
+       ZB_ZCL_UNSUP_GENERAL_COMMAND = 0x82,
+       /**< A manufacturer specific unicast, cluster specific
+               command was received with an unknown manufacturer
+               code, or the manufacturer code was recognized but the
+               command is not supported. */
+       ZB_ZCL_UNSUP_MANUF_CLUSTER_COMMAND = 0x83,
+       /**< A manufacturer specific unicast, ZCL specific command
+               was received with an unknown manufacturer code, or
+               the manufacturer code was recognized but the command
+               is not supported. */
+       ZB_ZCL_UNSUP_MANUF_GENERAL_COMMAND = 0x84,
+       /**< At least one field of the command contains an incorrect
+               value, according to the specification the device is
+               implemented to. */
+       ZB_ZCL_INVALID_FIELD = 0x85,
+       /**< The specified attribute does not exist on the device. */
+       ZB_ZCL_UNSUPPORTED_ATTRIBUTE = 0x86,
+       /**< Out of range error, or set to a reserved value. Attribute
+               keeps its old value.
+               Note that an attribute value may be out of range if an
+               attribute is related to another, e.g. with minimum and
+               maximum attributes. See the individual attribute
+               descriptions for specific details. */
+       ZB_ZCL_INVALID_VALUE = 0x87,
+       /**< Attempt to write a read only attribute. */
+       ZB_ZCL_READ_ONLY = 0x88,
+       /**< An operation (e.g. an attempt to create an entry in a
+               table) failed due to an insufficient amount of free space
+               available. */
+       ZB_ZCL_INSUFFICIENT_SPACE = 0x89,
+       /**< An attempt to create an entry in a table failed due to a
+               duplicate entry already being present in the table. */
+       ZB_ZCL_DUPLICATE_EXISTS = 0x8A,
+       /**< The requested information (e.g. table entry) could not be found. */
+       ZB_ZCL_NOT_FOUND = 0x8B,
+       /**< Periodic reports cannot be issued for this attribute. */
+       ZB_ZCL_UNREPORTABLE_ATTRIBUTE = 0x8C,
+       /**< The data type given for an attribute is incorrect.
+               Command not carried out. */
+       ZB_ZCL_INVALID_DATA_TYPE = 0x8D,
+       /**< The selector for an attribute is incorrect. */
+       ZB_ZCL_INVALID_SELECTOR = 0x8E,
+       /**< A request has been made to read an attribute that the
+               requestor is not authorized to read. No action taken. */
+       ZB_ZCL_WRITE_ONLY = 0x8F,
+       /**< Setting the requested values would put the device in an
+               inconsistent state on startup. No action taken. */
+       ZB_ZCL_INCONSISTENT_STARTUP_STATE = 0x90,
+       /**< An attempt has been made to write an attribute that is
+               present but is defined using an out-of-band method and
+               not over the air. */
+       ZB_ZCL_DEFINED_OUT_OF_BAND = 0x91,
+       /**< The supplied values (e.g. contents of table cells) are
+               inconsistent. */
+       ZB_ZCL_INCONSISTENT = 0x92,
+       /**< The credentials presented by the device sending the
+               command are not sufficient to perform this action. */
+       ZB_ZCL_ACTION_DENIED = 0x93,
+       /**< The exchange was aborted due to excessive response time. */
+       ZB_ZCL_TIMEOUT = 0x94,
+       /**< Failed case when a client or a server decides to abort the
+               upgrade process. */
+       ZB_ZCL_ABORT = 0x95,
+       /**< Invalid OTA upgrade image (ex. failed signature
+               validation or signer information check or CRC check). */
+       ZB_ZCL_INVALID_IMAGE = 0x96,
+       /**< Server does not have data block available yet. */
+       ZB_ZCL_WAIT_FOR_DATA = 0x97,
+       /**< No OTA upgrade image available for a particular client. */
+       ZB_ZCL_NO_IMAGE_AVAILABLE = 0x98,
+       /**< The client still requires more OTA upgrade image files
+               in order to successfully upgrade. */
+       ZB_ZCL_REQUIRE_MORE_IMAGE = 0x99,
+} zb_zcl_status_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Figure 2.28 Format of the Attribute Report Fields
+ *
+ * @since_tizen 3.0
+ */
+typedef struct discover_attribute_info_record_s* discover_attr_info_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief structure for reading attribute
+ *
+ * @since_tizen 3.0
+ */
+typedef struct read_structured_attribute_record_s* read_structured_attr_record_h;
+
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Figure 2.16 Format of the Attribute Reporting Configuration Record
+ *
+ * @since_tizen 3.0
+ */
+typedef struct read_attribute_status_record_s* read_attr_status_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief write attributes data structure
+ *
+ * @since_tizen 3.0
+ */
+typedef struct write_attribute_record_s* write_attr_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief For write attribute response command
+ *
+ * @since_tizen 3.0
+ */
+typedef struct write_attribute_status_record_s* write_attr_status_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Figure 2.11 Format of the Write Attribute Record Field
+ *
+ * @since_tizen 3.0
+ */
+typedef struct write_attribute_structured_status_record_s* write_attr_structured_status_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Figure 2.32 Format of the Write Attribute Record Field
+ *
+ * @since_tizen 3.0
+ */
+typedef struct write_attribute_structured_record_s* write_attr_structured_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Figure 2.24 Format of the Attribute Report Fields
+ *
+ * @since_tizen 3.0
+ */
+typedef struct attribute_report_s* attr_report_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief reporting configuration record structure
+ *
+ * @since_tizen 3.0
+ */
+typedef struct reporting_configuration_record_s* report_config_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Read reporting configuration record
+ *
+ * @since_tizen 3.0
+ */
+typedef struct read_reporting_configuration_record_s* read_report_config_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Figure 2.18 Format of the Attribute Status Record Field
+ *
+ * @since_tizen 3.0
+ */
+typedef struct reporting_configuration_response_record_s* report_config_response_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Figure 12.5 Format of the Extended Attribute Information Fields
+ *
+ * @since_tizen 3.0
+ */
+typedef struct extended_attribute_infomation_s* extended_attr_info_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Table 2.16 simple data type
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_value_s* zb_value_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Figure 2.8 Format of Attribute Value Field for an array, Set or Bag
+ *
+ * @since_tizen 3.0
+ */
+typedef struct attribute_array_s* attribute_array_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZCL_MODULE
+ * @brief Global record type
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_GLOBAL_READ_ATTR = 0,
+       ZB_GLOBAL_WRITE_ATTR,
+       ZB_GLOBAL_CONFIG_REPORT,
+       ZB_GLOBAL_READ_REPORT_CONFIG,
+       ZB_GLOBAL_WRITE_ATTR_STRUCTURED
+} zb_zcl_global_record_e;
+
+/**
+ * @brief The structure type for record data of zigbee global request.
+ * @details This structure contains record data of zigbee global request.
+ *   ex) Read/Write attributes response, Configure reporting response.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct {
+       zb_zcl_global_record_e type;
+       union {
+               read_attr_status_record_h *read_attr; /**< Attribute Reporting Configuration Record */
+               write_attr_status_record_h *write_attr; /**< For write attribute response command */
+               report_config_response_record_h *report_config_rsp; /**< Attribute Status Record Field */
+               report_config_record_h *report_config; /**< Reporting configuration record structure */
+               write_attr_structured_record_h *write_attr_structured; /**< Write Attribute Record Field */
+       } record;
+       int records_len; /**< The number of records */
+} zb_global_record_data_s;
+
+/**
+ * @}
+ */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZCL_TYPE_H__ */
diff --git a/include/zdo/zb-zdo-bind-mgr.h b/include/zdo/zb-zdo-bind-mgr.h
new file mode 100644 (file)
index 0000000..2a83866
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZDO_BIND_MANAGER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZDO_BIND_MANAGER_H__
+
+#include <zdo/zb-zdo-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zdo-bind-mgr.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZDO_BINDING_MANAGER_MODULE Binding Manager
+ *
+ * @brief zigbee provides API for Binding.
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_BINDING_MANAGER_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_BINDING_MANAGER_OVERVIEW Overview
+ * This API set consists of ZDP device discovery API
+ *
+ * @{
+ */
+
+/**
+ * @brief Bind response
+ * @details The Bind_rsp is generated in response to a Bind_req. If the Bind_req is
+ * processed and the Binding Table entry committed on the Remote Device, a Status of
+ * SUCCESS is returned.\n\n If the Remote Device is not a Primary binding table cache
+ * or the SrcAddress, a Status of NOT_SUPPORTED is returned.\n\n The supplied
+ * endpoint shall be checked to determine whether it falls within the specified range.
+ * If it does not, a Status of INVALID_EP shall be returned.\n\n If the Remote Device is
+ * the Primary binding table cache or SrcAddress but does not have Binding Table
+ * resources for the request, a Status of TABLE_FULL is returned.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    #ZB_ZDP_INVALID_EP \n
+ *                    #ZB_ZDP_TABLE_FULL \n
+ *                    #ZB_ZDP_NOT_AUTHORIZED \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_bind_req()
+ *
+ */
+typedef void (*zb_zdo_bind_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Binding request when destination address present but not endpoint present
+ * @details The Bind_req is generated from a Local Device wishing to create a Binding
+ * Table entry for the source and destination addresses contained as parameters.\n\n The
+ * destination addressing on this command shall be unicast only, and the destination
+ * address shall be that of a Primary binding table cache or to the SrcAddress itself.
+ * The Binding Manager is optionally supported on the source device (unless that
+ * device is also the ZigBee Coordinator) so that device shall issue a
+ * NOT_SUPPORTED status to the Bind_req if not supported.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] dst_addr16 The Network address of destination
+ * @param[in] src_addr64 The IEEE address of source
+ * @param[in] src_ep The source endpoint for the binding entry
+ * @param[in] cluster_id The identifier of the cluster on the source device that is bound
+ *                       to the destination.
+ * @param[in] dst_addr64 The IEEE address of destination
+ * @param[in] type ZB_UNICAST_BINDING : A unicast binding whose 64-bit identifier is the
+ *                                                                     destination ieee_addr. \n
+ *                    ZB_MANY_TO_ONE_BINDING : A unicast binding whose 64-bit identifier is
+ *                                          the many-to-one destination ieee_addr.
+ *                                          A Route discovery should be disabled when
+ *                                          sending unicast via may-to-one binding \n
+ *                 ZB_MULTICAST_BINDING : A multicast binding whose 64-bit identifier is
+ *                                        the group address. A multicast binding can be
+ *                                        used to send messages to the group and to
+ *                                        receive message sent to the group
+ * @param[in] group_addr The destination address for the binding entry
+ * @param[in] dst_ep The destination endpoint for the binding entry.
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_bind_rsp()
+ */
+int zb_zdo_bind_req(
+               zigbee_h handle,
+               nwk_addr dst_addr16,
+               ieee_addr src_addr64,
+               unsigned char src_ep,
+               unsigned short cluster_id,
+               ieee_addr dst_addr64,
+               unsigned char type,
+               nwk_addr group_addr,
+               unsigned char dst_ep,
+               zb_zdo_bind_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Unbind response
+ * @details The Unbind_rsp is generated in response to an Unbind_req. If the Unbind_req is
+ * processed and the corresponding Binding Table entry is removed from the Remote
+ * Device, a Status of SUCCESS is returned. If the Remote Device is not the ZigBee
+ * Coordinator or the SrcAddress, a Status of NOT_SUPPORTED is returned.\n\n The
+ * supplied endpoint shall be checked to determine whether it falls within the
+ * specified range. If it does not, a Status of INVALID_EP shall be returned If the
+ * Remote Device is the ZigBee Coordinator or SrcAddress but does not have a
+ * Binding Table entry corresponding to the parameters received in the request, a
+ * Status of NO_ENTRY is returned.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    #ZB_ZDP_INVALID_EP \n
+ *                    #ZB_ZDP_NO_ENTRY \n
+ *                    #ZB_ZDP_NOT_AUTHORIZED
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_unbind_req_addr()
+ *
+ */
+typedef void (*zb_zdo_unbind_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Binding request when destination address present but not endpoint present
+ * @details The Unbind_req is generated from a Local Device wishing to remove a Binding
+ * Table entry for the source and destination addresses contained as parameters.\n\n The
+ * destination addressing on this command shall be unicast only and the destination
+ * address must be that of the a Primary binding table cache or the SrcAddress.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] dst_addr16 The Network address of destination
+ * @param[in] src_addr64 The IEEE address of source
+ * @param[in] src_ep The source endpoint for the binding entry
+ * @param[in] cluster_id The identifier of the cluster on the source device that is bound
+ *                       to the destination.
+ * @param[in] dst_addr64 The IEEE address of destination
+ * @param[in] type #ZB_UNICAST_BINDING : A unicast binding whose 64-bit identifier is the
+ *                                                                     destination ieee_addr. \n
+ *                    #ZB_MANY_TO_ONE_BINDING : A unicast binding whose 64-bit identifier is
+ *                                          the many-to-one destination ieee_addr.
+ *                                          A Route discovery should be disabled when
+ *                                          sending unicast via may-to-one binding \n
+ *                 #ZB_MULTICAST_BINDING : A multicast binding whose 64-bit identifier is
+ *                                        the group address. A multicast binding can be
+ *                                        used to send messages to the group and to
+ *                                        receive message sent to the group
+ * @param[in] group_addr The destination address for the binding entry
+ * @param[in] dst_ep The destination endpoint for the binding entry.
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_unbind_rsp()
+ *
+ */
+int zb_zdo_unbind_req(
+               zigbee_h handle,
+               nwk_addr dst_addr16,
+               ieee_addr src_addr64,
+               unsigned char src_ep,
+               unsigned short cluster_id,
+               ieee_addr dst_addr64,
+               unsigned char type,
+               nwk_addr group_addr,
+               unsigned char dst_ep,
+               zb_zdo_unbind_rsp cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZDO_BIND_MANAGER_H__ */
diff --git a/include/zdo/zb-zdo-config.h b/include/zdo/zb-zdo-config.h
new file mode 100644 (file)
index 0000000..4104855
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZDO_CONFIG_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZDO_CONFIG_H__
+
+#include <zdo/zb-zdo-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * @file zb-zdo-config.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_MODULE_ZDO_MODULE
+ * @brief zigbee configuration API.
+ * @since_tizen 3.0
+ *
+ * @{
+ */
+
+/**
+ * @brief Set start-up attribute set
+ * @details In order to ensure interoperability, all ZigBee HA devices should implement
+ * compatible Startup Attribute Sets (SAS). This does not mean that set must be
+ * modifiable through a commissioning cluster, but that the device must internally
+ * implement these stack settings to ensure compatibility and consistent user
+ * experience. The start up set parameters described by the Commissioning cluster
+ * provide a good basis to specify a HA startup set.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] pan_id Short address
+ * @param[in] epan_id Usually 00-50-C2-77-10-00-00-00 is the global commissioning EPID
+ * @param[in] channel_mask
+ * @param[in] start_control
+ * @param[in] trust_center_addr
+ * @param[in] master_key
+ * @param[in] master_key_len
+ * @param[in] network_key
+ * @param[in] network_key_len
+ * @param[in] default_link_key_join
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ */
+int zb_zdo_set_compatible_startup_parameters(
+               zigbee_h handle,
+               nwk_addr pan_id, /* default : NULL (0xFFFF) */
+               ieee_addr epan_id, /* default : NULL (0x0000000000000000) */
+               unsigned int channel_mask, /* default : NULL (0x07FFF800) */
+               unsigned char start_control, /* default : 3 (un-comissioned, simlely push end-device's button when joining) */
+               ieee_addr trust_center_addr, /* default : NULL (0x0000000000000000) */
+               const unsigned char *master_key, /* default : NULL */
+               unsigned char master_key_len, /* default : 0 */
+               const unsigned char *network_key, /* default : NULL */
+               unsigned char network_key_len, /* default : 0 */
+               unsigned char default_link_key_join /* default : 0 */
+       );
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZDO_CONFIG_H__ */
\ No newline at end of file
diff --git a/include/zdo/zb-zdo-dev-disc.h b/include/zdo/zb-zdo-dev-disc.h
new file mode 100644 (file)
index 0000000..ecb557c
--- /dev/null
@@ -0,0 +1,1084 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZDO_DEVICE_DISCOVERY_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZDO_DEVICE_DISCOVERY_H__
+
+#include <zdo/zb-zdo-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zdo-dev-disc.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZDO_DEVICE_DISCOVERY_MODULE Device Discovery
+ *
+ * @brief zigbee provides API for Device Discovery.
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_DEVICE_DISCOVERY_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_DEVICE_DISCOVERY_OVERVIEW Overview
+ * This API set consists of ZDP device discovery API
+ *
+ * @{
+ */
+
+
+/**
+ * @brief Network / IEEE address response
+ * @details The NWK_addr_rsp is generated by a Remote Device in response to a\n
+ * NWK_addr_req or IEEE_addr_req command inquiring as to the NWK address of the Remote
+ * Device or the NWK address of an address held in a local discovery cache.\n
+ * The destination addressing on this command is unicast.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND
+ * @param[out] remote_dev_addr64 64-bit address for the remote device
+ * @param[out] remote_dev_addr16 16-bit address for the remote device
+ * @param[out] num_of_assoc_dev Count of the number of 16-bit short addresses to follow.
+ *                              If the RequestType in the request is Extended Response
+ *                              and there are no associated devices on the Remote Device,
+ *                              this field shall be set to 0.
+ *                              If an error occurs or the RequestType in the request is
+ *                              for a Single Device Response, this field shall not
+ *                              be included in the frame.
+ * @param[out] start_idx Starting index into the list of associated devices for this
+ *                       report. If the RequestType in the request is Extended Response
+ *                       and there are no associated devices on the Remote Device,
+ *                       this field shall not be included in the frame.
+ *                       If an error occurs or the RequestType in the request is
+ *                       for a Single Device Response, this field shall not
+ *                       be included in the frame.
+ * @param[out] assoc_dev_addr_list A list of 16-bit addresses, one corresponding to each
+ *                               associated device to Remote Device; The number of 16-bit
+ *                               network addresses contained in this field is specified
+ *                               in the NumAssocDev field.
+ *                               If the RequestType in the request is Extended Response
+ *                               and there are no associated devices on the Remote Device,
+ *                               this field shall not be included in the frame.
+ *                               If an error occurs or the RequestType in the request is
+ *                               for a Single Device Response, this field shall not
+ *                               be included in the frame.
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_nwk_addr_req()
+ */
+typedef void (*zb_zdo_addr_rsp)(
+       unsigned char status,
+       ieee_addr remote_dev_addr64,
+       nwk_addr remote_dev_addr16,
+       unsigned char num_of_assoc_dev,
+       unsigned char start_idx,
+       unsigned short *assoc_dev_addr_list,
+       void *user_data);
+
+/**
+ * @brief Network address request
+ * @details The NWK_addr_req is generated from a Local Device wishing to inquire as to the\n
+ * 16-bit address of the Remote Device based on its known IEEE address. The\n
+ * destination addressing on this command shall be unicast or broadcast to all\n
+ * devices for which macRxOnWhenIdle = TRUE.\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] request_type \n
+ *            0x00 - Single device response \n
+ *            0x01 - Extended response \n
+ * @param[in] start_idx If the Request type for this command is Extended response,
+ *                      is StartIndex provides the starting index for the requested
+ *                      elements of the associated devices list
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_nwk_addr_rsp()
+ */
+int zb_zdo_nwk_addr_req(
+       zigbee_h handle,
+       ieee_addr addr64,
+       unsigned char request_type,
+       unsigned char start_idx,
+       zb_zdo_addr_rsp cb,
+       void *user_data);
+
+/**
+ * @brief IEEE address request
+ * @details The IEEE_addr_req is generated from a Local Device wishing to inquire as to
+ * the 64-bit IEEE address of the Remote Device based on their known 16-bit address.
+ * The destination addressing on this command shall be unicast.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_ieee_addr_rsp()
+ */
+int zb_zdo_ieee_addr_req(
+       zigbee_h handle,
+       nwk_addr addr16,
+       zb_zdo_addr_rsp cb,
+       void *user_data);
+
+/**
+ * @brief Active endpoint response
+ * @details The Active_EP_rsp is generated by a remote device in response to an
+ * Active_EP_req directed to the remote device. This command shall be unicast to
+ * the originator of the Active_EP_req command.\n\n
+ * The remote device shall generate the Active_EP_rsp command using the format
+ * illustrated param list. The NWKAddrOfInterest field shall match that specified
+ * in the original Active_EP_req command. If the NWKAddrOfInterest field
+ * matches the network address of the remote device, it shall set the Status field to
+ * SUCCESS, set the ActiveEPCount field to the number of active endpoints on that
+ * device and include an ascending list of all the identifiers of the active endpoints on
+ * that device in the ActiveEPList field.\n\n
+ * If the NWKAddrOfInterest field does not match the network address of the
+ * remote device and it is an end device, it shall set the Status field to
+ * INV_REQUESTTYPE, set the ActiveEPCount field to 0, and not include the
+ * ActiveEPList field.\n\n If the NWKAddrOfInterest field does not match the network
+ * address of the remote device and it is the coordinator or a router, it shall determine
+ * whether the NWKAddrOfInterest field matches the network address of a device it
+ * holds in a discovery cache. \n\n If the NWKAddrOfInterest field does not match the
+ * network address of a device it holds in a discovery cache, it shall set the Status
+ * field to DEVICE_NOT_FOUND, set the ActiveEPCount field to 0, and not
+ * include the ActiveEPList field.\n\n If the NWKAddrOfInterest matches the network
+ * address of a device held in a discovery cache on the remote device, it shall
+ * determine whether that device has any active endpoints. If the discovery
+ * information corresponding to the ActiveEP request has not yet been uploaded to
+ * the discovery cache, the remote device shall set the Status field to
+ * NO_DESCRIPTOR, set the ActiveEPCount field to 0 and not include the
+ * ActiveEPList field.\n\n If the cached device has no active endpoints, the remote
+ * device shall set the Status field to SUCCESS, set the ActiveEPCount field to 0,
+ * and not include the ActiveEPList field.\n\n If the cached device has active endpoints,
+ * the remote device shall set the Status field to SUCCESS, set the ActiveEPCount
+ * field to the number of active endpoints on that device, and include an ascending
+ * list of all the identifiers of the active endpoints on that device in the ActiveEPList
+ * field .
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND \n
+ *                    #ZB_ZDP_NO_DESCRIPTOR \n
+ * @param[out] addr16 Network address for the request
+ * @param[out] count The count of active endpoint on the remote device
+ * @param[out] ep_list List of bytes each of which represents an 8-bit endpoint
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_active_ep()
+ */
+typedef void (*zb_zdo_active_ep_rsp)(
+       unsigned char status,
+       nwk_addr addr16,
+       unsigned char count,
+       unsigned char *ep_list,
+       void *user_data);
+
+/**
+ * @brief Active EP request
+ * @details The Active_EP_req command is generated from a local device wishing to acquire
+ * the list of endpoints on a remote device with simple descriptors. This command
+ * shall be unicast either to the remote device itself or to an alternative device that
+ * contains the discovery information of the remote device.\n\n
+ * The local device shall generate the Active_EP_req command using the format
+ * illustrated in param list. The NWKAddrOfInterest field shall contain the network
+ * address of the remote device for which the active endpoint list is required.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_active_ep_rsp()
+ */
+int zb_zdo_active_ep(
+       zigbee_h handle,
+       nwk_addr addr16,
+       zb_zdo_active_ep_rsp cb,
+       void *user_data);
+
+/**
+ * @brief Simple descriptor response
+ * @details The Simple_Desc_rsp is generated by a remote device in response to a
+ * Simple_Desc_req directed to the remote device. This command shall be unicast to
+ * the originator of the Simple_Desc_req command.
+ * The remote device shall generate the Simple_Desc_rsp command using the format
+ * illustrated in Table 2.94. The NWKAddrOfInterest field shall match that specified
+ * in the original Simple_Desc_req command. If the endpoint field specified in the
+ * original Simple_Desc_req command does not fall within the correct range
+ * specified in param list, the remote device shall set the Status field to
+ * INVALID_EP, set the Length field to 0 and not include the SimpleDescriptor
+ * field.\n\n
+ * If the NWKAddrOfInterest field matches the network address of the remote
+ * device, it shall determine whether the endpoint field specifies the identifier of an
+ * active endpoint on the device. If the endpoint field corresponds to an active
+ * endpoint, the remote device shall set the Status field to SUCCESS, set the Length
+ * field to the length of the simple descriptor on that endpoint, and include the simple
+ * descriptor for that endpoint in the SimpleDescriptor field.
+ * If the endpoint field does not correspond to an active endpoint, the remote device
+ * shall set the Status field to NOT_ACTIVE, set the Length field to 0, and not
+ * include the SimpleDescriptor field.\n\n
+ * If the NWKAddrOfInterest field does not match the network address of the
+ * remote device and it is an end device, it shall set the Status field to
+ * INV_REQUESTTYPE, set the Length field to 0, and not include the
+ * SimpleDescriptor field. If the NWKAddrOfInterest field does not match the
+ * network address of the remote device and it is the coordinator or a router, it shall
+ * determine whether the NWKAddrOfInterest field matches the network address of
+ * one of its children. If the NWKAddrOfInterest field does not match the network
+ * address of one of the children of the remote device, it shall set the Status field to
+ * DEVICE_NOT_FOUND, set the Length field to 0, and not include the
+ * SimpleDescriptor field.\n\n
+ * If the NWKAddrOfInterest matches the network address of one of the children of
+ * the remote device, it shall determine whether a simple descriptor for that device
+ * and on the requested endpoint is available. If a simple descriptor is not available
+ * on the requested endpoint of the child indicated by the NWKAddrOfInterest field,
+ * the remote device shall set the Status field to NO_DESCRIPTOR, set the Length
+ * field to 0, and not include the SimpleDescriptor field. If a simple descriptor is
+ * available on the requested endpoint of the child indicated by the
+ * NWKAddrOfInterest field, the remote device shall set the Status field to
+ * SUCCESS, set the Length field to the length of the simple descriptor on that
+ * endpoint, and include the simple descriptor for that
+ * endpoint of the matching child device in the SimpleDescriptor field.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INVALID_EP \n
+ *                    #ZB_ZDP_NOT_ACTIVE \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_NO_DESCRIPTOR
+ * @param[out] addr16 Network address for the request
+ * @param[out] len Length in bytes of the simple descriptor to follow
+ * @param[out] handle Simple descriptor structure this filed shall only be included
+ *                    in the frame if the status field is equal to ZB_ZDP_SUCCESS
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_simple_desc_req()
+ */
+typedef void (*zb_zdo_simple_desc_rsp)(
+               nwk_addr addr16,
+               unsigned char len,
+               const zb_zdo_simple_desc_h handle,
+               void *user_data);
+
+/**
+ * @brief Simple descriptor request
+ * @details The Simple_Desc_req command is generated from a local device wishing to
+ * inquire as to the simple descriptor of a remote device on a specified endpoint. This
+ * command shall be unicast either to the remote device itself or to an alternative
+ * device that contains the discovery information of the remote device.\n\n
+ * The local device shall generate the Simple_Desc_req command using the format
+ * illustrated in param list. The NWKAddrOfInterest field shall contain the network
+ * address of the remote device for which the simple descriptor is required and the
+ * endpoint field shall contain the endpoint identifier from which to obtain the
+ * required simple descriptor.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] ep The endpoint on the destination
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ENDPOINT Invalid endpoint. 0 is reserved for ZDP
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_simple_desc_rsp()
+ */
+int zb_zdo_simple_desc_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char ep,
+               zb_zdo_simple_desc_rsp cb,
+               void *user_data);
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+/**
+ * @brief Extended simple descriptor response
+ * @details The Extended_Simple_Desc_rsp is generated by a remote device in response to an
+ * Extended_Simple_Desc_req directed to the remote device. This command shall
+ * be unicast to the originator of the Extended_Simple_Desc_req command.
+ * The remote device shall generate the Extended_Simple_Desc_rsp command using
+ * the format illustrated in param list. The NWKAddrOfInterest field shall match
+ * that specified in the original Extended_Simple_Desc_req command. If the
+ * endpoint field specified in the original Extended_Simple_Desc_req command
+ * does not fall within the correct range specified in Table 2.49, the remote device
+ * shall set the Status field to INVALID_EP, set the Endpoint and StartIndex fields to
+ * their respective values supplied in the request, and not include the AppClusterList
+ * field.\n\n
+ * If the NWKAddrOfInterest field matches the network address of the remote
+ * device, it shall determine whether the endpoint field specifies the identifier of an
+ * active endpoint on the device.\n\n If the endpoint field corresponds to an active
+ * endpoint, the remote device shall set the Status field to SUCCESS, set the
+ * AppClusterList field to the sequence of octets from the concatenated AppInput
+ * ClusterList and AppOutputClusterList from the Simple Descriptor (Tables 2.39),
+ * and supply that field as AppClusterList in the response. Note that dependent on
+ * the value of StartIndex in the request, the results in AppClusterList may be empty
+ * (for example, the StartIndex begins after the sequence of octets given by the
+ * concatenation of AppInputClusterList and AppOutputClusterList).\n\n If the endpoint
+ * field does not correspond to an active endpoint, the remote device shall set the
+ * Status field to NOT_ACTIVE, set the StartIndex field to the value supplied in the
+ * request, and not include the AppClusterList field.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INVALID_EP \n
+ *                    #ZB_ZDP_NOT_ACTIVE \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_NO_DESCRIPTOR
+ * @param[out] addr16 Network address for the request
+ * @param[out] ep The endpoint on the destination
+ * @param[out] app_input_cluster_count The total count of application input cluster in
+ *                                    the simple descriptor for this endpoint
+ * @param[out] app_output_cluster_count The total count of application output cluster in
+ *                                     the simple descriptor for this endpoint
+ * @param[out] start_idx Starting index within the AppClusterList of the response
+ *                       represented by an ordered list of the Application Input
+ *                       Cluster List and Application Output Cluster List from the
+ *                       Simple Descriptor for this endpoint.
+ * @param[out] app_cluster_list A concatenated, ordered list of the AppInputClusterList
+ *                              and AppOutputClusterList, beginning with StartIndex,
+ *                              from the Simple Descriptor.
+ *                              This field shall only be included in the frame if the
+ *                              status field is equal to ZB_ZDP_SUCCESS.
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_extended_simple_desc_req()
+ */
+typedef void (*zb_zdo_extended_simple_desc_rsp)(
+               unsigned char status,
+               nwk_addr addr16,
+               unsigned char ep,
+               unsigned char app_input_cluster_count,
+               unsigned char app_output_cluster_count,
+               unsigned char start_idx,
+               const unsigned char *app_cluster_list,
+               void *user_data);
+
+/**
+ * @brief Extended simple descriptor request
+ * @details The Extended_Active_EP_req command is generated from a local device wishing
+ * to acquire the list of endpoints on a remote device with simple descriptors. This
+ * command shall be unicast either to the remote device itself or to an alternative
+ * device that contains the discovery information of the remote device.n\n The
+ * Extended_Active_EP_req is used for devices which support more active
+ * endpoints than can be returned by a single Active_EP_req.
+ * The local device shall generate the Extended_Active_EP_req command using the
+ * format illustrated in Table 2.66.\n\n The NWKAddrOfInterest field shall contain the
+ * network address of the remote device for which the active endpoint list is
+ * required.\n\n The StartIndex field shall be set in the request to enable retrieval of
+ * lists of active endpoints from devices whose list exceeds the size of a single ASDU and
+ * where fragmentation is not supported.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] start_idx Starting index within the active endpoint list in the response
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_extended_simple_desc_rsp()
+ */
+int zb_zdo_extended_simple_desc_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char start_idx,
+               zb_zdo_extended_simple_desc_rsp cb,
+               void *user_data);
+
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
+/**
+ * @brief Matching descriptor response
+ * @details The Match_Desc_rsp is generated by a remote device in response to a
+ * Match_Desc_req either broadcast or directed to the remote device. This command
+ * shall be unicast to the originator of the Match_Desc_req command.
+ * The remote device shall generate the Match_Desc_rsp command using the format
+ * illustrated in Table 2.96. If the NWKAddrOfInterest field of the original
+ * Match_Desc_req was equal to the broadcast network address for all devices for
+ * which macRxOnWhenIdle = TRUE (0xfffd), the remote device shall apply the
+ * match criterion, as described below, that was specified in the original
+ * Match_Desc_req command to each of its simple descriptors. If the remote device
+ * is the coordinator or a router, it shall also apply the match criterion, as described
+ * below, to each simple descriptor that it may have obtained from each of its
+ * children.
+ * \n\n
+ * If the NWKAddrOfInterest field of the original Match_Desc_req was not equal to
+ * the broadcast network address for all devices for which macRxOnWhenIdle =
+ * TRUE (0xfffd), the remote device shall set the NWKAddrOfInterest field to the
+ * same network address that was specified in the original Match_Desc_req
+ * command.
+ * \n\n
+ * If the NWKAddrOfInterest field matches the network address of the remote
+ * device, it shall apply the match criterion, as described below, that was specified in
+ * the original Match_Desc_req command to each of its simple descriptors.
+ * If the NWKAddrOfInterest field does not match the network address of the
+ * remote device and it is an end device, it shall set the Status field to
+ * INV_REQUESTTYPE, set the MatchLength field to 0, and not include the
+ * MatchList field. If the NWKAddrOfInterest field does not match the network
+ * address of the remote device and it is the coordinator or a router, it shall determine
+ * whether the NWKAddrOfInterest field matches the network address of one of its
+ * children. If the NWKAddrOfInterest field does not match the network address of
+ * one of the children of the remote device, it shall set the Status field to
+ * DEVICE_NOT_FOUND, set the MatchLength field to 0, and not include the
+ * MatchList field.
+ * \n\n
+ * If the NWKAddrOfInterest matches the network address of one of the children of
+ * the remote device, it shall determine whether any simple descriptors for that
+ * device are available. If no simple descriptors are available for the child indicated
+ * by the NWKAddrOfInterest field, the remote device shall set the Status field to
+ * NO_DESCRIPTOR, set the MatchLength field to 0, and not include the
+ * MatchList field. If any simple descriptors are available for the child indicated by
+ * the NWKAddrOfInterest field, the remote device shall apply the match criterion,
+ * as described below, that was specified in the original Match_Desc_req command
+ * to each of these simple descriptors.
+ * \n\n
+ * The remote device shall apply the match criteria to each simple descriptor as follows.
+ * The remote device shall first check if the ProfileID
+ * field matches exactly the application profile identifier field of the simple
+ * descriptor. If the profileID field does not match exactly the remote device shall
+ * check if the Profile ID of the Match_desc_req matches the wildcard profile
+ * (0xFFFF) and the Profile ID of the Simple Descriptor is within the Standard range
+ * (a public profile) as dictated by document [B25]. 14 If the profile identifiers do not
+ * match, the remote device shall assume the match to be unsuccessful and perform
+ * no further matching.
+ * \n\n
+ * If the profile identifiers match, the remote device shall determine whether the
+ * match criteria contains a list of input clusters (the NumInClusters field is not equal
+ * to 0). If the match criteria contains a list of input clusters, the remote device shall
+ * check that at least one of the cluster identifiers listed in the InClusterList field
+ * matches one of the cluster identifiers in the application input cluster list field of
+ * the simple descriptor. If at least one matching input cluster is found, the remote
+ * device shall assume the match to be successful, note the identifier of the endpoint
+ * to which this simple descriptor refers and perform no further matching.
+ * If the remote device is unable to find any matching input clusters, it shall
+ * determine whether the match criterion contains a list of output clusters (the
+ * NumOutClusters field is not equal to 0). If the match criterion contains a list of
+ * output clusters, the remote device shall check that at least one of the cluster
+ * identifiers listed in the OutClusterList field matches one of the cluster identifiers
+ * in the application output cluster list field of the simple descriptor. If at least one
+ * matching output cluster is found, the remote device shall assume the match to be
+ * successful and note the identifier of the endpoint to which this simple descriptor
+ * refers. If the remote device is unable to find any output matching clusters, it shall
+ * assume the match to be unsuccessful.
+ * \n\n
+ * If the above procedure produces one or more matches, the remote device shall
+ * construct a separate Match_Desc_rsp command for each matching device
+ * (including itself). For each response, the Status field shall be set to SUCCESS, the
+ * NWKAddrOfInterest field shall be set to the address of the appropriate matching
+ * device, the MatchLength field shall be set to the number of simple descriptors that
+ * matched the criteria for the appropriate matching device, and the MatchList field
+ * shall contain an ascending list of the endpoints on which a simple descriptor
+ * matched the criteria for the appropriate matching device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_NO_DESCRIPTOR
+ * @param[out] addr16 Network address for the request
+ * @param[out] match_length The count of endpoint on the remote device that match the
+ *                          match the request criteria
+ * @param[out] match_list List of bytes each of which represents an 8-bit endpoint
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_match_desc_req()
+ */
+typedef void (*zb_zdo_match_desc_rsp)(
+               unsigned char status,
+               nwk_addr addr16,
+               unsigned char match_length,
+               unsigned char **match_list,
+               void *user_data);
+
+/**
+ * @brief Matching descriptor request
+ * @details The Match_Desc_req command is generated from a local device wishing to find
+ * remote devices supporting a specific simple descriptor match criterion. This
+ * command shall either be broadcast to all devices for which macRxOnWhenIdle =
+ * TRUE, or unicast. If the command is unicast, it shall be directed either to the
+ * remote device itself or to an alternative device that contains the discovery
+ * information of the remote device.
+ * \n\n
+ * The local device shall generate the Match_Desc_req command using the format
+ * illustrated in param list. The NWKAddrOfInterest field shall contain the network
+ * address indicating a broadcast to all devices for which macRxOnWhenIdle =
+ * TRUE (0xfffd) if the command is to be broadcast, or the network address of the
+ * remote device for which the match is required.
+ * The remaining fields shall contain the required criterion for which the simple
+ * descriptor match is requested. The ProfileID field shall contain the identifier of
+ * the profile for which the match is being sought or the wildcard profile ID of
+ * 0xFFFF.
+ * \n\n
+ * The NumInClusters field shall contain the number of elements in the InClusterList
+ * field. If the value of this field is 0, the InClusterList field shall not be included. If
+ * the value of the NumInClusters field is not equal to 0, the InClusterList field shall
+ * contain the list of input cluster identifiers for which the match is being sought.
+ * The NumOutClusters field shall contain the number of elements in the
+ * OutClusterList field. If the value of this field is 0, the OutClusterList field shall
+ * not be included. If the value of the NumOutClusters field is not equal to 0, the
+ * OutClusterList field shall contain the list of output cluster identifiers for which the
+ * match is being sought.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] profile_id Profile ID to be matched at the destination
+ * @param[in] num_in_clusters The number of input clusters provided for matching within
+ *                            the in_cluster_list
+ * @param[in] in_cluster_list List of input cluster ids to b used for matching
+ * @param[in] num_out_clusters The number of output clusters provided for matching within
+ *                             the out_cluster_list
+ * @param[in] out_cluster_list List of output cluster ids to b used for matching
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_match_desc_rsp()
+ */
+int zb_zdo_match_desc_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned short profile_id,
+               unsigned char num_in_clusters,
+               unsigned short *in_cluster_list,
+               unsigned char num_out_clusters,
+               unsigned short *out_cluster_list,
+               zb_zdo_match_desc_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Node descriptor response
+ * @details The Node_Desc_rsp is generated by a remote device in response to a
+ * Node_Desc_req directed to the remote device. This command shall be unicast to
+ * the originator of the Node_Desc_req command.
+ * \n\n
+ * The remote device shall generate the Node_Desc_rsp command using the format
+ * illustrated in param list. The NWKAddrOfInterest field shall match that specified
+ * in the original Node_Desc_req command. If the NWKAddrOfInterest field
+ * matches the network address of the remote device, it shall set the Status field to
+ * SUCCESS and include its node descriptor in the NodeDescriptor field.
+ * If the NWKAddrOfInterest field does not match the network address of the
+ * remote device and it is an end device, it shall set the Status field to
+ * INV_REQUESTTYPE and not include the NodeDescriptor field.\n\n If the
+ * NWKAddrOfInterest field does not match the network address of the remote
+ * device and it is the coordinator or a router, it shall determine whether the
+ * NWKAddrOfInterest field matches the network address of one of its children. If
+ * the NWKAddrOfInterest field does not match the network address of one of the
+ * children of the remote device, it shall set the Status field to
+ * DEVICE_NOT_FOUND and not include the NodeDescriptor field.\n\n If the
+ * NWKAddrOfInterest matches the network address of one of the children of the
+ * remote device, it shall determine whether a node descriptor for that device is
+ * available. If a node descriptor is not available for the child indicated by the
+ * NWKAddrOfInterest field, the remote device shall set the Status field to
+ * NO_DESCRIPTOR and not include the NodeDescriptor field.\n\n If a node descriptor
+ * is available for the child indicated by the NWKAddrOfInterest field, the remote
+ * device shall set the Status field to SUCCESS and include the node descriptor
+ * of the matching child device in the NodeDescriptor field.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_NO_DESCRIPTOR
+ * @param[out] addr16 Network address for the request
+ * @param[out] node_desc This field shall only be included in the frame if the
+ *                       status field is equal to ZB_ZDP_SUCCESS.
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_node_desc_req()
+ */
+typedef void (*zb_zdo_node_desc_rsp)(
+               unsigned char status,
+               nwk_addr addr16,
+               const zb_zdo_node_descriptor_h node_desc,
+               void *user_data);
+
+/**
+ * @brief Node descriptor request
+ * @details The Node_Desc_req command is generated from a local device wishing to inquire
+ * as to the node descriptor of a remote device. This command shall be unicast either
+ * to the remote device itself or to an alternative device that contains the discovery
+ * information of the remote device.
+ * \n\n
+ * The local device shall generate the Node_Desc_req command using the format
+ * illustrated in param list. The NWKAddrOfInterest field shall contain the network
+ * address of the remote device for which the node descriptor is required.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_node_desc_rsp()
+ */
+int zb_zdo_node_desc_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               zb_zdo_node_desc_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Power descriptor response
+ * @details The Power_Desc_rsp is generated by a remote device in response to a
+ * Power_Desc_req directed to the remote device. This command shall be unicast to
+ * the originator of the Power_Desc_req command.\n
+ * \n
+ * The remote device shall generate the Power_Desc_rsp command using the format
+ * illustrated in Table 2.93. The NWKAddrOfInterest field shall match that specified
+ * in the original Power_Desc_req command. If the NWKAddrOfInterest field
+ * matches the network address of the remote device, it shall set the Status field to
+ * SUCCESS and include its power descriptor in the PowerDescriptor field.
+ * If the NWKAddrOfInterest field does not match the network address of the
+ * remote device and it is an end device, it shall set the Status field to
+ * INV_REQUESTTYPE and not include the PowerDescriptor field. If the
+ * NWKAddrOfInterest field does not match the network address of the remote
+ * device and it is the coordinator or a router, it shall determine whether the
+ * NWKAddrOfInterest field matches the network address of one of its children. If
+ * the NWKAddrOfInterest field does not match the network address of one of the
+ * children of the remote device, it shall set the Status field to
+ * DEVICE_NOT_FOUND and not include the PowerDescriptor field.\n\n If the
+ * NWKAddrOfInterest matches the network address of one of the children of the
+ * remote device, it shall determine whether a power descriptor for that device is
+ * available. If a power descriptor is not available for the child indicated by the
+ * NWKAddrOfInterest field, the remote device shall set the Status field to
+ * NO_DESCRIPTOR and not include the PowerDescriptor field.\n\n If a power
+ * descriptor is available for the child indicated by the NWKAddrOfInterest field,
+ * the remote device shall set the Status field to SUCCESS and include the power
+ * descriptor of the matching child device in the PowerDescriptor field.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_NO_DESCRIPTOR
+ * @param[out] addr16 Network address for the request
+ * @param[out] power_desc This field shall only be included in the frame if the
+ * @                     status field is equal to ZB_ZDP_SUCCESS.
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_power_desc_req()
+ */
+typedef void (*zb_zdo_power_desc_rsp)(
+               unsigned char status,
+               nwk_addr addr16,
+               const zb_zdo_node_power_descriptor_h power_desc,
+               void *user_data);
+
+/**
+ * @brief Power descriptor request
+ * @details The Power_Desc_req command is generated from a local device wishing to
+ * inquire as to the power descriptor of a remote device. This command shall be
+ * unicast either to the remote device itself or to an alternative device that contains
+ * the discovery information of the remote device.
+ * \n\n
+ * The local device shall generate the Power_Desc_req command using the format
+ * illustrated in param list. The NWKAddrOfInterest field shall contain the network
+ * address of the remote device for which the power descriptor is required.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_power_desc_rsp()
+ */
+int zb_zdo_power_desc_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               zb_zdo_power_desc_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Complex descriptor response
+ * @details The Complex_Desc_rsp is generated by a remote device in response to a
+ * Complex_Desc_req directed to the remote device. This command shall be unicast
+ * to the originator of the Complex_Desc_req command.
+ * The remote device shall generate the Complex_Desc_rsp command using the
+ * format illustrated in param list. The NWKAddrOfInterest field shall match that
+ * specified in the original Complex_Desc_req command. If the
+ * NWKAddrOfInterest field matches the network address of the remote device but a
+ * complex descriptor does not exist, it shall set the Status field to
+ * NOT_SUPPORTED, set the Length field to 0, and not include the
+ * ComplexDescriptor field. If the NWKAddrOfInterest field matches the network
+ * address of the remote device and a complex descriptor exists, it shall set the Status
+ * field to SUCCESS, set the Length field to the length of the complex descriptor,
+ * and include its complex descriptor (see sub-clause 2.3.2.6) in the
+ * ComplexDescriptor field.\n
+ * \n
+ * If the NWKAddrOfInterest field does not match the network address of the
+ * remote device and it is an end device, it shall set the Status field to
+ * INV_REQUESTTYPE, set the Length field to 0, and not include the
+ * ComplexDescriptor field. If the NWKAddrOfInterest field does not match the
+ * network address of the remote device and it is the coordinator or a router, it shall
+ * determine whether the NWKAddrOfInterest field matches the network address of
+ * one of its children. If the NWKAddrOfInterest field does not match the network
+ * address of one of the children of the remote device, it shall set the Status field to
+ * DEVICE_NOT_FOUND, set the Length field to 0, and not include the
+ * ComplexDescriptor field.\n\n If the NWKAddrOfInterest matches the network
+ * address of one of the children of the remote device, it shall determine whether a
+ * complex descriptor for that device is available. If a complex descriptor is not
+ * available for the child indicated by the NWKAddrOfInterest field, the remote
+ * device shall set the Status field to NO_DESCRIPTOR, set the Length field to 0,
+ * and not include the ComplexDescriptor field.\n\n If a complex descriptor is available
+ * for the child indicated by the NWKAddrOfInterest field, the remote device shall
+ * set the Status field to SUCCESS, set the Length field to the length of the complex
+ * descriptor for that device, and include the complex descriptor of the matching
+ * child device in the ComplexDescriptor field.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_NO_DESCRIPTOR
+ * @param[out] addr16 Network address for the request
+ * @param[out] length Length in bytes of the complex_desc field
+ * @param[out] complex_desc This field shall only be included in the frame if the
+ * @                        status field is equal to ZB_ZDP_SUCCESS.
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_complex_desc_req()
+ */
+typedef void (*zb_zdo_complex_desc_rsp)(
+               unsigned char status,
+               nwk_addr addr16,
+               unsigned char length,
+               unsigned char *complex_desc,
+               void *user_data);
+
+/**
+ * @brief Complex descriptor request
+ * @details The Complex_Desc_req command is generated from a local device wishing to
+ * inquire as to the complex descriptor of a remote device. This command shall be
+ * unicast either to the remote device itself or to an alternative device that contains
+ * the discovery information of the remote device.
+ * \n
+ * The local device shall generate the Complex_Desc_req command using the
+ * format illustrated in param list. The NWKAddrOfInterest field shall contain the
+ * network address of the remote device for which the complex descriptor is
+ * required.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_complex_desc_rsp()
+ */
+int zb_zdo_complex_desc_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               zb_zdo_complex_desc_rsp cb,
+               void *user_data);
+
+/**
+ * @brief User descriptor response
+ * @details The User_Desc_rsp is generated by a remote device in response to a
+ * User_Desc_req directed to the remote device. This command shall be unicast to
+ * the originator of the User_Desc_req command.\n
+ * \n
+ * The remote device shall generate the User_Desc_rsp command using the format
+ * illustrated in Table 2.98. The NWKAddrOfInterest field shall match that specified
+ * in the original User_Desc_req command. If the NWKAddrOfInterest field
+ * matches the network address of the remote device but a user descriptor does not
+ * exist, it shall set the Status field to NO_DESCRIPTOR, set the Length field to 0,
+ * and not include the UserDescriptor field. If the NWKAddrOfInterest field
+ * matches the network address of the remote device and a user descriptor exists, it
+ * shall set the Status field to SUCCESS, set the Length field to the length of the user
+ * descriptor, and include its user descriptor in the UserDescriptor field.
+ * If the NWKAddrOfInterest field does not match the network address of the
+ * remote device and it is an end device, it shall set the Status field to
+ * INV_REQUESTTYPE, set the Length field to 0, and not include the
+ * UserDescriptor field.\n\n If the NWKAddrOfInterest field does not match the network
+ * address of the remote device and it is the coordinator or a router, it shall determine
+ * whether the NWKAddrOfInterest field matches the network address of one of its
+ * children.\n\n If the NWKAddrOfInterest field does not match the network address of
+ * one of the children of the remote device, it shall set the Status field to
+ * DEVICE_NOT_FOUND, set the Length field to 0, and not include the
+ * UserDescriptor field.\n\n If the NWKAddrOfInterest matches the network address of
+ * one of the children of the remote device, it shall determine whether a user
+ * descriptor for that device is available.\n\n If a user descriptor is not available for the
+ * child indicated by the NWKAddrOfInterest field, the remote device shall set the
+ * Status field to NO_DESCRIPTOR, set the Length field to 0, and not include the
+ * UserDescriptor field.\n\n If a user descriptor is available for the child indicated by the
+ * NWKAddrOfInterest field, the remote device shall set the Status field to
+ * SUCCESS, set the Length field to the length of the user descriptor for that device,
+ * and include the user descriptor of the matching child device in the UserDescriptor
+ * field.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    #ZB_ZDP_DEVICE_NOT_FOUND \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ *                    #ZB_ZDP_NO_DESCRIPTOR
+ * @param[out] addr16 Network address for the request
+ * @param[out] length Length in bytes of the user_desc field
+ * @param[out] user_desc This field shall only be included in the frame if the
+ *                            status field is equal to ZB_ZDP_SUCCESS.
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_user_desc_req()
+ */
+typedef void (*zb_zdo_user_desc_rsp)(
+               unsigned char status,
+               nwk_addr addr16,
+               unsigned char len,
+               unsigned char *user_desc,
+               void *user_data);
+
+/**
+ * @brief Complex descriptor request
+ * @details The User_Desc_req command is generated from a local device wishing to inquire
+ * as to the user descriptor of a remote device. This command shall be unicast either
+ * to the remote device itself or to an alternative device that contains the discovery
+ * information of the remote device.
+ * \n
+ * The local device shall generate the User_Desc_req command using the format
+ * illustrated in Table 2.53. The NWKAddrOfInterest field shall contain the network
+ * address of the remote device for which the user descriptor is required.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_complex_desc_rsp()
+ */
+int zb_zdo_user_desc_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               zb_zdo_user_desc_rsp cb,
+               void *user_data);
+/**
+ * @brief User descriptor confirm response
+ * @details The User_Desc_conf is generated by a remote device in response to a
+ * User_Desc_set directed to the remote device. This command shall be unicast to
+ * the originator of the User_Desc_set command.
+ * \n
+ * The remote device shall generate the User_Desc_conf command using the format
+ * illustrated in param list. The NWKAddrOfInterest field shall match that
+ * specified in the original User_Desc_set command. If the NWKAddrOfInterest
+ * field matches the network address of the remote device but a user descriptor does
+ * not exist, it shall set the Status field to NOT_SUPPORTED. If the
+ * NWKAddrOfInterest field matches the network address of the remote device and
+ * a user descriptor exists, it shall set the Status field to SUCCESS and configure the
+ * user descriptor with the ASCII character string specified in the original
+ * User_Desc_set command.\n
+ * \n
+ * If the NWKAddrOfInterest field does not match the network address of the
+ * remote device and it is an end device, it shall set the Status field to
+ * INV_REQUESTTYPE.\n\n If the NWKAddrOfInterest field does not match the
+ * network address of the remote device and it is the coordinator or a router, it shall
+ * determine whether the NWKAddrOfInterest field matches the network address of
+ * one of its children. If the NWKAddrOfInterest field does not match the network
+ * address of one of the children of the remote device, it shall set the Status field to
+ * DEVICE_NOT_FOUND.\n\n If the NWKAddrOfInterest matches the network
+ * address of one of the children of the remote device, it shall determine whether a
+ * user descriptor for that device is available. If a user descriptor is not available for
+ * the child indicated by the NWKAddrOfInterest field, the remote device shall set
+ * the Status field to NO_DESCRIPTOR.\n\n If a user descriptor is available for the
+ * child indicated by the NWKAddrOfInterest field, the remote device shall set the
+ * Status field to SUCCESS and configure the user descriptor with the ASCII
+ * character string specified in the original User_Desc_set command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    returned value from NLME-GET.confirm primitive \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_user_desc_req()
+ */
+typedef void (*zb_zdo_user_desc_conf)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief User descriptor set request
+ * @details The User_Desc_set command is generated from a local device wishing to
+ * configure the user descriptor on a remote device. This command shall be unicast
+ * either to the remote device itself or to an alternative device that contains the
+ * discovery information of the remote device.
+ * \n\n
+ * The local device shall generate the User_Desc_set command using the format
+ * illustrated in param list. The NWKAddrOfInterest field shall contain the network
+ * address of the remote device for which the user descriptor is to be configured and
+ * the UserDescription field shall contain the ASCII character string that is to be
+ * configured in the user descriptor. Characters with ASCII codes numbered 0x00
+ * through 0x1f are not permitted to be included in this string.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] len Length of the user_desc filed in bytes
+ * @param[in] user_desc Pointer of user description
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_user_desc_conf()
+ */
+int zb_zdo_user_desc_set(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char len,
+               unsigned char *user_desc,
+               zb_zdo_user_desc_conf cb,
+               void *user_data);
+
+/**
+ * @brief device announce request
+ * @details The Device_annce is provided to enable ZigBee devices on the network to notify
+ * other ZigBee devices that the device has joined or re-joined the network,
+ * identifying the device's 64-bit IEEE address and new 16-bit NWK address, and
+ * informing the Remote Devices of the capability of the ZigBee device.\n\n This
+ * command shall be invoked for all ZigBee end devices upon join or rejoin. This
+ * command may also be invoked by ZigBee routers upon join or rejoin as part of
+ * NWK address conflict resolution.\n\n The destination addressing on this primitive is
+ * broadcast to all devices for which macRxOnWhenIdle = TRUE.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 The IEEE address for device of interest
+ * @param[in] capability See zb_zdo_mac_capability_field_e in zb-zdo.h header file
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_user_desc_conf()
+ */
+int zb_zdo_device_annce(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               unsigned char capability);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZDO_DEVICE_DISCOVERY_H__ */
diff --git a/include/zdo/zb-zdo-nwk-mgr.h b/include/zdo/zb-zdo-nwk-mgr.h
new file mode 100644 (file)
index 0000000..4c22040
--- /dev/null
@@ -0,0 +1,712 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZDO_NETWORK_MANAGER_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZDO_NETWORK_MANAGER_H__
+
+#include <zdo/zb-zdo-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zdo-nwk-mgr.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZDO_NETWORK_MANAGER_MODULE Network Manager
+ *
+ * @brief zigbee provides API for Network Management.
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_NETWORK_MANAGER_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_NETWORK_MANAGER_OVERVIEW Overview
+ * This API set consists of ZDP network manager API
+ *
+ * @{
+ */
+
+/**
+ * @brief Network management discovery response
+ * @details The Mgmt_NWK_Disc_rsp is generated in response to an Mgmt_NWK_Disc_req.
+ * If this management command is not supported, a status
+ * of NOT_SUPPORTED shall be returned and all parameter fields after the Status
+ *  field shall be omitted.\n\n Otherwise, the Remote Device shall implement the
+ *  following process.\n\n
+ *  Upon receipt of and after support for the Mgmt_NWK_Disc_req has been
+ *  verified, the Remote Device shall issue an NLME-NETWORK-
+ *  DISCOVERY.request primitive using the ScanChannels and ScanDuration
+ *  parameters, supplied in the Mgmt_NWK_Disc_req command.\n\n Upon receipt of the
+ *  NLME-NETWORK-DISCOVERY.confirm primitive, the Remote Device shall
+ *  report the results, starting with the StartIndex element, via the\
+ *  Mgmt_NWK_Disc_rsp command.\n\n The NetworkList field shall contain whole
+ *  NetworkList records, formatted as specified in Table 2.125, until the limit on
+ *  MSDU size, i.e., aMaxMACFrameSize (see [B1]), is reached.\n\n The number of
+ *  results reported shall be set in the NetworkListCount.\n\n
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status ZB_ZDP_NOT_SUPPORTED or returned value from NLME-NETWORK.DISCOVERY.
+ *                    request
+ * @param[out] network_count The total number of networks reported by the NLME-NETWORK-
+ *                           DISCOVERY.confirm.
+ * @param[out] start_idx The starting point in the NetworkList from the NLME-NETWORK-
+ *                       DISCOVERY.confirm where reporting begins for this response.
+ * @param[out] network_list_count The number of network list descriptors reported within
+ *                                this response.
+ * @param[out] nwk_list A list of network list descriptors.
+ * @param[out] user_data User data
+ *
+ * @see zb_zdo_mgmt_nwk_disc_req()
+ */
+typedef void (*zb_zdo_mgmt_nwk_disc_rsp)(
+               unsigned char status,
+               unsigned char network_count,
+               unsigned char start_idx,
+               unsigned char network_list_count,
+               const zb_zdo_network_list_record_h *nwk_list,
+               void *user_data);
+
+/**
+ * @brief Bitmask to scan all 802.15.4 channels.
+ */
+#define ZB_802_15_4_CHANNELS_MASK 0x07FFF800UL
+
+/**
+ * @brief Network discover management request
+ * @details The Mgmt_NWK_Disc_req is generated from a Local Device requesting that the
+ * Remote Device execute a Scan to report back networks in the vicinity of the Local
+ * Device.\n\n The destination addressing on this command shall be unicast.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 destination address
+ * @param[in] scan_channels The five most significant bits (b27,...,b31) are reserved.
+ *                          The 27 least significant bits (b0, b1,... b26) indicate
+ *                          which channels are to be scanned (1 = scan, 0 = do not scan)
+ *                          for each of the 27 valid channels.
+ * @param[in] scan_duration A value used to calculate the length of time to spend
+ *                          scanning each channel. The time spent scanning each channel is
+ *                          (aBaseSuperframeDuration * (2 n + 1)) symbols, where n is
+ *                          the value of the ScanDuration parameter. For more information
+ *                          on MAC sub-layer scanning
+ * @param[in] scan_count A number of beacon-request in one scan-duration
+ * @param[in] start_idx Starting index
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_nwk_disc_rsp()
+ */
+int zb_zdo_mgmt_nwk_disc_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned int scan_channels,
+               unsigned char scan_duration,
+               unsigned char scan_count,
+               unsigned char start_idx,
+               zb_zdo_mgmt_nwk_disc_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Network management LQI response
+ * @details The Recover_Source_Bind_rsp is generated from a backup binding table cache
+ * device in response to a Recover_Source_Bind_req from a primary binding table
+ * cache and contains the status of the request.\n\n This command shall be unicast to the
+ * requesting device. If the responding device is not a backup binding table cache, it
+ * shall return a status of NOT_SUPPORTED.\n\n If the originator of the request is not
+ * recognized as a primary binding table cache, it shall return a status of
+ * INV_REQUESTTYPE. \n\n Otherwise, the backup binding table cache shall prepare a
+ * list of binding table entries from its backup beginning with StartIndex. \n\n It will
+ * fit in as many entries as possible into a Recover_Source_Bind_rsp command and return
+ * a status of SUCCESS.\n\n If StartIndex is more than the number of entries in the
+ * Source table, a status of NO_ENTRY is returned.\n\n For a successful response,
+ * SourceTableEntries is the total number of entries in the backup source table, and
+ * SourceTableListCount is the number of entries which is being returned in the
+ * response.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    #ZB_ZDP_TABLE_FULL \n
+ *                    #ZB_ZDP_INV_REQUESTTYPE \n
+ * @param[out] source_table_entries Total number of source table entries in the backup
+ *                                  binding cache.
+ * @param[out] start_idx Starting index within the neighbor table to begin reporting for
+ *                       the neighbor table list.
+ * @param[out] neighbor_table_list_count The number of neighbor table entries included
+ *                                       within neighbor table list.
+ * @param[out] neighbor_table_list A list of neighbor table list.
+ * @param[out] user_data User data
+ *
+ * @see zb_zdo_mgmt_lqi_req()
+ */
+typedef void (*zb_zdo_mgmt_lqi_rsp)(
+               unsigned char status,
+               unsigned char neighbor_table_entries,
+               unsigned char start_idx,
+               unsigned char neighbor_table_list_count,
+               const zb_zdo_neighbor_table_desc_h *neighbor_table_list,
+               void *user_data);
+
+/**
+ * @brief LQI management request
+ * @details The Mgmt_Lqi_req is generated from a Local Device wishing to obtain a
+ * neighbor list for the Remote Device along with associated LQI values to each
+ * neighbor. The destination addressing on this command shall be unicast only and
+ * the destination address must be that of a ZigBee Coordinator or ZigBee Router.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 destination address
+ * @param[in] start_idx Starting index for the requested elements of the neighbor table
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_lqi_rsp()
+ */
+int zb_zdo_mgmt_lqi_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char start_idx,
+               zb_zdo_mgmt_lqi_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Routing management response
+ * @details The Mgmt_Rtg_rsp is generated in response to an Mgmt_Rtg_req. If this
+ * management command is not supported, a status of NOT_SUPPORTED shall be
+ * returned and all parameter fields after the Status field shall be omitted. Otherwise,
+ * the Remote Device shall implement the following processing.
+ * Upon receipt of and after support for the Mgmt_Rtg_req has been verified, the
+ * Remote Device shall perform an NLME-GET.request (for the nwkRouteTable
+ * attribute) and process the resulting NLME-GET.confirm (containing the
+ * nwkRouteTable attribute) to create the Mgmt_Rtg_rsp command. The
+ * Mgmt_Rtg_rsp command shall contain the same status that was contained in the
+ * NLME-GET.confirm primitive and if this was not SUCCESS, all parameter fields
+ * after the status field shall be omitted.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    returned value from NLME-GET.confirm  primitive \n
+ * @param[out] routing_table_entries Total number of routing table entries within the
+ *                                   remote device.
+ * @param[out] start_idx Starting index within the Routing Table to begin reporting for
+ *                       the RoutingTableList.
+ * @param[out] routing_table_list_count The number of routing table entries included
+ *                                      within RoutingTableList.
+ * @param[out] neighbor_table_list A list of routing table list.
+ * @param[out] user_data User data
+ *
+ * @see zb_zdo_mgmt_rtg_req()
+ */
+typedef void (*zb_zdo_mgmt_rtg_rsp)(
+               unsigned char status,
+               unsigned char routing_table_entries,
+               unsigned char start_idx,
+               unsigned char routing_table_list_count,
+               const zb_zdo_routing_table_h *routing_table_list,
+               void *user_data);
+
+/**
+ * @brief Routing management request
+ * @details The Mgmt_Rtg_req is generated from a Local Device wishing to retrieve the
+ * ontents of the Routing Table from the Remote Device. The destination
+ * addressing on this command shall be unicast only and the destination address
+ * must be that of the ZigBee Router or ZigBee Coordinator.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 destination network address
+ * @param[in] start_idx Starting index for the requested elements of the routing table
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_rtg_rsp()
+ */
+int zb_zdo_mgmt_rtg_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char start_idx,
+               zb_zdo_mgmt_rtg_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Binding management response
+ * @details The Mgmt_Bind_rsp is generated in response to a Mgmt_Bind_req. If this
+ * management command is not supported, a status of NOT_SUPPORTED shall be
+ * returned and all parameter fields after the Status field shall be omitted. Otherwise,
+ * the Remote Device shall implement the following processing.\n\n
+ * Upon receipt of and after support for the Mgmt_Bind_req has been verified, the
+ * Remote Device shall perform an APSME-GET.request (for the apsBindingTable
+ * attribute) and process the resulting APSME-GET.confirm (containing the
+ * apsBindingTable attribute) to create the Mgmt_Bind_rsp command. The
+ * Mgmt_Bind_rsp command shall contain the same status that was contained in the
+ * APSME-GET.confirm primitive and if this was not SUCCESS, all parameter
+ * fields after the status field shall be omitted.\n\n
+ * From the apsBindingTable attribute, the binding table shall be accessed, starting
+ * with the index specified by StartIndex, and moved to the BindingTableList field of
+ * the Mgmt_Bind_rsp command. The entries reported from the binding table shall
+ * be those, starting with StartIndex and including whole BindingTableList records
+ * until the MSDU size limit, i.e., aMaxMACFrameSize,
+ * is reached. Within the Mgmt_Bind_Rsp command, the BindingTableEntries field
+ * shall represent the total number of Binding Table entries in the Remote Device.
+ * The BindingTableListCount field shall be the number of entries reported in the
+ * BindingTableList field of the Mgmt_Bind_req command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    returned value from NLME-GET.confirm primitive \n
+ * @param[out] binding_table_entries Total number of Binding Table entries within the
+ *                                  Remote Device.
+ * @param[out] start_idx Starting index within the Binding Table to begin reporting for
+ *                      the BindingTableList.
+ * @param[out] binding_table_list_count The number of binding table entries included
+ *                                      within BindingTableList.
+ * @param[out] neighbor_table_list A list of routing table list.
+ * @param[out] user_data User data
+ *
+ * @see zb_zdo_mgmt_bind_req()
+ */
+typedef void (*zb_zdo_mgmt_bind_rsp)(
+               unsigned char status,
+               unsigned char binding_table_entries,
+               unsigned char start_idx,
+               unsigned char binding_table_list_count,
+               const zb_zdo_binding_table_h *binding_table_list,
+               void *user_data);
+
+/**
+ * @brief Binding management request
+ * @details The Mgmt_Bind_req is generated from a Local Device wishing to retrieve the
+ * contents of the Binding Table from the Remote Device.  \n\n The destination
+ * addressing on this command shall be unicast only and the destination address
+ * must be that of a Primary binding table cache or source device holding its own
+ * binding table.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 destination network address
+ * @param[in] start_idx Starting index for the requested elements of the binding table
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_bind_rsp()
+ */
+int zb_zdo_mgmt_bind_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char start_idx,
+               zb_zdo_mgmt_bind_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Leave management response
+ * @details The Mgmt_Leave_rsp is generated in response to a Mgmt_Leave_req. \n\n If this
+ * management command is not supported, a status of NOT_SUPPORTED shall be
+ * returned. \n\n Otherwise, the Remote Device shall implement the following
+ * processing.
+ * Upon receipt of and after support for the Mgmt_Leave_req has been verified, the
+ * Remote Device shall execute the NLME-LEAVE.request to disassociate from the
+ * currently associated network. The Mgmt_Leave_rsp shall contain the same status
+ * that was contained in the NLME-LEAVE.confirm primitive. \n\n
+ * Once a device has disassociated, it may execute pre-programmed logic to perform
+ * NLME-NETWORK-DISCOVERY and NLME-JOIN to join/re-join a network.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    #ZB_ZDP_NOT_AUTHORIZED \n
+ *                    returned value from NLME-LEAVE.confirm primitive \n
+ * @param[out] user_data User data
+ *
+ * @see zb_zdo_mgmt_leave_req()
+ */
+typedef void (*zb_zdo_mgmt_leave_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Leave device management request
+ * @details The Mgmt_Bind_req is generated from a Local Device wishing to retrieve the
+ * contents of the Binding Table from the Remote Device.\n\n The destination
+ * addressing on this command shall be unicast only and the destination address
+ * must be that of a Primary binding table cache or source device holding its own
+ * binding table.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr64 The IEEE address for designated device to leave
+ * @param[in] remove_children This field has a value of 1 if the device being asked to
+ *                            leave the network is also being asked to remove its child
+ *                            devices, if any. Otherwise, it has a value of 0.
+ * @param[in] rejoin This field has a value of 1 if the device being asked to leave from
+ *                   the current parent is requested to rejoin the network. Otherwise,
+ *                   it has a value of 0.
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_leave_rsp()
+ */
+int zb_zdo_mgmt_leave_req(
+               zigbee_h handle,
+               ieee_addr addr64,
+               bool remove_children,
+               bool rejoin,
+               zb_zdo_mgmt_leave_rsp cb,
+               void *user_data);
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+/**
+ * @brief Direct join management response
+ * @details The Mgmt_Direct_Join_rsp is generated in response to a Mgmt_Direct_Join_req.
+ * If this management command is not supported, a status of NOT_SUPPORTED
+ * shall be returned.\n\n Otherwise, the Remote Device shall implement the following
+ * processing.\n\n
+ * Upon receipt and after support for the Mgmt_Direct_Join_req has been verified,
+ * the Remote Device shall execute the NLME-DIRECT-JOIN.request to directly
+ * associate the DeviceAddress contained in the Mgmt_Direct_Join_req to the
+ * network.\n\n The Mgmt_Direct_Join_rsp shall contain the same status that was
+ * contained in the NLME-DIRECT-JOIN.confirm primitive.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    #ZB_ZDP_NOT_AUTHORIZED \n
+ *                    returned value from NLME-DIRECT-JOIN.confirm primitive \n
+ * @param[out] user_data User data
+ *
+ * @see zb_zdo_mgmt_direct_join_rsp()
+ */
+typedef void (*zb_zdo_mgmt_direct_join_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Direct join device management request
+ * @details The Mgmt_Direct_Join_req is generated from a Local Device requesting that a
+ * Remote Device permit a device designated by DeviceAddress to join the network
+ * directly.\n\n The Mgmt_Direct_Join_req is generated by a management application
+ * which directs the request to a Remote Device where the NLME-DIRECT-
+ * JOIN.request is to be executed using the parameter supplied by
+ * Mgmt_Direct_Join_req.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr64 The IEEE address for designated device to leave
+ * @param[in] capability See zb_zdo_mac_capability_field_e in zb-zdo.h header file
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_direct_join_rsp()
+ */
+int zb_zdo_mgmt_direct_join_req(
+               zigbee_h handle,
+               ieee_addr addr64,
+               unsigned char capability,
+               zb_zdo_mgmt_direct_join_rsp cb,
+               void *user_data);
+
+#endif /* ZB_SUPPORT_PRIORITY_5*/
+
+/**
+ * @brief Permit joining management response
+ * @details The Mgmt_Permit_Joining_rsp is generated in response to a unicast
+ * Mgmt_Permit_Joining_req.\n\n In the description which follows, note that no
+ * response shall be sent if the Mgmt_Permit_Joining_req was received as a
+ * broadcast to all routers.\n\n If this management command is not permitted by the
+ * requesting device, a status of INVALID_REQUEST shall be returned.\n\n Upon
+ * receipt and after support for Mgmt_Permit_Joining_req has been verified, the
+ * Remote Device shall execute the NLME-PERMIT-JOINING.request.\n\n The
+ * Mgmt_Permit-Joining_rsp shall contain the same status that was contained in the
+ * NLME-PERMIT-JOINING.confirm primitive.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    #ZB_ZDP_NOT_AUTHORIZED \n
+ *                    returned value from NLME-DIRECT-JOINING.confirm primitive \n
+ * @param[out] user_data User data
+ *
+ * @see zb_zdo_mgmt_direct_join_rsp()
+ */
+typedef void (*zb_zdo_mgmt_permit_joining_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Permit join device management request
+ * @details The Mgmt_Permit_Joining_req is generated from a Local Device requesting that
+ * a remote device or devices allow or disallow association.\n\n The
+ * Mgmt_Permit_Joining_req is generated by a management application or
+ * commissioning tool which directs the request to a remote device(s) where the
+ * NLME-PERMIT-JOINING.request is executed using the PermitDuration
+ * parameter supplied by Mgmt_Permit_Joining_req.\n\n Additionally, if the remote
+ * device is the Trust Center and TC_Significance is set to 1, the Trust Center
+ * authentication policy will be affected. The addressing may be unicast or
+ * 'broadcast to all routers and coordinator'.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 destination network address
+ * @param[in] permit_duration The length of time in seconds during which the ZigBee
+ *                            coordinator or router will allow associations. \n
+ *                            The value 0x00 and 0xff indicate that permission is
+ *                            disabled or enabled, respectively, without a specified time
+ *                            limit.
+ * @param[in] tc_significance If this is set to 0x01 and the remote device is the Trust Center,
+ *                            the command affects the Trust Center authentication policy as
+ *                            described in the sub-clauses below; \n \n
+ *                            If this is set to 0x00, there is no effect on the Trust Center.
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_permit_joining_rsp()
+ */
+int zb_zdo_mgmt_permit_joining_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char permit_duration,
+               unsigned char tc_significance,
+               zb_zdo_mgmt_permit_joining_rsp cb,
+               void *user_data);
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+/**
+ * @brief Cache management response
+ * @details The Mgmt_Cache_rsp is generated in response to an Mgmt_Cache_req. If this
+ * management command is not supported, or the Remote Device is not a Primary
+ * Cache Device, a status of NOT_SUPPORTED shall be returned and all parameter
+ * fields after the Status field shall be omitted. Otherwise, the Remote Device shall
+ * implement the following processing.\n\n Upon receipt of the Mgmt_Cache_req and
+ * after support for the Mgmt_Cache_req has been verified, the Remote Device shall
+ * access an internally maintained list of registered ZigBee End Devices utilizing the
+ * discovery cache on this Primary Discovery Cache device.\n\n The entries reported
+ * shall be those, starting with StartIndex and including whole DiscoveryCacheList
+ * records (see Table 2.139) until the limit on MSDU size, i.e., aMaxMACFrameSize
+ * (see [B1]), is reached.\n\n Within the Mgmt_Cache_rsp command, the
+ * DiscoveryCacheListEntries field shall represent the total number of registered
+ * entries in the Remote Device. The parameter DiscoveryCacheListCount shall be
+ * the number of entries reported in the DiscoveryCacheList field of the
+ * Mgmt_Cache_rsp command.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ * @param[out] discovery_cache_entries discovery cache entries
+ * @param[out] start_idx data User data
+ * @param[out] discovery_cache_list_count The list shall contain the number of elements
+ *                                        given by the DiscoveryCacheListCount parameter.
+ * @param[out] discover_cache_list A list of descriptors.
+ * @param[out] user_data User data
+ *
+ * @see zb_zdo_mgmt_cache_req()
+ */
+typedef void (*zb_zdo_mgmt_cache_rsp)(
+               unsigned char status,
+               unsigned char discovery_cache_entries,
+               unsigned char start_idx,
+               unsigned char discovery_cache_list_count,
+               const zb_zdo_discovery_cache_h *discover_cache_list,
+               void *user_data);
+
+/**
+ * @brief Cache management request
+ * @details The Mgmt_Cache_req is provided to enable ZigBee devices on the network to
+ * retrieve a list of ZigBee End Devices registered with a Primary Discovery Cache
+ * device.\n\n The destination addressing on this primitive shall be unicast.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 destination network address
+ * @param[in] start_idx Starring index for the requested elements of the discover cache
+ *                      list
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_cache_rsp()
+ */
+int zb_zdo_mgmt_cache_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               unsigned char start_idx,
+               zb_zdo_mgmt_cache_rsp cb,
+               void *user_data);
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
+#if 0 /* This will be handled evnt_handler */
+/**
+ * @brief Update network management notify
+ * @details The Mgmt_NWK_Update_notify is provided to enable ZigBee devices to report
+ * @the condition on local channels to a network manager. The scanned channel list is
+ * @the report of channels scanned and it is followed by a list of records, one for each
+ * @channel scanned, each record including one byte of the energy level measured
+ * @during the scan, or 0xff if there is too much interference on this channel.
+ * @When sent in response to a Mgmt_NWK_Update_req command the status field
+ * @shall represent the status of the request. When sent unsolicited the status field
+ * @shall be set to SUCCESS.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] addr16 source address from
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INVALID_REQUEST \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ *                    any status value returned from the PLME-SET.confirm primitive
+ * @param[out] scanned_channels List of channels scanned by the request
+ * @param[out] total_transmissions Count of the total transmissions reported by the
+ *                                 device.
+ * @param[out] transmission_failures Sum ot the total transmissions failure reported by
+ *                                   the end device.
+ * @param[out] scanned_channel_list_count The list shall contain the number of records
+ *                                        contained in the EnergyValues parameter.
+ * @param[out] energy_values The result of an energy measurement made on this
+ *                           channel in accordance with.
+ *
+ * @see zb_zdo_mgmt_nwk_update_req()
+ */
+typedef void (*zb_zdo_mgmt_nwk_update_noti)(
+               nwk_addr addr16,
+               unsigned char status,
+               unsigned int scanned_channels,
+               unsigned short total_transmissions,
+               unsigned short transmission_failures,
+               unsigned char scanned_channel_list_count,
+               unsigned char *energy_values);
+#endif
+/**
+ * @brief Update network management request
+ * @details This command is provided to allow updating of network configuration parameters
+ * or to request information from devices on network conditions in the local
+ * operating environment.\n\n The destination addressing on this primitive shall be
+ * unicast or broadcast to all devices for which macRxOnWhenIdle = TRUE.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] scan_channels The five most significant bits (b27,...,b31) are reserved.
+ *                         The 27 least significant bits (b0, b1,... b26) indicate
+ *                         which channels are to be scanned (1 = scan, 0 = do not scan)
+ *                         for each of the 27 valid channels.
+ * @param[in] scan_duration A value used to calculate the length of time to spend
+ *                         scanning each channel.\n The time spent scanning each channel
+ *                         is (aBaseSuperframeDuration * (2 n + 1)) symbols, where n is
+ *                         the value of the ScanDuration parameter. For more information
+ *                         on MAC sub-layer scanning
+ * @param[in] scan_count This field represents the number of energy scan to be conducted
+ *                      and reported
+ * @param[in] nwk_update_id The value of the nwkUpdateId contained in this request.
+ *                         This value is set by the Network Channel Manager prior to
+ *                         sending the message. \n
+ *                         This field shall only be present of the ScanDuration is 0xfe
+ *                         or 0xff. If the ScanDuration is 0xff, then the value in the
+ *                         nwkUpdateID shall be ignored. \n
+ * @param[in] nwk_manager_addr This field shall be present only if the ScanDuration is set
+ *                            to 0xff, and, where present, indicates the NWK address for
+ *                            the device with the Network Manager bit set in its Node
+ *                            Descriptor
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_INVALID_ADDRESS Invalid address
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_mgmt_nwk_update_noti()
+ */
+int zb_zdo_mgmt_nwk_update_req(
+               zigbee_h handle,
+               unsigned int scan_channels,
+               unsigned char scan_duration,
+               unsigned char scan_count,
+               unsigned char nwk_update_id,
+               nwk_addr nwk_manager_addr);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZDO_NETWORK_MANAGER_H__ */
diff --git a/include/zdo/zb-zdo-svc-disc.h b/include/zdo/zb-zdo-svc-disc.h
new file mode 100644 (file)
index 0000000..1a05682
--- /dev/null
@@ -0,0 +1,570 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_ZDO_SERVICE_DISCOVERY_H__
+#define __TIZEN_NETWORK_ZIGBEE_ZDO_SERVICE_DISCOVERY_H__
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+
+#include <zb-type.h>
+#include <zdo/zb-zdo-type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file zb-zdo-svc-disc.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @defgroup CAPI_NETWORK_ZIGBEE_ZDO_SERVICE_DISCOVERY_MODULE Service Discovery
+ *
+ * @brief zigbee provides API for Service Discover.
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_SERVICE_DISCOVERY_HEADER Header
+ *  \#include <zigbee.h>
+ *
+ * @section CAPI_NETWORK_ZIGBEE_ZDO_SERVICE_DISCOVERY_OVERVIEW Overview
+ * This API set consists of ZDP service discovery API
+ *
+ * @{
+ */
+
+/**
+ * @brief Find system server request's response
+ * @details The System_Server_Discovery_rsp is generated from Remote Devices on receipt
+ * of a System_Server_Discovery_req primitive if the parameter matches the Server
+ * Mask field in its node descriptor. If there is no match, the
+ * System_Server_Discovery_req shall be ignored and no response given. Matching
+ * is performed by masking the ServerMask parameter of the
+ * System_Server_Discovery_req with the Server Mask field in the node descriptor.
+ * This command shall be unicast to the device which sent
+ * System_Server_Discovery_req with Acknowledge request set in TxOptions. The
+ * parameter ServerMask contains the bits in the parameter of the request which
+ * match the server mask in the node descriptor.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    returned value from NLME-GET.confirm primitive \n
+ * @param[out] server_mask Server Mask Bit Assignment
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_system_server_discover_req()
+ */
+typedef void (*zb_zdo_system_server_discover_rsp)(
+               unsigned char status,
+               unsigned short server_mask,
+               void *user_data);
+
+/**
+ * @brief Find system server request
+ * @details The System_Server_Discovery_req is generated from a Local Device wishing to
+ * discover the location of a particular system server or servers as indicated by the
+ * ServerMask parameter.\n\n The destination addressing on this request is 'broadcast to
+ * all devices for which macRxOnWhenIdle = TRUE.'
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] server_mask Server Mask Bit Assignment
+ * @param[in] cb The callback function
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_system_server_discover_rsp()
+ */
+int zb_zdo_system_server_discover_req(
+               zigbee_h handle,
+               unsigned short server_mask,
+               zb_zdo_system_server_discover_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Find node cache request's response
+ * @details The Find_node_cache_rsp is provided to notify a Local Device of the successful
+ * iscovery of the Primary Discovery Cache device for the given NWKAddr and
+ * EEEAddr fields supplied in the request, or to signify that the device of interest is
+ * apable of responding to discovery requests.\n\n The Find_node_cache_rsp shall be
+ * enerated only by Primary Discovery Cache devices holding discovery
+ * nformation for the NWKAddr and IEEEAddr in the request or the device of
+ * nterest itself and all other Remote Devices shall not supply a response.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] cache_nwk_addr NWK Address for the Primary Discovery Cache device holding
+ *                            the discovery information.
+ * @param[out] addr16 Server NWK Address for the device of interest.
+ * @param[out] addr64 Server IEEE Address for the device of interest.
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_find_node_cache_req()
+ */
+typedef void (*zb_zdo_find_node_cache_rsp)(
+               nwk_addr cache_nwk_addr,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               void *user_data);
+
+/**
+ * @brief Find Node cache store request
+ * @details The Find_node_cache_req is provided to enable ZigBee devices on the network to
+ * broadcast to all devices for which macRxOnWhenIdle = TRUE a request to find a
+ * device on the network that holds discovery information for the device of interest,
+ * as specified in the request parameters.\n\n The effect of a successful
+ * Find_node_cache_req is to have the Primary Discovery Cache device, holding
+ * discovery information for the device of interest, unicast a Find_node_cache_rsp
+ * back to the Local Device. Note that, like the NWK_addr_req, only the device
+ * meeting this criteria shall respond to the request generated by
+ * Find_node_cache_req.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_remove_node_cache_rsp()
+ */
+int zb_zdo_find_node_cache_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               zb_zdo_find_node_cache_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Find discovery cache request's response
+ * @details The Find_node_cache_rsp is provided to notify a Local Device of the successful
+ * discovery of the Primary Discovery Cache device for the given NWKAddr and
+ * IEEEAddr fields supplied in the request, or to signify that the device of interest is
+ * capable of responding to discovery requests.\n\n The Find_node_cache_rsp shall be
+ * generated only by Primary Discovery Cache devices holding discovery
+ * information for the NWKAddr and IEEEAddr in the request or the device of
+ * interest itself and all other Remote Devices shall not supply a response.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    returned value from NLME-GET.confirm primitive \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_discovery_cache_req()
+ */
+typedef void (*zb_zdo_discovery_cache_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Discovery cache request
+ * @details The Discovery_Cache_req is provided to enable devices on the network to locate
+ * a Primary Discovery Cache device on the network.\n\n The destination addressing on
+ * this primitive shall be broadcast to all devices for which macRxOnWhenIdle =
+ * TRUE.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_remove_node_cache_rsp()
+ */
+int zb_zdo_discovery_cache_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               zb_zdo_discovery_cache_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Find discovery store request's response
+ * @details The Discovery_store_rsp is provided to notify a Local Device of the request status
+ * from a Primary Discovery Cache device. Included in the response is a status code
+ * to notify the Local Device whether the request is successful (the Primary Cache
+ * Device has space to store the discovery cache data for the Local Device), whether
+ * the request is unsupported (meaning the Remote Device is not a Primary
+ * Discovery Cache device), or insufficient space exists.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INSUFFICIENT_SPACE \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_discovery_store_req()
+ */
+typedef void (*zb_zdo_discovery_store_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Discovery store request
+ * @details The Discovery_store_req is provided to enable ZigBee end devices on the
+ * network to request storage of their discovery cache information on a Primary
+ * Discovery Cache device.\n\n Included in the request is the amount of storage space
+ * the Local Device requires.\n\n
+ * The destination addressing on this request is unicast.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] node_desc_size Size of node description structure
+ * @param[in] power_desc_size Size of power description structure
+ * @param[in] active_ep_size Number of active EP
+ * @param[in] simple_desc_count Number of simple description structure
+ * @param[in] simple_desc_list Pointer of simple description structure size
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_remove_node_cache_rsp()
+ */
+int zb_zdo_discovery_store_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               unsigned char node_desc_size,
+               unsigned char power_desc_size,
+               unsigned char active_ep_size,
+               unsigned char simple_desc_count,
+               unsigned char *simple_desc_list,
+               zb_zdo_discovery_store_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Node description store request's response
+ * @details The Node_store_rsp is provided to notify a Local Device of the request status
+ * from a Primary Discovery Cache device.\n\n Included in the response is a status code
+ * to notify the Local Device whether the request is successful (the Primary Cache
+ * Device has space to store the discovery cache data for the Local Device), whether
+ * the request is not supported (meaning the Remote Device is not a Primary
+ * Discovery Cache device), or insufficient space exists.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INSUFFICIENT_SPACE \n
+ *                    #ZB_ZDP_NOT_PERMITED \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_node_desc_store_req()
+ */
+typedef void (*zb_zdo_node_desc_store_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Node description store request
+ * @details The Node_Desc_store_req is provided to enable ZigBee end devices on the
+ * network to request storage of their Node Descriptor on a Primary Discovery
+ * Cache device which has previously received a SUCCESS status from a
+ * Discovery_store_req to the same Primary Discovery Cache device.\n\n Included in
+ * this request is the Node Descriptor the Local Device wishes to cache.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] nodedsc Pointer of node description structure
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_remove_node_cache_rsp()
+ */
+int zb_zdo_node_desc_store_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               zb_zdo_node_descriptor_h nodedsc,
+               zb_zdo_node_desc_store_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Power description store request's response
+ * @details The Power_Desc_store_rsp is provided to notify a Local Device of the request
+ * status from a Primary Discovery Cache device. Included in the response is a status
+ * code to notify the Local Device whether the request is successful (the Primary
+ * Cache Device has space to store the discovery cache data for the Local Device),
+ * whether the request is not supported (meaning the Remote Device is not a Primary
+ * Discovery Cache device), or insufficient space exists.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS  \n
+ *                    #ZB_ZDP_INSUFFICIENT_SPACE \n
+ *                    #ZB_ZDP_NOT_PERMITED \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_power_desc_store_req()
+ */
+typedef void (*zb_zdo_power_desc_store_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Power description store request
+ * @details The Power_Desc_store_req is provided to enable ZigBee end devices on the
+ * network to request storage of their Power Descriptor on a Primary Discovery
+ * Cache device which has previously received a SUCCESS status from a
+ * Discovery_store_req to the same Primary Discovery Cache device. Included in
+ * this request is the Power Descriptor the Local Device wishes to cache.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] powerdsc Pointer of power description structure
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_remove_node_cache_rsp()
+ */
+int zb_zdo_power_desc_store_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               zb_zdo_node_power_descriptor_h powerdsc,
+               zb_zdo_power_desc_store_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Active EP store request's response
+ * @details The Active_EP_store_rsp is provided to notify a Local Device of the request
+ * status from a Primary Discovery Cache device.\n\n Included in the response is a status
+ * code to notify the Local Device whether the request is successful (the Primary
+ * Cache Device has space to store the discovery cache data for the Local Device),
+ * the request is not supported (meaning the Remote Device is not a Primary
+ * Discovery Cache device), or insufficient space exists.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INSUFFICIENT_SPACE \n
+ *                    #ZB_ZDP_NOT_PERMITED \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_active_ep_store_req()
+ */
+typedef void (*zb_zdo_active_ep_store_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Active EP store request
+ * @details The Simple_desc_store_req is provided to enable ZigBee end devices on the
+ * network to request storage of their list of Simple Descriptors on a Primary
+ * Discovery Cache device which has previously received a SUCCESS status from a
+ * Discovery_store_req to the same Primary Discovery Cache device. Note that each
+ * Simple Descriptor for every active endpoint on the Local Device must be
+ * individually uploaded to the Primary Discovery Cache device via this command
+ * to enable cached discovery.\n\n Included in this request is the length of the Simple
+ * Descriptor the Local Device wishes to cache and the Simple Descriptor itself.\n\n The
+ * endpoint is a field within the Simple Descriptor and is accessed by the Remote
+ * Device to manage the discovery cache information for the Local Device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] active_ep_count Number of End-point List
+ * @param[in] ep_list End-point list
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_remove_node_cache_rsp()
+ */
+int zb_zdo_active_ep_store_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               unsigned char active_ep_count,
+               unsigned char *ep_list,
+               zb_zdo_active_ep_store_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Simple description store request's response
+ * @details The Simple_Desc_store_rsp is provided to notify a Local Device of the request
+ * status from a Primary Discovery Cache device.\n\n Included in the response is a status
+ * code to notify the Local Device whether the request is successful (the Primary
+ * Cache Device has space to store the discovery cache data for the Local Device),
+ * the request is not supported (meaning the Remote Device is not a Primary
+ * Discovery Cache device), or insufficient space exists.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INSUFFICIENT_SPACE \n
+ *                    #ZB_ZDP_NOT_PERMITED \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_simple_desc_store_req()
+ */
+typedef void (*zb_zdo_simple_desc_store_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Simple description store request
+ * @details The Simple_desc_store_req is provided to enable ZigBee end devices on the
+ * network to request storage of their list of Simple Descriptors on a Primary
+ * Discovery Cache device which has previously received a SUCCESS status from a
+ * Discovery_store_req to the same Primary Discovery Cache device.\n\n Note that each
+ * Simple Descriptor for every active endpoint on the Local Device must be
+ * individually uploaded to the Primary Discovery Cache device via this command
+ * to enable cached discovery.\n\n Included in this request is the length of the Simple
+ * Descriptor the Local Device wishes to cache and the Simple Descriptor itself. The
+ * endpoint is a field within the Simple Descriptor and is accessed by the Remote
+ * Device to manage the discovery cache information for the Local Device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] simpledsc Pointer of simple description structure
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_remove_node_cache_rsp()
+ */
+int zb_zdo_simple_desc_store_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               zb_zdo_simple_desc_h simpledsc,
+               zb_zdo_simple_desc_store_rsp cb,
+               void *user_data);
+
+/**
+ * @brief Simple description remove request's response
+ * @details The Remove_node_cache_rsp is provided to notify a Local Device of the request
+ * status from a Primary Discovery Cache device.\n\n Included in the response is a status
+ * code to notify the Local Device whether the request is successful (the Primary
+ * Cache Device has removed the discovery cache data for the indicated device of
+ * interest), or the request is not supported (meaning the Remote Device is not a
+ * Primary Discovery Cache device).
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] status #ZB_ZDP_SUCCESS \n
+ *                    #ZB_ZDP_INSUFFICIENT_SPACE \n
+ *                    #ZB_ZDP_NOT_PERMITED \n
+ *                    #ZB_ZDP_NOT_SUPPORTED \n
+ * @param[out] user_data user data
+ *
+ * @see zb_zdo_remove_node_cache_req()
+ */
+typedef void (*zb_zdo_remove_node_cache_rsp)(
+               unsigned char status,
+               void *user_data);
+
+/**
+ * @brief Remove node cache request
+ * @details The Remove_node_cache_req is provided to enable ZigBee devices on the
+ * network to request removal of discovery cache information for a specified ZigBee
+ * end device from a Primary Discovery Cache device.\n\n The effect of a successful
+ * Remove_node_cache_req is to undo a previously successful Discovery_store_req
+ * and additionally remove any cache information stored on behalf of the specified
+ * ZigBee end device on the Primary Discovery Cache device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr16 Network address for device of interest
+ * @param[in] addr64 IEEE address for device of interest
+ * @param[in] cb Response callback
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_zdo_remove_node_cache_rsp()
+ */
+int zb_zdo_remove_node_cache_req(
+               zigbee_h handle,
+               nwk_addr addr16,
+               ieee_addr addr64,
+               zb_zdo_remove_node_cache_rsp cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_ZDO_SERVICE_DISCOVERY_H__ */
diff --git a/include/zdo/zb-zdo-type.h b/include/zdo/zb-zdo-type.h
new file mode 100644 (file)
index 0000000..99fbc78
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __ZB_ZDO_TYPE_H__
+#define __ZB_ZDO_TYPE_H__
+
+#include <zb-type.h>
+
+/**
+ * @file zb-zdo-type.h
+ */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.138 ZDP Enumerations Description
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_SUCCESS = 0, /**< Success */
+       ZB_ZDP_INV_REQUESTTYPE = 0x80, /**< Invalid Request Type */
+       ZB_ZDP_DEVICE_NOT_FOUND = 0x81, /**< Device Not Found */
+       ZB_ZDP_INVALID_EP = 0x82, /**< Invalid Endpoint */
+       ZB_ZDP_NOT_ACTIVE = 0x83, /**< Not Active */
+       ZB_ZDP_NOT_SUPPORTED = 0x84, /**< Not Supported */
+       ZB_ZDP_TIMEOUT = 0x85, /**< Timeout */
+       ZB_ZDP_NO_MATCH = 0x86, /**< No Match */
+       ZB_ZDP_NO_ENTRY = 0x88, /**< No Entry */
+       ZB_ZDP_NO_DESCRIPTOR = 0x89, /**< No Descriptor */
+       ZB_ZDP_INSUFFICIENT_SPACE = 0x8A, /**< Insufficient Space */
+       ZB_ZDP_NOT_PERMITED = 0x8B, /**< Not Permitted */
+       ZB_ZDP_TABLE_FULL = 0x8C, /**< Table Full */
+       ZB_ZDP_NOT_AUTHORIZED = 0x8D, /**< Not Authorized */
+       ZB_ZDP_DEVICE_BINDING_TABLE_FULL = 0x8E, /**< Binding Table Full */
+} zb_zdo_status_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief RequestType Enumeration
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_SINGLE_DEVICE_RESPONSE = 0, /**< 0 : Single Device Response */
+       ZB_ZDP_EXTENDED_RESPONSE = 1, /**< 1 : Extended Response */
+} zb_zdo_request_type_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.30 Values of the Logical Type Field
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_COORDINATOR = 0, /**< Coordinator */
+       ZB_ZDP_ROUTER = 1, /**< Router */
+       ZB_ZDP_END_DEVIEC = 2, /**< End Device */
+} zb_zdo_logical_type_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.31 Values of the Frequency Band Field
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_868_868_6_MHZ = 0, /**< 868~888.6MHz */
+       ZB_ZDP_902_928_MHA = 2, /**< 902~928MHz */
+       ZB_ZDP_2400_2483_5_MHZ = 3, /**< 2400~2483.5MHz */
+} zb_zdo_frequency_band_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Alternative PAN coordinator bit in MAC capability Flags
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_DO_NOT_SUPPORT_PAN_COORDINATOR = 0, /**< Otherwise..*/
+       ZB_ZDP_SUPPORT_PAN_COORDINATOR = 1, /**< This node is capable of becoming a PAN
+               coordinator. */
+} zb_zdo_alternative_pan_coordinator_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Device type bit in MAC capability Flags
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_RFD = 0, /**< This node is a reduced function device (RFD) */
+       ZB_ZDP_FFD = 1, /**< This node is a full function device (FFD) */
+} zb_zdo_device_type_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Power Source bit in MAC capability Flags
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_NO_NODE_POWER_DESCRIPTION = 0, /**< Otherwise.. */
+       ZB_ZDP_MAIN_POWER = 1, /**< Current power source is main power. This information is
+               derived from the node current power source field of the node power descriptor */
+} zb_zdo_power_source_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Receiver on when idle bit in MAC capability Flags
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_KEEP_POWER_SAVE_MODE = 0, /**< Otherwise.. */
+       ZB_ZDP_DO_NOT_POWER_SAVE_MODE = 1, /**< The device does not disable its receiver to
+               conserve power during idle periods. */
+} zb_zdo_receiver_on_when_idle_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Security capability bit in MAC capability Flags
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_DO_NOT_SUPPORT_SECURITY_MODE = 0,
+       ZB_ZDP_SUPPORT_SECURITY_MODE = 1,
+} zb_zdo_security_capability_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Figure 2.17 Format of the MAC Capability Flags Field
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_ALTERNATIVE_PAN_COORDINATOR = (1 << 0), /**< Alternative Pan Coordinator see
+               #zb_zdo_alternative_pan_coordinator_e */
+       ZB_ZDP_DEVICE_TYPE = (1 << 1), /**< Device Type see #zb_zdo_device_type_e */
+       ZB_ZDP_POWER_SOURCE = (1 << 2), /**< Power Source see #zb_zdo_power_source_e */
+       ZB_ZDP_RECEIVER_ON_WHEN_IDLE = (1 << 3), /**< Register on When Idle
+               see #zb_zdo_receiver_on_when_idle_e */
+       ZB_ZDP_SECURITY_CAPABILITY = (1 << 6), /**< Security Capability
+               see #zb_zdo_security_capability_e */
+       ZB_ZDP_ALLOCATE_ADDRESS = (1 << 7), /**< Allocated Address.\n
+               This mean device receive network address from coordinator\n
+               This field will always have a value of 1 in implementations of IEEE 802.15.4 spec,
+               indicating that the joining device must be issued a 16-bit short address */
+} zb_zdo_mac_capability_field_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.32 Server Mask Bit Assignments
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_PRIMARY_TRUST_CENTER = (1 << 0), /**< Primary Trust Center */
+       ZB_ZDP_BACKUP_TRUST_CENTER = (1 << 1), /**< Backup Trust Center */
+       ZB_ZDP_PRIMARY_BINDING_TABLE_CACHE = (1 << 2), /**< Primary Binding Table Cache */
+       ZB_ZDP_BACKUP_BINDING_TABLE_CACHE = (1 << 3), /**< Backup Binding Table Cache */
+       ZB_ZDP_PRIMARY_DISCOVERY_CACHE = (1 << 4), /**< Primary Discovery Cache */
+       ZB_ZDP_BACKUP_DISCOVERY_CACHE = (1 << 5), /**< Backup Discovery Cache */
+       ZB_ZDP_NETWORK_MANAGER = (1 << 6), /**< Network Manager */
+} zb_zdo_server_mask_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.29 Fields of the Node Descriptor
+ * @details Type and capabilities of the node.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_zdo_node_descriptor_s* zb_zdo_node_descriptor_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.35 Values of the Current Power Mode Field
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_RECEVIER_SYNCHRONIZED_WITH_RECEVIER_ON = 0, /**< Register Synchronized with Receiver On */
+       ZB_ZDP_RECEIVER_COMES_ON_PERIODICALLY = ( 1 << 0), /**< Register Comes on Periodically */
+       ZB_ZDP_RECEIVER_COMES_ON_WHEN_STIMULATED = ( 1 << 1), /**< Register Comes on When Stimulated */
+} zb_zdo_current_power_mode_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.34 Fields of the Node Power Descriptor
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_CONSTANT_POWER = 0, /**< Constant Power */
+       ZB_ZDP_RECHARGEABLE_BATTERY = 1, /**< Rechargeable Battery */
+       ZB_ZDP_DISPOSABLE_BATTERY = 2, /**< Disposable Battery */
+} zb_zdo_available_power_source_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.36 Values of the Available Power Sources Field
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_ZDP_CHARGE_LEVEL_CRITICAL = 0, /**< Charge Level Critical */
+       ZB_ZDP_CHARGE_LEVEL_33 = 1, /**< Charge Level 33% */
+       ZB_ZDP_CHARGE_LEVEL_66 = 2, /**< Charge Level 66% */
+       ZB_ZDP_CHARGE_LEVEL_100 = 3, /**< Charge Level 100% */
+} zb_zdo_current_power_source_level_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Binding type
+ *
+ * @since_tizen 3.0
+ */
+typedef enum {
+       ZB_UNICAST_BINDING = 0x03, /**< A unicast binding whose 64-bit identifier is the
+                                                               destination ieee_addr. */
+       ZB_MANY_TO_ONE_BINDING = 0x83, /**< A unicast binding whose 64-bit identifier is the
+                                                               many-to-one destination ieee_addr. A Route discovery
+                                                               should be disabled when sending unicast via may-to-one
+                                                               binding */
+       ZB_MULTICAST_BINDING = 0x01, /**< A multicast binding whose 64-bit identifier is the
+                                                               group address. A multicast binding can be used to send
+                                                               messages to the group and to receive message sent to
+                                                               the group */
+} zb_binding_type_e;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.34 Fields of the Node Power Descriptor .
+ * @details Node power characteristics.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_zdo_node_power_descriptor_s* zb_zdo_node_power_descriptor_h;
+
+
+#define MAX_ENDPOINT_CLUSTERS 32 /**< Cluster counts to handle with */
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @details Device descriptions contained in node.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_zdo_simple_desc_s* zb_zdo_simple_desc_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief The handle of zigbee end-device information
+ * @details a zb_end_device_info_h is an opaque data structure.\n
+ * zb_end_device_info_h is a data type of network address, IEEE address, endpoint count
+ * and endpoint information structure.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_end_device_info_s* zb_end_device_info_h;
+
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.125 NetworkList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_zdo_network_list_record_s* zb_zdo_network_list_record_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.127 NeighborTableList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_zdo_neighbor_table_desc_s* zb_zdo_neighbor_table_desc_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.129 RoutingTableList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_zdo_routing_table_s* zb_zdo_routing_table_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.131 BindingTableList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_zdo_binding_table_s* zb_zdo_binding_table_h;
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Table 2.136 DiscoveryCacheList Record Format.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct zb_zdo_discovery_cache_s* zb_zdo_discovery_cache_h;
+
+
+/**
+ * @}
+ */
+
+#endif /* __ZB_ZDO_TYPE_H__ */
+
diff --git a/include/zigbee.h b/include/zigbee.h
new file mode 100644 (file)
index 0000000..bf43dd6
--- /dev/null
@@ -0,0 +1,643 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __CAPI_NETWORK_ZIGBEE_H__
+#define __CAPI_NETWORK_ZIGBEE_H__
+
+/* For test */
+#define ZIGBEE_SUPPORT_ORDERED_SEQUENCE_DATA 0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <tizen_type.h>
+
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zb-zdo.h>
+#include <zb-zcl.h>
+#include <zb-ha.h>
+#include <zb-custom.h>
+
+/**
+ * @file zigbee.h
+ */
+
+/**
+ * @addtogroup CAPI_NETWORK_ZIGBEE_MODULE ZigBee
+ *
+ * @{
+ */
+
+/**
+ * @brief create handle to access the zigbee service.
+ * @details all this function to start zigbee service
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks You must free all resources of the zigbee by calling zigbee_disconnect()
+ * if zigbee service is no longer needed.
+ *
+ * @param[out] handle The handle of zigbee
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_OUT_OF_MEMORY Out-of-memory
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_destroy()
+ */
+int zb_create(zigbee_h *handle);
+
+/**
+ * @brief Disconnect to the zigbee service.
+ * @details all this function to stop zigbee service
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks You must free all resources of the zigbee by calling zb_disconnect()
+ * if zigbee service is no longer needed.
+ *
+ * @param[in] handle The handle of zigbee
+ *
+ * @return None
+ *
+ * @see zb_create()
+ */
+void zb_destroy(zigbee_h handle);
+
+/**
+ * @brief Specifies the type of function passed to zb_set_event_handler()
+ * @details This function can receive events from the devices in the network.
+ * ex) join, re-join, leave and attribute change report
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks You can receive below events.
+ * @see #ZB_ZDP_ENABLE_EVENT
+ * @see #ZB_ZDP_JOIN_EVENT
+ * @see #ZB_ZDP_REJOIN_EVENT
+ * @see #ZB_ZDP_LEAVE_DONE_EVENT
+ * @see #ZB_ZDP_UPDATED_NETWORK_NOTIFICATION_EVENT
+ * @see #ZB_ZCL_ALARM_EVENT
+ * @see #ZB_ZCL_IAS_ZONE_ENROLL_REQUEST_EVENT
+ * @see #ZB_ZCL_IAS_ZONE_STATUS_CHANGE_NOTIFICATION_EVENT
+ * @see #ZB_ZCL_IAS_ZONE_STATUS_CHANGE_EXTENDED_NOTIFICATION_EVENT
+ * @see #ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_ATTRIBUTE_REPORT_EVENT
+ * @see #ZB_ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_REPORT_EVENT
+ * @see #ZB_ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_REPORT_EVENT
+ * @see #ZB_ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_REPORT_EVENT
+ * @see #ZB_ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_REPORT_EVENT
+ * @see #ZB_ZCL_COLOR_CONTROL_CURRENT_TEMPERATURE_ATTRIBUTE_REPORT_EVENT
+ * @see #ZB_ZCL_DOOR_LOCK_OPERATIONAL_NOTIFICATION_EVENT
+ * @see #ZB_ZCL_DOOR_LOCK_PROGRAMING_NOTIFICATION_EVENT
+ * @see #ZB_ZCL_SIMPLE_METERING_REMOVE_MIRROR_EVENT
+ * @see #ZB_ZCL_SIMPLE_METERING_REQUEST_MIRROR_EVENT
+ *
+ * @param[out] addr16 Network address (16 bit) from the source device
+ * @param[out] addr64 IEEE address (EUI64) from the source device
+ * @param[out] event_type The event identification
+ * @param[out] lparam parameter data pointer
+ *
+ * @pre The callback must be registered when using zb_set_event_handler()
+ *
+ * @see zb_event_cb()
+ */
+typedef void (*zb_event_cb)(nwk_addr addr16, ieee_addr addr64, zb_event_e event_type,
+               zb_event_data_s lparam);
+
+/**
+ * @brief enable the zigbee service.
+ * @details all this function to start zigbee service
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks You must free all resources of the zigbee by calling zb_destroy()
+ * if zigbee service is no longer needed.
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] event_handler The event handler
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_create()
+ * @see zb_destroy()
+ *
+ */
+int zb_enable(zigbee_h handle, zb_event_cb event_handler);
+
+/**
+ * @brief disable the zigbee service.
+ * @details all this function to stop zigbee service
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ *
+ * @remarks You must free all resources of the zigbee by calling zb_destroy()
+ * if zigbee service is no longer needed.
+ *
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ *
+ * @see zb_create()
+ * @see zb_destroy()
+ *
+ */
+int zb_disable(zigbee_h handle);
+
+/**
+ * @brief Chip reset for the zigbee transceiver.
+ * @details If the Zigbee transceiver works abnormally, this function do HW reset.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ */
+int zb_hw_reset(zigbee_h handle);
+
+/**
+ * @brief Switch channel when an occupied channel is noisy.
+ * @details When noisy, do energy scan and active scan to switch operational channel.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] channel target channel number to switch
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_coex_stop()
+ *
+ */
+int zb_coex_start(zigbee_h handle, unsigned char channel);
+
+/**
+ * @brief Stop channel switching operation.
+ * @details Halt current operation related to channel switching.
+ *
+ * @since_tizen 3.0
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_coex_start()
+ *
+ */
+int zb_coex_stop(zigbee_h handle);
+
+/**
+ * @brief Make network to operate as zigbee coordinator
+ * @details This function to enable zigbee coordinator.
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks If you want to change parameters related to network configuration you should
+ * call zb_zdo_set_compatible_startup_parameters() API
+ *
+ * @param[in] handle The handle of zigbee
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @post When forming network finished, fome_network_done event will be generated.
+ *
+ * @see zb_disable_network()
+ * @see zb_zdo_set_compatible_startup_parameters()
+ */
+int zb_form_network(zigbee_h handle);
+
+/**
+ * @brief Disable network and stop zigbee coordinator role
+ * @details This function to stop zigbee coordinator
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks You must destroy all device and routing information before calling this
+ * function.
+ *
+ * @param[in] handle The handle of zigbee
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_form_network()
+ */
+int zb_disable_network(zigbee_h handle);
+
+/**
+ * @brief Forces a node to leave one network and to rejoin the other
+ * @details Force a node to leave one network and to rejoin the other. If remove_children
+ * sets true, the the target end device will reset its state-machine as factory default.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] addr The source EUI64 of the binding (the remote device's EUI64)
+ * @param[in] remove_children Remove children
+ * @param[in] rejoin Rejoin after leave
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_form_network()
+ */
+int zb_leave_device(zigbee_h handle, ieee_addr addr, bool remove_children, bool rejoin);
+
+/**
+ * @brief enable or disable coordinator device can accept other device's association request
+ * @details The function is generated from a Local Device requesting that
+ * a remote device or devices allow or disallow association.
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks Especially, this can be very useful for disabling joining all throughout the
+ * network. Typically, this is the last step when commissioning a network. It closes it
+ * down to prevent other nodes getting on the network without permission.
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[in] timeout Number of seconds during which devices will be allowed to join
+ * the network. A value of 0xff turns permit joining on permanently
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_form_network()
+ */
+int zb_permit_join(zigbee_h handle, unsigned char timeout);
+
+/**
+ * @brief show current coordinator's IEEE MAC address
+ * @details The function gets the coordinator's MAC address from the machine which runs
+ * zigbee-service daemon.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[out] addr64 the Zigbee IEEE MAC address of this machine.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_get_network_info()
+ */
+int zb_get_controller_mac_address(zigbee_h handle, ieee_addr addr64);
+
+/**
+ * @brief get information of the current network environment of coordinator
+ * @details The function shows network environment
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[out] addr64 the Zigbee IEEE MAC address
+ * @param[out] nodeid Node ID
+ * @param[out] panid PAN ID
+ * @param[out] channel 11~26 : 2.4GHz~2.485GHz
+ * @param[out] tx_power Tx power strength
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see zb_form_network()
+ */
+int zb_get_network_info(zigbee_h handle, ieee_addr addr64, nwk_addr *nodeid,
+               nwk_addr *panid, unsigned char *channel, unsigned char *tx_power);
+
+/**
+ * @brief Get all children device list information.
+ * @details This function return end-point list and simple description per each end-point
+ * at each device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] handle The handle of zigbee
+ * @param[out] count The number of end-devices
+ * @param[out] list The device information list
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see struct zb_end_device_info_s
+ */
+int zb_get_all_device_list(zigbee_h handle, int *count, zb_end_device_info_h **list);
+
+/**
+ * @brief free all children device list information.
+ * @details This function return end-point list and simple description per each end-point
+ * at each device.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The device information list
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see struct zb_end_device_info_s
+ */
+int zb_device_list_free(zb_end_device_info_h *list);
+
+/**
+ * @brief callback function when getting end-device information.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] index nth child
+ * @param[out] child handle of a end-device
+ * @param[out] user_data user data
+ *
+ * @pre The callback must be registered when using zb_devices_info_foreach_end_device()
+ *
+ * @return ZIGBEE_FUNC_CONTINUE to continue iteration, otherwise ZIGBEE_FUNC_STOP to stop iteration.
+ * @retval #ZIGBEE_FUNC_CONTINUE Continue iteration
+ * @retval #ZIGBEE_FUNC_STOP Stop iteration
+ *
+ * @see zb_devices_info_foreach_end_device()
+ */
+typedef bool (*zb_end_device_cb )(int index, zb_end_device_info_h child, void *user_data);
+
+/**
+ * @brief Calls a function for each children end-point of parent.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list handle of end-devices parent
+ * @param[in] cb zb_end_device_cb()
+ * @param[in] user_data user data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_devices_info_foreach_end_device()
+ */
+int zb_devices_info_foreach_end_device(zb_end_device_info_h *list,
+               zb_end_device_cb cb, void *user_data);
+
+/**
+ * @brief get network address of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[out] addr16 network address of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_network_address(zb_end_device_info_h handle, nwk_addr *addr16);
+
+/**
+ * @brief get ieee address of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[out] addr64 ieee address of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_ieee_address(zb_end_device_info_h handle, ieee_addr addr64);
+
+/**
+ * @brief get a number of end-points of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[out] count a number of endpoints of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_num_of_ep(zb_end_device_info_h handle, unsigned char *count);
+
+/**
+ * @brief get list of end-points of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[out] ep_list list of endpoints of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_ep_list(zb_end_device_info_h handle, unsigned char *ep_list);
+
+/**
+ * @brief get 802.15.4 MAC capability of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[out] capability 802.15.4 MAC capability of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_mac_capabiity(zb_end_device_info_h handle,  unsigned char *capability);
+
+/**
+ * @brief get ability of alternative PAN coordinator of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[out] can_do_it alternative of PAN coordinator of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_alternative_pan_coordinator(zb_end_device_info_h handle,
+               unsigned char *can_do_it);
+
+/**
+ * @brief get device id of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[in] ep endpoint number
+ * @param[out] device_id device id of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_device_id(zb_end_device_info_h handle, unsigned char ep, unsigned short *device_id);
+
+/**
+ * @brief get profile id of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[in] ep endpoint number
+ * @param[out] profile_id profile id of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_profile_id(zb_end_device_info_h handle, unsigned char ep, unsigned short *profile_id);
+
+/**
+ * @brief get power source type of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[out] power_src power source type of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_power_source(zb_end_device_info_h handle, unsigned char *power_src);
+
+/**
+ * @brief get security capability of a specific end-point
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks This function should be called in zb_end_device_cb()
+ *
+ * @param[in] handle handle of a specific end-device
+ * @param[out] sec_capability security type of the end-point
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NO_DATA No data available
+ *
+ * @see zb_end_device_cb()
+ * @see zb_devices_info_foreach_end_device()
+ * @see zb_get_all_device_list()
+ */
+int zb_get_security_capabilty(zb_end_device_info_h handle,
+               unsigned char *sec_capability);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CAPI_NETWORK_ZIGBEE_H__ */
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e283b00
--- /dev/null
@@ -0,0 +1,34 @@
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+SET(CLIENT_PKG_CONF_FILE "capi-network-zigbee")
+
+FILE(GLOB CLIENT_SRCS *.c ${CMAKE_SOURCE_DIR}/common/*.c)
+#SET(CLIENT_SRCS ${CLIENT_SRCS} ${CMAKE_SOURCE_DIR}/common/${ZB_DBUS}.c)
+#SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/common/${ZB_DBUS}.c
+#      PROPERTIES GENERATED TRUE)
+
+pkg_check_modules(client_pkgs REQUIRED glib-2.0 gio-2.0 gio-unix-2.0 dlog capi-base-common)
+INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS})
+
+# Temporary debug info enable : -g
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -pthread -g")
+
+ADD_DEFINITIONS("-DZIGBEE_DBUS_INTERFACE=\"${DBUS_INTERFACE}\"")
+ADD_DEFINITIONS("-DZIGBEE_DBUS_OBJPATH=\"${DBUS_OBJECT_PATH}\"")
+
+ADD_LIBRARY(${CLIENT} SHARED ${CLIENT_SRCS})
+#ADD_DEPENDENCIES(${CLIENT} GENERATED_DBUS_CODE)
+TARGET_LINK_LIBRARIES(${CLIENT} ${client_pkgs_LIBRARIES})
+SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION ${FULLVER} SUBVERSION ${MAJORVER})
+INSTALL(TARGETS ${CLIENT} DESTINATION ${LIB_INSTALL_DIR})
+
+CONFIGURE_FILE(${CLIENT_PKG_CONF_FILE}.pc.in ${CLIENT_PKG_CONF_FILE}.pc @ONLY)
+INSTALL(FILES ${CLIENT_PKG_CONF_FILE}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+FILE(GLOB CLIENT_HEADER ${CMAKE_SOURCE_DIR}/include/*.h)
+INSTALL(FILES ${CLIENT_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${CLIENT})
+FILE(GLOB ZDO_HEADER ${CMAKE_SOURCE_DIR}/include/zdo/*.h)
+INSTALL(FILES ${ZDO_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${CLIENT}/zdo)
+FILE(GLOB ZCL_HEADER ${CMAKE_SOURCE_DIR}/include/zcl/*.h)
+INSTALL(FILES ${ZCL_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${CLIENT}/zcl)
diff --git a/lib/capi-network-zigbee.pc.in b/lib/capi-network-zigbee.pc.in
new file mode 100644 (file)
index 0000000..00d0bce
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}/bin
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@/@CLIENT@
+
+Name: @CLIENT@
+Description: Network/Wireless zigbee
+Version: @FULLVER@
+Requires:
+Libs: -L${libdir} -l@CLIENT@
+Cflags: -I${includedir}
diff --git a/lib/zbl-custom.c b/lib/zbl-custom.c
new file mode 100644 (file)
index 0000000..4f9598e
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <glib.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <zb-log.h>
+#include <zb-common.h>
+#include <zb-custom.h>
+
+#include "zbl.h"
+#include "zbl-dbus.h"
+#include "zigbee.h"
+
+API int zb_aps_send(zigbee_h handle, nwk_addr addr16,
+               unsigned char aps_frame_ctl, unsigned char src_ep, unsigned char dst_ep,
+               unsigned short cluster_id, unsigned short profile_id,
+               unsigned char zcl_frame_ctl, unsigned short mfg_code,
+               unsigned short payload_len, unsigned char *payload,
+               zb_aps_send_rsp cb, void *user_data)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       ret = zbl_aps_send(addr16, aps_frame_ctl, src_ep, dst_ep,
+                               cluster_id, profile_id, zcl_frame_ctl, mfg_code,
+                               payload_len, payload, cb, user_data);
+       DBG("zbl_aps_send()=0x%X", ret);
+       return ret;
+}
+
+API int zb_zcl_send(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep,
+               unsigned short cluster_id, unsigned char zcl_frame_ctl, unsigned char cmd,
+               unsigned short payload_len, unsigned char *payload,
+               zb_zcl_send_rsp cb, void *user_data)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       ret = zbl_zcl_send(addr16, src_ep, dst_ep, cluster_id, zcl_frame_ctl,
+                               cmd, payload_len, payload, cb, user_data);
+       DBG("zbl_zcl_send()=0x%X", ret);
+       return ret;
+}
+
+API int zb_send_to_local(zigbee_h handle, unsigned short length, unsigned char *data,
+               zb_send_to_local_rsp cb, void *user_data)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       ret = zbl_send_to_local(length, data, cb, user_data);
+       DBG("zbl_send_to_local()=0x%X", ret);
+       return ret;
+}
diff --git a/lib/zbl-dbus.c b/lib/zbl-dbus.c
new file mode 100644 (file)
index 0000000..3091241
--- /dev/null
@@ -0,0 +1,7489 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zb-log.h>
+#include <zb-type.h>
+#include <zb-utils.h>
+#include <zb-error.h>
+#include <zb-common.h>
+#include <zcl/zb-zcl-type.h>
+#include <zdo/zb-zdo-type.h>
+
+#include "zbl.h"
+#include "zbl-dbus.h"
+
+#define USE_ASYNC_DBUS_CALL
+
+static int zbl_ref_count;
+
+static GDBusConnection *gdbus_conn = NULL;
+static GDBusProxy *service_gproxy = NULL;
+static GDBusProxy *on_off_gproxy = NULL;
+static GDBusProxy *door_lock_gproxy = NULL;
+static GDBusProxy *level_control_gproxy = NULL;
+static GDBusProxy *thermostat_gproxy = NULL;
+static GDBusProxy *alarm_gproxy = NULL;
+static GDBusProxy *fan_control_gproxy = NULL;
+static GDBusProxy *mfglib_gproxy = NULL;
+static GDBusProxy *zcl_global_proxy = NULL;
+static GDBusProxy *zdo_dev_proxy = NULL;
+static GDBusProxy *zcl_basic_proxy = NULL;
+static GDBusProxy *zcl_identify_proxy = NULL;
+static GDBusProxy *zcl_ias_zone_proxy = NULL;
+static GDBusProxy *zcl_poll_control_proxy = NULL;
+static GDBusProxy *zcl_group_proxy = NULL;
+static GDBusProxy *zcl_scene_proxy = NULL;
+static GDBusProxy *zdo_bind_proxy = NULL;
+static GDBusProxy *zcl_color_control_proxy = NULL;
+static GDBusProxy *custom_gproxy = NULL;
+
+typedef struct {
+       bool found;
+       void *cb;
+       void *userdata;
+       unsigned int sid;
+       int tid;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       void *global_cmd;
+       void *handle;
+#endif
+} zbl_req_cb_s;
+
+static GDBusConnection *_zbl_get_connection(void)
+{
+       GError *error = NULL;
+
+       return g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+}
+
+static GDBusProxy *_zbl_get_service_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == service_gproxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_SERVICE_INTERFACE, NULL, NULL);
+       } else
+               proxy = service_gproxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_on_off_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == on_off_gproxy) {
+               proxy = g_dbus_proxy_new_sync((GDBusConnection*)gdbus_conn,
+                       G_DBUS_PROXY_FLAGS_NONE,
+                       NULL,
+                       ZIGBEE_SERVER_NAME,
+                       ZIGBEE_OBJECT_PATH,
+                       ZIGBEE_ON_OFF_INTERFACE,
+                       NULL,
+                       NULL);
+       } else
+               proxy = on_off_gproxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_door_lock_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == door_lock_gproxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_DOOR_LOCK_INTERFACE, NULL, NULL);
+       } else
+               proxy = door_lock_gproxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_level_control_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == level_control_gproxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_LEVEL_CONTROL_INTERFACE,
+                       NULL, NULL);
+       } else
+               proxy = level_control_gproxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_thermostat_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == thermostat_gproxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_THERMOSTAT_INTERFACE, NULL, NULL);
+       } else
+               proxy = thermostat_gproxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_alarm_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == alarm_gproxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ALARM_INTERFACE, NULL, NULL);
+       } else
+               proxy = alarm_gproxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_fan_control_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == fan_control_gproxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_FAN_CONTROL_INTERFACE, NULL,
+                       NULL);
+       } else
+               proxy = fan_control_gproxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_mfglib_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == mfglib_gproxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_MFGLIB_INTERFACE, NULL, NULL);
+       } else
+               proxy = mfglib_gproxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_zcl_global_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zcl_global_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZCLGLB_INTERFACE, NULL, NULL);
+       } else
+               proxy = zcl_global_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_zdo_dev_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zdo_dev_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZDOGLB_INTERFACE, NULL, NULL);
+       } else
+               proxy = zdo_dev_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_basic_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zcl_basic_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZCLBASIC_INTERFACE, NULL, NULL);
+       } else
+               proxy = zcl_basic_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_identify_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zcl_identify_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZCLIDENTIFY_INTERFACE, NULL, NULL);
+       } else
+               proxy = zcl_identify_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_ias_zone_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zcl_ias_zone_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZCLIAS_INTERFACE, NULL, NULL);
+       } else
+               proxy = zcl_ias_zone_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_poll_control_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zcl_poll_control_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZCLPOLL_INTERFACE, NULL, NULL);
+       } else
+               proxy = zcl_poll_control_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_group_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zcl_group_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZCLGROUP_INTERFACE, NULL, NULL);
+       } else
+               proxy = zcl_group_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_scene_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zcl_scene_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZCLSCENE_INTERFACE, NULL, NULL);
+       } else
+               proxy = zcl_scene_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_zdo_bind_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zdo_bind_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZDOBIND_INTERFACE, NULL, NULL);
+       } else
+               proxy = zdo_bind_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_color_control_proxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Connection Object is invalid");
+
+       if (NULL == zcl_color_control_proxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_ZCLCOLOR_INTERFACE, NULL, NULL);
+       } else
+               proxy = zcl_color_control_proxy;
+
+       return proxy;
+}
+
+static GDBusProxy *_zbl_get_custom_gproxy(void)
+{
+       GDBusProxy *proxy = NULL;
+       RETVM_IF(NULL == gdbus_conn, NULL, "Custom Object is invalid");
+
+       if (NULL == custom_gproxy) {
+               proxy = g_dbus_proxy_new_sync(gdbus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL,
+                       ZIGBEE_SERVER_NAME, ZIGBEE_OBJECT_PATH, ZIGBEE_CUSTOM_INTERFACE, NULL, NULL);
+       } else
+               proxy = custom_gproxy;
+
+       return proxy;
+}
+
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+static gint _global_compare_func(gconstpointer a, gconstpointer b)
+{
+       const zbl_req_cb_s *left = (const zbl_req_cb_s*)a;
+       const zbl_req_cb_s *right = (const zbl_req_cb_s*)b;
+       zb_event_global_default_rsp_s *left_data = NULL;
+       zb_event_global_default_rsp_s *right_data = NULL;
+
+       if (NULL == left || NULL == left->global_cmd)
+               return -1;
+       if (NULL == right || NULL == right->global_cmd)
+               return 1;
+
+       left_data = left->global_cmd;
+       right_data = right->global_cmd;
+
+       if (left_data->ep > right_data->ep)
+               return 1;
+       else if (left_data->ep < right_data->ep)
+               return -1;
+
+       if (left_data->cluster_id > right_data->cluster_id)
+               return 1;
+       else if (left_data->cluster_id < right_data->cluster_id)
+               return -1;
+
+       if (left_data->command_id > right_data->command_id)
+               return 1;
+       else if (left_data->command_id < right_data->command_id)
+               return -1;
+
+       /* endpoint, cluster_id and command_id are equal */
+       return 0;
+}
+
+static void _zbl_register_global_req(zigbee_h handle, zbl_req_cb_s *container)
+{
+       GList *list = NULL;
+       GList *item = NULL;
+
+       if (NULL == handle || NULL == container)
+               return;
+
+       list = handle->global_cmd_req;
+
+       /* Insert item if not exists */
+       DBG("Insert global cmd info");
+       if (list) {
+               item = g_list_find_custom(list, container, _global_compare_func);
+               if (NULL != item)
+                       handle->global_cmd_req = g_list_append(list, container);
+       } else
+               handle->global_cmd_req = g_list_append(list, container);
+}
+
+static void _zbl_deregister_global_req(zigbee_h handle, zbl_req_cb_s *container)
+{
+       GList *list = NULL;
+       GList *item = NULL;
+
+       if (NULL == handle || NULL == container)
+               return;
+
+       list = handle->global_cmd_req;
+       if (NULL == list)
+               return;
+
+       /* Remove item if exists */
+       DBG("Remove global cmd info");
+       item = g_list_find_custom(list, container, _global_compare_func);
+       if (NULL != item) {
+               handle->global_cmd_req = g_list_remove(list, container);
+       }
+}
+
+static void _zbl_remove_global_req(zigbee_h handle, unsigned char ep,
+       unsigned short cluster_id, unsigned char command_id)
+{
+       GList *head = NULL;
+       GList *iter = NULL;
+       zbl_req_cb_s *ret = NULL;
+
+       if (NULL == handle)
+               return;
+
+       head = handle->global_cmd_req;
+       iter = head;
+
+       while (NULL != iter) {
+               GList *next = iter->next;
+               zbl_req_cb_s *container = iter->data;
+               if (container && container->global_cmd) {
+                       zb_event_global_default_rsp_s *data = container->global_cmd;
+
+                       if (data && data->ep == ep && data->cluster_id == cluster_id
+                                       && data->command_id == command_id) {
+                               DBG("  Found: ep[%d] cluster_id[%X] command_id[%X] / sid[%d]",
+                                       ep, cluster_id, command_id, container->sid);
+                               ret = container;
+                               break;
+                       }
+               }
+               iter = next;
+       }
+
+       if (ret) {
+               if (ret->sid)
+                       g_dbus_connection_signal_unsubscribe(gdbus_conn, ret->sid);
+
+               if (ret->tid) {
+                       g_source_remove(ret->tid);
+                       DBG("tid=%d removed");
+                       ret->tid = 0;
+               }
+
+               _zbl_deregister_global_req(handle, ret);
+       }
+
+}
+#endif /* ZB_FEATURE_GLOBAL_RSP_SYNC */
+
+static void _zbl_signal_handler(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zigbee_h container = (zigbee_h)user_data;
+       RETM_IF(NULL == container, "container is null");
+       RETM_IF(NULL == container->event_handler, "event_handler is null");
+       DBG("%s signal received", signal_name);
+
+       if (g_strcmp0(signal_name, "service_enabled") == 0) {
+               gboolean enabled;
+               g_variant_get(parameters, "(b)", &enabled);
+
+               zb_event_data_s ev;
+               ev.data.enable = calloc(1, sizeof(zb_event_enable_s));
+               RETM_IF(NULL == ev.data.enable, "Failed to memory allocation !");
+
+               ev.data.enable->status = (unsigned char)enabled;
+               container->event_handler(0, NULL, ZB_ZDP_ENABLE_EVENT, ev);
+               free(ev.data.enable);
+       } else if (g_strcmp0(signal_name, "form_network_done") == 0) {
+               nwk_addr pan_id;
+               g_variant_get(parameters, "(q)", &pan_id);
+
+               zb_event_data_s ev;
+               ev.data.form_network = calloc(1, sizeof(zb_event_form_network_s));
+               RETM_IF(NULL == ev.data.form_network, "Failed to memory allocation !");
+
+               memcpy(&ev.data.form_network->pan_id, &pan_id, sizeof(nwk_addr));
+               container->event_handler(pan_id, NULL, ZB_ZDP_FORM_NETWORK_DONE, ev);
+               free(ev.data.form_network);
+       } else if (g_strcmp0(signal_name, "child_joined") == 0) {
+               nwk_addr addr16;
+               ieee_addr addr64;
+               unsigned char count;
+               unsigned char ep[10];
+               unsigned char value;
+
+               int j = 0;
+               GVariantIter *iter1;
+               GVariantIter *iter2;
+
+               g_variant_get(parameters, "(ayyayq)", &iter1, &count, &iter2, &addr16);
+               while (g_variant_iter_loop(iter1, "y", &value)) {
+                       addr64[j] = value;
+                       j++;
+               }
+               j = 0;
+               while (g_variant_iter_loop(iter2, "y", &value)) {
+                       ep[j] = value;
+                       j++;
+               }
+
+               zb_event_data_s ev;
+               ev.data.join = calloc(1, sizeof(zb_event_join_s));
+               RETM_IF(NULL == ev.data.join, "Failed to memory allocation !");
+
+               ev.data.join->count = count;
+               memcpy(ev.data.join->ep, ep, count);
+               container->event_handler(addr16, addr64, ZB_ZDP_JOIN_EVENT, ev);
+               free(ev.data.join);
+       } else if (g_strcmp0(signal_name, "child_rejoined") == 0) {
+               ieee_addr addr64;
+               unsigned char value;
+
+               int j = 0;
+               GVariantIter *iter;
+
+               g_variant_get(parameters, "(ay)", &iter);
+               while (g_variant_iter_loop(iter, "y", &value)) {
+                       addr64[j] = value;
+                       j++;
+               }
+
+               zb_event_data_s ev;
+               memset(&ev, 0, sizeof(zb_event_data_s));
+               container->event_handler(0, addr64, ZB_ZDP_REJOIN_EVENT, ev);
+       } else if (g_strcmp0(signal_name, "child_left") == 0) {
+               int j = 0;
+               ieee_addr addr64;
+               GVariantIter *iter;
+               unsigned char value, status;
+
+               g_variant_get(parameters, "(ayy)", &iter, &status);
+               while (g_variant_iter_loop(iter, "y", &value)) {
+                       addr64[j] = value;
+                       j++;
+               }
+
+               zb_event_data_s ev;
+               ev.data.child_left = calloc(1, sizeof(zb_event_child_left_s));
+               RETM_IF(NULL == ev.data.child_left, "Failed to memory allocation !");
+
+               ev.data.child_left->status = status;
+               container->event_handler(0, addr64, ZB_ZDP_CHILD_LEFT, ev);
+               free(ev.data.child_left);
+       } else if (g_strcmp0(signal_name, "leave_network_done") == 0) {
+               nwk_addr addr16;
+               g_variant_get(parameters, "(q)", &addr16);
+
+               zb_event_data_s ev;
+               memset(&ev, 0, sizeof(zb_event_data_s));
+               container->event_handler(addr16, NULL, ZB_ZDP_LEAVE_DONE_EVENT, ev);
+       } else if (!g_strcmp0(signal_name, "zcl_global_default_response")) {
+               nwk_addr addr16;
+               unsigned char ep;
+               unsigned short cluster_id;
+               unsigned char command_id;
+               unsigned char status;
+
+               g_variant_get(parameters, "(qyqyy)",  &addr16, &ep, &cluster_id, &command_id, &status);
+
+               zb_event_data_s ev;
+               ev.data.global_default_rsp = calloc(1, sizeof(zb_event_global_default_rsp_s));
+               RETM_IF(NULL == ev.data.global_default_rsp, "Failed to memory allocation !");
+
+               ev.data.global_default_rsp->ep = ep;
+               ev.data.global_default_rsp->cluster_id = cluster_id;
+               ev.data.global_default_rsp->command_id = command_id;
+               ev.data.global_default_rsp->status = status;
+
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+               /* If there is global request already, remove that. */
+               if (0x00 != status)
+                       _zbl_remove_global_req(container, ep, cluster_id, command_id);
+#endif
+
+               container->event_handler(addr16, NULL, ZB_ZCL_GLOBAL_DEFAULT_RSP_EVENT, ev);
+               free(ev.data.global_default_rsp);
+       } else if (!g_strcmp0(signal_name, "alarm_count")) {
+               unsigned short alarm_count;
+               g_variant_get(parameters, "(q)", &alarm_count);
+
+               zb_event_data_s ev;
+               ev.data.alarm = calloc(1, sizeof(zb_event_alarm_s));
+               RETM_IF(NULL == ev.data.alarm, "Failed to memory allocation !");
+
+               ev.data.alarm->count = alarm_count;
+               container->event_handler(0, NULL, ZB_ZCL_ALARM_EVENT, ev);
+               free(ev.data.alarm);
+       } else if (!g_strcmp0(signal_name, "report_attr_handler_rsp")) {
+               nwk_addr addr16;
+               unsigned char ep;
+               unsigned char value;
+               unsigned short attrData;
+               unsigned short cluster_id;
+               unsigned char dataType;
+               unsigned short data_size;
+               int dsizeIndex = 0;
+               char dSize[3] = {'\0', '\0'};
+               int i = 0, j = 0, records_len;
+               GVariantIter *attr_iter, *dataType_iter, *data_iter;
+
+               attr_report_h *records = NULL;
+
+               g_variant_get(parameters, "(qyqaqayayi)",  &addr16, &ep,
+                        &cluster_id, &attr_iter, &dataType_iter, &data_iter, &records_len);
+
+               records = calloc(records_len, sizeof(attr_report_h));
+               RETM_IF(NULL == records, "calloc() Fail(%d)", errno);
+               for (j = 0; j < records_len; j++) {
+                       records[j] = calloc(1, sizeof(struct attribute_report_s));
+                       if (NULL == records[j]) {
+                               for (i = 0; i < j; i++)
+                                       free(records[i]);
+                               free(records);
+                               ERR("calloc() Fail(%d)", errno);
+                               return;
+                       }
+               }
+               DBG("record_length %d", records_len);
+
+               j = 0;
+               while (g_variant_iter_loop(attr_iter, "q", &attrData)
+                               && g_variant_iter_loop(dataType_iter, "y", &dataType)) {
+                       records[j]->id = attrData;
+                       records[j]->type = dataType;
+                       DBG("dataType 0x%02x", records[j]->type);
+                       DBG("AttributeId 0x%04x", records[j]->id);
+                       j++;
+               }
+               j = 0;
+               while (j < records_len) {
+                       switch (records[j]->type) {
+                       /* String */
+                       case ZB_ZCL_OCTAT_STRING:
+                       case ZB_ZCL_CHRACTER_STRING:
+                               g_variant_iter_loop(data_iter, "y", &value);
+                               data_size = value + 1;
+                               records[j]->value = calloc(data_size, sizeof(unsigned char));
+                               if (NULL == records[j]->value) {
+                                       for (i = 0; i < j; i++)
+                                               free(records[i]->value);
+                                       for (i = 0; i < records_len; i++)
+                                               free(records[i]);
+                                       free(records);
+                                       ERR("calloc() Fail(%d)", errno);
+                                       return;
+                               }
+                               records[j]->value[dsizeIndex] = value;
+                               dsizeIndex++;
+                               for (i = dsizeIndex; i < data_size - 2; i++) {
+                                       g_variant_iter_loop(data_iter, "y", &value);
+                                       records[j]->value[i] = value;
+
+                               }
+                               break;
+                       case ZB_ZCL_LONG_OCTAT_STRING:
+                       case ZB_ZCL_LONG_CHRACTER_STRING:
+                               g_variant_iter_loop(data_iter, "y", &value);
+                               dSize[0] = value;
+                               g_variant_iter_loop(data_iter, "y", &value);
+                               dSize[1] =  value;
+                               data_size = dSize[1];
+                               data_size = (data_size << 8) | dSize[0];
+                               data_size += 2;
+                               records[j]->value = calloc(data_size, sizeof(unsigned char));
+                               if (NULL == records[j]->value) {
+                                       for (i = 0; i < j; i++)
+                                               free(records[i]->value);
+                                       for (i = 0; i < records_len; i++)
+                                               free(records[i]);
+                                       free(records);
+                                       ERR("calloc() Fail(%d)", errno);
+                                       return;
+                               }
+                               records[j]->value[dsizeIndex] = dSize[dsizeIndex];
+                               dsizeIndex++;
+                               records[j]->value[dsizeIndex] = dSize[dsizeIndex];
+                               dsizeIndex++;
+                               for (i = dsizeIndex; i < data_size - 2; i++) {
+                                       g_variant_iter_loop(data_iter, "y", &value);
+                                       records[j]->value[i] = value;
+                               }
+                               break;
+                       /* Array, set and bag */
+                       case ZB_ZCL_ARRAY:
+                       case ZB_ZCL_SET:
+                       case ZB_ZCL_BAG:
+                       /* structure */
+                       case ZB_ZCL_STRUCTURE:
+                               ERR("Not supported type = %d", records[i]->type);
+                               continue;
+                       default:
+                               data_size = zb_get_data_size(records[j]->type);
+                               records[j]->value = calloc(data_size, sizeof(unsigned char));
+                               if (NULL == records[j]->value) {
+                                       for (i = 0; i < j; i++)
+                                               free(records[i]->value);
+                                       for (i = 0; i < records_len; i++)
+                                               free(records[i]);
+                                       free(records);
+                                       ERR("calloc() Fail(%d)", errno);
+                                       return;
+                               }
+                               if (data_size != 0xFF) {
+                                       for (i = 0; i < data_size; i++) {
+                                               g_variant_iter_loop(data_iter, "y", &value);
+                                               records[j]->value[i] = value;
+                                               DBG("value[%d] 0x%02X", i, records[j]->value[i]);
+                                       }
+                               }
+                       }
+                       DBG("DataType = 0x%02X Data Size = %d", records[j]->type, data_size);
+                       j++;
+               }
+
+               zb_event_data_s ev;
+               ev.data.global_attr_report = calloc(1, sizeof(zb_event_global_attr_report_s));
+               if (NULL == ev.data.global_attr_report) {
+                       ERR("Failed to memory allocation !");
+                       for (j = 0; j < records_len; j++) {
+                               free(records[j]->value);
+                               free(records[j]);
+                       }
+                       return;
+               }
+
+               ev.data.global_attr_report->records = records;
+               ev.data.global_attr_report->count = records_len;
+               container->event_handler(addr16, NULL, ZB_ZCL_GLOBAL_ATTRIBUTE_REPORT_EVENT, ev);
+               for (j = 0; j < records_len; j++) {
+                       free(records[j]->value);
+                       free(records[j]);
+               }
+               free(records);
+               free(ev.data.global_attr_report);
+       } else if (!g_strcmp0(signal_name, "status_change_rsp")) {
+               zb_event_data_s ev;
+               nwk_addr addr16;
+               unsigned char src_ep;
+               unsigned char extended_status;
+               unsigned short zone_status;
+               unsigned short delay;
+               unsigned char zone_id;
+               g_variant_get(parameters, "(qyqyyq)", &addr16, &src_ep, &zone_status,
+                       &extended_status, &zone_id, &delay);
+               if (0xff == zone_id) {
+                       ev.data.ias_noti = calloc(1, sizeof(zb_event_ias_noti_s));
+                       RETM_IF(NULL == ev.data.ias_noti, "Failed to memory allocation !");
+
+                       ev.data.ias_noti->src_ep = src_ep;
+                       ev.data.ias_noti->zone_status = zone_status;
+                       container->event_handler(addr16, NULL,
+                               ZB_ZCL_IAS_ZONE_STATUS_CHANGE_NOTIFICATION_EVENT, ev);
+
+                       free(ev.data.ias_noti);
+               } else {
+                       ev.data.ias_extended_noti = calloc(1, sizeof(zb_event_ias_extended_noti_s));
+                       RETM_IF(NULL == ev.data.ias_extended_noti, "Failed to memory allocation !");
+
+                       ev.data.ias_extended_noti->src_ep = src_ep;
+                       ev.data.ias_extended_noti->zone_status = zone_status;
+                       ev.data.ias_extended_noti->extended_status = extended_status;
+                       ev.data.ias_extended_noti->zone_id = zone_id;
+                       ev.data.ias_extended_noti->delay = delay;
+                       container->event_handler(addr16, NULL,
+                               ZB_ZCL_IAS_ZONE_STATUS_CHANGE_EXTENDED_NOTIFICATION_EVENT, ev);
+
+                       free(ev.data.ias_extended_noti);
+               }
+       } else if (!g_strcmp0(signal_name, "enroll_request")) {
+               nwk_addr addr16;
+               unsigned char src_ep;
+               unsigned short zone_type;
+               unsigned char mfg_code;
+               zb_event_data_s ev;
+               ev.data.ias_enroll_request = calloc(1, sizeof(zb_event_ias_enroll_request_s));
+               RETM_IF(NULL == ev.data.ias_enroll_request, "Failed to memory allocation !");
+
+               g_variant_get(parameters, "(qyqy)", &addr16, &src_ep, &zone_type, &mfg_code);
+               ev.data.ias_enroll_request->src_ep = src_ep;
+               ev.data.ias_enroll_request->zone_type = zone_type;
+               ev.data.ias_enroll_request->mfg_code = mfg_code;
+               container->event_handler(addr16, NULL, ZB_ZCL_IAS_ZONE_ENROLL_REQUEST_EVENT, ev);
+               free(ev.data.ias_enroll_request);
+       } else
+               ERR("Can't handle this signal=%s", signal_name);
+       return;
+}
+
+static void _zbl_dbus_unsubscribe_signal(GList *sub_ids)
+{
+       GDBusConnection *conn = _zbl_get_connection();
+       if (NULL == conn || NULL == sub_ids)
+               return;
+
+       while (sub_ids) {
+               g_dbus_connection_signal_unsubscribe(conn, GPOINTER_TO_UINT(sub_ids));
+               sub_ids = g_list_remove(sub_ids, sub_ids);
+       }
+}
+
+static int _zbl_dbus_subscribe_signal(zigbee_h handle)
+{
+       unsigned int id;
+
+       /* Section 1. Subscribe ZDO signal */
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_SERVICE_INTERFACE,
+                                               "service_enabled", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(service_enabled) Fail(%d)", errno);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for service_enabled signal %d", id);
+
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_SERVICE_INTERFACE,
+                                               "child_joined", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(child_rejoined) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for child_joined signal %d", id);
+
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_SERVICE_INTERFACE,
+                                               "child_rejoined", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(child_rejoined) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for child_rejoined signal %d", id);
+
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_SERVICE_INTERFACE,
+                                               "child_left", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(child_left) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for child_left signal %d", id);
+
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_SERVICE_INTERFACE,
+                                               "leave_network_done", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(leave_network_done) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for leave_network_done signal %d", id);
+
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_SERVICE_INTERFACE,
+                                               "form_network_done", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(form_network_done) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for form_network_done signal %d", id);
+
+       /* Section 3. Subscribe ZCL global command */
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+               "zcl_global_default_response", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(zcl_global_default_response) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for zcl_global_default_response signal %d", id);
+
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+               "report_attr_handler_rsp", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(report_attr_handler_rsp) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for report_attr_handler_rsp signal %d", id);
+
+       /* Section 2. Subscribe ZCL alarm cluster signal */
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ALARM_INTERFACE,
+                                               "alarm_count", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(alarm_count) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for alarm_count signal %d", id);
+
+       /* Section 3. Subscribe ZCL IAS cluster signal */
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLIAS_INTERFACE,
+                                       "status_change_rsp", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                       _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(status_change_rsp) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for status_change_rsp signal %d", id);
+
+       id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLIAS_INTERFACE,
+                                               "enroll_request", ZIGBEE_OBJECT_PATH, NULL, G_DBUS_CALL_FLAGS_NONE,
+                                               _zbl_signal_handler, handle, NULL);
+       if (0 == id) {
+               ERR("g_dbus_connection_signal_subscribe(enroll_request) Fail(%d)\n", errno);
+               _zbl_dbus_unsubscribe_signal(handle->dbus_sub_ids);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+       handle->dbus_sub_ids = g_list_append(handle->dbus_sub_ids, GUINT_TO_POINTER(id));
+       DBG("subscribed for enroll_request signal %d", id);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static void _zbl_dbus_name_owner_notify(GObject *object, GParamSpec *pspec,
+               gpointer *user_data)
+{
+       GDBusProxy *proxy = G_DBUS_PROXY(object);
+       gchar *name_owner = g_dbus_proxy_get_name_owner(proxy);
+       if (name_owner)
+               return;
+       zbl_dbus_stop();
+}
+
+int zbl_enable(zigbee_h handle, zb_event_cb event_handler)
+{
+       GVariant *variant = NULL;
+       unsigned char enabled;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+       handle->event_handler = event_handler;
+       variant = g_dbus_proxy_call_sync(service_gproxy, "enable",
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &enabled);
+               DBG("ZigBee enabled status 0x%x", enabled);
+       }
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_disable(void)
+{
+       DBG("zbl_disable()");
+
+       if (0 <= zbl_ref_count) {
+               WARN("dbus does not initiaized\n");
+               return ZIGBEE_ERROR_NO_DATA;
+       }
+
+       if (0 > --zbl_ref_count) {
+               DBG("all connections closed\n");
+               return ZIGBEE_ERROR_NONE;
+       }
+
+       if (gdbus_conn) {
+
+               if (service_gproxy) {
+                       g_dbus_proxy_call_sync(service_gproxy, "disable",
+                                       NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+
+                       g_object_unref(service_gproxy);
+                       service_gproxy = NULL;
+                       g_object_unref(on_off_gproxy);
+                       on_off_gproxy = NULL;
+                       g_object_unref(door_lock_gproxy);
+                       door_lock_gproxy = NULL;
+                       g_object_unref(level_control_gproxy);
+                       level_control_gproxy = NULL;
+                       g_object_unref(thermostat_gproxy);
+                       thermostat_gproxy = NULL;
+                       g_object_unref(alarm_gproxy);
+                       alarm_gproxy = NULL;
+                       g_object_unref(fan_control_gproxy);
+                       fan_control_gproxy = NULL;
+
+                       g_object_unref(mfglib_gproxy);
+                       mfglib_gproxy = NULL;
+                       g_object_unref(zcl_global_proxy);
+                       zcl_global_proxy = NULL;
+                       g_object_unref(zcl_color_control_proxy);
+                       zcl_color_control_proxy = NULL;
+                       g_object_unref(custom_gproxy);
+                       custom_gproxy = NULL;
+               }
+
+               g_object_unref(gdbus_conn);
+               gdbus_conn = NULL;
+       }
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_hw_reset(void)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       DBG("zbl_hw_reset()");
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "zb_hw_reset",
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant)
+               g_variant_get(variant, "(y)", &status);
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_get_network_info(ieee_addr addr64, nwk_addr *nodeid, nwk_addr *panid,
+               unsigned char *channel, unsigned char *tx_power)
+{
+       GVariant *variant = NULL;
+       GVariantIter *mac_iter = NULL;
+       GError *dbus_err = NULL;
+
+       nwk_addr _nodeid;
+       nwk_addr _panid;
+       unsigned char _radio_channel;
+       unsigned char _radio_tx_power;
+       unsigned char value;
+       int i = 0;
+
+       DBG("zbl_get_network_info()");
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "network_info",
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &dbus_err);
+
+       if (variant) {
+               g_variant_get(variant, "(ayqqyy)", &mac_iter,
+                               &_nodeid, &_panid, &_radio_channel, &_radio_tx_power);
+
+               /* Get EUI */
+               i = 0;
+               while (g_variant_iter_loop(mac_iter, "y", &value)) {
+                       addr64[i] = value;
+                       i++;
+               }
+               DBG("  EUI : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                               addr64[0], addr64[1], addr64[2],
+                               addr64[3], addr64[4], addr64[5],
+                               addr64[6], addr64[7]);
+               DBG("  nodeID [0x%04X]", _nodeid);
+               DBG("  PanID [0x%04X]", _panid);
+               DBG("  Channel [%d] Tx Power [%d]", _radio_channel, _radio_tx_power);
+
+               if (nodeid)
+                       *nodeid = _nodeid;
+               if (panid)
+                       *panid = _panid;
+               if (channel)
+                       *channel = _radio_channel;
+               if (tx_power)
+                       *tx_power = _radio_tx_power;
+
+               g_variant_unref(variant);
+       } else {
+               ERR("Failed to get network_info [%s]", dbus_err->message);
+               g_error_free(dbus_err);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_get_controller_mac_address(ieee_addr addr64)
+{
+       GVariant *variant = NULL;
+       GVariantIter *iter = NULL;
+       char value;
+       int j = 0;
+
+       DBG("zbl_get_controller_mac_address()");
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "get_mac",
+                       NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(ay)", &iter);
+               while (g_variant_iter_loop(iter, "y", &value)) {
+                       addr64[j] = value;
+                       j++;
+               }
+               DBG("IEEE ADDR 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X",
+                       addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5],
+                       addr64[6], addr64[7]);
+               return ZIGBEE_ERROR_NONE;
+       }
+       return ZIGBEE_ERROR_IO_ERROR;
+}
+
+int zbl_get_cluster_list(ieee_addr eui64, unsigned char endpoint, unsigned short list[],
+               unsigned char *count)
+{
+       GVariant *variant = NULL;
+       GVariantBuilder *mac_builder = NULL;
+       GVariant *mac_variant = NULL;
+       GVariantIter *iter = NULL;
+       unsigned short cluster;
+       int i = 0;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       mac_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       g_variant_builder_add(mac_builder, "y", eui64[7]);
+       g_variant_builder_add(mac_builder, "y", eui64[6]);
+       g_variant_builder_add(mac_builder, "y", eui64[5]);
+       g_variant_builder_add(mac_builder, "y", eui64[4]);
+       g_variant_builder_add(mac_builder, "y", eui64[3]);
+       g_variant_builder_add(mac_builder, "y", eui64[2]);
+       g_variant_builder_add(mac_builder, "y", eui64[1]);
+       g_variant_builder_add(mac_builder, "y", eui64[0]);
+       mac_variant = g_variant_builder_end(mac_builder);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "cluster_list",
+                               g_variant_new("(@ayy)", mac_variant, endpoint), G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(aq)", &iter);
+               while (g_variant_iter_loop(iter, "q", &cluster)) {
+                       DBG("Cluster 0x%04X", cluster);
+                       list[i++] = cluster;
+               }
+               *count = i;
+               if (0 == i)
+                       ERR("No Clusters for Endpoint %0X", endpoint);
+
+               g_variant_iter_free(iter);
+               g_variant_unref(variant);
+       } else {
+               ERR("No Clusters for Endpoint %0X", endpoint);
+               *count = 0;
+       }
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_get_endpoint_list(ieee_addr eui64, unsigned char list[], unsigned char *count)
+{
+       GVariant *variant = NULL;
+       GVariantBuilder *mac_builder = NULL;
+       GVariant *mac_variant = NULL;
+       GVariantIter *iter = NULL;
+       unsigned char endpoint;
+       int i = 0;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       mac_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       g_variant_builder_add(mac_builder, "y", eui64[7]);
+       g_variant_builder_add(mac_builder, "y", eui64[6]);
+       g_variant_builder_add(mac_builder, "y", eui64[5]);
+       g_variant_builder_add(mac_builder, "y", eui64[4]);
+       g_variant_builder_add(mac_builder, "y", eui64[3]);
+       g_variant_builder_add(mac_builder, "y", eui64[2]);
+       g_variant_builder_add(mac_builder, "y", eui64[1]);
+       g_variant_builder_add(mac_builder, "y", eui64[0]);
+       mac_variant = g_variant_builder_end(mac_builder);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "endpoint_list",
+                               g_variant_new("(@ay)", mac_variant), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(ay)", &iter);
+               while (g_variant_iter_loop(iter, "y", &endpoint)) {
+                       DBG("Endpoint 0x%X", endpoint);
+                       list[i++] = endpoint;
+               }
+               if (i > 0) {
+                       *count = i;
+                       DBG("Endpoint Count %d", i);
+               } else {
+                       ERR("No Endpoints");
+                       *count = 0;
+               }
+               g_variant_iter_free(iter);
+               g_variant_unref(variant);
+
+       } else {
+               ERR("NULL Variant");
+               ERR("No Endpoints");
+               *count = 0;
+       }
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zb_api_get_node_type(ieee_addr eui64, unsigned char *node_type)
+{
+       GVariant *variant = NULL;
+       GVariantBuilder *mac_builder = NULL;
+       GVariant *mac_variant = NULL;
+       unsigned char n_type = 0;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       mac_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       g_variant_builder_add(mac_builder, "y", eui64[7]);
+       g_variant_builder_add(mac_builder, "y", eui64[6]);
+       g_variant_builder_add(mac_builder, "y", eui64[5]);
+       g_variant_builder_add(mac_builder, "y", eui64[4]);
+       g_variant_builder_add(mac_builder, "y", eui64[3]);
+       g_variant_builder_add(mac_builder, "y", eui64[2]);
+       g_variant_builder_add(mac_builder, "y", eui64[1]);
+       g_variant_builder_add(mac_builder, "y", eui64[0]);
+       mac_variant = g_variant_builder_end(mac_builder);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "node_type",
+                               g_variant_new("(@ay)", mac_variant), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(y)", &n_type);
+               *node_type = n_type;
+               DBG("Node Type 0x%x", n_type);
+
+       } else {
+               ERR("NULL Variant");
+               *node_type = 0;
+       }
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_get_all_device_info(zb_end_device_info_h **dev_list, unsigned char* num)
+{
+       int i = 0;
+       int j = 0;
+       int k = 0;
+       struct zb_end_device_info_s **list;
+       GVariant *variant = NULL;
+       GVariantIter *iter = NULL;
+       GVariantIter *mac_iter = NULL;
+       GVariantIter *endpoint_iter = NULL;
+       unsigned short node_id;
+       unsigned char node_type;
+       unsigned char node_mac_address[8] = {0x00};
+       unsigned char endpoint_cnt = 0;
+       unsigned char value;
+       unsigned char value_endpoint;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       /* check the format string when there are no input args */
+       variant = g_dbus_proxy_call_sync(service_gproxy, "device_info",
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(a(qyayyay))", &iter);
+
+               list = calloc(MAX_DEVICE_LIST+1, sizeof(zb_end_device_info_h));
+               RETV_IF(NULL == list, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               for (i = 0; i < MAX_DEVICE_LIST && list; i++) {
+                       list[i] = calloc(1, sizeof(struct zb_end_device_info_s));
+                       if (NULL == list[i]) {
+                               for (j = 0; j < i; j++)
+                                       free(list[j]);
+                               free(list);
+                               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+                       }
+               }
+
+               i = 0;
+               while (g_variant_iter_loop(iter, "(qyayyay)", &node_id, &node_type, &mac_iter,
+                               &endpoint_cnt, &endpoint_iter)) {
+                       j = 0;
+                       k = 0;
+                       /* Get Network Address */
+                       list[i]->addr16 = node_id;
+                       DBG("Node ID: 0x%04X", node_id);
+                       /* Get Node Type */
+                       list[i]->node_type = node_type;
+                       DBG("Node Type : 0x%02X", node_type);
+                       /* Get End-Point count */
+                       list[i]->num_of_ep = endpoint_cnt;
+                       DBG("Endpoint Count: 0x%X", endpoint_cnt);
+                       /* Get End-Point list */
+                       list[i]->num_of_ep = endpoint_cnt;
+                       while (g_variant_iter_loop(endpoint_iter, "y", &value_endpoint)) {
+                               list[i]->ep[k] = value_endpoint;
+                               DBG("Endpoint : %d", value_endpoint);
+                               k++;
+                       }
+                       /* Get IEEE address */
+                       while (g_variant_iter_loop(mac_iter, "y", &value)) {
+                               node_mac_address[j] = value;
+                               j++;
+                       }
+                       memcpy(list[i]->addr64, node_mac_address, sizeof(ieee_addr));
+                       DBG("Node MAC Addr : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                               node_mac_address[0], node_mac_address[1], node_mac_address[2],
+                               node_mac_address[3], node_mac_address[4], node_mac_address[5],
+                               node_mac_address[6], node_mac_address[7]);
+                       i++;
+
+               }
+               if (0 == i)
+                       ERR("No attached nodes");
+
+               *num = i;
+               *dev_list = list;
+               g_variant_iter_free(iter);
+               g_variant_unref(variant);
+       } else {
+               ERR("NULL Variant");
+               ERR("No attached nodes");
+               *num = 0;
+
+       }
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_coex_start(unsigned char channel)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       DBG("zbl_coex_start()");
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "coex_start",
+                               g_variant_new("(y)", channel), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+
+       if (variant)
+               g_variant_get(variant, "(y)", &status);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_coex_stop(void)
+{
+       GVariant *variant = NULL;
+       int ret = 0;
+
+       DBG("zbl_coex_stop()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "coex_stop",
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+
+       if (variant)
+               g_variant_get(variant, "(q)", &ret);
+
+       return ret;
+}
+
+int zbl_form_network(zigbee_h handle)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       DBG("zbl_form_network()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       /* Send enable command : sync */
+       variant = g_dbus_proxy_call_sync(service_gproxy, "form_network",
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Form network Status 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_disable_network(void)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       DBG("zbl_disable_network()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "leave_network",
+                               NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("disable network Status 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_leave_device(ieee_addr addr64, bool remove_children, bool rejoin)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+       GVariantBuilder *mac_builder = NULL;
+       GVariant* mac_variant = NULL;
+       unsigned char _remove_children = (remove_children) ? 1 : 0;
+       unsigned char _rejoin = (rejoin) ? 1 : 0;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       mac_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       g_variant_builder_add(mac_builder, "y", addr64[7]);
+       g_variant_builder_add(mac_builder, "y", addr64[6]);
+       g_variant_builder_add(mac_builder, "y", addr64[5]);
+       g_variant_builder_add(mac_builder, "y", addr64[4]);
+       g_variant_builder_add(mac_builder, "y", addr64[3]);
+       g_variant_builder_add(mac_builder, "y", addr64[2]);
+       g_variant_builder_add(mac_builder, "y", addr64[1]);
+       g_variant_builder_add(mac_builder, "y", addr64[0]);
+       mac_variant = g_variant_builder_end(mac_builder);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "leave_req",
+                               g_variant_new("(@ayyy)", mac_variant, _remove_children, _rejoin),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(b)", &status);
+               DBG("zigbee_remove_device 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_permit_join(unsigned char duration, bool broadcast)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "permit_join",
+                               g_variant_new("(ib)", duration, broadcast),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("permit join Status 0x%x", status);
+       }
+
+       return status;
+}
+
+static gboolean _zbl_timeout_addr_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_addr_rsp cb = NULL;
+
+       DBG(" _zbl_timeout_addr_req()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, NULL, 0, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_request_cleanup(gpointer data)
+{
+       zbl_req_cb_s *container = data;
+       RET_IF(NULL == container);
+
+       if (container->tid) {
+               g_source_remove(container->tid);
+               DBG("tid=%d removed");
+               container->tid = 0;
+       }
+
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       _zbl_deregister_global_req(container->handle, container);
+#endif
+
+       free(container);
+}
+
+static void _zbl_addr_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_addr_rsp cb = container->cb;
+
+       int j = 0;
+       nwk_addr addr16;
+       ieee_addr addr64;
+       unsigned char status;
+       unsigned char num;
+       unsigned char start_idx;
+       unsigned char value;
+       GVariantIter *mac_iter;
+
+       container->found = true;
+
+       DBG("_zbl_addr_req_cb");
+
+       g_variant_get(parameters, "(yayqyy)", &status, &mac_iter, &addr16, &num, &start_idx);
+       while (g_variant_iter_loop(mac_iter, "y", &value)) {
+               addr64[j] = value;
+               j++;
+       }
+
+       if (cb)
+               cb(status, addr64, addr16, num, start_idx, NULL, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_nwk_addr_req(zigbee_h handle, ieee_addr addr64, unsigned char request_type,
+       unsigned char start_idx, zb_zdo_addr_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+       GVariantBuilder *mac_builder = NULL;
+       GVariant* mac_variant = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG(" zbl_nwk_addr_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "nwk_addr_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_addr_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_addr_req, container);
+       container->userdata = user_data;
+
+       mac_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       g_variant_builder_add(mac_builder, "y", addr64[7]);
+       g_variant_builder_add(mac_builder, "y", addr64[6]);
+       g_variant_builder_add(mac_builder, "y", addr64[5]);
+       g_variant_builder_add(mac_builder, "y", addr64[4]);
+       g_variant_builder_add(mac_builder, "y", addr64[3]);
+       g_variant_builder_add(mac_builder, "y", addr64[2]);
+       g_variant_builder_add(mac_builder, "y", addr64[1]);
+       g_variant_builder_add(mac_builder, "y", addr64[0]);
+       mac_variant = g_variant_builder_end(mac_builder);
+
+       g_dbus_proxy_call(zdo_dev_proxy, "nwk_addr_req",
+               g_variant_new("(@ayyy)", mac_variant, request_type, start_idx),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ieee_addr_req(zigbee_h handle, nwk_addr addr16, zb_zdo_addr_rsp cb,
+               void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_ieee_addr_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "nwk_addr_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_addr_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_addr_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "ieee_addr_req", g_variant_new("(q)", addr16),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_active_ep_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_active_ep_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_active_ep_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_active_ep_rsp cb = container->cb;
+
+       int j = 0;
+       nwk_addr addr16;
+       unsigned char status;
+       unsigned char count;
+       unsigned char value;
+       GVariantIter *ep_iter;
+       unsigned char *ep_list;
+
+       DBG("_zbl_active_ep_cb");
+
+       g_variant_get(parameters, "(qyayy)", &addr16, &status, &ep_iter, &count);
+       ep_list = calloc(count+1, sizeof(unsigned char));
+       RETM_IF(NULL == ep_list, "calloc() Fail(%d)", errno);
+
+       container->found = true;
+
+       while (g_variant_iter_loop(ep_iter, "y", &value)) {
+               ep_list[j] = value;
+               j++;
+       }
+
+       if (cb)
+               cb(status, addr16, count, ep_list, container->userdata);
+
+       free(ep_list);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_active_ep(zigbee_h handle, nwk_addr addr16, zb_zdo_active_ep_rsp cb,
+               void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_active_ep()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "active_ep_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_active_ep_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_active_ep_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "active_ep_req", g_variant_new("(q)", addr16),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_simple_desc_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_simple_desc_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_simple_desc_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zbl_simple_desc_req_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_simple_desc_rsp cb = container->cb;
+
+       int j = 0;
+       int count;
+       unsigned short addr16;
+       unsigned short value;
+       GVariantIter *in_iter;
+       GVariantIter *out_iter;
+       zb_zdo_simple_desc_h records;
+
+       records = calloc(1, sizeof(struct zb_zdo_simple_desc_s));
+       RETM_IF(NULL == records, "calloc() Fail(%d)", errno);
+
+       container->found = true;
+
+       g_variant_get(parameters, "(qiyyqqyyaqaq)", &addr16, &count, &records->device_ver,
+                       &records->ep, &records->profile_id, &records->device_id,
+                       &records->num_of_in_clusters, &records->num_of_out_clusters, &in_iter,
+                       &out_iter);
+#if 0
+       records->in_clusters = calloc(sizeof(unsigned short), records->num_of_in_clusters);
+       if (NULL == records->in_clusters) {
+               ERR("calloc() Fail(%d)", errno);
+               free(records);
+               return;
+       }
+       records->out_clusters = calloc(sizeof(unsigned short), records->num_of_out_clusters);
+       if (NULL == records->out_clusters) {
+               ERR("calloc() Fail(%d)", errno);
+               free(records->in_clusters);
+               free(records);
+               return;
+       }
+#endif
+       while (g_variant_iter_loop(in_iter, "q", &value)) {
+               records->in_clusters[j] = value;
+               j++;
+       }
+
+       j = 0;
+       while (g_variant_iter_loop(out_iter, "q", &value)) {
+               records->out_clusters[j] = value;
+               j++;
+       }
+
+       if (cb) {
+               cb(addr16, count, records, container->userdata);
+               DBG("addr16=0x%x, count=%d, records->ep=%d, records->device_id=0x%x",
+                       addr16, count, records->ep, records->device_id);
+               for (j = 0; j < records->num_of_in_clusters; j++)
+                       DBG("in_clusters[%d] = 0x%x", j, records->in_clusters[j]);
+               for (j = 0; j < records->num_of_out_clusters; j++)
+                       DBG("out_clusters[%d] = 0x%x", j, records->out_clusters[j]);
+       }
+#if 0
+       free(records->in_clusters);
+       free(records->out_clusters);
+#endif
+       free(records);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_simple_desc_req(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               zb_zdo_simple_desc_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_simple_desc_req() : [%X]", addr16);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "simple_desc_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_simple_desc_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_simple_desc_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "simple_desc_req", g_variant_new("(qy)", addr16, ep),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+int zbl_extended_simple_desc_req(zigbee_h handle, nwk_addr addr16,
+               unsigned char start_idx, zb_zdo_extended_simple_desc_rsp cb, void *user_data)
+{
+       return ZIGBEE_ERROR_NOT_SUPPORTED;
+}
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
+static gboolean _zbl_timeout_match_desc_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_match_desc_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_match_desc_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_match_desc_rsp cb = container->cb;
+
+       int j = 0;
+       int match_len;
+       nwk_addr addr16;
+       unsigned char value;
+       unsigned char status;
+       GVariantIter *ml_iter;
+       unsigned char *match_list = NULL;
+       g_variant_get(parameters, "(yqyay)", &status, &addr16, &match_len, &ml_iter);
+
+       DBG("match_len = %d", match_len);
+
+       if (match_len > 0) {
+               match_list = calloc(match_len+1, sizeof(unsigned char));
+               RETM_IF(NULL == match_list, "calloc() Fail(%d)", errno);
+               while (g_variant_iter_loop(ml_iter, "y", &value)) {
+                       match_list[j] = value;
+                       DBG("match_list[i]=%d", j, match_list[j]);
+                       j++;
+               }
+       }
+
+       if (cb)
+               cb(status, addr16, match_len, &match_list, container->userdata);
+
+       if (match_list)
+               free(match_list);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+
+int zbl_match_desc_req(zigbee_h handle, nwk_addr addr16,
+               unsigned short profile_id, unsigned char num_in_clusters,
+               unsigned short *in_clusters, unsigned char num_out_clusters,
+               unsigned short *out_clusters, zb_zdo_match_desc_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       int i;
+       GVariantBuilder *incl_builder = NULL;
+       GVariant* incl_variant = NULL;
+       GVariantBuilder *outcl_builder = NULL;
+       GVariant* outcl_variant = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_match_desc_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "matched_descriptor_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_match_desc_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_match_desc_req, container);
+       container->userdata = user_data;
+
+       incl_builder = g_variant_builder_new(G_VARIANT_TYPE("aq"));
+       for (i = 0; i < num_in_clusters; i++)
+               g_variant_builder_add(incl_builder, "q", in_clusters[i]);
+
+       outcl_builder = g_variant_builder_new(G_VARIANT_TYPE("aq"));
+       for (i = 0; i < num_out_clusters; i++)
+               g_variant_builder_add(outcl_builder, "q", out_clusters[i]);
+
+       incl_variant = g_variant_builder_end(incl_builder);
+       outcl_variant = g_variant_builder_end(outcl_builder);
+
+       g_dbus_proxy_call(zdo_dev_proxy, "matched_descriptor_req",
+                               g_variant_new("(qqy@aqy@aq)", addr16, profile_id, num_in_clusters,
+                               incl_variant, num_out_clusters, outcl_variant),
+                               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_node_desc_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_node_desc_rsp cb = NULL;
+
+       DBG("_zbl_timeout_node_desc_req()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_node_desc_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_node_desc_rsp cb = container->cb;
+
+       nwk_addr addr16;
+       unsigned char status;
+       zb_zdo_node_descriptor_h desc;
+
+       DBG("_zbl_node_desc_req_cb");
+
+       desc = calloc(1, sizeof(struct zb_zdo_node_descriptor_s));
+       RETM_IF(NULL == desc, "calloc() Fail(%d)", errno);
+
+       container->found = true;
+
+       g_variant_get(parameters, "(yqyyyyyyqyqqqy)", &status, &addr16,
+               &desc->logical_type, &desc->complex_desciptor_available,
+               &desc->user_descriptor_available, &desc->aps_flags, &desc->frequency_band,
+               &desc->mac_capability_flags, &desc->manufacturer_code, &desc->maximum_buffer_size,
+               &desc->maximum_incoming_transfer_size, &desc->server_mask,
+               &desc->maximum_outgoing_transfer_size, &desc->descriptor_capability_field);
+
+       if (cb)
+               cb(status, addr16, desc, container->userdata);
+
+       free(desc);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_node_desc_req(nwk_addr addr16, zb_zdo_node_desc_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_node_desc_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "node_desc_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_node_desc_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_node_desc_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "node_desc_req", g_variant_new("(q)", addr16),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_power_desc_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_node_desc_rsp cb = NULL;
+
+       DBG("_zbl_timeout_power_desc_req()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_power_desc_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_power_desc_rsp cb = container->cb;
+
+       nwk_addr addr16;
+       unsigned char status;
+       zb_zdo_node_power_descriptor_h desc;
+
+       DBG("_zbl_power_desc_req_cb");
+
+       desc = calloc(1, sizeof(struct zb_zdo_node_power_descriptor_s));
+       RETM_IF(NULL == desc, "calloc() Fail(%d)", errno);
+
+       container->found = true;
+
+       g_variant_get(parameters, "(yqyyyy)", &status, &addr16,
+                               &desc->current_power_mode, &desc->available_power_sources,
+                               &desc->current_power_source, &desc->current_power_source_level);
+
+       if (cb)
+               cb(status, addr16, desc, container->userdata);
+
+       free(desc);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_power_desc_req(nwk_addr addr16, zb_zdo_power_desc_rsp cb,      void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "power_desc_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_power_desc_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_power_desc_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "power_desc_req", g_variant_new("(q)", addr16),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_complex_desc_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_complex_desc_rsp cb = NULL;
+
+       DBG("_zbl_timeout_complex_desc_req()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_complex_desc_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_complex_desc_rsp cb = container->cb;
+
+       int length;
+       nwk_addr addr16;
+       unsigned char j = 0;
+       unsigned char value;
+       unsigned char status;
+       GVariantIter *comp_iter = NULL;
+       unsigned char *complex_desc = NULL;
+
+       DBG("_zbl_complex_desc_req_cb");
+
+       g_variant_get(parameters, "(yqyay)", &status, &addr16, &length, &comp_iter);
+       if (length > 0) {
+               complex_desc = calloc(length, sizeof(char));
+               RETM_IF(NULL == complex_desc, "calloc() Fail(%d)", errno);
+               while (g_variant_iter_loop(comp_iter, "y", &value)) {
+                       complex_desc[j] = value;
+                       j++;
+               }
+       }
+
+       container->found = true;
+
+       if (cb)
+               cb(status, addr16, length, complex_desc, container->userdata);
+
+       free(complex_desc);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_complex_desc_req(nwk_addr addr16, zb_zdo_complex_desc_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "complex_desc_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_complex_desc_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_complex_desc_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "complex_desc_req", g_variant_new("(q)", addr16),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_user_desc_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_complex_desc_rsp cb = NULL;
+
+       DBG("_zbl_timeout_user_desc_req()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_user_desc_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_user_desc_rsp cb = container->cb;
+
+       int length;
+       nwk_addr addr16;
+       unsigned char j = 0;
+       unsigned char value;
+       unsigned char status;
+       GVariantIter *comp_iter = NULL;
+       unsigned char *complex_desc = NULL;
+
+       DBG("_zbl_user_desc_req_cb");
+
+       g_variant_get(parameters, "(yqyay)", &status, &addr16, &length, &comp_iter);
+       if (length > 0) {
+               complex_desc = calloc(length, sizeof(char));
+               RETM_IF(NULL == complex_desc, "calloc() Fail(%d)", errno);
+               while (g_variant_iter_loop(comp_iter, "y", &value)) {
+                       complex_desc[j] = value;
+                       j++;
+               }
+       }
+
+       container->found = true;
+
+       if (cb)
+               cb(status, addr16, length, complex_desc, container->userdata);
+
+       free(complex_desc);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_user_desc_req(nwk_addr addr16, zb_zdo_user_desc_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "user_desc_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_user_desc_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_user_desc_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "user_desc_req", g_variant_new("(q)", addr16),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_user_desc_set(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_user_desc_conf cb = NULL;
+
+       DBG("_zbl_timeout_user_desc_req()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_user_desc_set_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_user_desc_conf cb = container->cb;
+
+       unsigned char status;
+
+       container->found = true;
+
+       DBG("_zbl_user_desc_set_cb");
+
+       g_variant_get(parameters, "(y)", &status);
+
+       if (cb)
+               cb(status, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+#define MAX_USER_DESC_SIZE 0x10
+#define USER_DESC_COMMAND_SIZE 20
+
+int zbl_user_desc_set(zigbee_h handle, nwk_addr addr16, unsigned char len,
+               unsigned char *user_desc, zb_zdo_user_desc_conf cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+       unsigned char j = 0x00;
+       GVariantBuilder *user_desc_builder = NULL;
+       GVariant *user_desc_variant = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+       RETVM_IF(len > MAX_USER_DESC_SIZE || len < 0x00, ZIGBEE_ERROR_INVALID_PARAMETER,
+               "invalid length=%d", len);
+       RETVM_IF(NULL == user_data, ZIGBEE_ERROR_INVALID_PARAMETER, "invalid data");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "user_desc_confirm", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_user_desc_set_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_user_desc_set, container);
+       container->userdata = user_data;
+
+       user_desc_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       for (j = 0; j < len; j++)
+               g_variant_builder_add(user_desc_builder, "y", user_desc[j]);
+
+       user_desc_variant = g_variant_builder_end(user_desc_builder);
+
+       g_dbus_proxy_call(zdo_dev_proxy, "user_desc_set_req", g_variant_new("(qy@ay)",
+               addr16, len, user_desc_variant), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_device_annce(zigbee_h handle, nwk_addr addr16, ieee_addr addr64,
+               unsigned char capability)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+       GVariantBuilder *mac_builder = NULL;
+       GVariant* mac_variant = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       mac_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       g_variant_builder_add(mac_builder, "y", addr64[7]);
+       g_variant_builder_add(mac_builder, "y", addr64[6]);
+       g_variant_builder_add(mac_builder, "y", addr64[5]);
+       g_variant_builder_add(mac_builder, "y", addr64[4]);
+       g_variant_builder_add(mac_builder, "y", addr64[3]);
+       g_variant_builder_add(mac_builder, "y", addr64[2]);
+       g_variant_builder_add(mac_builder, "y", addr64[1]);
+       g_variant_builder_add(mac_builder, "y", addr64[0]);
+       mac_variant = g_variant_builder_end(mac_builder);
+
+       variant = g_dbus_proxy_call_sync(zdo_dev_proxy, "device_annce",
+                               g_variant_new("(q@ayy)", addr16, mac_variant, capability),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_device_annce Status 0x%x", status);
+       }
+
+       return status;
+}
+
+static gboolean _zbl_timeout_bind_req_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_bind_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_bind_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_bind_rsp cb = container->cb;
+
+       unsigned char status;
+
+       container->found = true;
+
+       DBG("_zbl_bind_req_cb");
+
+       g_variant_get(parameters, "(y)", &status);
+
+       if (cb)
+               cb(status, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_bind_req(nwk_addr dst_addr16, ieee_addr src_addr64,
+               unsigned char src_ep, unsigned short cluster_id, ieee_addr dst_addr64,
+               unsigned char type, nwk_addr group_addr, unsigned char dst_ep,
+               zb_zdo_bind_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+       GVariantBuilder *src_addr64_builder = NULL;
+       GVariant* src_addr64_variant = NULL;
+       GVariantBuilder *dst_addr64_builder = NULL;
+       GVariant* dst_addr64_variant = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_bind_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_zdo_bind_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_bind_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOBIND_INTERFACE,  "binding_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_bind_req_cb, container, _zbl_request_cleanup);
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_bind_req_req, container);
+       container->userdata = user_data;
+
+       src_addr64_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+
+       if (src_addr64) {
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[7]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[6]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[5]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[4]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[3]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[2]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[1]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[0]);
+       }
+       src_addr64_variant = g_variant_builder_end(src_addr64_builder);
+
+       dst_addr64_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       if (dst_addr64) {
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[7]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[6]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[5]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[4]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[3]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[2]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[1]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[0]);
+       }
+       dst_addr64_variant = g_variant_builder_end(dst_addr64_builder);
+
+       g_dbus_proxy_call(zdo_bind_proxy, "bind_req",
+               g_variant_new("(q@ayyq@ayyqy)", dst_addr16, src_addr64_variant, src_ep,
+                                               cluster_id, dst_addr64_variant, type, group_addr, dst_ep),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_unbind_req_req(gpointer p)
+{
+       zbl_req_cb_s *con = NULL;
+       zb_zdo_unbind_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       con = p;
+       RETVM_IF(NULL == con, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = con->cb;
+
+       if (false == con->found && con->cb)
+               cb(ZB_ZDP_TIMEOUT, con->userdata);
+
+       con->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, con->sid);
+       con->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_unbind_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_bind_rsp cb = container->cb;
+
+       unsigned char status;
+
+       container->found = true;
+
+       DBG("_zbl_unbind_req_cb");
+
+       g_variant_get(parameters, "(y)", &status);
+
+       if (cb)
+               cb(status, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+
+int zbl_unbind_req(nwk_addr dst_addr16,
+               ieee_addr src_addr64, unsigned char src_ep, unsigned short cluster_id,
+               ieee_addr dst_addr64, unsigned char type, nwk_addr group_addr,
+               unsigned char dst_ep, zb_zdo_unbind_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+       GVariantBuilder *src_addr64_builder = NULL;
+       GVariant* src_addr64_variant = NULL;
+       GVariantBuilder *dst_addr64_builder = NULL;
+       GVariant* dst_addr64_variant = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_bind_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_zdo_unbind_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_bind_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOBIND_INTERFACE,  "unbindng_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_unbind_req_cb, container, _zbl_request_cleanup);
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_unbind_req_req, container);
+       container->userdata = user_data;
+
+       src_addr64_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       if (src_addr64) {
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[7]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[6]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[5]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[4]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[3]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[2]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[1]);
+               g_variant_builder_add(src_addr64_builder, "y", src_addr64[0]);
+       }
+       src_addr64_variant = g_variant_builder_end(src_addr64_builder);
+
+       dst_addr64_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       if (dst_addr64) {
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[7]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[6]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[5]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[4]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[3]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[2]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[1]);
+               g_variant_builder_add(dst_addr64_builder, "y", dst_addr64[0]);
+       }
+       dst_addr64_variant = g_variant_builder_end(dst_addr64_builder);
+
+       g_dbus_proxy_call(zdo_bind_proxy, "unbind_req",
+               g_variant_new("(q@ayyq@ayyqy)", dst_addr16, src_addr64_variant, src_ep,
+                                               cluster_id, dst_addr64_variant, type, group_addr, dst_ep),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_mgmt_nwk_disc_req(gpointer p)
+{
+       zbl_req_cb_s *con = NULL;
+       zb_zdo_mgmt_nwk_disc_rsp cb = NULL;
+       zb_zdo_network_list_record_h *records = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       con = p;
+       RETVM_IF(NULL == con, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = con->cb;
+
+       records = calloc(1, sizeof(zb_zdo_network_list_record_h));
+       if (records) {
+               records[0] = calloc(1, sizeof(struct zb_zdo_network_list_record_s));
+       }
+
+       if (false == con->found && con->cb)
+               cb(0, 0, 0, 0, records, con->userdata);
+
+       if (records[0])
+               free(records[0]);
+       if (records)
+               free(records);
+
+       con->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, con->sid);
+       con->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_mgmt_nwk_disc_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_mgmt_nwk_disc_rsp cb = container->cb;
+
+       int i = 0;
+       int j = 0;
+       unsigned char value;
+       unsigned char status = 0;
+       unsigned char nwk_count = 0;
+       unsigned char start_index = 0;
+       unsigned char nwk_list_count = 0;
+
+       GVariantIter *mac_iter;
+       GVariantIter *resp_iter;
+
+       DBG("_zbl_mgmt_nwk_disc_req_cb()");
+
+       g_variant_get(parameters, "(yyyya(ayayyqyyyyy))", &status, &nwk_count,
+               &start_index, &nwk_list_count, &resp_iter);
+
+       zb_zdo_network_list_record_h *records = NULL;
+
+       if (!status) {
+               if (nwk_list_count > 0) {
+                       records = calloc(nwk_list_count, sizeof(zb_zdo_network_list_record_h));
+                       RETM_IF(NULL == records, "calloc() Fail(%d)", errno);
+                       for (i = 0; i < nwk_list_count; i++) {
+                               records[i] = calloc(1, sizeof(struct zb_zdo_network_list_record_s));
+                               if (NULL == records[i]) {
+                                       ERR("calloc() Fail(%d)", errno);
+                                       goto OUT;
+                               }
+                       }
+               }
+               for (i = 0; i < nwk_list_count; i++) {
+                       g_variant_iter_loop(resp_iter, "(ayayyqyyyyy)", &mac_iter, &records[i]->logical_channel,
+                               &records[i]->stack_profile, &records[i]->zigbee_version, &records[i]->beacon_order,
+                               &records[i]->superframe_order, &records[i]->permit_joining);
+                       for (j = 0; j < 8; j++) {
+                               g_variant_iter_loop(mac_iter, "y", &value);
+                               records[i]->extended_pan_id[j] = value;
+                       }
+               }
+       }
+
+       if (cb)
+               cb(status, nwk_count, start_index, nwk_list_count, records, container->userdata);
+
+OUT:
+       for (i = 0; i < nwk_list_count; i++)
+               if (records[i])
+                       free(records[i]);
+       free(records);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_mgmt_nwk_disc_req(nwk_addr addr16, unsigned int scan_channels,
+       unsigned char scan_duration, unsigned char scan_count, unsigned char start_idx,
+       zb_zdo_mgmt_nwk_disc_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_mgmt_nwk_disc_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "nwk_disc_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_mgmt_nwk_disc_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_mgmt_nwk_disc_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "nwk_disc_req",
+               g_variant_new("(quyqy)", addr16, scan_channels, scan_duration, scan_count, start_idx),
+               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_mgmt_nwk_update_req(unsigned int scan_channels, unsigned char scan_duration,
+       unsigned char scan_count, unsigned char nwk_update_id, nwk_addr nwk_manager_addr)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_mgmt_nwk_update_req()");
+
+       g_dbus_proxy_call(zdo_dev_proxy, "nwk_update_req",
+               g_variant_new("(quyyy)", nwk_manager_addr, scan_channels, scan_duration,
+               scan_count, nwk_update_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_mgmt_lqi_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_mgmt_lqi_rsp cb = NULL;
+       zb_zdo_neighbor_table_desc_h *records = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       records = calloc(1, sizeof(zb_zdo_neighbor_table_desc_h));
+       if (records) {
+               records[0] = calloc(1, sizeof(struct zb_zdo_neighbor_table_desc_s));
+       }
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, 0, 0, records, container->userdata);
+
+       if (records[0])
+               free(records[0]);
+       if (records)
+               free(records);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_mgmt_lqi_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zbl_mgmt_lqi_req_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_mgmt_lqi_rsp cb = container->cb;
+
+       int i = 0;
+       int j = 0;
+       unsigned char value;
+       unsigned char status;
+       unsigned char start_index;
+       unsigned char neighbor_table_enteries;
+       unsigned char neighbor_table_list_count;
+
+       GVariantIter *resp_iter;
+       GVariantIter *mac_iter;
+       GVariantIter *mac_iter1;
+       zb_zdo_neighbor_table_desc_h *records = NULL;
+
+       g_variant_get(parameters, "(yyyya(ayayyqyyyyy))", &status, &neighbor_table_enteries,
+                       &start_index, &neighbor_table_list_count, &resp_iter);
+
+       if (neighbor_table_list_count > 0) {
+               records = calloc(neighbor_table_list_count, sizeof(zb_zdo_neighbor_table_desc_h));
+               RETM_IF(NULL == records, "calloc() Fail(%d)", errno);
+               for (i = 0; i < neighbor_table_list_count; i++) {
+                       records[i] = calloc(1, sizeof(struct zb_zdo_neighbor_table_desc_s));
+                       if (NULL == records[i]) {
+                               ERR("calloc() Fail(%d)", errno);
+                               goto OUT;
+                       }
+               }
+       }
+       for (i = 0; i < neighbor_table_list_count; i++) {
+               g_variant_iter_loop(resp_iter, "(ayayyqyyyyy)", &mac_iter, &mac_iter1,
+                               &records[i]->device_type, &records[i]->addr16, &records[i]->rx_on_when_idle,
+                               &records[i]->relationship, &records[i]->permit_joining, &records[i]->depth,
+                               &records[i]->lqi);
+               for (j = 0; j < 8; j++) {
+                       g_variant_iter_loop(mac_iter, "y", &value);
+                       records[i]->extended_pan_id[j] = value;
+                       g_variant_iter_loop(mac_iter1, "y", &value);
+                       records[i]->addr64[j] = value;
+               }
+
+               DBG("ext PAN ID = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02",
+               records[i]->extended_pan_id[0], records[i]->extended_pan_id[1],
+               records[i]->extended_pan_id[2], records[i]->extended_pan_id[3],
+               records[i]->extended_pan_id[4], records[i]->extended_pan_id[5],
+               records[i]->extended_pan_id[6], records[i]->extended_pan_id[7]);
+
+               DBG("IEEE address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02",
+               records[i]->addr64[0], records[i]->addr64[1], records[i]->addr64[2], records[i]->addr64[3],
+               records[i]->addr64[4], records[i]->addr64[5], records[i]->addr64[6], records[i]->addr64[7]);
+       }
+
+       if (cb) {
+               cb(status, neighbor_table_enteries,     start_index, neighbor_table_list_count,
+                       records, container->userdata);
+       }
+OUT:
+       for (i = 0; i < neighbor_table_list_count; i++)
+               if (records[i])
+                       free(records[i]);
+       free(records);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_mgmt_lqi_req(nwk_addr addr16, unsigned char start_idx,
+               zb_zdo_mgmt_lqi_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_mgmt_lqi_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "mgmt_lqi_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_mgmt_lqi_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_mgmt_lqi_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "mgmt_lqi_req",
+               g_variant_new("(qy)", addr16, start_idx), G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL,
+               container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_mgmt_rtg_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_mgmt_rtg_rsp cb = NULL;
+       zb_zdo_routing_table_h *records = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       records = calloc(1, sizeof(zb_zdo_routing_table_h));
+       if (records) {
+               records[0] = calloc(1, sizeof(struct zb_zdo_routing_table_s));
+       }
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, 0, 0, records, container->userdata);
+
+       if (records[0])
+               free(records[0]);
+       if (records)
+               free(records);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_mgmt_rtg_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zbl_mgmt_rtg_req_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_mgmt_rtg_rsp cb = container->cb;
+
+       int i;
+       unsigned char status;
+       unsigned char start_index;
+       unsigned char routing_table_enteries;
+       unsigned char routing_table_list_count;
+
+       GVariantIter *rsp_iter;
+       zb_zdo_routing_table_h *records = NULL;
+
+       g_variant_get(parameters, "(yyyya(qyyyyq))", &status, &routing_table_enteries,
+                       &start_index, &routing_table_list_count, &rsp_iter);
+
+       if (routing_table_list_count > 0) {
+               records = calloc(routing_table_list_count, sizeof(zb_zdo_routing_table_h));
+               RETM_IF(NULL == records, "calloc() Fail(%d)", errno);
+               for (i = 0; i < routing_table_list_count; i++) {
+                       records[i] = calloc(1, sizeof(struct zb_zdo_routing_table_s));
+                       if (NULL == records[i]) {
+                               ERR("calloc() Fail(%d)", errno);
+                               goto OUT;
+                       }
+               }
+       }
+
+       for (i = 0; i < routing_table_list_count; i++) {
+               g_variant_iter_loop(rsp_iter, "(qyyyyq)", &records[i]->dst_addr, &records[i]->status,
+                       &records[i]->memory_constrained, &records[i]->route_record_required,
+                       &records[i]->many_to_one, &records[i]->next_hop_addr);
+       }
+
+       if (cb) {
+               cb(status, routing_table_enteries,      start_index, routing_table_list_count,
+                       records, container->userdata);
+       }
+OUT:
+       for (i = 0; i < routing_table_list_count; i++)
+               if (records[i])
+                       free(records[i]);
+       free(records);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_mgmt_rtg_req(nwk_addr addr16, unsigned char start_idx,
+               zb_zdo_mgmt_rtg_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_mgmt_rtg_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "mgmt_rtg_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_mgmt_rtg_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_mgmt_rtg_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "mgmt_rtg_req",
+               g_variant_new("(qy)", addr16, start_idx), G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL,
+               container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_mgmt_bind_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_mgmt_bind_rsp cb = NULL;
+       zb_zdo_binding_table_h *records = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       records = calloc(1, sizeof(zb_zdo_binding_table_h));
+       if (records) {
+               records[0] = calloc(1, sizeof(struct zb_zdo_binding_table_s));
+       }
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, 0, 0, 0, records, container->userdata);
+
+       if (records[0])
+               free(records[0]);
+       if (records)
+               free(records);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_mgmt_bind_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zbl_mgmt_bind_req_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_mgmt_bind_rsp cb = container->cb;
+
+       unsigned char status;
+       unsigned char value;
+
+       int i = 0;
+       int j = 0;
+       unsigned char binding_table_enteries;
+       unsigned char binding_table_list_count;
+       unsigned char start_index;
+
+       GVariantIter *mac_iter, *rsp_iter, *destep_iter;
+       zb_zdo_binding_table_h *records = NULL;
+
+       g_variant_get(parameters, "(yyyya(ayyqyay))", &status, &binding_table_enteries,
+                       &start_index, &binding_table_list_count, &rsp_iter);
+
+       if (binding_table_list_count > 0) {
+               records = calloc(binding_table_list_count, sizeof(zb_zdo_binding_table_h));
+               RETM_IF(NULL == records, "calloc() Fail(%d)", errno);
+               for (i = 0; i < binding_table_list_count; i++) {
+                       records[i] = calloc(binding_table_list_count, sizeof(struct zb_zdo_binding_table_s));
+                       if (NULL == records[i]) {
+                               ERR("calloc() Fail(%d)", errno);
+                               goto OUT;
+                       }
+               }
+       }
+       for (i = 0; i < binding_table_list_count; i++) {
+               g_variant_iter_loop(rsp_iter, "(ayyqyay)", &mac_iter, &records[i]->src_ep,
+                       &records[i]->cluster_id, &records[i]->dst_addr_mode, &destep_iter);
+               for (j = 0; j < 8; j++) {
+                       g_variant_iter_loop(mac_iter, "y", &value);
+                       records[i]->src_addr64[j] = value;
+               }
+               if (0x03 == records[i]->dst_addr_mode) {
+                       for (j = 0; j < 8; j++) {
+                               g_variant_iter_loop(destep_iter, "y", &value);
+                               records[i]->dst_addr64[j] = value;
+                       }
+                       g_variant_iter_loop(destep_iter, "y", &value);
+                       records[i]->dst_ep = value;
+                       DBG("Destination MAC Addr : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                               records[i]->dst_addr64[7], records[i]->dst_addr64[6],
+                               records[i]->dst_addr64[5], records[i]->dst_addr64[4],
+                               records[i]->dst_addr64[3], records[i]->dst_addr64[2],
+                               records[i]->dst_addr64[1], records[i]->dst_addr64[0]);
+
+               } else if (0x01 == records[i]->dst_addr_mode) {
+                       g_variant_iter_loop(destep_iter, "y", &value);
+                       records[i]->dst_addr16 = value;
+               g_variant_iter_loop(destep_iter, "y", &value);
+                       records[i]->dst_addr16 += (value << 8);
+               }
+       }
+
+       if (cb) {
+               cb(status, binding_table_enteries, start_index, binding_table_list_count,
+                       records, container->userdata);
+       }
+
+OUT:
+       for (i = 0; i < binding_table_list_count; i++)
+               if (records[i])
+                       free(records[i]);
+       free(records);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_mgmt_bind_req(nwk_addr addr16, unsigned char start_idx,
+               zb_zdo_mgmt_bind_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_mgmt_bind_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "mgmt_bind_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_mgmt_bind_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_mgmt_bind_req, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(zdo_dev_proxy, "mgmt_bind_req", g_variant_new("(qy)", addr16,
+               start_idx), G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_mgmt_leave_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_mgmt_leave_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_mgmt_leave_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zbl_mgmt_leave_req_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_mgmt_leave_rsp cb = container->cb;
+       unsigned char status;
+
+       g_variant_get(parameters, "(y)", &status);
+
+       if (cb)
+               cb(status, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_mgmt_leave_device(ieee_addr addr64, unsigned char remove_children,
+               unsigned rejoin, zb_zdo_mgmt_leave_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+       GVariantBuilder *mac_builder = NULL;
+       GVariant* mac_variant = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "mgmt_left_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_mgmt_leave_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_mgmt_leave_req, container);
+       container->userdata = user_data;
+
+       mac_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       g_variant_builder_add(mac_builder, "y", addr64[7]);
+       g_variant_builder_add(mac_builder, "y", addr64[6]);
+       g_variant_builder_add(mac_builder, "y", addr64[5]);
+       g_variant_builder_add(mac_builder, "y", addr64[4]);
+       g_variant_builder_add(mac_builder, "y", addr64[3]);
+       g_variant_builder_add(mac_builder, "y", addr64[2]);
+       g_variant_builder_add(mac_builder, "y", addr64[1]);
+       g_variant_builder_add(mac_builder, "y", addr64[0]);
+       mac_variant = g_variant_builder_end(mac_builder);
+
+       variant = g_dbus_proxy_call_sync(service_gproxy, "leave_req",
+                               g_variant_new("(@ayyy)", mac_variant, remove_children, rejoin),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(b)", &status);
+               DBG("Status 0x%x", status);
+       }
+
+       return status;
+}
+
+static gboolean _zbl_timeout_mgmt_permit_joining_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zdo_mgmt_permit_joining_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZDP_TIMEOUT, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_mgmt_permit_joining_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zbl_mgmt_permit_joining_req_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_zdo_mgmt_permit_joining_rsp cb = container->cb;
+       unsigned char status;
+
+       g_variant_get(parameters, "(y)", &status);
+
+       if (cb)
+               cb(status, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_mgmt_permit_joining_req(nwk_addr addr16, unsigned char duration,
+               unsigned char tc_significance, zb_zdo_mgmt_permit_joining_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zdo_dev_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZDOGLB_INTERFACE,  "mgmt_permit_join_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_mgmt_permit_joining_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_mgmt_permit_joining_req, container);
+       container->userdata = user_data;
+
+       variant = g_dbus_proxy_call_sync(zdo_dev_proxy, "mgmt_permit_join_req",
+                               g_variant_new("(qyy)", addr16, duration, tc_significance),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status 0x%x", status);
+       }
+
+       return status;
+}
+
+static gboolean _zbl_timeout_aps_send(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_aps_send_rsp cb = NULL;
+
+       DBG("_zb_timeout_aps_send()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_aps_send_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zb_aps_send_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_aps_send_rsp cb = container->cb;
+       unsigned short addr16;
+       unsigned char src_ep;
+       unsigned char dst_ep;
+       unsigned char cluster_id;
+       unsigned char profile_id;
+       unsigned char *payload = NULL;
+       unsigned short payload_len = 0;
+       unsigned char value;
+       GVariantIter *payload_iter;
+       int i = 0;
+
+       g_variant_get(parameters, "(qyyqqayq)", &addr16, &src_ep, &dst_ep,
+                       &cluster_id, &profile_id, &payload_iter, &payload_len);
+
+       if (payload_len > 0) {
+               payload = calloc(payload_len, sizeof(unsigned char));
+               while (g_variant_iter_loop(payload_iter, "y", &value)) {
+                       payload[i++] = value;
+               }
+       }
+
+       if (cb)
+               cb(addr16, src_ep, dst_ep, cluster_id, profile_id,
+                       payload_len, payload, container->userdata);
+
+       if (payload)
+               free(payload);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_aps_send(nwk_addr addr16, unsigned char aps_frame_ctl,
+               unsigned char src_ep, unsigned char dst_ep,
+               unsigned short cluster_id, unsigned short profile_id,
+               unsigned char zcl_frame_ctl, unsigned short mfg_code,
+               unsigned short payload_len, unsigned char *payload,
+               zb_aps_send_rsp cb, void *user_data)
+{
+       int sub_id, to, i;
+       zbl_req_cb_s *container;
+
+       GVariant *variant = NULL;
+       GVariantBuilder *payload_builder = NULL;
+       GVariant *payload_variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == custom_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(custom_gproxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_CUSTOM_INTERFACE,  "aps_send_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_aps_send_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_aps_send, container);
+       container->userdata = user_data;
+
+       payload_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       if (payload_len > 0) {
+               for (i = payload_len - 1; i >= 0 ; i--) {
+                       g_variant_builder_add(payload_builder, "y", payload[i]);
+               }
+       }
+       payload_variant = g_variant_builder_end(payload_builder);
+
+       variant = g_dbus_proxy_call_sync(custom_gproxy, "aps_send",
+                               g_variant_new("(qyyyqqyq@ay)", addr16, aps_frame_ctl,
+                                       src_ep, dst_ep, cluster_id, profile_id, zcl_frame_ctl,
+                                       mfg_code, payload_variant),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status 0x%x", status);
+               g_variant_unref(variant);
+       }
+
+       return status;
+}
+
+static gboolean _zbl_timeout_zcl_send(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_send_rsp cb = NULL;
+
+       DBG("_zb_timeout_zcl_send()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_zcl_send_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zbl_zcl_send_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_send_rsp cb = container->cb;
+       unsigned short addr16;
+       unsigned char src_ep;
+       unsigned char dst_ep;
+       unsigned char cluster_id;
+       unsigned char profile_id;
+       unsigned char *payload = NULL;
+       unsigned short payload_len = 0;
+       unsigned char value;
+       GVariantIter *payload_iter;
+       int i = 0;
+
+       g_variant_get(parameters, "(qyyqqayq)", &addr16, &src_ep, &dst_ep,
+                       &cluster_id, &profile_id, &payload_iter, &payload_len);
+
+       if (payload_len > 0) {
+               payload = calloc(payload_len, sizeof(unsigned char));
+               while (g_variant_iter_loop(payload_iter, "y", &value)) {
+                       payload[i++] = value;
+               }
+       }
+
+       if (cb)
+               cb(addr16, src_ep, dst_ep, cluster_id, profile_id,
+                       payload_len, payload, container->userdata);
+
+       if (payload)
+               free(payload);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_zcl_send(nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned short cluster_id, unsigned char zcl_frame_ctl, unsigned char cmd,
+               unsigned short payload_len, unsigned char *payload,
+               zb_zcl_send_rsp cb, void *user_data)
+{
+       int sub_id, to, i;
+       zbl_req_cb_s *container;
+
+       GVariant *variant = NULL;
+       GVariantBuilder *payload_builder = NULL;
+       GVariant *payload_variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == custom_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(custom_gproxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_CUSTOM_INTERFACE,  "zcl_send_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_zcl_send_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_zcl_send, container);
+       container->userdata = user_data;
+
+       payload_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       if (payload_len > 0) {
+               for (i = payload_len - 1; i >= 0 ; i--) {
+                       g_variant_builder_add(payload_builder, "y", payload[i]);
+               }
+       }
+       payload_variant = g_variant_builder_end(payload_builder);
+
+       variant = g_dbus_proxy_call_sync(custom_gproxy, "zcl_send",
+                               g_variant_new("(qyyqyy@ay)", addr16, src_ep, dst_ep,
+                                       cluster_id, zcl_frame_ctl, cmd, payload_variant),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status 0x%x", status);
+               g_variant_unref(variant);
+       }
+
+       return status;
+}
+
+static gboolean _zbl_timeout_send_to_local(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_send_to_local_rsp cb = NULL;
+
+       DBG("_zb_timeout_send_to_local()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_send_to_local_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zb_send_to_local_cb()");
+       zbl_req_cb_s *container = user_data;
+       zb_send_to_local_rsp cb = container->cb;
+       unsigned char *data = NULL;
+       unsigned short length = 0;
+       unsigned char value;
+       GVariantIter *payload_iter;
+       int i = 0;
+
+       g_variant_get(parameters, "(ayq)", &payload_iter, &length);
+
+       if (length > 0) {
+               data = calloc(length, sizeof(unsigned char));
+               while (g_variant_iter_loop(payload_iter, "y", &value)) {
+                       data[i++] = value;
+               }
+       }
+
+       if (cb)
+               cb(length, data, container->userdata);
+
+       if (data)
+               free(data);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_send_to_local(unsigned short length, unsigned char *data,
+               zb_send_to_local_rsp cb, void *user_data)
+{
+       int sub_id, to, i;
+       zbl_req_cb_s *container;
+
+       GVariant *variant = NULL;
+       GVariantBuilder *payload_builder = NULL;
+       GVariant *payload_variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == custom_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(custom_gproxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_CUSTOM_INTERFACE,  "send_to_local_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_send_to_local_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_send_to_local, container);
+       container->userdata = user_data;
+
+       payload_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       if (length > 0) {
+               for (i = length - 1; i >= 0 ; i--) {
+                       g_variant_builder_add(payload_builder, "y", data[i]);
+               }
+       }
+       payload_variant = g_variant_builder_end(payload_builder);
+
+       variant = g_dbus_proxy_call_sync(custom_gproxy, "send_to_local",
+                               g_variant_new("(@ay)", payload_variant),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status 0x%x", status);
+               g_variant_unref(variant);
+       }
+
+       return status;
+}
+
+static gboolean _zbl_timeout_read_attributes_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_global_rsp cb = NULL;
+
+       DBG("_zbl_timeout_read_attributes_req()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, NULL, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_read_attributes_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_global_rsp cb = container->cb;
+
+       int j = 0;
+       int isString;
+       unsigned char value;
+
+       nwk_addr addr16;
+       unsigned char ep;
+       unsigned short attr_id;
+       unsigned short cluster_id;
+       unsigned char status;
+       unsigned char type;
+       unsigned short records_len;
+       unsigned char attr_value[128];
+
+       GVariantIter *iter;
+       read_attr_status_record_h records;
+       zb_global_record_data_s *data;
+
+       DBG("_zbl_read_attributes_req_cb");
+
+       data = calloc(1, sizeof(zb_global_record_data_s));
+       records = calloc(1, sizeof(struct read_attribute_status_record_s));
+       if (!records || !data) {
+               ERR("calloc() Fail(%d)", errno);
+               goto OUT;
+       }
+
+       container->found = true;
+
+       g_variant_get(parameters, "(qyayqqyyqi)",
+               &addr16, &ep, &iter, &attr_id, &cluster_id, &status, &type, &records_len, &isString);
+       if (!isString) {
+               while (g_variant_iter_loop(iter, "y", &value)) {
+                       attr_value[j] = value;
+                       DBG("attr_value[%d] = 0x%02X", j, value);
+                       j++;
+               }
+       } else {
+               while (g_variant_iter_loop(iter, "y", &value)) {
+                       if (j == 0)
+                               records_len = value;
+                       attr_value[j] = value;
+                       DBG("attr_value[%d] = 0x%02X", j, value);
+                       j++;
+               }
+       }
+
+       records->id = attr_id;
+       records->status = status;
+       records->type = type;
+       records->value = attr_value;
+       data->type = ZB_GLOBAL_READ_ATTR;
+       data->record.read_attr = &records;
+       data->records_len = records_len;
+
+       if (cb)
+               cb(addr16, ep, cluster_id, data, records_len, container->userdata);
+
+OUT:
+       if (records)
+               free(records);
+       if (data)
+               free(data);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_read_attr_req(zigbee_h handle, unsigned short addr16, unsigned char dest_ep,
+       unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned short *attribute_ids,
+       int attribute_ids_len, zb_zcl_global_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       int i = 0;
+       unsigned char *t;
+       GVariant *attr_variant = NULL;
+       GVariantBuilder *attr_builder = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_read_attr_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+                               "read_attributes_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                               _zbl_read_attributes_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_read_attributes_req, container);
+       container->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(container->tid);
+               container->tid = 0;
+               free(container);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dest_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_READ_ATTRIBUTES_COMMAND_ID;
+
+       container->global_cmd = global_req;
+       container->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, container);
+#endif
+
+       t = (unsigned char *)attribute_ids;
+       attr_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       for (i = 0; i < attribute_ids_len*sizeof(unsigned short); i++)
+               g_variant_builder_add(attr_builder, "y", t[i]);
+       attr_variant = g_variant_builder_end(attr_builder);
+
+       g_dbus_proxy_call(zcl_global_proxy, "read_attributes_req", g_variant_new("(@ayiqqyy)",
+               attr_variant, attribute_ids_len, addr16, cluster_id, zcl_frame_ctl, dest_ep),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_write_attributes_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_global_rsp cb = NULL;
+
+       DBG("_zbl_timeout_write_attributes_req()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, NULL, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_write_attributes_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_global_rsp cb = container->cb;
+
+       int i = 0;
+       nwk_addr addr16;
+       unsigned char ep;
+       unsigned short cluster_id;
+       unsigned short attribute_id;
+       int records_len;
+       unsigned char value;
+
+       GVariantIter *stat_iter, *attr_iter;
+       write_attr_status_record_h records;
+       zb_global_record_data_s *data;
+
+       g_variant_get(parameters, "(qyayaqqi)",
+               &addr16, &ep, &stat_iter , &attr_iter, &cluster_id, &records_len);
+
+       records = calloc(records_len, sizeof(struct write_attribute_status_record_s));
+       data = calloc(1, sizeof(zb_global_record_data_s));
+       if (!records || !data) {
+               ERR("calloc() Fail(%d)", errno);
+               goto OUT;
+       }
+
+       while (g_variant_iter_loop(stat_iter, "y", &value)) {
+                       records[i].status = value;
+                       i++;
+       }
+       i = 0;
+       while (g_variant_iter_loop(attr_iter, "q", &attribute_id)) {
+                       records[i].id = attribute_id;
+                       DBG("Attribute Id 0x%04X", attribute_id);
+                       i++;
+       }
+       data->type = ZB_GLOBAL_WRITE_ATTR;
+       data->record.write_attr = &records;
+       data->records_len = records_len;
+
+       if (cb)
+               cb(addr16, ep, cluster_id, data, records_len, container->userdata);
+
+OUT:
+       if (records)
+               free(records);
+       if (data)
+               free(data);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_write_attr_req(zigbee_h handle, nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, write_attr_record_h *records,
+               int records_len, zb_zcl_global_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_write_attr_req()");
+
+       GVariant *variant = NULL;
+       GVariantBuilder *rec_builder = NULL;
+       GVariant *rec_variant = NULL;
+
+       int i = 0;
+       int j = 0;
+
+       char dSize[3] = {'\0', '\0'};
+       int writeAttributeIndex = 0;
+       int size_of_allo = 0;
+
+       unsigned char *isString = NULL;
+       unsigned short *dataSize = NULL;
+       unsigned char *writeAttribute = NULL;
+
+       isString = calloc(records_len + 1, sizeof(unsigned char));
+       RETVM_IF(NULL == isString, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       dataSize = calloc(records_len + 1, sizeof(unsigned short));
+       if (NULL == dataSize) {
+               ERR("calloc() Fail(%d)", errno);
+               free(isString);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+
+       DBG("Records Length %d", records_len);
+
+       while (j < records_len) {
+               dataSize[j] = zb_get_data_size((*records)[j].type);
+               if (0xff != dataSize[j]) {
+                       isString[j] = 0;
+                       size_of_allo = size_of_allo + (dataSize[j] + 3);
+               } else {
+                       if ((*records)[j].value) {
+                               if ((*records)[j].type == ZB_ZCL_CHRACTER_STRING
+                                       || (*records)[j].type == ZB_ZCL_OCTAT_STRING) {
+                                               isString[j] = 1;
+                                               dataSize[j] = (*records)[j].value[0];
+                                               size_of_allo = size_of_allo + (dataSize[j] + 3 + 1);
+                               } else if ((*records)[j].type == ZB_ZCL_LONG_OCTAT_STRING
+                                       || (*records)[j].type == ZB_ZCL_LONG_CHRACTER_STRING) {
+                                       isString[j] = 2;
+                                       dSize[0] = (*records)[j].value[0];
+                                       dSize[1] = (*records)[j].value[1];
+                                       dataSize[j] = dSize[1];
+                                       dataSize[j] = (dataSize[j] << 8) | dSize[0];
+                                       size_of_allo = size_of_allo + (dataSize[j] + 3 + 2);
+                               }
+                       } else
+                               ERR("Data is not present");
+               }
+               j++;
+       }
+       DBG("size_of_allo Length %d", size_of_allo);
+
+       writeAttribute = calloc(size_of_allo + 1, sizeof(unsigned char));
+       if (NULL == writeAttribute) {
+               ERR("Couldn't Allocate Memory");
+               free(isString);
+               free(dataSize);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+
+       j = 0;
+       while (j < records_len && writeAttributeIndex < size_of_allo) {
+               writeAttribute[writeAttributeIndex++] = ((*records)[j].id) & 0xff;
+               writeAttribute[writeAttributeIndex++] = (((*records)[j].id) >> 8) & 0xff;
+               writeAttribute[writeAttributeIndex++] = (*records)[j].type;
+               for (i = 0; i < (dataSize[j] + isString[j]); i++) {
+                       writeAttribute[writeAttributeIndex++] = (*records)[j].value[i];
+                       DBG("0x%02X", (*records)[j].value[i]);
+               }
+               j++;
+       }
+
+       rec_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       DBG("   ");
+       for (i = 0; i < writeAttributeIndex ; i++) {
+               DBG("0x%02X", writeAttribute[i]);
+               g_variant_builder_add(rec_builder, "y", writeAttribute[i]);
+       }
+
+       rec_variant = g_variant_builder_end(rec_builder);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       if (NULL == container) {
+               ERR("calloc() Fail(%d)", errno);
+               free(isString);
+               free(dataSize);
+               free(writeAttribute);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+                               "write_attributes_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                               _zbl_write_attributes_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(isString);
+               free(dataSize);
+               free(container);
+               free(writeAttribute);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_write_attributes_req, container);
+       container->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(container->tid);
+               container->tid = 0;
+               free(container);
+               free(isString);
+               free(dataSize);
+               free(writeAttribute);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dst_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_WRITE_ATTRIBUTES_COMMAND_ID;
+
+       container->global_cmd = global_req;
+       container->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, container);
+#endif
+
+       variant = g_dbus_proxy_call_sync(zcl_global_proxy, "write_attributes_req",
+               g_variant_new("(@ayiqqyyy)", rec_variant, writeAttributeIndex, addr16,
+               cluster_id, zcl_frame_ctl, src_ep, dst_ep), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("read_attr_req Status 0x%02X", status);
+       }
+
+       free(isString);
+       free(dataSize);
+       free(writeAttribute);
+
+       return status;
+}
+
+int zbl_wattr_undivided_req(zigbee_h handle, nwk_addr addr16, unsigned char src_ep,
+               unsigned char dst_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               write_attr_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_wattr_undivided_req()");
+
+       GVariant *variant = NULL;
+       GVariantBuilder *rec_builder = NULL;
+       GVariant *rec_variant = NULL;
+
+       int i = 0;
+       int j = 0;
+
+       char dSize[3] = {'\0', '\0'};
+       int writeAttributeIndex = 0;
+       int size_of_allo = 0;
+
+       unsigned char *isString = NULL;
+       unsigned short *dataSize = NULL;
+       unsigned char *writeAttribute = NULL;
+
+       isString = calloc(records_len + 1, sizeof(unsigned char));
+       RETVM_IF(NULL == isString, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       dataSize = calloc(records_len + 1, sizeof(unsigned short));
+       if (NULL == dataSize) {
+               ERR("calloc() Fail(%d)", errno);
+               free(isString);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+
+       DBG("Records Length %d", records_len);
+
+       while (j < records_len) {
+               dataSize[j] = zb_get_data_size((*records)[j].type);
+               if (0xff != dataSize[j]) {
+                       isString[j] = 0;
+                       size_of_allo = size_of_allo + (dataSize[j] + 3);
+               } else {
+                       if ((*records)[j].value) {
+                               if ((*records)[j].type == ZB_ZCL_CHRACTER_STRING
+                                       || (*records)[j].type == ZB_ZCL_OCTAT_STRING) {
+                                               isString[j] = 1;
+                                               dataSize[j] = (*records)[j].value[0];
+                                               size_of_allo = size_of_allo + (dataSize[j] + 3 + 1);
+                               } else if ((*records)[j].type == ZB_ZCL_LONG_OCTAT_STRING
+                                       || (*records)[j].type == ZB_ZCL_LONG_CHRACTER_STRING) {
+                                       isString[j] = 2;
+                                       dSize[0] = (*records)[j].value[0];
+                                       dSize[1] = (*records)[j].value[1];
+                                       dataSize[j] = dSize[1];
+                                       dataSize[j] = (dataSize[j] << 8) | dSize[0];
+                                       size_of_allo = size_of_allo + (dataSize[j] + 3 + 2);
+                               }
+                       } else
+                               ERR("Data is not present");
+               }
+               j++;
+       }
+       DBG("size_of_allo Length %d", size_of_allo);
+
+       writeAttribute = calloc(size_of_allo + 1, sizeof(unsigned char));
+       if (NULL == writeAttribute) {
+               ERR("Couldn't Allocate Memory");
+               free(isString);
+               free(dataSize);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+
+       j = 0;
+       while (j < records_len && writeAttributeIndex < size_of_allo) {
+               writeAttribute[writeAttributeIndex++] = ((*records)[j].id) & 0xff;
+               writeAttribute[writeAttributeIndex++] = (((*records)[j].id) >> 8) & 0xff;
+               writeAttribute[writeAttributeIndex++] = (*records)[j].type;
+               for (i = 0; i < (dataSize[j] + isString[j]); i++) {
+                       writeAttribute[writeAttributeIndex++] = (*records)[j].value[i];
+                       DBG("0x%02X", (*records)[j].value[i]);
+               }
+               j++;
+       }
+
+       rec_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       DBG("   ");
+       for (i = 0; i < writeAttributeIndex ; i++) {
+               DBG("0x%02X", writeAttribute[i]);
+               g_variant_builder_add(rec_builder, "y", writeAttribute[i]);
+       }
+
+       rec_variant = g_variant_builder_end(rec_builder);
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       if (NULL == container) {
+               ERR("calloc() Fail(%d)", errno);
+               free(isString);
+               free(dataSize);
+               free(writeAttribute);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+                               "write_attributes_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                               _zbl_write_attributes_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(isString);
+               free(dataSize);
+               free(container);
+               free(writeAttribute);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_write_attributes_req, container);
+       container->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(container->tid);
+               container->tid = 0;
+               free(container);
+               free(isString);
+               free(dataSize);
+               free(writeAttribute);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dst_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_WRITE_ATTRIBUTES_UNDIVIDED_COMMAND_ID;
+
+       container->global_cmd = global_req;
+       container->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, container);
+#endif
+
+       variant = g_dbus_proxy_call_sync(zcl_global_proxy, "write_attributes_undivided_req",
+               g_variant_new("(@ayiqqyyy)", rec_variant, writeAttributeIndex, addr16,
+               cluster_id, zcl_frame_ctl, src_ep, dst_ep), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("read_attr_req Status 0x%02X", status);
+       }
+
+       free(isString);
+       free(dataSize);
+       free(writeAttribute);
+
+       return status;
+}
+
+int zbl_wattr_req_no_rsp(zigbee_h handle, nwk_addr addr16, unsigned char src_ep,
+               unsigned char dst_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               write_attr_record_h *records, int records_len)
+{
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_wattr_req_no_rsp()");
+
+       GVariant *variant = NULL;
+       GVariantBuilder *rec_builder = NULL;
+       GVariant *rec_variant = NULL;
+
+       int i = 0;
+       int j = 0;
+
+       char dSize[3] = {'\0', '\0'};
+       int writeAttributeIndex = 0;
+       int size_of_allo = 0;
+
+       unsigned char *isString = NULL;
+       unsigned short *dataSize = NULL;
+       unsigned char *writeAttribute = NULL;
+
+       isString = calloc(records_len + 1, sizeof(unsigned char));
+       RETVM_IF(NULL == isString, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       dataSize = calloc(records_len + 1, sizeof(unsigned short));
+       if (NULL == dataSize) {
+               ERR("calloc() Fail(%d)", errno);
+               free(isString);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+
+       DBG("Records Length %d", records_len);
+
+       while (j < records_len) {
+               dataSize[j] = zb_get_data_size((*records)[j].type);
+               if (0xff != dataSize[j]) {
+                       isString[j] = 0;
+                       size_of_allo = size_of_allo + (dataSize[j] + 3);
+               } else {
+                       if ((*records)[j].value) {
+                               if ((*records)[j].type == ZB_ZCL_CHRACTER_STRING
+                                       || (*records)[j].type == ZB_ZCL_OCTAT_STRING) {
+                                               isString[j] = 1;
+                                               dataSize[j] = (*records)[j].value[0];
+                                               size_of_allo = size_of_allo + (dataSize[j] + 3 + 1);
+                               } else if ((*records)[j].type == ZB_ZCL_LONG_OCTAT_STRING
+                                       || (*records)[j].type == ZB_ZCL_LONG_CHRACTER_STRING) {
+                                       isString[j] = 2;
+                                       dSize[0] = (*records)[j].value[0];
+                                       dSize[1] = (*records)[j].value[1];
+                                       dataSize[j] = dSize[1];
+                                       dataSize[j] = (dataSize[j] << 8) | dSize[0];
+                                       size_of_allo = size_of_allo + (dataSize[j] + 3 + 2);
+                               }
+                       } else
+                               ERR("Data is not present");
+               }
+               j++;
+       }
+       DBG("size_of_allo Length %d", size_of_allo);
+
+       writeAttribute = calloc(size_of_allo + 1, sizeof(unsigned char));
+       if (NULL == writeAttribute) {
+               ERR("Couldn't Allocate Memory");
+               free(isString);
+               free(dataSize);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+
+       j = 0;
+       while (j < records_len && writeAttributeIndex < size_of_allo) {
+               writeAttribute[writeAttributeIndex++] = ((*records)[j].id) & 0xff;
+               writeAttribute[writeAttributeIndex++] = (((*records)[j].id) >> 8) & 0xff;
+               writeAttribute[writeAttributeIndex++] = (*records)[j].type;
+               for (i = 0; i < (dataSize[j] + isString[j]); i++) {
+                       writeAttribute[writeAttributeIndex++] = (*records)[j].value[i];
+                       DBG("0x%02X", (*records)[j].value[i]);
+               }
+               j++;
+       }
+
+       rec_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       DBG("   ");
+       for (i = 0; i < writeAttributeIndex ; i++) {
+               DBG("0x%02X", writeAttribute[i]);
+               g_variant_builder_add(rec_builder, "y", writeAttribute[i]);
+       }
+
+       rec_variant = g_variant_builder_end(rec_builder);
+
+       g_dbus_proxy_call_sync(zcl_global_proxy, "write_attributes_no_rep",
+               g_variant_new("(@ayiqqyyy)", rec_variant, writeAttributeIndex, addr16,
+               cluster_id, zcl_frame_ctl, src_ep, dst_ep), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("write_attributes_no_rep Status 0x%02X", status);
+       }
+
+       free(isString);
+       free(dataSize);
+       free(writeAttribute);
+
+       return status;
+}
+
+static gboolean _zbl_timeout_configure_reporting(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_global_rsp cb = NULL;
+
+       DBG("_zbl_timeout_configure_reporting()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, NULL, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_configure_reporting_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_global_rsp cb = container->cb;
+
+       nwk_addr addr16;
+       unsigned char ep;
+       unsigned short cluster_id;
+       unsigned short attIdVal;
+       unsigned char value;
+       int j = 0, l = 0, k = 0, rec_len;
+       GVariantIter *stat_iter, *attr_iter, *dir_iter;
+       report_config_response_record_h records;
+       zb_global_record_data_s *data;
+
+       DBG("_zbl_configure_reporting_cb");
+
+       g_variant_get(parameters, "(ayaqayqiqy)",
+               &stat_iter, &attr_iter, &dir_iter, &cluster_id, &rec_len, &addr16, &ep);
+
+       records = calloc(rec_len, sizeof(struct reporting_configuration_response_record_s));
+       data = calloc(1, sizeof(zb_global_record_data_s));
+       if (!data || !records) {
+               ERR("calloc() Fail(%d)", errno);
+               goto OUT;
+       }
+
+       while (g_variant_iter_loop(stat_iter, "y", &value)) {
+                       DBG("Value 0x%02X", value);
+                       records[j].status = value;
+                       j++;
+       }
+
+       while (g_variant_iter_loop(attr_iter, "q", &attIdVal)) {
+                       if (records[l].status != ZB_ZCL_SUCCESS)
+                               records[l].id = attIdVal;
+                       l++;
+       }
+
+       while (g_variant_iter_loop(dir_iter, "y", &value)) {
+               if (records[k].status != ZB_ZCL_SUCCESS)
+                       records[k].dir = value;
+                       k++;
+       }
+       data->type = ZB_GLOBAL_CONFIG_REPORT;
+       data->record.report_config_rsp = &records;
+       data->records_len = rec_len;
+
+       container->found = true;
+
+       if (cb)
+               cb(addr16, ep, cluster_id, data, rec_len, container->userdata);
+
+OUT:
+       if (records)
+               free(records);
+       if (data)
+               free(data);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_configure_reporting(zigbee_h handle, nwk_addr addr16, unsigned char src_ep,
+               unsigned char dst_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               report_config_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       int i = 0;
+       int j = 0;
+       int len = 0;
+       int count = 0;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+       GVariant *variant = NULL;
+       GVariantBuilder *rec_builder = NULL;
+       GVariant *rec_variant = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_configure_reporting()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+                               "configure_reporting_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                               _zbl_configure_reporting_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_configure_reporting, container);
+       container->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(container->tid);
+               container->tid = 0;
+               free(container);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dst_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_CONFIGURE_REPORTING_COMMAND_ID;
+
+       container->global_cmd = global_req;
+       container->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, container);
+#endif
+
+       rec_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       for (i = 0; i < records_len; i++) {
+               g_variant_builder_add(rec_builder, "y", (*records)[i].dir);
+               DBG("dir = 0x%02X", (*records)[i].dir);
+               count += sizeof((*records)[i].dir);
+               g_variant_builder_add(rec_builder, "y", (*records)[i].id & 0xff);
+               g_variant_builder_add(rec_builder, "y", ((*records)[i].id >> 8) & 0xff);
+               DBG("id = 0x%04X", (*records)[i].id);
+               count += sizeof((*records)[i].id);
+               g_variant_builder_add(rec_builder, "y", (*records)[i].type);
+               count += sizeof((*records)[i].type);
+               DBG("type = 0x%04X", (*records)[i].type);
+               g_variant_builder_add(rec_builder, "y", (*records)[i].min_i & 0xff);
+               g_variant_builder_add(rec_builder, "y", ((*records)[i].min_i >> 8) & 0xff);
+               DBG("min_i = 0x%04X", (*records)[i].min_i);
+               count += sizeof((*records)[i].min_i);
+               g_variant_builder_add(rec_builder, "y", (*records)[i].max_i & 0xff);
+               g_variant_builder_add(rec_builder, "y", ((*records)[i].max_i >> 8) & 0xff);
+               DBG("max_i = 0x%04X", (*records)[i].max_i);
+               count += sizeof((*records)[i].max_i);
+
+               len = zb_get_data_size((*records)[i].type);
+               count += len;
+               DBG("change length = %d", len);
+               DBG("payload length = %d", count);
+
+               for (j = 0; j < len && (*records)[i].change+j; j++) {
+                       DBG("records[%d]->value[%d] = %d", i, j, (*records)[i].change[j]);
+                       g_variant_builder_add(rec_builder, "y", (*records)[i].change[j]);
+               }
+
+       }
+       rec_variant = g_variant_builder_end(rec_builder);
+
+       variant = g_dbus_proxy_call_sync(zcl_global_proxy, "configure_reporting_req",
+                               g_variant_new("(@ayqqqyyy)", rec_variant, count, addr16,
+                               cluster_id, zcl_frame_ctl, src_ep, dst_ep), G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_configure_reporting Status = 0x%02X", status);
+       }
+       return status;
+}
+
+static gboolean _zbl_timeout_read_configure_reporting(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_global_rsp cb = NULL;
+
+       DBG("_zbl_timeout_read_configure_reporting()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, NULL, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+#define ZCL_REPORTING_DIRECTION_REPORTED 0x00
+#define ZCL_REPORTING_DIRECTION_RECEIVED 0x01
+
+static void _zbl_read_configure_reporting_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_global_rsp cb = container->cb;
+
+       nwk_addr addr16;
+       unsigned char ep;
+       unsigned short cluster_id;
+
+       int i = 0;
+       int j = 0;
+       char value;
+       unsigned char *status = NULL;
+       unsigned char *data_size = NULL;
+       unsigned char *change = NULL;
+       unsigned short record_length;
+       GVariantIter *resp_iter;
+       GVariantIter *data_iter;
+
+       DBG("_zbl_read_configure_reporting_cb");
+
+       report_config_record_h *records = NULL;
+       zb_global_record_data_s *data = NULL;
+
+       g_variant_get(parameters, "(qyqqa(yyqyqqayq))",
+               &addr16, &ep, &cluster_id, &record_length, &resp_iter);
+
+       records = calloc(record_length, sizeof(report_config_record_h));
+       for (i = 0; i < record_length; i++) {
+               records[i] = calloc(1, sizeof(struct reporting_configuration_record_s));
+               if (NULL == records[i]) {
+                       ERR("calloc() Fail(%d)", errno);
+                       goto OUT;
+               }
+       }
+       data = calloc(1, sizeof(zb_global_record_data_s));
+       if (!data || !records) {
+               ERR("calloc() Fail(%d)", errno);
+               goto OUT;
+       }
+
+       DBG("record_length %d", record_length);
+       status = calloc(record_length, sizeof(unsigned char));
+       data_size = calloc(record_length, sizeof(unsigned char));
+       if (!status || !data_size) {
+               ERR("Couldn't allocate the memory (%s)", errno);
+               goto OUT;
+       }
+
+       for (i = 0; i < record_length; i++) {
+               g_variant_iter_loop(resp_iter, "(yyqyqqayq)", &status[i], &records[i]->dir,
+                       &records[i]->id, &records[i]->type, &records[i]->max_i, &records[i]->min_i,
+                       &data_iter, &records[i]->to);
+               if (records[i]->dir != ZCL_REPORTING_DIRECTION_REPORTED &&
+                       (zb_get_analog_or_discret(records[i]->type) == DATA_TYPE_ANALOG)) {
+                       data_size[i] = zb_get_data_size(records[j]->type);
+                       j = 0;
+                       if (data_size[i] != 0xff) {
+                               change = calloc(data_size[i]+1, sizeof(unsigned char));
+                               if (!change) {
+                                       ERR("calloc() Fail(%d)", errno);
+                                       records[i]->change = NULL;
+                                       continue;
+                               }
+                               while (g_variant_iter_loop(data_iter, "y", &value)) {
+                                       change[j] = value;
+                                       j++;
+                               }
+                               records[i]->change = change;
+                       } else
+                               records[i]->change = NULL;
+               } else
+                       records[i]->change = NULL;
+       }
+
+       data->type = ZB_GLOBAL_READ_REPORT_CONFIG;
+       data->record.report_config = records;
+       data->records_len = record_length;
+
+       container->found = true;
+
+       if (cb)
+               cb(addr16, ep, cluster_id, data, record_length, container->userdata);
+OUT:
+       if (data_size)
+               free(data_size);
+       if (status)
+               free(status);
+       if (records) {
+               for (i = 0; i < record_length; i++)
+                       if (records[i])
+                               free(records[i]);
+               free(records);
+       }
+       free(data);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+
+int zbl_read_configure_reporting(zigbee_h handle, nwk_addr addr16, unsigned char src_ep,
+               unsigned char dst_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               read_report_config_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       int i = 0;
+       int j = 0;
+       int size_of_allo = 0;
+       unsigned short idx = ZIGBEE_ERROR_NONE;
+       unsigned char status = 0;
+       GVariant *variant = NULL;
+       GVariantBuilder *rec_builder = NULL;
+       GVariant *rec_variant = NULL;
+       unsigned char *read_attributes;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_read_configure_reporting()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+                               "read_configure_reporting_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                               _zbl_read_configure_reporting_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_read_configure_reporting, container);
+       container->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(container->tid);
+               container->tid = 0;
+               free(container);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dst_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_READ_REPORTING_CONFIGURATION_COMMAND_ID;
+
+       container->global_cmd = global_req;
+       container->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, container);
+#endif
+
+       DBG("Records Length %d", records_len);
+       /**
+        * According to zcl spec
+        * Memory needed for the read_reporting_configured_frame.
+        * 1 byte(direction) + 2 bytes(AttributeId)
+        *  = 3 bytes/variable
+        */
+       while (j < records_len) {
+               size_of_allo = size_of_allo + 3;
+               j++;
+       }
+       DBG("size_of_allo Length %d", size_of_allo);
+
+       read_attributes = calloc(size_of_allo, sizeof(unsigned char));
+       if (NULL == read_attributes) {
+               ERR("Couldn't Allocate Memory");
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+               g_source_remove(container->tid);
+               container->tid = 0;
+               free(container);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       j = 0;
+       while (j < records_len && idx < size_of_allo) {
+               read_attributes[idx++] = (*records)[j].dir;
+               read_attributes[idx++] = (*records)[j].id & 0xff;
+               read_attributes[idx++] = (*records)[j].id >> 8 & 0xff;
+               DBG("Id copied \n");
+               j++;
+       }
+
+       rec_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+
+       for (i = 0; i < idx ; i++) {
+               DBG("0x%02X", read_attributes[i]);
+               g_variant_builder_add(rec_builder, "y", read_attributes[i]);
+       }
+
+       rec_variant = g_variant_builder_end(rec_builder);
+
+       variant = g_dbus_proxy_call_sync(zcl_global_proxy, "read_configure_reporting",
+                               g_variant_new("(@ayqqqyyy)", rec_variant, idx, addr16,
+                               cluster_id, zcl_frame_ctl, src_ep, dst_ep),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_read_configure_reporting Status = 0x%0.2X", status);
+       }
+
+       free(read_attributes);
+
+       return status;
+}
+
+static gboolean _zbl_timeout_discover_attributes_req(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_global_discover_attr_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL)");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, NULL, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_discover_attributes_req_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_global_discover_attr_rsp cb = container->cb;
+
+       nwk_addr addr16;
+       unsigned char ep;
+       discover_attr_info_record_h *records;
+
+       int records_len;
+       unsigned short cluster_id;
+       unsigned short attribute_id;
+       unsigned char value;
+       int j = 0, l = 0;
+       int discovery_complete;
+       GVariantIter *stat_iter, *attr_iter;
+
+       DBG("_zbl_discover_attributes_req_cb");
+
+       g_variant_get(parameters, "(qyayaqqii)",  &addr16, &ep, &stat_iter,
+                                       &attr_iter, &cluster_id, &records_len, &discovery_complete);
+       records = calloc(records_len, sizeof(discover_attr_info_record_h));
+       RETM_IF(NULL == records, "calloc() Fail(%d)", errno);
+       for (j = 0; j < records_len; j++) {
+               records[j] = calloc(1, sizeof(struct discover_attribute_info_record_s));
+               if (NULL == records[j]) {
+                       ERR("calloc() Fail(%d)", errno);
+                       for (l = 0; l < j; l++)
+                               free(records[l]);
+                       free(records);
+                       return;
+               }
+       }
+
+       j = 0;
+       while (g_variant_iter_loop(stat_iter, "y", &value)) {
+               records[j]->type = value;
+               DBG("Attribute Type 0x%02X", value);
+               j++;
+       }
+       while (g_variant_iter_loop(attr_iter, "q", &attribute_id)) {
+               records[l]->id = attribute_id;
+               DBG("Attribute Id 0x%04X", attribute_id);
+               l++;
+       }
+
+       container->found = true;
+
+       if (cb)
+               cb(addr16, ep, cluster_id, discovery_complete, records, records_len,
+                       container->userdata);
+
+       for (j = 0; j < records_len; j++)
+               free(records[j]);
+       free(records);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_discover_attr_req(zigbee_h handle, unsigned short addr16, unsigned char src_ep,
+               unsigned char dest_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               unsigned short start_id, unsigned char max_attribute_ids,
+               zb_zcl_global_discover_attr_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+       GVariant *variant = NULL;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_discover_attr_req()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL,
+                       ZIGBEE_ZCLGLB_INTERFACE,  "discover_attribute_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_discover_attributes_req_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_discover_attributes_req, container);
+       container->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(container->tid);
+               container->tid = 0;
+               free(container);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dest_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_DISCOVER_ATTRIBUTES_COMMAND_ID;
+
+       container->global_cmd = global_req;
+       container->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, container);
+#endif
+
+       g_dbus_proxy_call(zcl_global_proxy, "discover_attributes", g_variant_new("(qyyqqy)",
+               addr16, dest_ep, zcl_frame_ctl, cluster_id, start_id, max_attribute_ids),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_discover_attr_req Status = 0x%02X", status);
+       }
+
+       return status;
+}
+
+static gboolean _zbl_timeout_discover_cmds(gpointer p)
+{
+       zbl_req_cb_s *con = NULL;
+       zb_zcl_global_discover_cmds_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       con = p;
+       RETVM_IF(NULL == con, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = con->cb;
+
+       if (false == con->found && con->cb)
+               cb(0, 0, 0, 0, NULL, 0, con->userdata);
+
+       con->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, con->sid);
+       con->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_discover_cmds_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       DBG("_zbl_discover_cmds_cb");
+       zbl_req_cb_s *con = user_data;
+       RETM_IF(NULL == con, "cb_container is NULL");
+
+       zb_zcl_global_discover_cmds_rsp cb = con->cb;
+       nwk_addr addr16;
+       unsigned char ep;
+
+       int j = 0;
+       char value;
+       unsigned short cluster_id;
+       unsigned short cmd_len;
+       unsigned char *cmd_data;
+       unsigned char discoveryComplete;
+       GVariantIter *cmd_iter;
+
+       g_variant_get(parameters, "(ayqqqyy)",  &cmd_iter, &cluster_id, &cmd_len,
+               &addr16, &ep, &discoveryComplete);
+
+       cmd_data = calloc(cmd_len+1, sizeof(char));
+       RETM_IF(NULL == cmd_data, "calloc() Fail(%d)", errno);
+
+       while (g_variant_iter_loop(cmd_iter, "y", &value)) {
+               DBG("Value 0x%02X", value);
+               cmd_data[j] = value;
+               j++;
+       }
+
+       con->found = true;
+       if (cb)
+               cb(addr16, ep, cluster_id, discoveryComplete, cmd_data, cmd_len, con->userdata);
+
+       free(cmd_data);
+
+       if (con->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, con->sid);
+}
+
+int zbl_discover_cmds_gen(zigbee_h handle, nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned char start_command_id,
+               unsigned char max_command_ids, zb_zcl_global_discover_cmds_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+       GVariant *variant = NULL;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_discover_attr_gen()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+                               "discover_commands_received_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                               _zbl_discover_cmds_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_discover_cmds, con);
+       con->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(con->tid);
+               con->tid = 0;
+               free(con);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dst_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_DISCOVER_COMMANDS_GENERATED_COMMAND_ID;
+
+       con->global_cmd = global_req;
+       con->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, con);
+#endif
+
+       variant = g_dbus_proxy_call_sync(zcl_global_proxy, "discover_commands_received",
+               g_variant_new("(qyyqqy)", addr16, dst_ep, zcl_frame_ctl, cluster_id,
+               start_command_id, max_command_ids), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_discover_attr_gen Status = 0x%02X", status);
+       }
+       return status;
+}
+
+int zbl_discover_cmds_recv(zigbee_h handle, nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned char start_command_id,
+               unsigned char max_command_ids, zb_zcl_global_discover_cmds_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+       GVariant *variant = NULL;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_discover_cmds_recv()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+                               "discover_commands_received_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                               _zbl_discover_cmds_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_discover_cmds, con);
+       con->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(con->tid);
+               con->tid = 0;
+               free(con);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dst_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_DISCOVER_COMMANDS_RECEIVED_COMMAND_ID;
+
+       con->global_cmd = global_req;
+       con->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, con);
+#endif
+
+       variant = g_dbus_proxy_call_sync(zcl_global_proxy, "discover_commands_received",
+                               g_variant_new("(qyyqqy)", addr16, dst_ep, zcl_frame_ctl, cluster_id,
+                               start_command_id, max_command_ids), G_DBUS_CALL_FLAGS_NONE,     -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_discover_attr_gen Status = 0x%02X", status);
+       }
+       return status;
+}
+
+static gboolean _zbl_timeout_discover_attr_ext(gpointer p)
+{
+       zbl_req_cb_s *con = NULL;
+       zb_zcl_global_discover_attr_extended_rsp cb = NULL;
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       con = p;
+       RETVM_IF(NULL == con, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = con->cb;
+
+       if (false == con->found && con->cb)
+               cb(0, 0, 0, 0, NULL, 0, con->userdata);
+
+       con->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, con->sid);
+       con->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_discover_attr_ext_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *con = user_data;
+       RETM_IF(NULL == con, "cb_container is NULL");
+
+       zb_zcl_global_discover_attr_extended_rsp cb = con->cb;
+       nwk_addr addr16;
+       unsigned char ep;
+
+       int i = 0;
+       int j = 0;
+       unsigned short cluster_id;
+       unsigned char t_value;
+       unsigned char ac_value;
+
+       unsigned short rec_len;
+       unsigned short attr_data;
+       unsigned char discoveryComplete;
+       GVariantIter *attr_iter, *type_itr, *ac_itr;
+       extended_attr_info_h *records;
+
+       DBG("Will get the value now");
+
+       g_variant_get(parameters, "(aqayayqqqyy)", &attr_iter, &type_itr, &ac_itr,
+               &cluster_id, &rec_len, &addr16, &ep, &discoveryComplete);
+
+       DBG("records length 0x%04X", rec_len);
+
+       records = calloc(rec_len, sizeof(extended_attr_info_h));
+       RETM_IF(NULL == records, "calloc() Fail(%d)", errno);
+       for (j = 0; j < rec_len; j++) {
+               records[j] = calloc(1, sizeof(struct extended_attribute_infomation_s));
+               if (NULL == records[j]) {
+                       ERR("calloc() Fail(%d)", errno);
+                       for (i = 0; i < j; i++)
+                               free(records[i]);
+                       free(records);
+                       return;
+               }
+       }
+
+       j = 0;
+       while (g_variant_iter_loop(attr_iter, "q", &attr_data)
+                       && g_variant_iter_loop(type_itr, "y", &t_value)
+                       && g_variant_iter_loop(ac_itr, "y", &ac_value)) {
+               DBG("attrData 0x%04X", attr_data);
+               DBG("t_value 0x%02X", t_value);
+               DBG("ac_value 0x%02X", ac_value);
+               records[j]->id = attr_data;
+               records[j]->type = t_value;
+               records[j]->acl = ac_value;
+               j++;
+       }
+
+       con->found = true;
+       if (cb)
+               cb(addr16, ep, cluster_id, discoveryComplete, records, rec_len, con->userdata);
+
+       for (j = 0; j < rec_len; j++)
+               free(records[j]);
+       free(records);
+
+       if (con->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, con->sid);
+}
+
+int zbl_discover_attr_ext(zigbee_h handle, nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned short start_id,
+               unsigned char max_attribute_ids, zb_zcl_global_discover_attr_extended_rsp cb,
+               void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+       GVariant *variant = NULL;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       zb_event_global_default_rsp_s *global_req = NULL;
+#endif
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_global_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_discover_attr_ext()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_global_proxy);
+       sub_id = g_dbus_connection_signal_subscribe(gdbus_conn, NULL, ZIGBEE_ZCLGLB_INTERFACE,
+               "discover_attributes_extended_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+               _zbl_discover_attr_ext_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_discover_attr_ext, con);
+       con->userdata = user_data;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       global_req = calloc(1, sizeof(zb_event_global_default_rsp_s));
+       if (NULL == global_req) {
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, sub_id);
+               g_source_remove(con->tid);
+               con->tid = 0;
+               free(con);
+               ERR("calloc() Fail(%d)", errno);
+               return ZIGBEE_ERROR_OUT_OF_MEMORY;
+       }
+       global_req->ep = dst_ep;
+       global_req->cluster_id = cluster_id;
+       global_req->command_id = ZB_ZCL_DISCOVER_ATTRIBUTES_EXTENDED_COMMAND_ID;
+
+       con->global_cmd = global_req;
+       con->handle = handle;
+
+       /* Register global request information into handle */
+       _zbl_register_global_req(handle, con);
+#endif
+
+       variant = g_dbus_proxy_call_sync(zcl_global_proxy, "discover_attributes_extended",
+                               g_variant_new("(qyyqqy)", addr16, dst_ep, zcl_frame_ctl,
+                               cluster_id, start_id, max_attribute_ids), G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_discover_attr_ext Status = 0x%02X", status);
+       }
+       return status;
+}
+
+int zbl_reset_alarm(nwk_addr addr16, unsigned char ep, unsigned char alarm_code,
+               unsigned short cluster_id)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == alarm_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(alarm_gproxy, "reset_alarm",
+                               g_variant_new("(qyyq)", addr16, ep, alarm_code, cluster_id),
+                                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_alarm_reset_alarm Status %d", status);
+       }
+       return status;
+}
+
+int zbl_reset_all_alarm(nwk_addr addr16, unsigned char ep)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == alarm_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(alarm_gproxy, "reset_all_alarm",
+                               g_variant_new("(qy)", addr16, ep),
+                                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_alarm_reset_all_alarm Status %d", status);
+       }
+       return status;
+}
+
+static gboolean _zbl_timeout_get_alarm(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_alarm_get_alarm_rsp cb = NULL;
+
+       DBG("_zbl_timeout_get_alarm()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(ZB_ZCL_TIMEOUT, 0, ZB_ZCL_UNSUP_CLUSTER_COMMAND, 0, 0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_get_alarm_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_alarm_get_alarm_rsp cb = container->cb;
+
+       nwk_addr addr16 = 0;
+       unsigned char ep = 0;
+       unsigned char status = 0;
+       unsigned char alarm_code = 0;
+       unsigned short cluster_id = 0;
+       unsigned int time_stamp = 0;
+
+       container->found = true;
+
+       DBG("_zbl_get_alarm_cb");
+
+       g_variant_get(parameters, "(qyyyqu)", &addr16, &ep, &status, &alarm_code,
+                                       &cluster_id, &time_stamp);
+
+       if (cb)
+               cb(addr16, ep, status, alarm_code, cluster_id, time_stamp, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_get_alarm(nwk_addr addr16, unsigned char ep, zb_zcl_alarm_get_alarm_rsp cb,
+               void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *container;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == alarm_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_get_alarm()");
+
+       container = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(alarm_gproxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ALARM_INTERFACE,  "get_alarm_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_get_alarm_cb, container, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(container);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       container->cb = cb;
+       container->sid = sub_id;
+       container->tid = g_timeout_add_seconds(to, _zbl_timeout_get_alarm, container);
+       container->userdata = user_data;
+
+       g_dbus_proxy_call(alarm_gproxy, "get_alarm", g_variant_new("(qy)", addr16, ep),
+               G_DBUS_CALL_FLAGS_NONE, to, NULL, NULL, container);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_reset_all_alarm_log(nwk_addr addr16, unsigned char ep)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == alarm_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(alarm_gproxy, "reset_all_alarm_log",
+                               g_variant_new("(qy)", addr16, ep),
+                                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_reset_all_alarm_log Status %d", status);
+       }
+
+       return status;
+}
+
+int zbl_ccontrol_move_to_hue(nwk_addr addr16, unsigned char ep,
+               unsigned char hue, unsigned char direction,
+               unsigned short transition_time)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "move_to_hue",
+                       g_variant_new("(qyyyq)", addr16, ep, hue, direction, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+
+int zbl_ccontrol_move_hue(nwk_addr addr16, unsigned char ep,
+               unsigned char move_mode, unsigned char rate)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "move_hue",
+                       g_variant_new("(qyyy)", addr16, ep, move_mode, rate),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_step_hue(nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size,
+               unsigned char transition_time)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "step_hue",
+                       g_variant_new("(qyyyy)", addr16, ep, step_mode, step_size, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_move_to_saturation(nwk_addr addr16, unsigned char ep,
+               unsigned char saturation, unsigned short transition_time)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "move_to_saturation",
+                       g_variant_new("(qyyq)", addr16, ep, saturation, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_move_saturation(nwk_addr addr16, unsigned char ep,
+               unsigned char move_mode, unsigned char rate)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "move_saturation",
+                       g_variant_new("(qyyy)", addr16, ep, move_mode, rate),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_step_saturation(nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size,
+               unsigned char transition_time)
+{
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "step_saturation",
+                       g_variant_new("(qyyyy)", addr16, ep, step_mode, step_size, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_move_to_hue_and_saturation(nwk_addr addr16, unsigned char ep,
+               unsigned char hue, unsigned char saturation,
+               unsigned short transition_time)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "move_to_hue_and_saturation",
+                       g_variant_new("(qyyyq)", addr16, ep, hue, saturation, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_move_to_color(nwk_addr addr16, unsigned char ep,
+               unsigned short color_x, unsigned short color_y,
+               unsigned short transition_time)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "move_to_color",
+                       g_variant_new("(qyqqq)", addr16, ep, color_x, color_y, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_move_color(nwk_addr addr16, unsigned char ep,
+               unsigned short rate_x, unsigned short rate_y)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "move_color",
+                       g_variant_new("(qyqq)", addr16, ep, rate_x, rate_y),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_step_color(nwk_addr addr16, unsigned char ep,
+               unsigned short step_x, unsigned short step_y,
+               unsigned short transition_time)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "step_color",
+                       g_variant_new("(qyqqq)", addr16, ep, step_x, step_y, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_ccontrol_move_to_color_temperature(nwk_addr addr16, unsigned char ep,
+               unsigned short color_temperature,
+               unsigned short transition_time)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_color_control_proxy, "move_color_temperature",
+                       g_variant_new("(qyqq)", addr16, ep, color_temperature, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_reset_factory_default(nwk_addr addr16, unsigned char ep)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_basic_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(zcl_basic_proxy, "rest_factory_default",
+                               g_variant_new("(qy)", addr16, ep), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_reset_factory_default Status %d", status);
+       }
+
+       return status;
+}
+
+int zbl_identify(nwk_addr addr16, unsigned char dst_ep, unsigned short identify_time)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_identify_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(zcl_identify_proxy, "identify",
+                               g_variant_new("(qyq)", addr16, dst_ep, identify_time),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zbl_reset_factory_default Status %d", status);
+       }
+       return status;
+}
+
+static gboolean _zbl_timeout_identify_query(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_identify_query_cb cb = NULL;
+
+       DBG("_zbl_timeout_identity_query()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_identify_query_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_identify_query_cb cb = container->cb;
+
+       nwk_addr addr16 = 0;
+       unsigned short identify_time = 0;
+
+       container->found = true;
+
+       DBG("_zbl_identity_query_cb");
+
+       g_variant_get(parameters, "(qq)", &addr16, &identify_time);
+
+       if (cb)
+               cb(addr16, identify_time, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_identify_query(nwk_addr addr16, unsigned char dst_ep,
+               zb_zcl_identify_query_cb cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_identify_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_identify_query()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_identify_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLIDENTIFY_INTERFACE, "query_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_identify_query_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_identify_query, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_identify_proxy, "query", g_variant_new("(qy)", addr16, dst_ep),
+               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_add_group(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_group_add_group_rsp cb = NULL;
+
+       DBG("_zbl_timeout_add_group()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_add_group_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_group_add_group_rsp cb = container->cb;
+
+       nwk_addr addr16;
+       unsigned char ep;
+       unsigned char status;
+       unsigned short group_id;
+
+       container->found = true;
+
+       DBG("_zbl_add_group_cb");
+
+       g_variant_get(parameters, "(qyyq)", &addr16, &ep, &status, &group_id);
+
+       if (cb)
+               cb(addr16, ep, status, group_id, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_add_group(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+               const char *group_name, zb_zcl_group_add_group_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       int j = 0;
+       GVariant *groupname_variant = NULL;
+       GVariantBuilder *groupname_builder = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_group_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_add_group()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_group_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLGROUP_INTERFACE, "add_group_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_add_group_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_add_group, con);
+       con->userdata = user_data;
+
+
+       groupname_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       while (group_name[j] != '\0') {
+               g_variant_builder_add(groupname_builder, "y", group_name[j]);
+               j++;
+       }
+       groupname_variant = g_variant_builder_end(groupname_builder);
+
+       g_dbus_proxy_call(zcl_group_proxy, "add_group",
+               g_variant_new("(qyq@ay)", addr16, ep, group_id, groupname_variant),
+               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_view_group(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_group_view_group_rsp cb = NULL;
+
+       DBG("_zbl_timeout_view_group()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_view_group_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_group_view_group_rsp cb = container->cb;
+
+       int j = 0;
+       nwk_addr addr16;
+       unsigned char ep;
+       unsigned char value;
+       unsigned char status;
+       unsigned short group_id;
+       char *group_name = NULL;
+       GVariantIter *grpNameiter;
+
+       DBG("_zbl_view_group_cb");
+
+       g_variant_get(parameters, "(qyyqay)", &addr16, &ep, &status, &group_id, &grpNameiter);
+       g_variant_iter_loop(grpNameiter, "y", &value);
+       /* first byte indicates the length of the string */
+       if ((value - '0') > 0) {
+               DBG("Value %d ", (value - '0'));
+               group_name = calloc((value - '0') + 1, sizeof(char));
+               if (NULL == group_name) {
+                       ERR("calloc() Fail(%d)", errno);
+                       goto OUT;
+               }
+               group_name[j] = value;
+               j++;
+               while (g_variant_iter_loop(grpNameiter, "y", &value) && (j <= (value - '0'))) {
+                       group_name[j] = value;
+                       DBG("Name %c", group_name[j]);
+                       j++;
+               }
+       } else {
+               group_name = calloc(1, sizeof(char));
+               if (NULL == group_name) {
+                       ERR("calloc() Fail(%d)", errno);
+                       goto OUT;
+               }
+               group_name[j] = value;
+               j++;
+               group_name[j] = '\0';
+               j++;
+       }
+
+       DBG("GroupName = %s", group_name);
+
+       container->found = true;
+
+       if (cb)
+               cb(addr16, ep, status, group_id, group_name, container->userdata);
+OUT:
+       if (group_name)
+               free(group_name);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_view_group(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+               zb_zcl_group_view_group_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_group_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_view_group()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_group_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLGROUP_INTERFACE,  "view_group_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_view_group_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_view_group, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_group_proxy, "view_group", g_variant_new("(qyq)",
+               addr16, ep, group_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_get_group_membership(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_group_get_group_membership_rsp cb = NULL;
+
+       DBG("_zbl_timeout_get_group_membership()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_group_get_group_membership_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_group_get_group_membership_rsp cb = container->cb;
+
+       int j = 0;
+       nwk_addr addr16;
+       unsigned char ep;
+       unsigned short gl_value;
+       unsigned char capacity;
+       unsigned char group_count;
+       unsigned short *grouplist = NULL;
+       GVariantIter *grpListiter;
+
+       DBG("_zbl_group_get_group_membership_cb");
+
+
+       g_variant_get(parameters, "(qyyyaq)", &addr16, &ep, &capacity, &group_count, &grpListiter);
+
+       if (group_count > 0) {
+               grouplist = calloc(group_count+1, sizeof(unsigned short));
+               RETM_IF(NULL == grouplist, "calloc() Fail(%d)", errno);
+               while (g_variant_iter_loop(grpListiter, "q", &gl_value)) {
+                       grouplist[j] = gl_value;
+                       j++;
+               }
+       }
+
+       container->found = true;
+
+       if (cb)
+               cb(addr16, ep, capacity, group_count, grouplist, container->userdata);
+
+       free(grouplist);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_group_get_group_membership(nwk_addr addr16, unsigned char ep,
+               unsigned char group_count, unsigned short *group_list,
+               zb_zcl_group_get_group_membership_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       int j = 0;
+       GVariant *grouplist_variant = NULL;
+       GVariantBuilder *grouplist_builder = NULL;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_group_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_group_get_group_membership()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_group_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLGROUP_INTERFACE,  "get_group_membership_rsp", ZIGBEE_OBJECT_PATH,
+                       NULL, 0, _zbl_group_get_group_membership_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_get_group_membership, con);
+       con->userdata = user_data;
+
+       grouplist_builder = g_variant_builder_new(G_VARIANT_TYPE("aq"));
+       while (j < group_count) {
+               g_variant_builder_add(grouplist_builder, "y", group_list[j]);
+               j++;
+       }
+       grouplist_variant = g_variant_builder_end(grouplist_builder);
+
+       g_dbus_proxy_call(zcl_group_proxy, "get_group_membership",
+               g_variant_new("(qyy@aq)", addr16, ep, group_count,      grouplist_variant),
+               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_remove_group(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_group_remove_group_rsp cb = NULL;
+
+       DBG("_zbl_timeout_remove_group()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_remove_group_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_group_remove_group_rsp cb = container->cb;
+
+       nwk_addr addr16;
+       unsigned char ep;
+       unsigned char status;
+       unsigned short group_id;
+
+       container->found = true;
+
+       DBG("_zbl_remove_group_cb");
+
+       g_variant_get(parameters, "(qyyq)", &addr16, &ep, &status, &group_id);
+
+       if (cb)
+               cb(addr16, ep, status, group_id, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_remove_group(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+               zb_zcl_group_remove_group_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_group_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_group_remove_group()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_group_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLGROUP_INTERFACE,  "remove_group_rsp", ZIGBEE_OBJECT_PATH,
+                       NULL, 0, _zbl_remove_group_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_remove_group, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_group_proxy, "remove_group", g_variant_new("(qyq)",
+               addr16, ep, group_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_remove_all_group(nwk_addr addr16, unsigned char ep)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_group_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_group_remove_all_group()");
+
+       variant = g_dbus_proxy_call_sync(zcl_group_proxy, "remove_all_group",
+                               g_variant_new("(qy)", addr16, ep),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%02X", status);
+       }
+
+       return status;
+}
+
+int zbl_add_group_if_identifying(nwk_addr addr16, unsigned char ep,
+               unsigned short group_id, const char *group_name)
+{
+       int j = 0;
+       GVariant *groupname_variant = NULL;
+       GVariant *variant = NULL;
+       GVariantBuilder *groupname_builder = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_group_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       groupname_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       while (group_name[j] != '\0') {
+               g_variant_builder_add(groupname_builder, "y", group_name[j]);
+               j++;
+       }
+       groupname_variant = g_variant_builder_end(groupname_builder);
+
+       variant = g_dbus_proxy_call_sync(zcl_group_proxy, "add_group_if_identifying",
+               g_variant_new("(qyq@ay)", addr16, ep, group_id, groupname_variant),
+               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%02X", status);
+       }
+
+       return status;
+}
+
+int zbl_level_control_move_to_level(nwk_addr addr16, unsigned char ep,
+               unsigned char level, unsigned short transition_time)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == level_control_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_level_control_move_to_level()");
+
+       variant = g_dbus_proxy_call_sync(level_control_gproxy, "move_to_level",
+                               g_variant_new("(qyyq)", addr16, ep, level, transition_time),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_level_control_move(nwk_addr addr16, unsigned char ep,
+               unsigned char move_mode, unsigned char rate)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == level_control_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_level_control_move()");
+
+       variant = g_dbus_proxy_call_sync(level_control_gproxy, "move",
+                       g_variant_new("(qyyy)", addr16, ep, move_mode, rate),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_level_control_step(nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size,
+               unsigned short transition_time)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == level_control_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_level_control_step()");
+
+       variant = g_dbus_proxy_call_sync(level_control_gproxy, "step",
+                       g_variant_new("(qyyyq)", addr16, ep, step_mode, step_size, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_level_control_stop(nwk_addr addr16, unsigned char ep)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == level_control_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_level_control_stop()");
+
+       variant = g_dbus_proxy_call_sync(level_control_gproxy, "stop",
+                       g_variant_new("(qy)", addr16, ep), G_DBUS_CALL_FLAGS_NONE,
+                       -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_level_control_move_to_level_with_on_off(nwk_addr addr16,
+               unsigned char ep, unsigned char level, unsigned short transition_time)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == level_control_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_level_control_move_to_level_with_on_off()");
+
+       variant = g_dbus_proxy_call_sync(level_control_gproxy, "move_to_level_with_on_off",
+                       g_variant_new("(qyyq)", addr16, ep, level, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_level_control_move_with_on_off(nwk_addr addr16, unsigned char ep,
+               unsigned char move_mode, unsigned char rate)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == level_control_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_level_control_move_with_on_off()");
+
+       variant = g_dbus_proxy_call_sync(level_control_gproxy, "move_with_on_off",
+                       g_variant_new("(qyyy)", addr16, ep, move_mode, rate),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_level_control_step_with_on_off(nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size,
+               unsigned short transition_time)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == level_control_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_level_control_step_with_on_off()");
+
+       variant = g_dbus_proxy_call_sync(level_control_gproxy, "step_with_on_off",
+                       g_variant_new("(qyyyq)", addr16, ep, step_mode, step_size, transition_time),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_onoff_set(nwk_addr addr16, unsigned char ep, unsigned char on_off_type)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == on_off_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(on_off_gproxy, "set_on_off",
+                               g_variant_new("(qyy)", addr16, ep, on_off_type), G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("zigbee_set_on_off Status 0x%x", status);
+       }
+
+       return status;
+}
+
+int zbl_zone_enroll_response(nwk_addr addr16, unsigned char dst_ep,
+               unsigned char enroll_response_code, unsigned char zone_id)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_ias_zone_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(zcl_ias_zone_proxy, "enroll_response",
+                               g_variant_new("(qyyy)", addr16, dst_ep, enroll_response_code,
+                               zone_id), G_DBUS_CALL_FLAGS_NONE,
+                               -1, NULL, NULL);
+
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%02X", status);
+       }
+       return status;
+}
+
+int zbl_pollcontrol_check_in_response(nwk_addr addr16, unsigned char ep,
+               unsigned char start_fast_polling, unsigned short fast_poll_timeout)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_poll_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(zcl_poll_control_proxy, "check_in_response",
+                               g_variant_new("(qyyq)", addr16, ep, start_fast_polling,
+                               fast_poll_timeout), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%02X", status);
+       }
+       return status;
+}
+
+int zbl_pollcontrol_fast_poll_stop(nwk_addr addr16, unsigned char ep)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_poll_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(zcl_poll_control_proxy, "fast_poll_stop",
+                       g_variant_new("(qy)", addr16, ep), G_DBUS_CALL_FLAGS_NONE,
+                       -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%02X", status);
+       }
+       return status;
+}
+
+static gboolean _zbl_timeout_set_long_poll_interval(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_pollctrl_check_in cb = NULL;
+
+       DBG("_zbl_timeout_set_long_poll_interval()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_set_long_poll_interval_cb(GDBusConnection *connection,
+               const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+               const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_pollctrl_check_in cb = container->cb;
+
+       nwk_addr addr16 = 0;
+       unsigned char ep = 0;
+
+       container->found = true;
+
+       DBG("_zbl_set_long_poll_interval_cb");
+
+       g_variant_get(parameters, "(qy)", &addr16, &ep);
+
+       if (cb)
+               cb(addr16, ep, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_pollcontrol_set_long_poll_interval(nwk_addr addr16, unsigned char ep,
+       unsigned int new_long_poll_interval, zb_zcl_pollctrl_check_in cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_poll_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_pollcontrol_set_long_poll_interval()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_poll_control_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLPOLL_INTERFACE,  "checkin_response", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_set_long_poll_interval_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_set_long_poll_interval, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_poll_control_proxy, "set_long_poll_interval",
+                       g_variant_new("(qyu)", addr16, ep, new_long_poll_interval),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_pollcontrol_set_short_poll_interval(nwk_addr addr16, unsigned char ep,
+       unsigned int new_short_poll_interval, zb_zcl_pollctrl_check_in cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_poll_control_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       DBG("zbl_pollcontrol_set_short_poll_interval()");
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_poll_control_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLPOLL_INTERFACE,  "checkin_response", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_set_long_poll_interval_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_set_long_poll_interval, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_poll_control_proxy, "set_short_poll_interval",
+                       g_variant_new("(qyu)", addr16, ep, new_short_poll_interval),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_add_scene(gpointer p)
+{
+       zbl_req_cb_s *container = p;
+       zb_zcl_scene_add_scene_rsp cb = container->cb;
+
+       DBG("_zbl_timeout_add_scene()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_add_scene_cb(GDBusConnection *connection, const gchar *sender_name,
+       const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
+       GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_scene_add_scene_rsp cb = container->cb;
+
+       nwk_addr addr16 = 0;
+       unsigned char ep;
+       unsigned char status;
+       unsigned short group_id;
+       unsigned char scene_id;
+
+       container->found = true;
+
+       DBG("_zbl_add_scene_cb");
+
+       g_variant_get(parameters, "(qyyqy)", &addr16, &ep, &status,     &group_id, &scene_id);
+
+       if (cb)
+               cb(addr16, ep, status, group_id, scene_id, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_add_scene(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+       unsigned char scene_id, unsigned short transition_time, const char *scene_name,
+       unsigned short ext_field_len, const char *extension_field_sets,
+       zb_zcl_scene_add_scene_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       int j = 0;
+       int index = 0;
+       GVariant *scenename_variant = NULL;
+       GVariantBuilder *scenename_builder = NULL;
+       GVariant *extensionfieldSet_variant = NULL;
+       GVariantBuilder *extensionfieldSet_builder = NULL;
+
+       DBG("zbl_add_scene()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_scene_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_scene_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLSCENE_INTERFACE,  "add_scene_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_add_scene_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_add_scene, con);
+       con->userdata = user_data;
+
+       scenename_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+       while ('\0' != scene_name[j]) {
+               g_variant_builder_add(scenename_builder, "y", scene_name[j]);
+               j++;
+       }
+       scenename_variant = g_variant_builder_end(scenename_builder);
+       extensionfieldSet_builder = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+
+       while (index < ext_field_len) {
+               INFO("Ext contents 0x%02X", extension_field_sets[index]);
+               g_variant_builder_add(extensionfieldSet_builder, "y", extension_field_sets[index]);
+               index++;
+       }
+       extensionfieldSet_variant = g_variant_builder_end(extensionfieldSet_builder);
+
+       g_dbus_proxy_call(zcl_scene_proxy, "add_scene",
+               g_variant_new("(qyqyqq@ay@ay)", addr16, ep, group_id, scene_id, transition_time,
+               ext_field_len, scenename_variant, extensionfieldSet_variant), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_view_scene(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_scene_view_scene_rsp cb = NULL;
+
+       DBG("_zbl_timeout_view_scene()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, 0, 0, NULL, NULL, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_view_scene_cb(GDBusConnection *connection, const gchar *sender_name,
+       const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
+       GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_scene_view_scene_rsp cb = container->cb;
+
+       int j = 0;
+       int len;
+       nwk_addr addr16 = 0;
+       unsigned char ep;
+       unsigned char status;
+       unsigned short group_id;
+       unsigned char scene_id;
+       unsigned short transition_time = 0;
+       unsigned char value;
+       unsigned short ext_len = 0;
+       char *scene_name = NULL;
+       char *extendedFieldSets = NULL;
+       GVariantIter *sceneNameIter = NULL;
+       GVariantIter *extendedSetIter = NULL;
+
+       DBG("_zbl_view_scene_cb");
+
+       g_variant_get(parameters, "(qyyqyqayyay)", &addr16, &ep, &status, &group_id, &scene_id,
+               &transition_time, &sceneNameIter, &ext_len, &extendedSetIter);
+
+       g_variant_iter_loop(sceneNameIter, "y", &value);
+
+       /** first byte indicates the length of the string */
+       len = value -'0';
+       if (0 < len) {
+               scene_name = calloc(len + 1, sizeof(char));
+               if (NULL == scene_name) {
+                       ERR("calloc() Fail(%d)", errno);
+                       goto OUT;
+               }
+               scene_name[j] = value;
+               j++;
+               while (g_variant_iter_loop(sceneNameIter, "y", &value)) {
+                       scene_name[j] = value;
+                       j++;
+               }
+       } else {
+               scene_name = calloc(1 + 1, sizeof(char));
+               if (NULL == scene_name) {
+                       ERR("calloc() Fail(%d)", errno);
+                       goto OUT;
+               }
+               scene_name[j] = value;
+       }
+
+       j = 0;
+       if (0 < ext_len) {
+               extendedFieldSets = calloc(ext_len + 1, sizeof(char));
+               if (NULL == extendedFieldSets) {
+                       ERR("calloc() Fail(%d)", errno);
+                       goto OUT;
+               }
+               while (g_variant_iter_loop(extendedSetIter, "y", &value)) {
+                       extendedFieldSets[j] = value;
+                       j++;
+               }
+       }
+
+       container->found = true;
+
+       if (cb)
+               cb(addr16, ep, status, group_id, scene_id, transition_time, scene_name,
+                       extendedFieldSets, ext_len, container->userdata);
+
+OUT:
+       if (scene_name)
+               free(scene_name);
+
+       if (extendedFieldSets)
+               free(extendedFieldSets);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_view_scene(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+       unsigned char scene_id, zb_zcl_scene_view_scene_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       DBG("zbl_scene_view_scene()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_scene_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_scene_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLSCENE_INTERFACE,  "view_scene_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_view_scene_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_view_scene, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_scene_proxy, "view_scene",
+               g_variant_new("(qyqy)", addr16, ep, group_id, scene_id), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_remove_scene(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_scene_remove_scene_rsp cb = NULL;
+
+       DBG("_zbl_timeout_remove_scene()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_remove_scene_cb(GDBusConnection *connection, const gchar *sender_name,
+       const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
+       GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_scene_remove_scene_rsp cb = container->cb;
+
+       nwk_addr addr16 = 0;
+       unsigned char ep;
+       unsigned char status;
+       unsigned short group_id;
+       unsigned char scene_id;
+
+       container->found = true;
+
+       DBG("_zbl_remove_scene_cb");
+
+       g_variant_get(parameters, "(qyyqy)", &addr16, &ep, &status, &group_id, &scene_id);
+
+       if (cb)
+               cb(addr16, ep, status, group_id, scene_id, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_remove_scene(nwk_addr addr16, unsigned char ep,
+       unsigned short group_id, unsigned char scene_id, zb_zcl_scene_remove_scene_rsp cb,
+       void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       DBG("zbl_scene_remove_scene()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_scene_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_scene_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLSCENE_INTERFACE,  "remove_scene_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_remove_scene_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_remove_scene, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_scene_proxy, "remove_scene",
+               g_variant_new("(qyqy)", addr16, ep, group_id, scene_id), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL, NULL);
+
+       DBG("zbl_scene_remove_scene() - 1");
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_remove_all_scene(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_scene_remove_all_scene_rsp cb = NULL;
+
+       DBG("_zbl_timeout_remove_all_scene()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_remove_all_scene_cb(GDBusConnection *connection, const gchar *sender_name,
+       const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
+       GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_scene_remove_all_scene_rsp cb = container->cb;
+
+       nwk_addr addr16 = 0;
+       unsigned char ep;
+       unsigned char status;
+       unsigned short group_id;
+
+       container->found = true;
+
+       DBG("_zbl_remove_all_scene_cb");
+
+       g_variant_get(parameters, "(qyyq)", &addr16, &ep, &status, &group_id);
+
+       if (cb)
+               cb(addr16, ep, status, group_id, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_remove_all_scene(nwk_addr addr16, unsigned char ep,
+       unsigned short group_id, zb_zcl_scene_remove_all_scene_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       DBG("zbl_scene_remove_all_scene()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_scene_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_scene_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLSCENE_INTERFACE,  "remove_all_scene_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_remove_all_scene_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_remove_all_scene, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_scene_proxy, "remove_all_scene",
+               g_variant_new("(qyq)", addr16, ep, group_id), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_scene_store_scene(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_scene_store_scene_rsp cb = NULL;
+
+       DBG("_zbl_timeout_scene_store_scene()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, 0, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_scene_store_scene_cb(GDBusConnection *connection,
+       const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+       const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_scene_store_scene_rsp cb = container->cb;
+
+       nwk_addr addr16 = 0;
+       unsigned char ep;
+       unsigned char status;
+       unsigned short group_id;
+       unsigned char scene_id;
+
+       container->found = true;
+
+       DBG("_zbl_scene_store_scene_cb");
+
+       g_variant_get(parameters, "(qyyqy)", &addr16, &ep, &status, &group_id, &scene_id);
+
+       if (cb)
+               cb(addr16, ep, status, group_id, scene_id, container->userdata);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_store_scene(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+       unsigned char scene_id, zb_zcl_scene_store_scene_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       DBG("zbl_scene_store_scene()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_scene_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_scene_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLSCENE_INTERFACE,  "store_scene_rsp", ZIGBEE_OBJECT_PATH, NULL, 0,
+                       _zbl_scene_store_scene_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_scene_store_scene, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_scene_proxy, "store_scene",
+               g_variant_new("(qyqy)", addr16, ep, group_id, scene_id), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_recall_scene(nwk_addr addr16, unsigned char ep,        unsigned short group_id,
+       unsigned char scene_id)
+{
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_scene_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       g_dbus_proxy_call(zcl_scene_proxy, "recall_scene",
+               g_variant_new("(qyqy)", addr16, ep, group_id, scene_id), G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL, NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+static gboolean _zbl_timeout_get_scene_membership(gpointer p)
+{
+       zbl_req_cb_s *container = NULL;
+       zb_zcl_scene_get_scene_membership_rsp cb = NULL;
+
+       DBG("_zbl_timeout_get_scene_membership()");
+
+       RETVM_IF(NULL == gdbus_conn, G_SOURCE_REMOVE, "gdbus_conn is NULL");
+       container = p;
+       RETVM_IF(NULL == container, G_SOURCE_REMOVE, "cb_container is NULL");
+       cb = container->cb;
+
+       if (false == container->found && container->cb)
+               cb(0, 0, 0, 0, 0, 0, NULL, container->userdata);
+
+       container->tid = 0;
+
+       g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+       DBG("container->sid=%d unsubscribed");
+       container->sid = 0;
+
+       return G_SOURCE_REMOVE;
+}
+
+static void _zbl_get_scene_membership_cb(GDBusConnection *connection,
+       const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+       const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+       zbl_req_cb_s *container = user_data;
+       zb_zcl_scene_get_scene_membership_rsp cb = container->cb;
+
+       int j = 0;
+       nwk_addr addr16 = 0;
+       unsigned char ep;
+       unsigned char status;
+       unsigned short group_id;
+       unsigned char capacity;
+       unsigned char value;
+       unsigned char scene_count = 0;
+       unsigned char *scene_list = NULL;
+       GVariantIter *sceneListIter = NULL;
+
+       DBG("_zbl_get_scene_membership_cb");
+
+       g_variant_get(parameters, "(qyyyqyay)", &addr16, &ep, &status, &capacity, &group_id,
+               &scene_count, &sceneListIter);
+
+       if (0 < scene_count) {
+               scene_list = calloc(scene_count+1, sizeof(char));
+               if (NULL == scene_list) {
+                       ERR("calloc() Fail(%d)", errno);
+                       goto OUT;
+               }
+               while (g_variant_iter_loop(sceneListIter, "y", &value)) {
+                       scene_list[j] = value;
+                       DBG("Scene_List 0x%02X", scene_list[j]);
+                       j++;
+               }
+       }
+
+       container->found = true;
+
+       if (cb)
+               cb(addr16, ep, status, capacity, group_id, scene_count, scene_list, container->userdata);
+
+OUT:
+       if (scene_list)
+               free(scene_list);
+
+       if (container->sid)
+               g_dbus_connection_signal_unsubscribe(gdbus_conn, container->sid);
+}
+
+int zbl_get_scene_membership(nwk_addr addr16, unsigned char ep,
+       unsigned short group_id, zb_zcl_scene_get_scene_membership_rsp cb, void *user_data)
+{
+       int sub_id, to;
+       zbl_req_cb_s *con;
+
+       DBG("zbl_scene_get_scene_membership()");
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == zcl_scene_proxy, ZIGBEE_ERROR_IO_ERROR);
+
+       con = calloc(1, sizeof(zbl_req_cb_s));
+       RETVM_IF(NULL == con, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
+       to = zbl_dbus_get_timeout(zcl_scene_proxy);
+       sub_id = g_dbus_connection_signal_subscribe((GDBusConnection*)gdbus_conn, NULL,
+                       ZIGBEE_ZCLSCENE_INTERFACE, "get_scene_membership_rsp", ZIGBEE_OBJECT_PATH,
+                       NULL, 0, _zbl_get_scene_membership_cb, con, _zbl_request_cleanup);
+
+       if (0 == sub_id) {
+               ERR("g_dbus_connection_signal_subscribe() Fail");
+               free(con);
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       con->cb = cb;
+       con->sid = sub_id;
+       con->tid = g_timeout_add_seconds(to, _zbl_timeout_get_scene_membership, con);
+       con->userdata = user_data;
+
+       g_dbus_proxy_call(zcl_scene_proxy, "get_scene_membership",
+               g_variant_new("(qyq)", addr16, ep, group_id), G_DBUS_CALL_FLAGS_NONE, -1, NULL,
+               NULL, NULL);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+int zbl_thermostat_adjust_setpoint(nwk_addr addr16, unsigned char ep, unsigned char mode,
+       unsigned char amount)
+{
+       GVariant *variant = NULL;
+       unsigned char status = ZIGBEE_ERROR_NONE;
+
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == thermostat_gproxy, ZIGBEE_ERROR_IO_ERROR);
+
+       variant = g_dbus_proxy_call_sync(thermostat_gproxy, "setpoint_raise_lower",
+                               g_variant_new("(qyyy)", addr16, ep, mode, amount),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
+       if (variant) {
+               g_variant_get(variant, "(y)", &status);
+               DBG("Status = 0x%02X", status);
+       }
+       return status;
+}
+
+int zbl_dbus_start(zigbee_h handle)
+{
+       FN_CALL;
+
+       unsigned int id;
+
+       if (gdbus_conn) {
+               zbl_ref_count++;
+               return ZIGBEE_ERROR_NONE;
+       }
+
+       gdbus_conn = _zbl_get_connection();
+       if (!gdbus_conn) {
+               ERR("Couldn't connect to the System bus");
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       id = g_signal_connect(gdbus_conn, "notify::g-name-owner",
+                       G_CALLBACK(_zbl_dbus_name_owner_notify), NULL);
+       if (0 == id) {
+               ERR("g_signal_connect() Fail\n");
+               return ZIGBEE_ERROR_IO_ERROR;
+       }
+
+       /* Phase 1. Subscribe signals */
+       _zbl_dbus_subscribe_signal(handle);
+
+       /* Phase 2. Make proxies */
+       service_gproxy = _zbl_get_service_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get service_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(service_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       on_off_gproxy = _zbl_get_on_off_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get on_off_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(on_off_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       door_lock_gproxy = _zbl_get_door_lock_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get door_lock_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(door_lock_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       level_control_gproxy = _zbl_get_level_control_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get level_control_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(level_control_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       thermostat_gproxy = _zbl_get_thermostat_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get thermostat_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(thermostat_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       fan_control_gproxy = _zbl_get_fan_control_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get fan_control_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(fan_control_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       alarm_gproxy = _zbl_get_alarm_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get alarm_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(alarm_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       mfglib_gproxy = _zbl_get_mfglib_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get mfglib_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(mfglib_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zcl_global_proxy = _zbl_get_zcl_global_proxy();
+       RETVM_IF(NULL == service_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zcl_global_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zcl_global_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zdo_dev_proxy = _zbl_get_zdo_dev_proxy();
+       RETVM_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zdo_dev_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zdo_dev_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zcl_basic_proxy = _zbl_get_basic_proxy();
+       RETVM_IF(NULL == zcl_basic_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zcl_basic_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zcl_basic_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zcl_identify_proxy = _zbl_get_identify_proxy();
+       RETVM_IF(NULL == zcl_identify_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zcl_identify_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zcl_identify_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zcl_ias_zone_proxy = _zbl_get_ias_zone_proxy();
+       RETVM_IF(NULL == zcl_ias_zone_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zcl_ias_zone_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zcl_ias_zone_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zcl_poll_control_proxy = _zbl_get_poll_control_proxy();
+       RETVM_IF(NULL == zcl_poll_control_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zcl_poll_control_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zcl_poll_control_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zcl_group_proxy = _zbl_get_group_proxy();
+       RETVM_IF(NULL == zcl_group_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zcl_group_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zcl_group_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zcl_scene_proxy = _zbl_get_scene_proxy();
+       RETVM_IF(NULL == zcl_scene_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zcl_scene_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zcl_scene_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zdo_bind_proxy = _zbl_get_zdo_bind_proxy();
+       RETVM_IF(NULL == zdo_bind_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zdo_bind_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zdo_bind_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zcl_color_control_proxy = _zbl_get_color_control_proxy();
+       RETVM_IF(NULL == zcl_color_control_proxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get zcl_color_control_proxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(zcl_color_control_proxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       custom_gproxy = _zbl_get_custom_gproxy();
+       RETVM_IF(NULL == custom_gproxy, ZIGBEE_ERROR_IO_ERROR, "Couldn't get custom_gproxy");
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(custom_gproxy), ZIGBEE_BROADCAST_TIMEOUT);
+
+       zbl_ref_count++;
+       return ZIGBEE_ERROR_NONE;
+}
+
+void zbl_dbus_stop(void)
+{
+       if (0 <= zbl_ref_count) {
+               WARN("dbus does not initiaized\n");
+               return;
+       }
+       if (0 > --zbl_ref_count)
+               DBG("all connections closed\n");
+
+       g_object_unref(gdbus_conn);
+       gdbus_conn = NULL;
+       return;
+}
+
+GDBusConnection* zbl_dbus_get_object(void)
+{
+       return gdbus_conn;
+}
+
+int zbl_dbus_get_timeout(GDBusProxy *proxy)
+{
+       gint timeout;
+       RETV_IF(NULL == gdbus_conn, ZIGBEE_BROADCAST_TIMEOUT);
+       timeout = g_dbus_proxy_get_default_timeout(proxy);
+       if (timeout <= 0) {
+               ERR("Invalid timeout (%d)", timeout);
+               return ZIGBEE_BROADCAST_TIMEOUT;
+       }
+       return timeout/1000;
+}
+
diff --git a/lib/zbl-dbus.h b/lib/zbl-dbus.h
new file mode 100644 (file)
index 0000000..219d338
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_LIBRARY_DBUS_H__
+#define __TIZEN_NETWORK_ZIGBEE_LIBRARY_DBUS_H__
+
+#include <gio/gio.h>
+
+#include <zigbee.h>
+#include <zb-type.h>
+#include <zb-custom.h>
+
+int zbl_dbus_start(zigbee_h handle);
+void zbl_dbus_stop(void);
+GDBusConnection* zbl_dbus_get_object(void);
+int zbl_dbus_get_timeout(GDBusProxy *proxy);
+int zbl_enable(zigbee_h handle, zb_event_cb event_handler);
+int zbl_disable(void);
+int zbl_hw_reset(void);
+int zbl_coex_start(unsigned char channel);
+int zbl_coex_stop(void);
+int zbl_get_network_info(ieee_addr addr64, nwk_addr *nodeid, nwk_addr *panid,
+               unsigned char *channel, unsigned char *tx_power);
+int zbl_get_controller_mac_address(ieee_addr addr64);
+int zbl_get_all_device_info(zb_end_device_info_h **dev_list, unsigned char* num);
+int zbl_form_network(zigbee_h handle);
+int zbl_disable_network(void);
+int zbl_leave_device(ieee_addr addr64, bool remove_children, bool rejoin);
+int zbl_permit_join(unsigned char duration, bool broadcast);
+int zbl_nwk_addr_req(zigbee_h handle, ieee_addr addr64, unsigned char request_type,
+       unsigned char start_idx, zb_zdo_addr_rsp cb, void *user_data);
+int zbl_ieee_addr_req(zigbee_h handle, nwk_addr addr16, zb_zdo_addr_rsp cb,
+               void *user_data);
+int zbl_active_ep(zigbee_h handle, nwk_addr addr16, zb_zdo_active_ep_rsp cb,
+               void *user_data);
+int zbl_simple_desc_req(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               zb_zdo_simple_desc_rsp cb, void *user_data);
+int zbl_match_desc_req(zigbee_h handle, nwk_addr addr16,
+               unsigned short profile_id, unsigned char num_in_clusters,
+               unsigned short *in_clusters, unsigned char num_out_clusters,
+               unsigned short *out_clusters, zb_zdo_match_desc_rsp cb, void *user_data);
+int zbl_device_annce(zigbee_h handle, nwk_addr addr16, ieee_addr addr64,
+               unsigned char capability);
+int zbl_node_desc_req(nwk_addr addr16, zb_zdo_node_desc_rsp cb, void *user_data);
+int zbl_power_desc_req(nwk_addr addr16, zb_zdo_power_desc_rsp cb,      void *user_data);
+int zbl_complex_desc_req(nwk_addr addr16, zb_zdo_complex_desc_rsp cb, void *user_data);
+int zbl_user_desc_req(nwk_addr addr16, zb_zdo_user_desc_rsp cb, void *user_data);
+int zbl_bind_req(nwk_addr dst_addr16, ieee_addr src_addr64,
+               unsigned char src_ep, unsigned short cluster_id, ieee_addr dst_addr64,
+               unsigned char type, nwk_addr group_addr, unsigned char dst_ep, zb_zdo_bind_rsp cb,
+               void *user_data);
+int zbl_unbind_req(nwk_addr dst_addr16, ieee_addr src_addr64,
+               unsigned char src_ep, unsigned short cluster_id, ieee_addr dst_addr64,
+               unsigned char type, nwk_addr group_addr, unsigned char dst_ep,
+               zb_zdo_unbind_rsp cb, void *user_data);
+int zbl_mgmt_nwk_disc_req(nwk_addr addr16, unsigned int scan_channels,
+       unsigned char scan_duration, unsigned char scan_count, unsigned char start_idx,
+       zb_zdo_mgmt_nwk_disc_rsp cb, void *user_data);
+int zbl_mgmt_nwk_update_req(unsigned int scan_channels, unsigned char scan_duration,
+       unsigned char scan_count, unsigned char nwk_update_id, nwk_addr nwk_manager_addr);
+int zbl_mgmt_lqi_req(nwk_addr addr16, unsigned char start_idx,
+               zb_zdo_mgmt_lqi_rsp cb, void *user_data);
+int zbl_mgmt_rtg_req(nwk_addr addr16, unsigned char start_idx,
+               zb_zdo_mgmt_rtg_rsp cb, void *user_data);
+int zbl_mgmt_bind_req(nwk_addr addr16, unsigned char start_idx,
+               zb_zdo_mgmt_bind_rsp cb, void *user_data);
+int zbl_mgmt_leave_device(ieee_addr addr64, unsigned char remove_children,
+               unsigned rejoin, zb_zdo_mgmt_leave_rsp cb, void *user_data);
+int zbl_mgmt_permit_joining_req(nwk_addr addr16, unsigned char duration,
+               unsigned char tc_significance, zb_zdo_mgmt_permit_joining_rsp cb, void *user_data);
+
+/* Custom Commands */
+int zbl_aps_send(nwk_addr addr16, unsigned char aps_frame_ctl,
+               unsigned char src_ep, unsigned char dst_ep,
+               unsigned short cluster_id, unsigned short profile_id,
+               unsigned char zcl_frame_ctl, unsigned short mfg_code,
+               unsigned short payload_len, unsigned char *payload,
+               zb_aps_send_rsp cb, void *user_data);
+int zbl_zcl_send(nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned short cluster_id, unsigned char zcl_frame_ctl, unsigned char cmd,
+               unsigned short payload_len, unsigned char *payload,
+               zb_zcl_send_rsp cb, void *user_data);
+int zbl_send_to_local(unsigned short length, unsigned char *data,
+               zb_send_to_local_rsp cb, void *user_data);
+
+/* ZCL Global Commands */
+int zbl_read_attr_req(zigbee_h handle, unsigned short addr16, unsigned char dest_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned short *attribute_ids,
+               int attribute_ids_len, zb_zcl_global_rsp cb, void *user_data);
+int zbl_write_attr_req(zigbee_h handle, nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, write_attr_record_h *records,
+               int records_len, zb_zcl_global_rsp cb, void *user_data);
+int zbl_wattr_undivided_req(zigbee_h handle, nwk_addr addr16, unsigned char src_ep,
+               unsigned char dst_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               write_attr_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data);
+int zbl_wattr_req_no_rsp(zigbee_h handle, nwk_addr addr16, unsigned char src_ep,
+               unsigned char dst_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               write_attr_record_h *records, int records_len);
+int zbl_configure_reporting(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, report_config_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data);
+int zbl_read_configure_reporting(zigbee_h handle, nwk_addr addr16, unsigned char src_ep,
+               unsigned char dst_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               read_report_config_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data);
+int zbl_discover_attr_req(zigbee_h handle, unsigned short addr16, unsigned char src_ep,
+               unsigned char dest_ep, unsigned char zcl_frame_ctl, unsigned short cluster_id,
+               unsigned short start_id, unsigned char max_attribute_ids,
+               zb_zcl_global_discover_attr_rsp cb, void *user_data);
+int zbl_discover_cmds_gen(zigbee_h handle, nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned char start_command_id,
+               unsigned char max_command_ids, zb_zcl_global_discover_cmds_rsp cb, void *user_data);
+int zbl_discover_cmds_recv(zigbee_h handle, nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned char start_command_id,
+               unsigned char max_command_ids, zb_zcl_global_discover_cmds_rsp cb, void *user_data);
+int zbl_discover_attr_ext(zigbee_h handle, nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned short start_id,
+               unsigned char max_attribute_ids, zb_zcl_global_discover_attr_extended_rsp cb,
+               void *user_data);
+
+/* ZCL Alarm Cluster */
+int zbl_reset_alarm(nwk_addr addr16, unsigned char ep, unsigned char alarm_code,
+               unsigned short cluster_id);
+int zbl_reset_all_alarm(nwk_addr addr16, unsigned char ep);
+int zbl_get_alarm(nwk_addr addr16, unsigned char ep, zb_zcl_alarm_get_alarm_rsp cb,
+               void *user_data);
+int zbl_reset_all_alarm_log(nwk_addr addr16, unsigned char ep);
+
+/* ZCL Color Control Cluster */
+int zbl_ccontrol_move_to_hue(nwk_addr addr16, unsigned char ep,
+               unsigned char hue, unsigned char direction,
+               unsigned short transition_time);
+int zbl_ccontrol_move_hue(nwk_addr addr16, unsigned char ep,
+               unsigned char move_mode, unsigned char rate);
+int zbl_ccontrol_step_hue(nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size,
+               unsigned char transition_time);
+int zbl_ccontrol_move_to_saturation(nwk_addr addr16, unsigned char ep,
+               unsigned char saturation, unsigned short transition_time);
+int zbl_ccontrol_move_saturation(nwk_addr addr16, unsigned char ep,
+               unsigned char move_mode, unsigned char rate);
+int zbl_ccontrol_step_saturation(nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size,
+               unsigned char transition_time);
+int zbl_ccontrol_move_to_hue_and_saturation(nwk_addr addr16, unsigned char ep,
+               unsigned char hue, unsigned char saturation,
+               unsigned short transition_time);
+int zbl_ccontrol_move_to_color(nwk_addr addr16, unsigned char ep,
+               unsigned short color_x, unsigned short color_y,
+               unsigned short transition_time);
+int zbl_ccontrol_move_color(nwk_addr addr16, unsigned char ep,
+               unsigned short rate_x, unsigned short rate_y);
+int zbl_ccontrol_step_color(nwk_addr addr16, unsigned char ep,
+               unsigned short step_x, unsigned short step_y,
+               unsigned short transition_time);
+int zbl_ccontrol_move_to_color_temperature(nwk_addr addr16, unsigned char ep,
+               unsigned short color_temperature,
+               unsigned short transition_time);
+
+/* ZCL Basic Cluster */
+int zbl_reset_factory_default(nwk_addr addr16, unsigned char ep);
+
+/* ZCL Identity Cluster */
+int zbl_identify(nwk_addr addr16, unsigned char dst_ep, unsigned short identify_time);
+int zbl_identify_query(nwk_addr addr16, unsigned char dst_ep,
+               zb_zcl_identify_query_cb cb, void *user_data);
+
+/* ZCL Group Cluster */
+int zbl_add_group(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+               const char *group_name, zb_zcl_group_add_group_rsp cb, void *user_data);
+int zbl_view_group(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+               zb_zcl_group_view_group_rsp cb, void *user_data);
+int zbl_group_get_group_membership(nwk_addr addr16, unsigned char ep,
+               unsigned char group_count, unsigned short *group_list,
+               zb_zcl_group_get_group_membership_rsp cb, void *user_data);
+int zbl_remove_group(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+               zb_zcl_group_remove_group_rsp cb, void *user_data);
+int zbl_remove_all_group(nwk_addr addr16, unsigned char ep);
+int zbl_add_group_if_identifying(nwk_addr addr16, unsigned char ep,
+               unsigned short group_id, const char *group_name);
+
+/* ZCL Level Control Cluster */
+int zbl_level_control_move_to_level(nwk_addr addr16, unsigned char ep,
+               unsigned char level, unsigned short transition_time);
+int zbl_level_control_move(nwk_addr addr16, unsigned char ep,
+               unsigned char move_mode, unsigned char rate);
+int zbl_level_control_step(nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size,
+               unsigned short transition_time);
+int zbl_level_control_stop(nwk_addr addr16, unsigned char ep);
+int zbl_level_control_move_to_level_with_on_off(nwk_addr addr16,
+               unsigned char ep, unsigned char level, unsigned short transition_time);
+int zbl_level_control_move_with_on_off(nwk_addr addr16, unsigned char ep,
+               unsigned char move_mode, unsigned char rate);
+int zbl_level_control_step_with_on_off(nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size,
+               unsigned short transition_time);
+
+/* ZCL On/Off Cluster */
+int zbl_onoff_set(nwk_addr addr16, unsigned char ep, unsigned char on_off_type);
+int zbl_zone_enroll_response(nwk_addr addr16, unsigned char dst_ep,
+               unsigned char enroll_response_code, unsigned char zone_id);
+
+/* Poll-control Cluster */
+int zbl_pollcontrol_check_in_response(nwk_addr addr16, unsigned char ep,
+               unsigned char start_fast_polling, unsigned short fast_poll_timeout);
+int zbl_pollcontrol_fast_poll_stop(nwk_addr addr16, unsigned char ep);
+int zbl_pollcontrol_set_long_poll_interval(nwk_addr addr16, unsigned char ep,
+       unsigned int new_long_poll_interval, zb_zcl_pollctrl_check_in cb, void *user_data);
+int zbl_pollcontrol_set_short_poll_interval(nwk_addr addr16, unsigned char ep,
+       unsigned int new_short_poll_interval, zb_zcl_pollctrl_check_in cb, void *user_data);
+
+/* Scene Cluster */
+int zbl_add_scene(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+       unsigned char scene_id, unsigned short transition_time, const char *scene_name,
+       unsigned short ext_field_len, const char *extension_field_sets,
+       zb_zcl_scene_add_scene_rsp cb, void *user_data);
+int zbl_view_scene(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+       unsigned char scene_id, zb_zcl_scene_view_scene_rsp cb, void *user_data);
+int zbl_remove_scene(nwk_addr addr16, unsigned char ep,
+       unsigned short group_id, unsigned char scene_id, zb_zcl_scene_remove_scene_rsp cb,
+       void *user_data);
+int zbl_remove_all_scene(nwk_addr addr16, unsigned char ep,
+       unsigned short group_id, zb_zcl_scene_remove_all_scene_rsp cb, void *user_data);
+int zbl_store_scene(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+       unsigned char scene_id, zb_zcl_scene_store_scene_rsp cb, void *user_data);
+int zbl_recall_scene(nwk_addr addr16, unsigned char ep, unsigned short group_id,
+       unsigned char scene_id);
+int zbl_get_scene_membership(nwk_addr addr16, unsigned char ep,
+       unsigned short group_id, zb_zcl_scene_get_scene_membership_rsp cb, void *user_data);
+
+/* Thermostat Cluster */
+int zbl_thermostat_adjust_setpoint(nwk_addr addr16, unsigned char ep, unsigned char mode,
+       unsigned char amount);
+
+#endif /* __TIZEN_NETWORK_ZIGBEE_LIBRARY_DBUS_H__ */
diff --git a/lib/zbl-zcl-alarm.c b/lib/zbl-zcl-alarm.c
new file mode 100644 (file)
index 0000000..0356f3a
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-alarm-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_alarm_reset_alarm(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               unsigned char alarm_code, unsigned short cluster_id)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_reset_alarm(addr16, ep, alarm_code, cluster_id);
+       return ret;
+}
+
+API int zb_zcl_alarm_reset_all_alarm(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_reset_all_alarm(addr16, ep);
+       return ret;
+}
+
+API int zb_zcl_alarm_get_alarm(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               zb_zcl_alarm_get_alarm_rsp cb, void *user_data)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_get_alarm(addr16, ep, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_alarm_reset_all_alarm_log(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_reset_all_alarm_log(addr16, ep);
+       return ret;
+}
diff --git a/lib/zbl-zcl-basic.c b/lib/zbl-zcl-basic.c
new file mode 100644 (file)
index 0000000..8778a93
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_basic_reset_factory_default(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_reset_factory_default(addr16, ep);
+       return ret;
+}
diff --git a/lib/zbl-zcl-color-control.c b/lib/zbl-zcl-color-control.c
new file mode 100644 (file)
index 0000000..d73cc6b
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-color-control-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_ccontrol_move_to_hue(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char hue, unsigned char direction,
+               unsigned short transition_time)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_move_to_hue(addr16, ep, hue, direction, transition_time);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_move_hue(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char move_mode, unsigned char rate)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_move_hue(addr16, ep, move_mode, rate);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_step_hue(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char step_mode, unsigned char step_size,
+               unsigned char transition_time)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_step_hue(addr16, ep, step_mode, step_size, transition_time);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_move_to_saturation(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned char saturation,
+               unsigned short transition_time)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_move_to_saturation(addr16, ep, saturation, transition_time);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_move_saturation(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char move_mode, unsigned char rate)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_move_saturation(addr16, ep, move_mode, rate);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_step_saturation(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char step_mode, unsigned char step_size,
+               unsigned char transition_time)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_step_saturation(addr16, ep, step_mode, step_size, transition_time);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_move_to_hue_and_saturation(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned char hue, unsigned char saturation,
+               unsigned short transition_time)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_move_to_hue_and_saturation(addr16, ep, hue, saturation, transition_time);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_move_to_color(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short color_x, unsigned short color_y,
+               unsigned short transition_time)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_move_to_color(addr16, ep, color_x, color_y, transition_time);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_move_color(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short rate_x, unsigned short rate_y)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_move_color(addr16, ep, rate_x, rate_y);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_step_color(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short step_x, unsigned short step_y,
+               unsigned short transition_time)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_step_color(addr16, ep, step_x, step_y, transition_time);
+       return ret;
+}
+
+API int zb_zcl_ccontrol_move_to_color_temperature(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned short color_temperature,
+               unsigned short transition_time)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_ccontrol_move_to_color_temperature(addr16, ep, color_temperature, transition_time);
+       return ret;
+}
+
diff --git a/lib/zbl-zcl-door-lock.c b/lib/zbl-zcl-door-lock.c
new file mode 100644 (file)
index 0000000..81578b4
--- /dev/null
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-door-lock-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+
+API int zb_zcl_doorlock_lock(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               const char *pin_or_rfid_code, zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == pin_or_rfid_code, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_unlock(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               const char *pin_or_rfid_code, zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == pin_or_rfid_code, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_toggle(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               const char *pin_or_rfid_code, zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == pin_or_rfid_code, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_unlock_with_timeout(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short timeout, const char *pin_or_rfid_code,
+               zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == pin_or_rfid_code, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_get_log_record(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short log_index,
+               zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_set_pin_code(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id, unsigned char user_status,
+               unsigned char user_type, const char *pin, zb_zcl_doorlock_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == pin, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_get_pin_code(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id, zb_zcl_doorlock_get_pin_code_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_clear_pin_code(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id, zb_zcl_doorlock_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_clear_all_pin_code(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_set_user_status(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id, unsigned char user_status,
+               zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_set_week_day_schedule(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char schedule_id, unsigned short user_id,
+               unsigned char days_mask, unsigned char start_hour, unsigned char start_minute,
+               unsigned char end_hour, unsigned char end_minute, zb_zcl_doorlock_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_get_week_day_schedule(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned char schedule_id,
+               unsigned short user_id, zb_zcl_doorlock_get_week_day_schedule_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_set_year_day_schedule(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned char schedule_id,
+               unsigned short user_id, unsigned int zigbee_local_start_time,
+               unsigned int zigbee_local_end_time, zb_zcl_doorlock_rsp cb,     void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_get_year_day_schedule(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned char schedule_id,
+               unsigned short user_id, zb_zcl_doorlock_get_year_day_schedule_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_set_holiday_schedule(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char holiday_schedule_id,
+               unsigned int zigbee_local_start_time, unsigned int zigbee_local_end_time,
+               unsigned char operating_mode_during_holiday, zb_zcl_doorlock_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_get_holiday_schedule(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char holiday_schedule_id,
+               zb_zcl_doorlock_get_holiday_schedule_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_clear_holiday_schedule(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned char holiday_schedule_id,
+               zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_set_user_type(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id, unsigned char user_type,
+               zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_get_user_type(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id, zb_zcl_doorlock_get_user_type_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_set_rfid_code(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id, unsigned char user_status,
+               unsigned char user_type, const char *rfid_code,
+               zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == rfid_code, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_get_rfid_code(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id, zb_zcl_doorlock_get_rfid_code_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_clear_rfid_code(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short user_id,
+               zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_doorlock_clear_all_rfid_code(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, zb_zcl_doorlock_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+#endif /* ZB_SUPPORT_PRIORITY_5 */
diff --git a/lib/zbl-zcl-global-commands.c b/lib/zbl-zcl-global-commands.c
new file mode 100644 (file)
index 0000000..0ea25e2
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-global-commands.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+#include "zb-utils.h"
+
+API int zb_zcl_global_read_attr(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, unsigned short *attribute_ids, int attribute_ids_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == attribute_ids, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == attribute_ids_len, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_read_attr_req(handle, addr16, dst_ep, zcl_frame_ctl, cluster_id, attribute_ids,
+                       attribute_ids_len, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_global_write_attr(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, write_attr_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == records, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == records_len, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_write_attr_req(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, records, records_len, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_global_write_attr_undivided(zigbee_h handle,
+               nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, write_attr_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == records, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == records_len, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_wattr_undivided_req(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, records, records_len, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_global_write_attr_no_rsp(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, write_attr_record_h *records, int records_len)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == records, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == records_len, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_wattr_req_no_rsp(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, records, records_len);
+       return ret;
+}
+
+API int zb_zcl_global_config_report(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, report_config_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == records, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == records_len, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_configure_reporting(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, records, records_len, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_global_read_config_report(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, read_report_config_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == records, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == records_len, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_read_configure_reporting(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, records, records_len, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_global_discover_attr(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, unsigned short start_id, unsigned char max_attribute_ids,
+               zb_zcl_global_discover_attr_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_discover_attr_req(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, start_id, max_attribute_ids, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_global_read_attr_structured(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, read_structured_attr_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+#if (0 == ZIGBEE_SUPPORT_ORDERED_SEQUENCE_DATA)
+       return ZIGBEE_ERROR_NOT_SUPPORTED;
+#endif
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == records, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == records_len, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_global_write_attr_structured(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned char dst_ep, unsigned char zcl_frame_ctl,
+               unsigned short cluster_id, write_attr_structured_record_h *records, int records_len,
+               zb_zcl_global_rsp cb, void *user_data)
+{
+#if (0 == ZIGBEE_SUPPORT_ORDERED_SEQUENCE_DATA)
+       return ZIGBEE_ERROR_NOT_SUPPORTED;
+#endif
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == records, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == records_len, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_global_discover_cmds_received(zigbee_h handle,
+               nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned char start_command_id,
+               unsigned char max_command_ids, zb_zcl_global_discover_cmds_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_discover_cmds_recv(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, start_command_id, max_command_ids, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_global_discover_cmds_generated(zigbee_h handle,
+               nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned char start_command_id,
+               unsigned char max_command_ids, zb_zcl_global_discover_cmds_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_discover_cmds_gen(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, start_command_id, max_command_ids, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_global_discover_attr_extended(zigbee_h handle,
+               nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned char zcl_frame_ctl, unsigned short cluster_id, unsigned short start_id,
+               unsigned char max_attribute_ids, zb_zcl_global_discover_attr_extended_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_discover_attr_ext(handle, addr16, src_ep, dst_ep, zcl_frame_ctl,
+                       cluster_id, start_id, max_attribute_ids, cb, user_data);
+       return ret;
+}
diff --git a/lib/zbl-zcl-groups.c b/lib/zbl-zcl-groups.c
new file mode 100644 (file)
index 0000000..e761be2
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-groups-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_group_add_group(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short group_id, const char *group_name,
+               zb_zcl_group_add_group_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == group_name, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_add_group(addr16, ep, group_id, group_name, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_group_view_group(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short group_id, zb_zcl_group_view_group_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_view_group(addr16, ep, group_id, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_group_get_group_membership(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char group_count, unsigned short *group_list,
+               zb_zcl_group_get_group_membership_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == group_list, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_group_get_group_membership(addr16, ep, group_count, group_list, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_group_remove_group(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short group_id, zb_zcl_group_remove_group_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_remove_group(addr16, ep, group_id, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_group_remove_all_group(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_remove_all_group(addr16, ep);
+       return ret;
+}
+
+API int zb_zcl_group_add_group_if_identifying(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short group_id, const char *group_name)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_add_group_if_identifying(addr16, ep, group_id, group_name);
+       return ret;
+}
diff --git a/lib/zbl-zcl-identify.c b/lib/zbl-zcl-identify.c
new file mode 100644 (file)
index 0000000..0657805
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-identify-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_identify(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               unsigned short identify_time)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_identify(addr16, ep, identify_time);
+       return ret;
+}
+
+API int zb_zcl_identify_query(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               zb_zcl_identify_query_cb cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_identify_query(addr16, ep, cb, user_data);
+       return ret;
+}
diff --git a/lib/zbl-zcl-isa-zone.c b/lib/zbl-zcl-isa-zone.c
new file mode 100644 (file)
index 0000000..2c7a14d
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-ias-zone-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_zone_enroll_response(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char enroll_response_code, unsigned char zone_id)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_zone_enroll_response(addr16, ep, enroll_response_code, zone_id);
+       return ret;
+}
diff --git a/lib/zbl-zcl-level-control.c b/lib/zbl-zcl-level-control.c
new file mode 100644 (file)
index 0000000..0fe98c1
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_levelctrl_move_to_level(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char level, unsigned short transition_time)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_level_control_move_to_level(addr16, ep, level, transition_time);
+       return ret;
+}
+
+API int zb_zcl_levelctrl_move(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char move_mode, unsigned char rate)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_level_control_move(addr16, ep, move_mode, rate);
+       return ret;
+}
+
+API int zb_zcl_levelctrl_step(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               unsigned char step_mode, unsigned char step_size, unsigned short transition_time)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_level_control_step(addr16, ep, step_mode, step_size, transition_time);
+       return ret;
+}
+
+API int zb_zcl_levelctrl_stop(zigbee_h handle, nwk_addr addr16, unsigned char ep)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_level_control_stop(addr16, ep);
+       return ret;
+}
+
+API int zb_zcl_levelctrl_move_to_level_with_on_off(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char level, unsigned short transition_time)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_level_control_move_to_level_with_on_off(addr16, ep, level, transition_time);
+       return ret;
+}
+
+API int zb_zcl_levelctrl_move_with_on_off(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char move_mode, unsigned char rate)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_level_control_move_with_on_off(addr16, ep, move_mode, rate);
+       return ret;
+}
+
+API int zb_zcl_levelctrl_step_with_on_off(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char step_mode, unsigned char step_size,
+               unsigned short transition_time)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_level_control_step_with_on_off(addr16, ep, step_mode, step_size, transition_time);
+       return ret;
+}
+
diff --git a/lib/zbl-zcl-on-off.c b/lib/zbl-zcl-on-off.c
new file mode 100644 (file)
index 0000000..86d1008
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_onoff_control(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               zb_zcl_onoff_e on_off_type)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_onoff_set(addr16, ep, on_off_type);
+       return ret;
+}
diff --git a/lib/zbl-zcl-poll-control.c b/lib/zbl-zcl-poll-control.c
new file mode 100644 (file)
index 0000000..fa3a836
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-poll-control-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_pollctrl_check_in_response(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char start_fast_polling,
+               unsigned short fast_poll_timeout)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_pollcontrol_check_in_response(addr16, ep, start_fast_polling,
+               fast_poll_timeout);
+       return ret;
+}
+
+API int zb_zcl_pollctrl_fast_poll_stop(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_pollcontrol_fast_poll_stop(addr16, ep);
+       return ret;
+}
+
+API int zb_zcl_pollctrl_set_long_poll_interval(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned int new_long_poll_interval,
+               zb_zcl_pollctrl_check_in cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_pollcontrol_set_long_poll_interval(addr16, ep, new_long_poll_interval,
+               cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_pollctrl_set_short_poll_interval(zigbee_h handle,
+               nwk_addr addr16, unsigned char ep, unsigned int new_short_poll_interval,
+               zb_zcl_pollctrl_check_in cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_pollcontrol_set_short_poll_interval(addr16, ep, new_short_poll_interval,
+               cb, user_data);
+       return ret;
+}
diff --git a/lib/zbl-zcl-scenes.c b/lib/zbl-zcl-scenes.c
new file mode 100644 (file)
index 0000000..7c48742
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-scenes-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_scene_add_scene(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               unsigned short group_id, unsigned char scene_id, unsigned short transition_time,
+               const char *scene_name, unsigned short ext_field_len,
+               const char *extension_field_sets, zb_zcl_scene_add_scene_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == scene_name, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == extension_field_sets, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_add_scene(addr16, ep, group_id, scene_id, transition_time, scene_name,
+               ext_field_len, extension_field_sets, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_scene_view_scene(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               unsigned short group_id, unsigned char scene_id, zb_zcl_scene_view_scene_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_view_scene(addr16, ep, group_id, scene_id, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_scene_remove_scene(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short group_id, unsigned char scene_id,
+               zb_zcl_scene_remove_scene_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_remove_scene(addr16, ep, group_id, scene_id, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_scene_remove_all_scene(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short group_id, zb_zcl_scene_remove_all_scene_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_remove_all_scene(addr16, ep, group_id, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_scene_store_scene(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               unsigned short group_id, unsigned char scene_id, zb_zcl_scene_store_scene_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_store_scene(addr16, ep, group_id, scene_id, cb, user_data);
+       return ret;
+}
+
+API int zb_zcl_scene_recall_scene(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short group_id, unsigned char scene_id)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_recall_scene(addr16, ep, group_id, scene_id);
+       return ret;
+}
+
+API int zb_zcl_scene_get_scene_membership(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned short group_id,
+               zb_zcl_scene_get_scene_membership_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_get_scene_membership(addr16, ep, group_id, cb, user_data);
+       return ret;
+}
+
diff --git a/lib/zbl-zcl-simple-metering.c b/lib/zbl-zcl-simple-metering.c
new file mode 100644 (file)
index 0000000..b5adaa1
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-simple-metering-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_smetering_get_profile(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char interval_channel, unsigned char end_time,
+               unsigned char number_of_periods, zb_zcl_smetering_get_profile_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_smetering_request_mirror_rsp(zigbee_h handle,
+               nwk_addr addr16, unsigned char src_ep, unsigned short endpoint_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == src_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zcl_smetering_mirror_removed(zigbee_h handle, nwk_addr addr16,
+               unsigned char src_ep, unsigned short removed_endpoint_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == src_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       return ZIGBEE_ERROR_NONE;
+}
diff --git a/lib/zbl-zcl-thermostat.c b/lib/zbl-zcl-thermostat.c
new file mode 100644 (file)
index 0000000..7b9c8ce
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-thermostat-cluster.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zcl_thermostat_adjust_setpoint(zigbee_h handle, nwk_addr addr16,
+               unsigned char ep, unsigned char mode, unsigned char amount)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(0x02 < mode, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+
+       ret = zbl_thermostat_adjust_setpoint(addr16, ep, mode, amount);
+       return ret;
+}
+
diff --git a/lib/zbl-zcl.c b/lib/zbl-zcl.c
new file mode 100644 (file)
index 0000000..eaf219c
--- /dev/null
@@ -0,0 +1,1446 @@
+#include <glib.h>
+#include <error.h>
+#include <stdlib.h>
+
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zcl/zb-zcl-type.h>
+#include <zcl/zb-zcl-attribute-type.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zb-common.h"
+#include "zcl/zb-zcl-type.h"
+
+API const char* zb_get_cluster_name(int id)
+{
+       const char* clust_name = NULL;
+
+       switch (id) {
+       case ZB_ZCL_BASIC_CLUSTER_ID:
+               clust_name = "ZB_ZCL_BASIC_CLUSTER_ID : 0x0000";
+               break;
+       case ZB_ZCL_POWER_CONFIG_CLUSTER_ID:
+               clust_name = "ZB_ZCL_POWER_CONFIG_CLUSTER_ID : 0x0001";
+               break;
+       case ZB_ZCL_DEVICE_TEMP_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DEVICE_TEMP_CLUSTER_ID : 0x0002";
+               break;
+       case ZB_ZCL_IDENTIFY_CLUSTER_ID:
+               clust_name = "ZB_ZCL_IDENTIFY_CLUSTER_ID : 0x0003";
+               break;
+       case ZB_ZCL_GROUPS_CLUSTER_ID:
+               clust_name = "ZB_ZCL_GROUPS_CLUSTER_ID : 0x0004";
+               break;
+       case ZB_ZCL_SCENES_CLUSTER_ID:
+               clust_name = "ZB_ZCL_SCENES_CLUSTER_ID : 0x0005";
+               break;
+       case ZB_ZCL_ON_OFF_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ON_OFF_CLUSTER_ID : 0x0006";
+               break;
+       case ZB_ZCL_ON_OFF_SWITCH_CONFIG_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ON_OFF_SWITCH_CONFIG_CLUSTER_ID : 0x0007";
+               break;
+       case ZB_ZCL_LEVEL_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_LEVEL_CONTROL_CLUSTER_ID : 0x0008";
+               break;
+       case ZB_ZCL_ALARM_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ALARM_CLUSTER_ID : 0x0009";
+               break;
+       case ZB_ZCL_TIME_CLUSTER_ID:
+               clust_name = "ZB_ZCL_TIME_CLUSTER_ID : 0x000A";
+               break;
+       case ZB_ZCL_RSSI_LOCATION_CLUSTER_ID:
+               clust_name = "ZB_ZCL_RSSI_LOCATION_CLUSTER_ID : 0x000B";
+               break;
+       case ZB_ZCL_BINARY_INPUT_BASIC_CLUSTER_ID:
+               clust_name = "ZB_ZCL_BINARY_INPUT_BASIC_CLUSTER_ID : 0x000F";
+               break;
+       case ZB_ZCL_COMMISSIONING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_COMMISSIONING_CLUSTER_ID : 0x0015";
+               break;
+       case ZB_ZCL_PARTITION_CLUSTER_ID:
+               clust_name = "ZB_ZCL_PARTITION_CLUSTER_ID : 0x0016";
+               break;
+       case ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID:
+               clust_name = "ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID : 0x0019";
+               break;
+       case ZB_ZCL_POWER_PROFILE_CLUSTER_ID:
+               clust_name = "ZB_ZCL_POWER_PROFILE_CLUSTER_ID : 0x001A";
+               break;
+       case ZB_ZCL_APPLIANCE_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_APPLIANCE_CONTROL_CLUSTER_ID : 0x001B";
+               break;
+       case ZB_ZCL_POLL_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_POLL_CONTROL_CLUSTER_ID : 0x0020";
+               break;
+       case ZB_ZCL_SHADE_CONFIG_CLUSTER_ID:
+               clust_name = "ZB_ZCL_SHADE_CONFIG_CLUSTER_ID : 0x0100";
+               break;
+       case ZB_ZCL_DOOR_LOCK_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DOOR_LOCK_CLUSTER_ID : 0x0101";
+               break;
+       case ZB_ZCL_WINDOW_COVERING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_WINDOW_COVERING_CLUSTER_ID : 0x0102";
+               break;
+       case ZB_ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID : 0x0200";
+               break;
+       case ZB_ZCL_THERMOSTAT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_THERMOSTAT_CLUSTER_ID : 0x0201";
+               break;
+       case ZB_ZCL_FAN_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_FAN_CONTROL_CLUSTER_ID : 0x0202";
+               break;
+       case ZB_ZCL_DEHUMID_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DEHUMID_CONTROL_CLUSTER_ID : 0x0203";
+               break;
+       case ZB_ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_ID:
+               clust_name = "ZB_ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_ID : 0x0204";
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_COLOR_CONTROL_CLUSTER_ID : 0x0300";
+               break;
+       case ZB_ZCL_BALLAST_CONFIGURATION_CLUSTER_ID:
+               clust_name = "ZB_ZCL_BALLAST_CONFIGURATION_CLUSTER_ID : 0x0301";
+               break;
+       case ZB_ZCL_ILLUM_MEASUREMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ILLUM_MEASUREMENT_CLUSTER_ID : 0x0400";
+               break;
+       case ZB_ZCL_ILLUM_LEVEL_SENSING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ILLUM_LEVEL_SENSING_CLUSTER_ID : 0x0401";
+               break;
+       case ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID : 0x0402";
+               break;
+       case ZB_ZCL_PRESSURE_MEASUREMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_PRESSURE_MEASUREMENT_CLUSTER_ID : 0x0403";
+               break;
+       case ZB_ZCL_FLOW_MEASUREMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_FLOW_MEASUREMENT_CLUSTER_ID : 0x0404";
+               break;
+       case ZB_ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID : 0x0405";
+               break;
+       case ZB_ZCL_OCCUPANCY_SENSING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_OCCUPANCY_SENSING_CLUSTER_ID : 0x0406";
+               break;
+       case ZB_ZCL_IAS_ZONE_CLUSTER_ID:
+               clust_name = "ZB_ZCL_IAS_ZONE_CLUSTER_ID : 0x0500";
+               break;
+       case ZB_ZCL_IAS_ACE_CLUSTER_ID:
+               clust_name = "ZB_ZCL_IAS_ACE_CLUSTER_ID : 0x0501";
+               break;
+       case ZB_ZCL_IAS_WD_CLUSTER_ID:
+               clust_name = "ZB_ZCL_IAS_WD_CLUSTER_ID : 0x0502";
+               break;
+       case ZB_ZCL_GENERIC_TUNNEL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_GENERIC_TUNNEL_CLUSTER_ID : 0x0600";
+               break;
+       case ZB_ZCL_BACNET_PROTOCOL_TUNNEL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_BACNET_PROTOCOL_TUNNEL_CLUSTER_ID : 0x0601";
+               break;
+       case ZB_ZCL_11073_PROTOCOL_TUNNEL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_11073_PROTOCOL_TUNNEL_CLUSTER_ID : 0x0614";
+               break;
+       case ZB_ZCL_ISO7816_PROTOCOL_TUNNEL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ISO7816_PROTOCOL_TUNNEL_CLUSTER_ID : 0x0615";
+               break;
+       case ZB_ZCL_PRICE_CLUSTER_ID:
+               clust_name = "ZB_ZCL_PRICE_CLUSTER_ID : 0x0700";
+               break;
+       case ZB_ZCL_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_ID : 0x0701";
+               break;
+       case ZB_ZCL_SIMPLE_METERING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_SIMPLE_METERING_CLUSTER_ID : 0x0702";
+               break;
+       case ZB_ZCL_MESSAGING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_MESSAGING_CLUSTER_ID : 0x0703";
+               break;
+       case ZB_ZCL_TUNNELING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_TUNNELING_CLUSTER_ID : 0x0704";
+               break;
+       case ZB_ZCL_PREPAYMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_PREPAYMENT_CLUSTER_ID : 0x0705";
+               break;
+       case ZB_ZCL_ENERGY_MANAGEMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ENERGY_MANAGEMENT_CLUSTER_ID : 0x0706";
+               break;
+       case ZB_ZCL_TOU_CALENDAR_CLUSTER_ID:
+               clust_name = "ZB_ZCL_TOU_CALENDAR_CLUSTER_ID : 0x0707";
+               break;
+       case ZB_ZCL_DEVICE_MANAGEMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DEVICE_MANAGEMENT_CLUSTER_ID : 0x0708";
+               break;
+       case ZB_ZCL_EVENTS_CLUSTER_ID:
+               clust_name = "ZB_ZCL_EVENTS_CLUSTER_ID : 0x0709";
+               break;
+       case ZB_ZCL_MDU_PAIRING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_MDU_PAIRING_CLUSTER_ID : 0x070A";
+               break;
+       case ZB_ZCL_KEY_ESTABLISHMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_KEY_ESTABLISHMENT_CLUSTER_ID : 0x0800";
+               break;
+       case ZB_ZCL_INFORMATION_CLUSTER_ID:
+               clust_name = "ZB_ZCL_INFORMATION_CLUSTER_ID : 0x0900";
+               break;
+       case ZB_ZCL_DATA_SHARING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DATA_SHARING_CLUSTER_ID : 0x0901";
+               break;
+       case ZB_ZCL_GAMING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_GAMING_CLUSTER_ID : 0x0902";
+               break;
+       case ZB_ZCL_DATA_RATE_CONTROL_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DATA_RATE_CONTROL_CLUSTER_ID : 0x0903";
+               break;
+       case ZB_ZCL_VOICE_OVER_ZIGBEE_CLUSTER_ID:
+               clust_name = "ZB_ZCL_VOICE_OVER_ZIGBEE_CLUSTER_ID : 0x0904";
+               break;
+       case ZB_ZCL_CHATTING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_CHATTING_CLUSTER_ID : 0x0905";
+               break;
+       case ZB_ZCL_PAYMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_PAYMENT_CLUSTER_ID : 0x0A01";
+               break;
+       case ZB_ZCL_BILLING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_BILLING_CLUSTER_ID : 0x0A02";
+               break;
+       case ZB_ZCL_APPLIANCE_IDENTIFICATION_CLUSTER_ID:
+               clust_name = "ZB_ZCL_APPLIANCE_IDENTIFICATION_CLUSTER_ID : 0x0B00";
+               break;
+       case ZB_ZCL_METER_IDENTIFICATION_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DATA_RATE_CONTROL_CLUSTER_ID : 0x0B01";
+               break;
+       case ZB_ZCL_APPLIANCE_EVENTS_AND_ALERT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_APPLIANCE_EVENTS_AND_ALERT_CLUSTER_ID : 0x0B02";
+               break;
+       case ZB_ZCL_APPLIANCE_STATISTICS_CLUSTER_ID:
+               clust_name = "ZB_ZCL_APPLIANCE_STATISTICS_CLUSTER_ID : 0x0905";
+               break;
+       case ZB_ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID : 0x0B04";
+               break;
+       case ZB_ZCL_DIAGNOSTICS_CLUSTER_ID:
+               clust_name = "ZB_ZCL_DIAGNOSTICS_CLUSTER_ID : 0x0B05";
+               break;
+       case ZB_ZCL_ZLL_COMMISSIONING_CLUSTER_ID:
+               clust_name = "ZB_ZCL_ZLL_COMMISSIONING_CLUSTER_ID : 0x1000";
+               break;
+       default:
+               clust_name = "UNDEFINED_CLUSTER";
+               break;
+       }
+
+       return clust_name;
+}
+
+typedef struct _attr_type_size {
+       unsigned char type;
+       unsigned char size;
+} AttrTypeSize;
+
+static AttrTypeSize attribute_sizes[] = {
+       {ZB_ZCL_NO_DATA_ATTRIBUTE_TYPE, 0},
+       {ZB_ZCL_8_BIT_DATA, 1},
+       {ZB_ZCL_16_BIT_DATA, 2},
+       {ZB_ZCL_24_BIT_DATA, 3},
+       {ZB_ZCL_32_BIT_DATA, 4},
+       {ZB_ZCL_40_BIT_DATA, 5},
+       {ZB_ZCL_48_BIT_DATA, 6},
+       {ZB_ZCL_56_BIT_DATA, 7},
+       {ZB_ZCL_64_BIT_DATA, 8},
+       {ZB_ZCL_BOOLEAN, 1},
+       {ZB_ZCL_8_BIT_BITMAP, 1},
+       {ZB_ZCL_16_BIT_BITMAP, 2},
+       {ZB_ZCL_24_BIT_BITMAP, 3},
+       {ZB_ZCL_32_BIT_BITMAP, 4},
+       {ZB_ZCL_40_BIT_BITMAP, 5},
+       {ZB_ZCL_48_BIT_BITMAP, 6},
+       {ZB_ZCL_56_BIT_BITMAP, 7},
+       {ZB_ZCL_64_BIT_BITMAP, 8},
+       {ZB_ZCL_UNSIGNED_8_BIT_INTEGER, 1},
+       {ZB_ZCL_UNSIGNED_16_BIT_INTEGER, 2},
+       {ZB_ZCL_UNSIGNED_24_BIT_INTEGER, 3},
+       {ZB_ZCL_UNSIGNED_32_BIT_INTEGER, 4},
+       {ZB_ZCL_UNSIGNED_40_BIT_INTEGER, 5},
+       {ZB_ZCL_UNSIGNED_48_BIT_INTEGER, 6},
+       {ZB_ZCL_UNSIGNED_56_BIT_INTEGER, 7},
+       {ZB_ZCL_UNSIGNED_64_BIT_INTEGER, 8},
+       {ZB_ZCL_SIGNED_8_BIT_INTEGER, 1},
+       {ZB_ZCL_SIGNED_16_BIT_INTEGER, 2},
+       {ZB_ZCL_SIGNED_24_BIT_INTEGER, 3},
+       {ZB_ZCL_SIGNED_32_BIT_INTEGER, 4},
+       {ZB_ZCL_SIGNED_40_BIT_INTEGER, 5},
+       {ZB_ZCL_SIGNED_48_BIT_INTEGER, 6},
+       {ZB_ZCL_SIGNED_56_BIT_INTEGER, 7},
+       {ZB_ZCL_SIGNED_64_BIT_INTEGER, 8},
+       {ZB_ZCL_8_BIT_ENUMERATION, 1},
+       {ZB_ZCL_16_BIT_ENUMERATION, 2},
+       {ZB_ZCL_SEMI_PRECISION, 2},
+       {ZB_ZCL_SINGLE_PRECISION, 4},
+       {ZB_ZCL_DOUBLE_PRECISION, 8},
+       {ZB_ZCL_TIME_OF_DAY, 4},
+       {ZB_ZCL_DATE, 4},
+       {ZB_ZCL_UTC_TIME, 4},
+       {ZB_ZCL_CLUSTER_ID, 2},
+       {ZB_ZCL_ATTRIBUTE_ID, 2},
+       {ZB_ZCL_BACNET_OID, 4},
+       {ZB_ZCL_IEEE_ADDRESS, 8},
+       {ZB_ZCL_128_BIT_SECURITY_KEY, 16},
+};
+
+static unsigned char analog_discrete_thresholds[] = {
+       0x07, DATA_TYPE_NONE,
+       0x1F, DATA_TYPE_DISCRETE,
+       0x2F, DATA_TYPE_ANALOG,
+       0x37, DATA_TYPE_DISCRETE,
+       0x3F, DATA_TYPE_ANALOG,
+       0x57, DATA_TYPE_DISCRETE,
+       0xDF, DATA_TYPE_NONE,
+       0xE7, DATA_TYPE_ANALOG,
+       0xFF, DATA_TYPE_NONE
+};
+
+API int zb_get_analog_or_discret(unsigned char type)
+{
+       int index = 0;
+
+       while (analog_discrete_thresholds[index] < type)
+               index += 2;
+
+       return analog_discrete_thresholds[index+1];
+}
+
+API int zb_get_data_size(unsigned char type)
+{
+       int i;
+       int count = (int)(sizeof(attribute_sizes) / 2);
+       for (i = 0; i < count; i++) {
+               if (attribute_sizes[i].type == type)
+                       return attribute_sizes[i].size;
+       }
+       return -1;
+}
+
+API int zb_create_read_attr_status_record(read_attr_status_record_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       read_attr_status_record_h simple = calloc(1, sizeof(struct read_attribute_status_record_s));
+       RETVM_IF(NULL == simple, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = simple;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_read_attr_status_record(read_attr_status_record_h handle)
+{
+       RET_IF(NULL == handle);
+       if (handle->value)
+               free(handle->value);
+       free(handle);
+}
+
+API int zb_get_id_from_read_attr_status_record(read_attr_status_record_h handle,
+               unsigned short* id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *id = handle->id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_id_to_read_attr_status_record(read_attr_status_record_h handle,
+               unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_status_from_read_attr_status_record(read_attr_status_record_h handle,
+               unsigned char* status)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == status, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *status = handle->status;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_status_to_read_attr_status_record(read_attr_status_record_h handle,
+               unsigned char status)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->status = status;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_type_from_read_attr_status_record(read_attr_status_record_h handle,
+               unsigned char *type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == type, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *type = handle->type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_type_to_read_attr_status_record(read_attr_status_record_h handle,
+               unsigned char type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->type = type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_value_from_read_attr_status_record(read_attr_status_record_h handle,
+               unsigned char type, zb_value_h value)
+{
+       int len = -1;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->value, ZIGBEE_ERROR_NO_DATA);
+
+       len = zb_get_data_size(type);
+       if (0 < len) {
+               memcpy(value->val, handle->value, len);
+               value->size = len;
+               value->type = type;
+       } else if (ZB_ZCL_OCTAT_STRING == type || ZB_ZCL_CHRACTER_STRING == type) {
+               if (value->str) {
+                       if (value->str->v)
+                               free(value->str->v);
+                       free(value->str);
+               }
+               value->str = calloc(1, sizeof(struct attribute_str_s));
+               RETV_IF(NULL == value->str, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               value->str->n = *handle->value;
+               /* The first 1 byte indicate invalid or length of string */
+               if (0xff == value->str->n) {
+                       free(value->str);
+                       return ZIGBEE_ERROR_NO_DATA;
+               }
+               value->str->v = calloc(value->str->n+1, 1);
+               if (NULL == value->str->v) {
+                       free(value->str);
+                       return ZIGBEE_ERROR_OUT_OF_MEMORY;
+               }
+               memcpy(value->str->v, handle->value+sizeof(value->str->n), value->str->n);
+
+               value->type = type;
+               value->size = value->str->n;
+       } else if (ZB_ZCL_LONG_OCTAT_STRING == type || ZB_ZCL_LONG_CHRACTER_STRING == type) {
+               if (value->wstr) {
+                       if (value->wstr->v)
+                               free(value->wstr->v);
+                       free(value->wstr);
+               }
+               value->wstr = calloc(1, sizeof(struct attribute_wstr_s));
+               RETV_IF(NULL == value->wstr, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               value->wstr->n = *(handle->value+1) << 8 | *handle->value;
+               /* The first 2 byte indicate invalid or length of string */
+               if (0xffff == value->wstr->n) {
+                       free(value->wstr);
+                       return ZIGBEE_ERROR_NO_DATA;
+               }
+               value->wstr->v = calloc(value->wstr->n+1, 1);
+               if (NULL == value->wstr->v) {
+                       free(value->wstr);
+                       return ZIGBEE_ERROR_OUT_OF_MEMORY;
+               }
+               memcpy(value->wstr->v, handle->value+sizeof(value->wstr->n), value->wstr->n);
+
+               value->type = type;
+               value->size = value->wstr->n;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_value_to_read_attr_status_record(read_attr_status_record_h handle,
+               unsigned char type, zb_value_h value)
+{
+       int len = -1;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       if (handle->value)
+               free(handle->value);
+
+       len = zb_get_data_size(type);
+       if (0 < len) {
+               handle->value = calloc(len, sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               memcpy(handle->value, value->val, len);
+       } else if (ZB_ZCL_OCTAT_STRING == type || ZB_ZCL_CHRACTER_STRING == type) {
+               RETV_IF(NULL == value->str, ZIGBEE_ERROR_NO_DATA);
+               handle->value = calloc(value->str->n + sizeof(value->str->n), sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               handle->value[0] = value->str->n;
+               memcpy(handle->value + sizeof(value->str->n),
+                       value->str->v+sizeof(value->str->n), value->str->n);
+       } else if (ZB_ZCL_LONG_OCTAT_STRING == type || ZB_ZCL_LONG_CHRACTER_STRING == type) {
+               RETV_IF(NULL == value->wstr, ZIGBEE_ERROR_NO_DATA);
+               handle->value = calloc(value->wstr->n + sizeof(value->wstr->n), sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               handle->value[0] = value->wstr->n & 0xff;
+               handle->value[1] = (value->wstr->n >> 8) & 0xff ;
+               memcpy(handle->value + sizeof(value->wstr->n),
+                       value->wstr->v+sizeof(value->wstr->n), value->wstr->n);
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_create_value(zb_value_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       zb_value_h simple = calloc(1, sizeof(struct zb_value_s));
+       RETVM_IF(NULL == simple, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = simple;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_value(zb_value_h handle)
+{
+       RET_IF(NULL == handle);
+       if (handle->str) {
+               if (handle->str->v)
+                       free(handle->str->v);
+               free(handle->str);
+       }
+       if (handle->wstr) {
+               if (handle->wstr->v)
+                       free(handle->wstr->v);
+               free(handle->wstr);
+       }
+       free(handle);
+}
+
+API int zb_set_value(zb_value_h handle, unsigned char type, unsigned char *value,
+               int count)
+{
+       int len = -1;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       len = zb_get_data_size(type);
+       if (0 < len) {
+               memcpy(handle->val, value, len);
+               handle->size = len;
+               handle->type = type;
+       } else if (ZB_ZCL_OCTAT_STRING == type || ZB_ZCL_CHRACTER_STRING == type) {
+               if (handle->str) {
+                       if (handle->str->v)
+                               free(handle->str->v);
+                       free(handle->str);
+               }
+               /* string size exception case */
+               RETV_IF(0xff - 1 < handle->str->n, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+               handle->str = malloc(sizeof(struct attribute_str_s));
+               RETV_IF(NULL == handle->str, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               handle->str->n = count;
+               /* The first 1 byte indicate invalid or length of string */
+               handle->str->v = calloc(sizeof(unsigned char), handle->str->n + sizeof(handle->str->n));
+               RETV_IF(NULL == handle->str->v, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               memcpy(handle->str->v, value+sizeof(handle->str->n), handle->str->n);
+
+               handle->type = type;
+               handle->size = count;
+       } else if (ZB_ZCL_LONG_OCTAT_STRING == type || ZB_ZCL_LONG_CHRACTER_STRING == type) {
+               if (handle->wstr) {
+                       if (handle->wstr->v)
+                               free(handle->wstr->v);
+                       free(handle->wstr);
+               }
+               /* 2 byte string size exception case */
+               RETV_IF(0xffff - 1 < handle->wstr->n, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+               handle->wstr = malloc(sizeof(struct attribute_wstr_s));
+               RETV_IF(NULL == handle->wstr, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               handle->wstr->n = count;
+               /* The first 2 byte indicate invalid or length of string */
+               handle->wstr->v = calloc(sizeof(unsigned char), handle->wstr->n + sizeof(handle->wstr->n));
+               RETV_IF(NULL == handle->wstr->v, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               memcpy(handle->wstr->v, value+sizeof(handle->wstr->n), handle->wstr->n);
+
+               handle->type = type;
+               handle->size = count;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_value(zb_value_h handle, unsigned char *type, unsigned char **value,
+               int *count)
+{
+       int len = -1;
+       unsigned char *s = NULL;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       len = zb_get_data_size(handle->type);
+       if (0 < len) {
+               s = calloc(handle->size + 1 , sizeof(char));
+               memcpy(s, handle->val, len);
+               *count = len;
+       } else if (ZB_ZCL_OCTAT_STRING == handle->type || ZB_ZCL_CHRACTER_STRING == handle->type) {
+               RETV_IF(NULL == handle->str, ZIGBEE_ERROR_NO_DATA);
+               s = calloc(sizeof(unsigned char), handle->str->n);
+               RETV_IF(NULL == s, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               memcpy(s, handle->str->v+sizeof(handle->str->n), handle->str->n);
+               *count = handle->str->n;
+       } else if (ZB_ZCL_OCTAT_STRING == handle->type || ZB_ZCL_CHRACTER_STRING == handle->type) {
+               RETV_IF(NULL == handle->wstr, ZIGBEE_ERROR_NO_DATA);
+               s = calloc(sizeof(unsigned char), handle->wstr->n);
+               RETV_IF(NULL == s, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               memcpy(s, handle->wstr->v+sizeof(handle->wstr->n), handle->wstr->n);
+               *count = handle->wstr->n;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       *type = handle->type;
+       *value = s;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_create_discover_attr_info(discover_attr_info_record_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       discover_attr_info_record_h simple = calloc(1,
+               sizeof(struct discover_attribute_info_record_s));
+       RETVM_IF(NULL == simple, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = simple;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_discover_attr_info(discover_attr_info_record_h handle)
+{
+       free(handle);
+}
+
+API int zb_get_id_from_discover_attr_info(
+               discover_attr_info_record_h handle,
+               unsigned short *id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *id = handle->id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_id_to_discover_attr_info(
+               discover_attr_info_record_h handle,
+               unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_type_from_discover_attr_info(
+               discover_attr_info_record_h handle,
+               unsigned char *type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == type, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *type = handle->type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_type_to_discover_attr_info(
+               discover_attr_info_record_h handle,
+               unsigned char type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->type = type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_create_write_attr_record(
+               write_attr_record_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       write_attr_record_h t = calloc(1, sizeof(struct write_attribute_record_s));
+       RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = t;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_write_attr_record(write_attr_record_h handle)
+{
+       RET_IF(NULL == handle);
+       if (handle->value)
+               free(handle->value);
+       free(handle);
+}
+
+API int zb_set_id_to_write_attr_record(write_attr_record_h handle,
+               unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_type_to_write_attr_record(write_attr_record_h handle,
+               unsigned char type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->type = type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_buf_to_write_attr_record(write_attr_record_h handle,
+       unsigned char type, unsigned char *value, int count)
+{
+       int len = -1;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       if (handle->value)
+               free(handle->value);
+
+       len = zb_get_data_size(type);
+       if (0 < len) {
+               handle->value = calloc(count + 1 , sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               memcpy(handle->value, value, count);
+       } else if (ZB_ZCL_OCTAT_STRING == type || ZB_ZCL_CHRACTER_STRING == type) {
+               handle->value = calloc(count + sizeof(unsigned char) + 1, sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               /* The first 1 byte indicate invalid or length of string */
+               handle->value[0] = count & 0xff;
+               memcpy(handle->value + sizeof(unsigned char), value + sizeof(unsigned char), count);
+       } else if (ZB_ZCL_LONG_OCTAT_STRING == handle->type || ZB_ZCL_LONG_CHRACTER_STRING == handle->type) {
+               handle->value = calloc(count + sizeof(unsigned short)  + 1, sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               /* The first 2 byte indicate invalid or length of string */
+               handle->value[0] = count & 0xff;
+               handle->value[1] = (count >> 8) & 0xff ;
+               memcpy(handle->value + sizeof(unsigned short), value + sizeof(unsigned short), count);
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_value_to_write_attr_record(write_attr_record_h handle, zb_value_h value)
+{
+       int len = -1;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       if (handle->value)
+               free(handle->value);
+
+       len = zb_get_data_size(value->type);
+       if (0 < len) {
+               handle->value = calloc(value->size + 1 , sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               memcpy(handle->value, value->val, value->size);
+               handle->type = value->type;
+       } else if (ZB_ZCL_OCTAT_STRING == handle->type || ZB_ZCL_CHRACTER_STRING == handle->type) {
+               RETV_IF(NULL == value->str, ZIGBEE_ERROR_NO_DATA);
+               /* 1 byte string size exception case */
+               RETV_IF(0xff - 1 < value->str->n, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+               handle->value = calloc(value->str->n + sizeof(value->str->n), sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               /* The first 1 byte indicate invalid or length of string */
+               handle->value[0] = value->str->n & 0xff;
+               memcpy(handle->value + sizeof(value->str->n),
+                       value->str->v + sizeof(value->str->n), value->str->n);
+       } else if (ZB_ZCL_LONG_OCTAT_STRING == handle->type || ZB_ZCL_LONG_CHRACTER_STRING == handle->type) {
+               RETV_IF(NULL == value->wstr, ZIGBEE_ERROR_NO_DATA);
+               /* 2 byte string size exception case */
+               RETV_IF(0xffff - 1 < value->wstr->n, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+               handle->value = calloc(value->wstr->n + sizeof(value->wstr->n), sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               /* The first 2 byte indicate invalid or length of string */
+               handle->value[0] = value->wstr->n & 0xff;
+               handle->value[1] = (value->wstr->n >> 8) & 0xff ;
+               memcpy(handle->value + sizeof(value->wstr->n),
+                       value->wstr->v + sizeof(value->wstr->n), value->wstr->n);
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_create_write_attr_status(write_attr_status_record_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       write_attr_status_record_h simple = calloc(1,
+               sizeof(struct write_attribute_status_record_s));
+       RETVM_IF(NULL == simple, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = simple;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_write_attr_status(write_attr_status_record_h handle)
+{
+       free(handle);
+}
+
+API int zb_get_status_from_write_attr_status(write_attr_status_record_h handle,
+               unsigned char *status)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == status, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *status = handle->status;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_status_to_write_attr_status(write_attr_status_record_h handle,
+               unsigned char status)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->status = status;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_id_from_write_attr_status(write_attr_status_record_h handle,
+               unsigned short *id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *id = handle->id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_id_to_write_attr_status(write_attr_status_record_h handle,
+               unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_create_report_config_record(report_config_record_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       report_config_record_h t;
+       t = calloc(1, sizeof(struct reporting_configuration_record_s));
+       RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = t;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_report_config_record(report_config_record_h handle)
+{
+       RET_IF(NULL == handle);
+       if (handle->change)
+               free(handle->change);
+       free(handle);
+}
+
+API int zb_get_dir_from_report_config_record(report_config_record_h handle,
+               unsigned char *dir)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dir, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *dir = handle->dir;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_dir_to_report_config_record(report_config_record_h handle,
+               unsigned char dir)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       if (dir == ZB_ZCL_CLIENT_TO_SERVER)
+               handle->dir = 0x00 ;
+       else
+               handle->dir = 0x01;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_id_from_report_config_record(report_config_record_h handle,
+               unsigned short *id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *id = handle->id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_id_to_report_config_record(report_config_record_h handle,
+               unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id ;
+       return ZIGBEE_ERROR_NONE;
+}
+
+
+API int zb_get_type_from_report_config_record(report_config_record_h handle,
+               unsigned char *type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == type, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *type = handle->type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_type_to_report_config_record(report_config_record_h handle,
+               unsigned char type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->type = type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+
+API int zb_get_min_i_from_report_config_record(report_config_record_h handle,
+               unsigned short *min_i)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == min_i, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *min_i = handle->min_i;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_min_i_to_report_config_record(report_config_record_h handle,
+               unsigned short min_i)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->min_i = min_i;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_max_i_from_report_config_record(report_config_record_h handle,
+               unsigned short *max_i)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == max_i, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *max_i = handle->max_i;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_max_i_to_report_config_record(report_config_record_h handle,
+               unsigned short max_i)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->max_i = max_i;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_timeout_from_report_config_record(report_config_record_h handle,
+               unsigned short *to)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == to, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *to = handle->to;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_timeout_to_report_config_record(report_config_record_h handle,
+               unsigned short to)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->to = to;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_change_from_report_config_record1(report_config_record_h handle,
+               zb_value_h value)
+{
+       int len = -1;
+       int data_type = DATA_TYPE_NONE;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->change, ZIGBEE_ERROR_NO_DATA);
+
+       len = zb_get_data_size(handle->type);
+       data_type = zb_get_analog_or_discret(handle->type);
+       if (0 < len /* && DATA_TYPE_ANALOG == data_type */) {
+               memcpy(value->val, handle->change, len);
+               value->type = handle->type;
+               value->size = len;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_change_to_report_config_record1(report_config_record_h handle,
+               zb_value_h value)
+{
+       int len = -1;
+       int data_type = DATA_TYPE_NONE;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       if (handle->change)
+               free(handle->change);
+
+       len = zb_get_data_size(value->type);
+       data_type = zb_get_analog_or_discret(value->type);
+       if (0 < len /* && DATA_TYPE_ANALOG == data_type */) {
+               handle->change = calloc(len + 1, sizeof(char));
+               RETVM_IF(NULL == handle->change, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+               memcpy(handle->change, value->val, len);
+               handle->type = value->type;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_change_from_report_config_record2(report_config_record_h handle,
+               unsigned char *type, unsigned char **value, int *size)
+{
+       int len = -1;
+       int data_type = DATA_TYPE_NONE;
+       unsigned char *t = NULL;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->change, ZIGBEE_ERROR_NO_DATA);
+
+       len = zb_get_data_size(handle->type);
+       data_type = zb_get_analog_or_discret(handle->type);
+       if (0 < len /* && DATA_TYPE_ANALOG == data_type */) {
+               t = calloc(len + 1, sizeof(char));
+               RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+               memcpy(t, handle->change, len);
+               *value = t;
+               *type = handle->type;
+               *size = len;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+API int zb_set_change_to_report_config_record2(
+               report_config_record_h handle, unsigned char type, unsigned char *value)
+{
+       int len = -1;
+       int data_type = DATA_TYPE_NONE;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       if (handle->change)
+               free(handle->change);
+
+       len = zb_get_data_size(type);
+       data_type = zb_get_analog_or_discret(type);
+
+       if (0 < len /* && DATA_TYPE_ANALOG == data_type */) {
+               handle->change = calloc(len + 1, sizeof(unsigned char));
+               RETVM_IF(NULL == handle->change, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+               memcpy(handle->change, value, len);
+               handle->type = type;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_change_from_report_config_record3(report_config_record_h handle,
+               unsigned char *type, unsigned char *value, int *size)
+{
+       int len = -1;
+       int data_type = DATA_TYPE_NONE;
+       unsigned char *t = NULL;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->change, ZIGBEE_ERROR_NO_DATA);
+
+       len = zb_get_data_size(handle->type);
+       data_type = zb_get_analog_or_discret(handle->type);
+       if (0 < len /* && DATA_TYPE_ANALOG == data_type */) {
+               memcpy(value, handle->change, len);
+               *type = handle->type;
+               *size = len;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_create_read_report_config_record(read_report_config_record_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       read_report_config_record_h t =
+               calloc(1, sizeof(struct read_reporting_configuration_record_s));
+       RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = t;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_read_report_config_record(read_report_config_record_h handle)
+{
+       free(handle);
+}
+
+API int zb_set_dir_to_read_report_config_record(read_report_config_record_h handle,
+               unsigned char dir)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       if (dir == ZB_ZCL_CLIENT_TO_SERVER)
+               handle->dir = 0x00;
+       else
+               handle->dir = 0x01;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_dir_from_read_report_config_record(read_report_config_record_h handle,
+               unsigned char *dir)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *dir = handle->dir;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_id_to_read_report_config_record(read_report_config_record_h handle,
+               unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_id_from_read_report_config_record(read_report_config_record_h handle,
+               unsigned short *id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *id = handle->id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_create_report_config_response_record(
+               report_config_response_record_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       report_config_response_record_h t =
+               calloc(1, sizeof(struct reporting_configuration_response_record_s));
+       RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = t;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_report_config_response_record(
+               report_config_response_record_h handle)
+{
+       free(handle);
+}
+
+API int zb_get_status_from_report_config_response_record(
+               report_config_response_record_h handle, unsigned char *status)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == status, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *status = handle->status;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_status_to_report_config_response_record(
+               report_config_response_record_h handle, unsigned char status)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->status = status;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_dir_from_report_config_response_record(
+               report_config_response_record_h handle, unsigned char *dir)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dir, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *dir = handle->dir;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_dir_to_report_config_response_record(
+               report_config_response_record_h handle, unsigned char dir)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->dir = handle->dir;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_id_from_report_config_response_record(
+       report_config_response_record_h handle, unsigned short *id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *id = handle->id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_id_to_report_config_response_record(
+       report_config_response_record_h handle, unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_create_attr_report(attr_report_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       attr_report_h t = calloc(1, sizeof(struct attribute_report_s));
+       RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = t;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_attr_report(attr_report_h handle)
+{
+       if (handle) {
+               if (handle->value)
+                       free(handle->value);
+               free(handle);
+       }
+}
+
+API int zb_get_id_from_attr_report(attr_report_h handle, unsigned short *id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *id = handle->id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_id_to_attr_report(attr_report_h handle, unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_type_from_attr_report(attr_report_h handle, unsigned char *type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == type, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *type = handle->type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_type_to_attr_report(attr_report_h handle, unsigned char type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->type = type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_value_from_attr_report(attr_report_h handle, zb_value_h value)
+{
+       int len = -1;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->value, ZIGBEE_ERROR_NO_DATA);
+
+       len = zb_get_data_size(handle->type);
+       if (0 < len) {
+               memcpy(value->val, handle->value, len);
+               value->size = len;
+               value->type = handle->type;
+       } else if (ZB_ZCL_OCTAT_STRING == handle->type || ZB_ZCL_CHRACTER_STRING == handle->type) {
+               if (value->str) {
+                       if (value->str->v)
+                               free(value->str->v);
+                       free(value->str);
+               }
+               value->str = calloc(1, sizeof(struct attribute_str_s));
+               RETV_IF(NULL == value->str, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               value->str->n = *handle->value;
+               /* The first 1 byte indicate invalid or length of string */
+               if (0xff == value->str->n) {
+                       free(value->str);
+                       return ZIGBEE_ERROR_NO_DATA;
+               }
+               value->str->v = calloc(value->str->n+1, 1);
+               if (NULL == value->str->v) {
+                       free(value->str);
+                       return ZIGBEE_ERROR_OUT_OF_MEMORY;
+               }
+               memcpy(value->str->v, handle->value+sizeof(value->str->n), value->str->n);
+
+               value->type = handle->type;
+               value->size = value->str->n;
+       } else if (ZB_ZCL_LONG_OCTAT_STRING == handle->type || ZB_ZCL_LONG_CHRACTER_STRING == handle->type) {
+               if (value->wstr) {
+                       if (value->wstr->v)
+                               free(value->wstr->v);
+                       free(value->wstr);
+               }
+               value->wstr = calloc(1, sizeof(struct attribute_wstr_s));
+               RETV_IF(NULL == value->wstr, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               value->wstr->n = *(handle->value+1) << 8 | *handle->value;
+               /* The first 2 byte indicate invalid or length of string */
+               if (0xffff == value->wstr->n) {
+                       free(value->wstr);
+                       return ZIGBEE_ERROR_NO_DATA;
+               }
+               value->wstr->v = calloc(value->wstr->n+1, 1);
+               if (NULL == value->wstr->v) {
+                       free(value->wstr);
+                       return ZIGBEE_ERROR_OUT_OF_MEMORY;
+               }
+               memcpy(value->wstr->v, handle->value+sizeof(value->wstr->n), value->wstr->n);
+
+               value->type = handle->type;
+               value->size = value->wstr->n;
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_value_to_attr_report(attr_report_h handle, zb_value_h value)
+{
+       int len = -1;
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == value, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       if (handle->value)
+               free(handle->value);
+
+       len = zb_get_data_size(value->type);
+       if (0 < len) {
+               handle->value = calloc(value->size + 1 , sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               memcpy(handle->value, value->val, value->size);
+               handle->type = value->type;
+       } else if (ZB_ZCL_OCTAT_STRING == handle->type || ZB_ZCL_CHRACTER_STRING == handle->type) {
+               RETV_IF(NULL == value->str, ZIGBEE_ERROR_NO_DATA);
+               handle->value = calloc(value->str->n + sizeof(value->str->n), sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               /* The first 1 byte indicate invalid or length of string */
+               handle->value[0] = value->str->n & 0xff;
+               memcpy(handle->value + sizeof(value->str->n),
+                       value->str->v + sizeof(value->str->n), value->str->n);
+       } else if (ZB_ZCL_LONG_OCTAT_STRING == handle->type || ZB_ZCL_LONG_CHRACTER_STRING == handle->type) {
+               RETV_IF(NULL == value->wstr, ZIGBEE_ERROR_NO_DATA);
+               handle->value = calloc(value->wstr->n + sizeof(value->wstr->n), sizeof(char));
+               RETV_IF(NULL == handle->value, ZIGBEE_ERROR_OUT_OF_MEMORY);
+               /* The first 2 byte indicate invalid or length of string */
+               handle->value[0] = value->wstr->n & 0xff;
+               handle->value[1] = (value->wstr->n >> 8) & 0xff ;
+               memcpy(handle->value + sizeof(value->wstr->n),
+                       value->wstr->v + sizeof(value->wstr->n), value->wstr->n);
+       } else
+               return ZIGBEE_ERROR_NOT_SUPPORTED;
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+
+/**
+ * @brief Figure 2.33 Format of the Selector Field
+ *
+ * @since_tizen 3.0
+ */
+struct selector_s {
+       unsigned char indicator; /**< number of index */
+       unsigned short *index; /**< index list */
+};
+
+/**
+ * @brief stcuture for reading attribute
+ *
+ * @since_tizen 3.0
+ */
+struct read_structured_attribute_record_s {
+       unsigned short id; /**< attribute identifier */
+       struct selector_s *selector; /**< selector format */
+};
+
+/**
+ * @brief Figure 2.11 Format of the Write Attribute Record Field
+ *
+ * @since_tizen 3.0
+ */
+struct write_attribute_structured_status_record_s {
+       unsigned char status; /**< status */
+       unsigned short id; /**< identifier */
+       struct selector_s selector; /**< selector */
+};
+
+/**
+ * @brief Figure 2.32 Format of the Write Attribute Record Field
+ *
+ * @since_tizen 3.0
+ */
+struct write_attribute_structured_record_s {
+       unsigned short id; /**< attribute identifier */
+       struct selector_s selector;
+       unsigned char type; /**< attribute data type */
+       unsigned char *value; /**< data value */; /**< attribute value */
+};
+
+API int zb_create_extended_attr_info(extended_attr_info_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       extended_attr_info_h t = calloc(1, sizeof(struct extended_attribute_infomation_s));
+       RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = t;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API void zb_destroy_extended_attr_info(extended_attr_info_h handle)
+{
+       free(handle);
+}
+
+API int zb_get_id_from_extended_attr_info(extended_attr_info_h handle,
+               unsigned short *id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *id = handle->id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_id_to_extended_attr_info(extended_attr_info_h handle,
+               unsigned short id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->id = id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_type_from_extended_attr_info(extended_attr_info_h handle,
+               unsigned char *type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == type, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *type = handle->type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_type_to_extended_attr_info(extended_attr_info_h handle,
+               unsigned char type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->type = type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_acl_from_extended_attr_info(extended_attr_info_h handle,
+               unsigned char *acl)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == acl, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *acl = handle->acl;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_set_acl_to_extended_attr_info(extended_attr_info_h handle,
+               unsigned char acl)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->acl = acl;
+       return ZIGBEE_ERROR_NONE;
+}
+
diff --git a/lib/zbl-zdo-bind-mgr.c b/lib/zbl-zdo-bind-mgr.c
new file mode 100644 (file)
index 0000000..147aa6d
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zdo/zb-zdo-type.h>
+#include <zdo/zb-zdo-bind-mgr.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zdo_bind_req(zigbee_h handle, nwk_addr dst_addr16,
+               ieee_addr src_addr64, unsigned char src_ep, unsigned short cluster_id,
+               ieee_addr dst_addr64, unsigned char type, nwk_addr group_addr,
+               unsigned char dst_ep, zb_zdo_bind_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_bind_req(dst_addr16, src_addr64, src_ep, cluster_id, dst_addr64, type,
+               group_addr, dst_ep, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_unbind_req(zigbee_h handle, nwk_addr dst_addr16,
+               ieee_addr src_addr64, unsigned char src_ep, unsigned short cluster_id,
+               ieee_addr dst_addr64, unsigned char type, nwk_addr group_addr,
+               unsigned char dst_ep, zb_zdo_unbind_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == src_ep || 0 == dst_ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       ret = zbl_unbind_req(dst_addr16, src_addr64, src_ep, cluster_id, dst_addr64, type,
+               group_addr, dst_ep, cb, user_data);
+       return ret;
+}
diff --git a/lib/zbl-zdo-dev-disc.c b/lib/zbl-zdo-dev-disc.c
new file mode 100644 (file)
index 0000000..64a0ebb
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zdo/zb-zdo-type.h>
+#include <zdo/zb-zdo-dev-disc.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zdo_nwk_addr_req(zigbee_h handle, ieee_addr addr64,
+               unsigned char request_type, unsigned char start_idx, zb_zdo_addr_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == addr64, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 != request_type && 1 != request_type, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_nwk_addr_req(handle, addr64, request_type, start_idx, cb,
+               user_data);
+       return ret;
+}
+
+API int zb_zdo_ieee_addr_req(zigbee_h handle, nwk_addr addr16, zb_zdo_addr_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_ieee_addr_req(handle, addr16, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_active_ep(zigbee_h handle, nwk_addr addr16, zb_zdo_active_ep_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_active_ep(handle, addr16, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_simple_desc_req(zigbee_h handle, nwk_addr addr16, unsigned char ep,
+               zb_zdo_simple_desc_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == ep, ZIGBEE_ERROR_INVALID_ENDPOINT);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_simple_desc_req(handle, addr16, ep, cb, user_data);
+       return ret;
+}
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+API int zb_zdo_extended_simple_desc_req(zigbee_h handle, nwk_addr addr16,
+               unsigned char start_idx, zb_zdo_extended_simple_desc_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       return ZIGBEE_ERROR_NONE;
+}
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
+API int zb_zdo_match_desc_req(zigbee_h handle, nwk_addr addr16,
+               unsigned short profile_id, unsigned char num_in_clusters,
+               unsigned short *in_clusters, unsigned char num_out_clusters,
+               unsigned short *out_clusters, zb_zdo_match_desc_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == in_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == num_in_clusters && 0 == num_out_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_match_desc_req(handle, addr16, profile_id, num_in_clusters,
+               in_clusters, num_out_clusters, out_clusters, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_node_desc_req(zigbee_h handle, nwk_addr addr16,
+               zb_zdo_node_desc_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_node_desc_req(addr16, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_power_desc_req(zigbee_h handle, nwk_addr addr16,
+               zb_zdo_power_desc_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_power_desc_req(addr16, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_complex_desc_req(zigbee_h handle, nwk_addr addr16,
+               zb_zdo_complex_desc_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_complex_desc_req(addr16, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_user_desc_req(zigbee_h handle, nwk_addr addr16,
+               zb_zdo_user_desc_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_user_desc_req(addr16, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_user_desc_set(zigbee_h handle, nwk_addr addr16, unsigned char len,
+               unsigned char *user_desc, zb_zdo_user_desc_conf cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == user_desc, ZIGBEE_ERROR_INVALID_PARAMETER);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_device_annce(zigbee_h handle, nwk_addr addr16, ieee_addr addr64,
+               unsigned char capability)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16 || 0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+       ret = zbl_device_annce(handle, addr16, addr64, capability);
+       return ret;
+}
+
diff --git a/lib/zbl-zdo-nwk-mgr.c b/lib/zbl-zdo-nwk-mgr.c
new file mode 100644 (file)
index 0000000..dfd097b
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zdo/zb-zdo-type.h>
+#include <zdo/zb-zdo-nwk-mgr.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+API int zb_zdo_mgmt_nwk_disc_req(zigbee_h handle, nwk_addr addr16,
+               unsigned int scan_channels, unsigned char scan_duration, unsigned char scan_count,
+               unsigned char start_idx, zb_zdo_mgmt_nwk_disc_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       ret = zbl_mgmt_nwk_disc_req(addr16, scan_channels, scan_duration, scan_count,
+               start_idx, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_mgmt_lqi_req(zigbee_h handle, nwk_addr addr16,
+               unsigned char start_idx, zb_zdo_mgmt_lqi_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       ret = zbl_mgmt_lqi_req(addr16, start_idx, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_mgmt_rtg_req(zigbee_h handle, nwk_addr addr16,
+               unsigned char start_idx, zb_zdo_mgmt_rtg_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       ret = zbl_mgmt_rtg_req(addr16, start_idx, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_mgmt_bind_req(zigbee_h handle, nwk_addr addr16,
+               unsigned char start_idx, zb_zdo_mgmt_bind_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       ret = zbl_mgmt_bind_req(addr16, start_idx, cb, user_data);
+       return ret;
+}
+
+API int zb_zdo_mgmt_leave_req(zigbee_h handle, ieee_addr addr64,
+               bool remove_children, bool rejoin, zb_zdo_mgmt_leave_rsp cb,
+               void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+       ret = zbl_mgmt_leave_device(addr64, remove_children, rejoin, cb, user_data);
+       return ret;
+}
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+API int zb_zdo_mgmt_direct_join_req(zigbee_h handle, ieee_addr addr64,
+               unsigned char capability, zb_zdo_mgmt_direct_join_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+       return ZIGBEE_ERROR_NONE;
+}
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
+API int zb_zdo_mgmt_permit_joining_req(zigbee_h handle, nwk_addr addr16,
+               unsigned char duration, unsigned char tc_significance,
+               zb_zdo_mgmt_permit_joining_rsp cb, void *user_data)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       ret = zbl_mgmt_permit_joining_req(addr16, duration, tc_significance, cb, user_data);
+       return ret;
+}
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+API int zb_zdo_mgmt_cache_req(zigbee_h handle, nwk_addr addr16,
+               unsigned char start_idx, zb_zdo_mgmt_cache_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       return ZIGBEE_ERROR_NONE;
+}
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
+API int zb_zdo_mgmt_nwk_update_req(zigbee_h handle, unsigned int scan_channels,
+       unsigned char scan_duration, unsigned char scan_count, unsigned char nwk_update_id,
+       nwk_addr nwk_manager_addr)
+{
+       int ret;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == nwk_manager_addr, ZIGBEE_ERROR_INVALID_ADDRESS);
+       ret = zbl_mgmt_nwk_update_req(scan_channels, scan_duration, scan_count, nwk_update_id,
+               nwk_manager_addr);
+       return ret;
+}
+
diff --git a/lib/zbl-zdo-svc-disc.c b/lib/zbl-zdo-svc-disc.c
new file mode 100644 (file)
index 0000000..6bb870b
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zdo/zb-zdo-type.h>
+#include <zdo/zb-zdo-svc-disc.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+
+#ifdef ZB_SUPPORT_PRIORITY_5
+
+API int zb_zdo_system_server_discover_req(zigbee_h handle,
+               unsigned short server_mask, zb_zdo_system_server_discover_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_find_node_cache_req(zigbee_h handle, nwk_addr addr16,
+               ieee_addr addr64, zb_zdo_find_node_cache_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16 || 0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_discovery_cache_req(zigbee_h handle, nwk_addr addr16,
+               ieee_addr addr64, zb_zdo_discovery_cache_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16 || 0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_discovery_store_req(zigbee_h handle, nwk_addr addr16,
+               ieee_addr addr64, unsigned char node_desc_size, unsigned char power_desc_size,
+               unsigned char active_ep_size, unsigned char simple_desc_count,
+               unsigned char *simple_desc_list, zb_zdo_discovery_store_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16 || 0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == simple_desc_list, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_node_desc_store_req(zigbee_h handle, nwk_addr addr16,
+               ieee_addr addr64, zb_zdo_node_descriptor_h nodedsc, zb_zdo_node_desc_store_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16 || 0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_power_desc_store_req(zigbee_h handle, nwk_addr addr16,
+               ieee_addr addr64, zb_zdo_node_power_descriptor_h powerdsc,
+               zb_zdo_power_desc_store_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_active_ep_store_req(zigbee_h handle, nwk_addr addr16,
+               ieee_addr addr64, unsigned char active_ep_count, unsigned char *ep_list,
+               zb_zdo_active_ep_store_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16 || 0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == ep_list, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_simple_desc_store_req(zigbee_h handle, nwk_addr addr16,
+               ieee_addr addr64, zb_zdo_simple_desc_h simpledsc, zb_zdo_simple_desc_store_rsp cb,
+               void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16 || 0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_zdo_remove_node_cache_req(zigbee_h handle, nwk_addr addr16,
+               ieee_addr addr64, zb_zdo_remove_node_cache_rsp cb, void *user_data)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
+       RETV_IF(0 == addr16 || 0 == addr64, ZIGBEE_ERROR_INVALID_ADDRESS);
+
+       return ZIGBEE_ERROR_NONE;
+}
+
+#endif /* ZB_SUPPORT_PRIORITY_5 */
+
diff --git a/lib/zbl-zdo.c b/lib/zbl-zdo.c
new file mode 100644 (file)
index 0000000..bee6f2a
--- /dev/null
@@ -0,0 +1,946 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+#include <glib.h>
+#include <error.h>
+#include <stdlib.h>
+
+#include <zb-type.h>
+#include <zb-error.h>
+#include <zdo/zb-zdo-type.h>
+
+#include "zbl.h"
+#include "zb-log.h"
+#include "zbl-dbus.h"
+#include "zb-common.h"
+
+API int zb_simple_desc_create(zb_zdo_simple_desc_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       zb_zdo_simple_desc_h desc = calloc(1, sizeof(struct zb_zdo_simple_desc_s));
+       RETVM_IF(NULL == desc, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = desc;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_copy(zb_zdo_simple_desc_h src, zb_zdo_simple_desc_h dst)
+{
+       RETV_IF(NULL == src, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dst, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(dst, src, sizeof(struct zb_zdo_simple_desc_s));
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_destroy(zb_zdo_simple_desc_h handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       free(handle);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_get_ep(zb_zdo_simple_desc_h handle, unsigned char *ep)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ep, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *ep = handle->ep;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_set_ep(zb_zdo_simple_desc_h handle, unsigned char ep)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->ep = ep;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_get_profile_id(zb_zdo_simple_desc_h handle,
+               unsigned short *profile_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == profile_id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *profile_id = handle->profile_id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_set_profile_id(zb_zdo_simple_desc_h handle,
+               unsigned short profile_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->profile_id = profile_id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+
+API int zb_simple_desc_get_device_id(zb_zdo_simple_desc_h handle,
+               unsigned short *device_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == device_id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *device_id = handle->device_id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_set_device_id(zb_zdo_simple_desc_h handle,
+               unsigned short device_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->device_id = device_id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_get_device_ver(zb_zdo_simple_desc_h handle,
+               unsigned short *device_ver)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == device_ver, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *device_ver = handle->device_ver;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_set_device_ver(zb_zdo_simple_desc_h handle,
+               unsigned short device_ver)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->device_ver = device_ver;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_get_num_of_in_clusters(zb_zdo_simple_desc_h handle,
+               unsigned char *num_of_in_clusters)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == num_of_in_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *num_of_in_clusters = handle->num_of_in_clusters;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_set_num_of_in_clusters(zb_zdo_simple_desc_h handle,
+               unsigned char num_of_in_clusters)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->num_of_in_clusters = num_of_in_clusters;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_get_num_of_out_clusters(zb_zdo_simple_desc_h handle,
+               unsigned char *num_of_out_clusters)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == num_of_out_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *num_of_out_clusters = handle->num_of_out_clusters;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_set_num_of_out_clusters(zb_zdo_simple_desc_h handle,
+               unsigned char num_of_out_clusters)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->num_of_out_clusters = num_of_out_clusters;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_get_in_clusters(zb_zdo_simple_desc_h handle,
+               unsigned short **in_clusters)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->in_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == in_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *in_clusters = handle->in_clusters;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_set_in_clusters(zb_zdo_simple_desc_h handle,
+               unsigned short *in_clusters, int num)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == in_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(num < 1 || num > MAX_ENDPOINT_CLUSTERS, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(handle->in_clusters, in_clusters, 2 * num);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_get_out_clusters(zb_zdo_simple_desc_h handle,
+               unsigned short **out_clusters)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->out_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *out_clusters = handle->out_clusters;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_simple_desc_set_out_clusters(zb_zdo_simple_desc_h handle,
+               unsigned short *out_clusters, int num)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_clusters, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(num < 1 || num > MAX_ENDPOINT_CLUSTERS, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(handle->out_clusters, out_clusters, 2 * num);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_all_device_list(zigbee_h handle, int *count, zb_end_device_info_h **list)
+{
+       int ret;
+       unsigned char cnt;
+       RETV_IF(NULL == count, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_get_all_device_info(list, &cnt);
+       *count = cnt;
+       return ret;
+}
+
+API int zb_devices_info_foreach_end_device(zb_end_device_info_h *list,
+               zb_end_device_cb cb, void *user_data)
+{
+       int index = 0;
+       GList *cur = NULL;
+       struct zb_end_device_info_s *real = NULL;
+
+       RETV_IF(NULL == list, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       cur = (GList *)list;
+       while (cur) {
+               GList *next = cur->next;
+               real = cur->data;
+               if (ZIGBEE_FUNC_STOP == cb(index, (zb_end_device_info_h)real->list, user_data))
+                       break;
+               index++;
+               cur = next;
+       }
+
+       return ZIGBEE_ERROR_NONE;
+
+}
+
+API int zb_get_network_address(zb_end_device_info_h handle, nwk_addr *addr16)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == addr16, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *addr16 = handle->addr16;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_ieee_address(zb_end_device_info_h handle, ieee_addr addr64)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == addr64, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(addr64, handle->addr64, sizeof(ieee_addr));
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_num_of_ep(zb_end_device_info_h handle, unsigned char *count)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == count, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *count = handle->num_of_ep;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_ep_list(zb_end_device_info_h handle, unsigned char *ep_list)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ep_list, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(ep_list, handle->ep, handle->num_of_ep);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_mac_capabiity(zb_end_device_info_h handle, unsigned char *capability)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == capability, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == handle->capability, ZIGBEE_ERROR_NO_DATA);
+       *capability = handle->capability;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_alternative_pan_coordinator(zb_end_device_info_h handle,
+               unsigned char *can_do_it)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == can_do_it, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == handle->capability, ZIGBEE_ERROR_NO_DATA);
+       *can_do_it = handle->capability & ZB_ZDP_ALTERNATIVE_PAN_COORDINATOR ? 1 : 0;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_device_id(zb_end_device_info_h handle, unsigned char ep,
+               unsigned short *device_id)
+{
+       int i;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == device_id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->desc, ZIGBEE_ERROR_NO_DATA);
+       for (i = 0; i < handle->num_of_ep; i++) {
+               RETV_IF(NULL == handle->desc[i], ZIGBEE_ERROR_NO_DATA);
+               if (handle->desc[i]->ep == ep) {
+                       *device_id = handle->desc[i]->device_id;
+                       return ZIGBEE_ERROR_NONE;
+               }
+       }
+       return ZIGBEE_ERROR_NO_DATA;
+}
+
+API int zb_get_profile_id(zb_end_device_info_h handle, unsigned char ep,
+               unsigned short *profile_id)
+{
+       int i;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == profile_id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->desc, ZIGBEE_ERROR_NO_DATA);
+       for (i = 0; i < handle->num_of_ep; i++) {
+               RETV_IF(NULL == handle->desc[i], ZIGBEE_ERROR_NO_DATA);
+               if (handle->desc[i]->ep == ep) {
+                       *profile_id = handle->desc[i]->profile_id;
+                       return ZIGBEE_ERROR_NONE;
+               }
+       }
+       return ZIGBEE_ERROR_NO_DATA;
+}
+
+API int zb_get_power_source(zb_end_device_info_h handle, unsigned char *power_src)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == power_src, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == handle->capability, ZIGBEE_ERROR_NO_DATA);
+       *power_src = handle->capability & ZB_ZDP_POWER_SOURCE ? 1 : 0;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_get_security_capabilty(zb_end_device_info_h handle,
+               unsigned char *sec_capability)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == sec_capability, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0 == handle->capability, ZIGBEE_ERROR_NO_DATA);
+       *sec_capability = handle->capability & ZB_ZDP_SECURITY_CAPABILITY ? 1 : 0;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_create(zb_zdo_node_power_descriptor_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       zb_zdo_node_power_descriptor_h desc =
+               calloc(1, sizeof(struct zb_zdo_node_power_descriptor_s));
+       RETVM_IF(NULL == desc, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = desc;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_copy(zb_zdo_node_power_descriptor_h src,
+               zb_zdo_node_power_descriptor_h dst)
+{
+       RETV_IF(NULL == src, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dst, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(dst, src, sizeof(struct zb_zdo_node_power_descriptor_s));
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_destroy(zb_zdo_node_power_descriptor_h handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       free(handle);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_get_current_power_mode(
+               zb_zdo_node_power_descriptor_h handle,
+               unsigned char* current_power_mode)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == current_power_mode, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *current_power_mode = handle->current_power_mode;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_set_current_power_mode(
+               zb_zdo_node_power_descriptor_h handle, unsigned char current_power_mode)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0b11 < current_power_mode, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->current_power_mode = current_power_mode;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_get_available_power_sources(
+               zb_zdo_node_power_descriptor_h handle, unsigned char* available_power_sources)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == available_power_sources, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *available_power_sources = handle->available_power_sources;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_set_available_power_sources(
+               zb_zdo_node_power_descriptor_h handle, unsigned char available_power_sources)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0b111 < available_power_sources, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->available_power_sources = available_power_sources;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_get_current_power_source(
+               zb_zdo_node_power_descriptor_h handle, unsigned char* current_power_source)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == current_power_source, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *current_power_source = handle->current_power_source;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_set_current_power_source(
+               zb_zdo_node_power_descriptor_h handle, unsigned char current_power_source)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0b111 < current_power_source, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->current_power_source = current_power_source;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_get_current_power_source_level(
+               zb_zdo_node_power_descriptor_h handle, unsigned char* current_power_source_level)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == current_power_source_level, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *current_power_source_level = handle->current_power_source_level;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_power_desc_set_current_power_source_level(
+               zb_zdo_node_power_descriptor_h handle, unsigned char current_power_source_level)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->current_power_source_level = current_power_source_level;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_create(zb_zdo_node_descriptor_h *handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       zb_zdo_node_descriptor_h desc = calloc(1, sizeof(struct zb_zdo_node_descriptor_s));
+       RETVM_IF(NULL == desc, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = desc;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_copy(zb_zdo_node_descriptor_h src,
+               zb_zdo_node_descriptor_h dst)
+{
+       RETV_IF(NULL == src, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dst, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(dst, src, sizeof(struct zb_zdo_node_descriptor_s));
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_destroy(zb_zdo_node_descriptor_h handle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       free(handle);
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_logical_type(zb_zdo_node_descriptor_h handle,
+               unsigned char* logical_type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == logical_type, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *logical_type = handle->logical_type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_logical_type(zb_zdo_node_descriptor_h handle,
+               unsigned char logical_type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0b11 < logical_type, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->logical_type = logical_type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_complex_desciptor_available(
+               zb_zdo_node_descriptor_h handle, unsigned char* complex_desciptor_available)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == complex_desciptor_available, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *complex_desciptor_available = handle->complex_desciptor_available;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_complex_descriptor_available(
+               zb_zdo_node_descriptor_h handle, unsigned char complex_desciptor_available)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0x01 < complex_desciptor_available, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->complex_desciptor_available = complex_desciptor_available;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_user_descriptor_available(
+               zb_zdo_node_descriptor_h handle, unsigned char* user_descriptor_available)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == user_descriptor_available, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *user_descriptor_available = handle->user_descriptor_available;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_user_descriptor_available(
+               zb_zdo_node_descriptor_h handle, unsigned char user_descriptor_available)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0x01 < user_descriptor_available, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->user_descriptor_available = user_descriptor_available;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_aps_flags(zb_zdo_node_descriptor_h handle,
+               unsigned char* aps_flags)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == aps_flags, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *aps_flags = handle->aps_flags;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_aps_flags(zb_zdo_node_descriptor_h handle,
+               unsigned char aps_flags)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0b111 < aps_flags, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->aps_flags = aps_flags;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_frequency_band(zb_zdo_node_descriptor_h handle,
+               unsigned char* frequency_band)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == frequency_band, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *frequency_band = handle->frequency_band;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_frequency_band(zb_zdo_node_descriptor_h handle,
+               unsigned char frequency_band)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0b1111 < frequency_band, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->frequency_band = frequency_band;
+       return ZIGBEE_ERROR_NONE;
+}
+
+
+API int zb_node_desc_get_mac_capability_flags(zb_zdo_node_descriptor_h handle,
+               unsigned char* mac_capability_flags)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == mac_capability_flags, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *mac_capability_flags = handle->mac_capability_flags;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_mac_capability_flags(zb_zdo_node_descriptor_h handle,
+               unsigned char mac_capability_flags)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->mac_capability_flags = mac_capability_flags;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_manufacturer_code(zb_zdo_node_descriptor_h handle,
+               unsigned short* manufacturer_code)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == manufacturer_code, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *manufacturer_code = handle->manufacturer_code;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_manufacturer_code(zb_zdo_node_descriptor_h handle,
+               unsigned short manufacturer_code)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       handle->manufacturer_code = manufacturer_code;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_maximum_buffer_size(zb_zdo_node_descriptor_h handle,
+               unsigned char* maximum_buffer_size)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == maximum_buffer_size, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *maximum_buffer_size = handle->maximum_buffer_size;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_maximum_buffer_size(zb_zdo_node_descriptor_h handle,
+               unsigned char maximum_buffer_size)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0x7f < maximum_buffer_size, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->maximum_buffer_size = maximum_buffer_size;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_maximum_incoming_transfer_size(
+               zb_zdo_node_descriptor_h handle, unsigned short* maximum_incoming_transfer_size)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == maximum_incoming_transfer_size, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *maximum_incoming_transfer_size = handle->maximum_incoming_transfer_size;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_maximum_incoming_transfer_size(
+               zb_zdo_node_descriptor_h handle, unsigned short maximum_incoming_transfer_size)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0x7fff < maximum_incoming_transfer_size, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->maximum_incoming_transfer_size = maximum_incoming_transfer_size;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_server_mask(zb_zdo_node_descriptor_h handle,
+               unsigned short* server_mask)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == server_mask, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *server_mask = handle->server_mask;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_server_mask(zb_zdo_node_descriptor_h handle,
+               unsigned short server_mask)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0x7f < server_mask, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->server_mask = server_mask;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_maximum_outgoing_transfer_size(
+               zb_zdo_node_descriptor_h handle, unsigned short* maximum_outgoing_transfer_size)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == maximum_outgoing_transfer_size, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *maximum_outgoing_transfer_size = handle->maximum_outgoing_transfer_size;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_maximum_outgoing_transfer_size(
+               zb_zdo_node_descriptor_h handle, unsigned short maximum_outgoing_transfer_size)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0x7fff < maximum_outgoing_transfer_size, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->maximum_outgoing_transfer_size = maximum_outgoing_transfer_size;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_get_descriptor_capability_field(
+               zb_zdo_node_descriptor_h handle, unsigned short* descriptor_capability_field)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == descriptor_capability_field, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *descriptor_capability_field = handle->descriptor_capability_field;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_node_desc_set_descriptor_capability_field(
+               zb_zdo_node_descriptor_h handle, unsigned short descriptor_capability_field)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(0x11 < descriptor_capability_field, ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE);
+       handle->descriptor_capability_field = descriptor_capability_field;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_network_list_record_get_extended_pan_id(
+               zb_zdo_network_list_record_h handle, ieee_addr extended_pan_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       extended_pan_id = handle->extended_pan_id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_network_list_record_get_logical_channel(
+               zb_zdo_network_list_record_h handle, unsigned char* logical_channel)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == logical_channel, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *logical_channel = handle->logical_channel;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_network_list_record_get_zigbee_version(
+               zb_zdo_network_list_record_h handle, unsigned char* zigbee_version)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == zigbee_version, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *zigbee_version = handle->zigbee_version;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_network_list_record_get_stack_profile(
+               zb_zdo_network_list_record_h handle, unsigned char* stack_profile)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == stack_profile, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *stack_profile = handle->stack_profile;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_network_list_record_get_beacon_order(
+               zb_zdo_network_list_record_h handle, unsigned char* beacon_order)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == beacon_order, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *beacon_order = handle->beacon_order;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_network_list_record_get_superframe_order(
+               zb_zdo_network_list_record_h handle, unsigned char* superframe_order)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == superframe_order, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *superframe_order = handle->superframe_order;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_network_list_record_get_permit_joining(
+               zb_zdo_network_list_record_h handle, unsigned char* permit_joining)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == permit_joining, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *permit_joining = handle->permit_joining;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_extended_pan_id(
+               zb_zdo_neighbor_table_desc_h handle, ieee_addr extended_pan_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->extended_pan_id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == extended_pan_id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(extended_pan_id, handle->extended_pan_id, sizeof(ieee_addr));
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_ieee_addr(
+               zb_zdo_neighbor_table_desc_h handle, ieee_addr addr64)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == handle->addr64, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == addr64, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(addr64, handle->addr64, sizeof(ieee_addr));
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_nwk_addr(
+               zb_zdo_neighbor_table_desc_h handle, nwk_addr* addr16)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == addr16, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *addr16 = handle->addr16;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_device_type(
+               zb_zdo_neighbor_table_desc_h handle, unsigned char* device_type)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == device_type, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *device_type = handle->device_type;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_rx_on_when_idle(
+               zb_zdo_neighbor_table_desc_h handle, unsigned char* rx_on_when_idle)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == rx_on_when_idle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *rx_on_when_idle = handle->rx_on_when_idle;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_relationship(
+               zb_zdo_neighbor_table_desc_h handle, unsigned char* releationship)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == releationship, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *releationship = handle->relationship;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_permit_joining(
+               zb_zdo_neighbor_table_desc_h handle, unsigned char* permit_joining)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == permit_joining, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *permit_joining = handle->permit_joining;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_depth(
+               zb_zdo_neighbor_table_desc_h handle, unsigned char* depth)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == depth, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *depth = handle->depth;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_neighbor_table_desc_get_lqi(zb_zdo_neighbor_table_desc_h handle,
+               unsigned char* lqi)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == lqi, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *lqi = handle->lqi;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_routing_table_get_dst_addr(zb_zdo_routing_table_h handle,
+               nwk_addr* dst_addr)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dst_addr, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *dst_addr = handle->dst_addr;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_routing_table_get_dst_status(zb_zdo_routing_table_h handle,
+               unsigned char *status)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == status, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *status = handle->status;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_routing_table_get_memory_constrained(
+               zb_zdo_routing_table_h handle, unsigned char *memory_constrained)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == memory_constrained, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *memory_constrained = handle->memory_constrained;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_routing_table_get_many_to_one(zb_zdo_routing_table_h handle,
+               unsigned char *many_to_one)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == many_to_one, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *many_to_one = handle->many_to_one;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_routing_table_get_route_record_required(
+               zb_zdo_routing_table_h handle, unsigned char *route_record_required)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == route_record_required, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *route_record_required = handle->route_record_required;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_routing_table_get_next_hop_addr(
+               zb_zdo_routing_table_h handle, nwk_addr *next_hop_addr)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == next_hop_addr, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *next_hop_addr = handle->next_hop_addr;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_binding_table_get_src_addr(zb_zdo_binding_table_h handle,
+               ieee_addr src_addr)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(src_addr, handle->src_addr64, sizeof(ieee_addr));
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_binding_table_get_src_ep(zb_zdo_binding_table_h handle,
+               unsigned char* src_ep)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == src_ep, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *src_ep = handle->src_ep;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_binding_table_get_cluster_id(zb_zdo_binding_table_h handle,
+               unsigned short *cluster_id)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cluster_id, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *cluster_id = handle->cluster_id;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_binding_table_get_dst_addr_mode(zb_zdo_binding_table_h handle,
+               unsigned char* dst_addr_mode)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dst_addr_mode, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *dst_addr_mode = handle->dst_addr_mode;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_binding_table_get_dst_addr16(zb_zdo_binding_table_h handle,
+               nwk_addr* addr16)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == addr16, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *addr16 = handle->dst_addr16;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_binding_table_get_dst_addr64(zb_zdo_binding_table_h handle,
+               ieee_addr addr64)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == addr64, ZIGBEE_ERROR_INVALID_PARAMETER);
+       memcpy(addr64, handle->dst_addr64, sizeof(ieee_addr));
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_binding_table_get_dst_ep(zb_zdo_binding_table_h handle,
+               unsigned char* dst_ep)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dst_ep, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *dst_ep = handle->dst_ep;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_discovery_cache_get_ieee_addr(zb_zdo_discovery_cache_h handle,
+               ieee_addr addr64)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       addr64 = handle->addr64;
+       return ZIGBEE_ERROR_NONE;
+}
+
+API int zb_discovery_cache_get_nwk_addr(zb_zdo_discovery_cache_h handle,
+               nwk_addr* addr16)
+{
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == addr16, ZIGBEE_ERROR_INVALID_PARAMETER);
+       *addr16 = handle->addr16;
+       return ZIGBEE_ERROR_NONE;
+}
diff --git a/lib/zbl.c b/lib/zbl.c
new file mode 100644 (file)
index 0000000..2ebb24e
--- /dev/null
+++ b/lib/zbl.c
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <glib.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <zb-log.h>
+#include <zb-common.h>
+
+#include "zbl.h"
+#include "zbl-dbus.h"
+#include "zigbee.h"
+
+API int zb_create(zigbee_h *handle)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       zigbee_h h = calloc(1, sizeof(struct zbl_zigbee_s));
+       RETVM_IF(NULL == h, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+       *handle = h;
+
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+       ret = zbl_dbus_start(*handle);
+       DBG("zbl_dbus_start()=0x%X", ret);
+
+       return ret;
+}
+
+API void zb_destroy(zigbee_h handle)
+{
+       RET_IF(NULL == handle);
+       zbl_dbus_stop();
+}
+
+API int zb_enable(zigbee_h handle, zb_event_cb event_handler)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_enable(handle, event_handler);
+       DBG("zbl_enable()=0x%X", ret);
+       return ret;
+}
+
+API int zb_disable(zigbee_h handle)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_disable();
+       DBG("zbl_disable()=0x%X", ret);
+       return ret;
+}
+
+API int zb_hw_reset(zigbee_h handle)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_hw_reset();
+       DBG("zbl_hw_reset()=0x%X", ret);
+       return ret;
+}
+
+API int zb_coex_start(zigbee_h handle, unsigned char channel)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_coex_start(channel);
+       DBG("zbl_coex_start()=0x%X", ret);
+       return ret;
+}
+
+API int zb_coex_stop(zigbee_h handle)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_coex_stop();
+       DBG("zbl_coex_stop()=0x%X", ret);
+       return ret;
+}
+
+API int zb_form_network(zigbee_h handle)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_form_network(handle);
+       DBG("zbl_form_network()=0x%X", ret);
+       return ret;
+}
+
+API int zb_disable_network(zigbee_h handle)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_disable_network();
+       DBG("zb_disable_network()=0x%X", ret);
+       return ret;
+}
+
+API int zb_leave_device(zigbee_h handle, ieee_addr addr, bool remove_children, bool rejoin)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_leave_device(addr, remove_children, rejoin);
+       DBG("zbl_leave_device()=0x%X", ret);
+       return ret;
+}
+
+API int zb_permit_join(zigbee_h handle, unsigned char timeout)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_permit_join(timeout, TRUE);
+       DBG("zb_permit_join()=0x%X", ret);
+       return ret;
+}
+
+API int zb_get_controller_mac_address(zigbee_h handle, ieee_addr addr64)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+       ret = zbl_get_controller_mac_address(addr64);
+       DBG("zbl_get_controller_mac_address()=0x%X", ret);
+       return ret;
+}
+
+API int zb_get_network_info(zigbee_h handle, ieee_addr addr64, nwk_addr *nodeid,
+               nwk_addr *panid, unsigned char *channel, unsigned char *tx_power)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+       ret = zbl_get_network_info(addr64, nodeid, panid, channel, tx_power);
+       DBG("zbl_get_network_info()=0x%X", ret);
+       return ret;
+}
+
+API int zb_device_list_free(zb_end_device_info_h *list)
+{
+       int i = 0, j = 0;
+       RETV_IF(NULL == list, ZIGBEE_ERROR_INVALID_PARAMETER);
+       while (list[i]) {
+               j = 0;
+               while (list[i]->desc && list[i]->desc[j]) {
+                       free(list[i]->desc[j]);
+                       j++;
+               }
+               if (list[i]->desc)
+                       free(list[i]->desc);
+               free(list[i]);
+               i++;
+       }
+       free(list);
+       return ZIGBEE_ERROR_NONE;
+}
diff --git a/lib/zbl.h b/lib/zbl.h
new file mode 100644 (file)
index 0000000..b2fb080
--- /dev/null
+++ b/lib/zbl.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_LIBRARY_H__
+#define __TIZEN_NETWORK_ZIGBEE_LIBRARY_H__
+
+#include <glib.h>
+#include <zigbee.h>
+
+#ifdef API
+#undef API
+#endif /* API */
+
+#define API __attribute__((visibility("default")))
+
+struct zbl_zigbee_s {
+       GList *dbus_sub_ids;
+       zb_event_cb event_handler;
+#ifdef ZB_FEATURE_GLOBAL_RSP_SYNC
+       GList *global_cmd_req;
+#endif
+};
+
+#endif /* TIZEN_NETWORK_ZIGBEE_LIBRARY_H__ */
diff --git a/packaging/capi-network-zigbee.manifest b/packaging/capi-network-zigbee.manifest
new file mode 100644 (file)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
diff --git a/packaging/capi-network-zigbee.spec b/packaging/capi-network-zigbee.spec
new file mode 100644 (file)
index 0000000..14302d7
--- /dev/null
@@ -0,0 +1,142 @@
+Name: capi-network-zigbee
+Summary: Network Zigbee Service in Tizen CAPI
+Version: 0.0.1
+Release: 0
+Group: Network & Connectivity/Other
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+Source1001: %{name}.manifest
+Source1003: lib%{name}-old.manifest
+Source1004: test-%{name}-old.manifest
+BuildRequires: cmake
+BuildRequires: pkgconfig(dbus-glib-1)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(capi-base-common)
+%if 0%{?tizen_version_major} >= 3
+BuildRequires: pkgconfig(cynara-client)
+BuildRequires: pkgconfig(cynara-session)
+BuildRequires: pkgconfig(cynara-creds-gdbus)
+%endif
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+#%define _unitdir /usr/lib/systemd/system
+%define project_name zigbee
+
+%description
+zigbee service library
+
+%package lib
+Summary: Zigbee Library (Shared Library)
+Group: Network & Connectivity/Other
+Requires: %{name} = %{version}
+
+%description lib
+Zigbee Library (Shared Library)
+This package aims to support the Zigbee service in Tizen platform.
+
+%package devel
+Summary: Zigbee Library (Shared Library) (development)
+Group: Network & Connectivity/Other
+Requires: %{name} = %{version}-%{release}
+Requires: %{name}-lib
+
+%description devel
+Zigbee Library (Shared Library) (Development)
+This package aims to support the Zigbee developers.
+
+%package -n test-%{name}
+Summary: Test Application for Zigbee
+Group: Network & Connectivity/Other
+Requires: %{name}-lib
+
+%description -n test-%{name}
+Zigbee Library test program(s)
+
+%prep
+%setup #-q
+chmod g-w %_sourcedir/*
+%if 0%{?tizen_version_major} >= 3
+cp %{SOURCE1001} ./%{name}.manifest
+cp %{SOURCE1001} ./lib%{name}.manifest
+cp %{SOURCE1004} ./test-%{name}.manifest
+%else
+cp %{SOURCE1001} ./%{name}.manifest
+cp %{SOURCE1003} ./lib%{name}.manifest
+cp %{SOURCE1004} ./test-%{name}.manifest
+%endif
+
+%build
+%if 0%{?tizen_version_major} >= 3
+TZ_VER_3=1
+%else
+TZ_VER_3=0
+%endif
+
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+
+%cmake . -DMAJORVER=%{MAJORVER} -DFULLVER=%{version} \
+       -DBIN_INSTALL_DIR:PATH=%{_bindir} \
+       -DZB_FEATURE_GLOBAL_RSP_SYNC=1
+
+%install
+rm -rf %{buildroot}/BUILD/%{name}
+%make_install
+
+%if 0%{?tizen_version_major} >= 3
+%else
+mkdir -p %{buildroot}/%{_datadir}/license
+cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}
+cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-lib
+cp LICENSE.APLv2 %{buildroot}/%{_datadir}/license/%{name}-test
+%endif
+
+%post
+
+%postun
+/sbin/ldconfig # re-inialize shared library db
+
+%post lib
+/sbin/ldconfig
+
+%postun lib
+/sbin/ldconfig
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%if 0%{?tizen_version_major} < 3
+%{_datadir}/license/%{name}
+%else
+%license LICENSE.APLv2
+%endif
+
+%files lib
+%manifest lib%{name}.manifest
+%defattr(-,root,root,-)
+%{_libdir}/lib%{project_name}.so.*
+%if 0%{?tizen_version_major} >= 3
+%license LICENSE.APLv2
+%else
+%{_datadir}/license/%{name}-lib
+%endif
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/lib%{project_name}.so
+%{_libdir}/pkgconfig/%{name}.pc
+%{_includedir}/%{project_name}/*.h
+%{_includedir}/%{project_name}/zdo/*.h
+%{_includedir}/%{project_name}/zcl/*.h
+
+%files -n test-%{name}
+%manifest test-%{name}.manifest
+%defattr(-,root,root,-)
+%if 0%{?tizen_version_major} >= 3
+%license LICENSE.APLv2
+%else
+%{_datadir}/license/%{name}-test
+%endif
+%{_bindir}/test-zigbee
+%{_bindir}/test-zigbee2
diff --git a/packaging/libcapi-network-zigbee-old.manifest b/packaging/libcapi-network-zigbee-old.manifest
new file mode 100644 (file)
index 0000000..3919bd4
--- /dev/null
@@ -0,0 +1,28 @@
+<manifest>
+       <define>
+               <domain name="zigbee" />
+               <permit>
+                       <smack permit="dbus" type="rwx" />
+               </permit>
+               <request>
+                       <smack request="dbus" type="rwx" />
+                       <smack request="device::app_logging" type="w" />
+                       <smack request="device::sys_logging" type="w" />
+               </request>
+       </define>
+       <assign>
+               <filesystem path="/usr/share/license/capi-network-zigbee-lib" label="_" />
+               <filesystem path="/usr/lib/libzigbee.so.*" label="_" />
+
+               <dbus name="org.tizen.zigbee.dbus" own="zigbee" bus="system">
+                       <node name="/org/tizen/zigbee/dbus">
+                               <interface name="org.tizen.zigbee.dbus">
+                                       <annotation name="com.tizen.smack" value="zigbee" />
+                               </interface>
+                       </node>
+               </dbus>
+       </assign>
+       <request>
+               <domain name="zigbee" />
+       </request>
+</manifest>
diff --git a/packaging/test-capi-network-zigbee-old.manifest b/packaging/test-capi-network-zigbee-old.manifest
new file mode 100644 (file)
index 0000000..740b259
--- /dev/null
@@ -0,0 +1,13 @@
+<manifest>
+       <define>
+               <domain name="zigbee-test" />
+               <request>
+                       <smack request="zigbee" type="rw" />
+                       <smack request="device::app_logging" type="w" />
+                       <smack request="device::sys_logging" type="w" />
+               </request>
+       </define>
+       <request>
+               <domain name="zigbee-test" />
+       </request>
+</manifest>
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..501363a
--- /dev/null
@@ -0,0 +1,57 @@
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+SET(test "test-zigbee")
+
+INCLUDE(FindPkgConfig)
+#pkg_check_modules(${test} REQUIRED dlog glib-2.0 gio-2.0 gio-unix-2.0 dlog capi-base-common)
+pkg_check_modules(${test} REQUIRED dlog glib-2.0)
+LINK_DIRECTORIES(${${test}_pkgs_LIBRARY_DIR})
+
+FOREACH(flag ${${test}_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+# Temporary debug info enable : -O0 -g
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -pthread -O0 -g")
+SET(CMAKE_EXE_LINKER_FLAGS "-lpthread")
+
+SET(ORG_SOURCES
+       test-zigbee.c
+)
+SET(NEW_SOURCES
+       main.c
+       menu.c
+       custom.c
+       zcl-cluster-alarm.c
+       zcl-cluster-colorctrl.c
+       zcl-cluster-group.c
+       zcl-cluster-identity.c
+       zcl-cluster-levelctrl.c
+       zcl-cluster-onoff.c
+       zcl-cluster-pollctrl.c
+       zcl-cluster-scene.c
+       zcl-cluster-thermostat.c
+       zcl-global-cmd.c
+       zdo-binding.c
+       zdo-device.c
+       zdo-network.c
+)
+
+#aux_source_directory(. sources)
+#FOREACH(src ${sources})
+#      GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+#      MESSAGE("[KSR] ${src_name} : ${test}")
+#      ADD_EXECUTABLE(${src_name} ${src})
+#      TARGET_LINK_LIBRARIES(${src_name} ${${src_name}_LDFLAGS} ${CLIENT})
+#      INSTALL(TARGETS ${src_name} DESTINATION ${BIN_INSTALL_DIR})
+#ENDFOREACH(src)
+
+# test-zigbee
+ADD_EXECUTABLE(test-zigbee ${ORG_SOURCES})
+TARGET_LINK_LIBRARIES(test-zigbee ${${test}_LDFLAGS} ${CLIENT})
+INSTALL(TARGETS test-zigbee DESTINATION ${BIN_INSTALL_DIR})
+
+# test-zigbee (new)
+ADD_EXECUTABLE(test-zigbee2 ${NEW_SOURCES})
+TARGET_LINK_LIBRARIES(test-zigbee2 ${${test}_LDFLAGS} ${CLIENT})
+INSTALL(TARGETS test-zigbee2 DESTINATION ${BIN_INSTALL_DIR})
diff --git a/test/custom.c b/test/custom.c
new file mode 100644 (file)
index 0000000..541ece5
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+extern nwk_addr  dest_addr16;
+
+void _zb_aps_send_rsp(nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned short cluster_id, unsigned short profile_id, unsigned short payload_len,
+               unsigned char *payload, void *user_data)
+{
+       unsigned short i = 0;
+       msgp("\n_zb_aps_send_rsp()");
+       msg("  src_ep      : 0x%X", src_ep);
+       msg("  src_ep      : 0x%X", dst_ep);
+       msg("  cluster_id  : 0x%04X", cluster_id);
+       msg("  profile_id  : 0x%04X", profile_id);
+       msg("  payload_len : 0x%04X", payload_len);
+       msg("  payload : ");
+       msgn("      ");
+       for (i = 0 ; i < payload_len; i++) {
+               msgn("%X ", payload[i]);
+       }
+       msgn("\n");
+}
+
+void _zb_zcl_send_rsp(nwk_addr addr16, unsigned char src_ep, unsigned char dst_ep,
+               unsigned short cluster_id, unsigned short profile_id, unsigned short payload_len,
+               unsigned char *payload, void *user_data)
+{
+       unsigned short i = 0;
+       msgp("\n_zb_zcl_send_rsp()");
+       msg("  src_ep      : 0x%X", src_ep);
+       msg("  src_ep      : 0x%X", dst_ep);
+       msg("  cluster_id  : 0x%04X", cluster_id);
+       msg("  profile_id  : 0x%04X", profile_id);
+       msg("  payload_len : 0x%04X", payload_len);
+       msg("  payload : ");
+       msgn("      ");
+       for (i = 0 ; i < payload_len; i++) {
+               msgn("%X ", payload[i]);
+       }
+       msgn("\n");
+}
+
+void _zb_send_to_local_rsp(unsigned short length, unsigned char *data, void *user_data)
+{
+       unsigned short i = 0;
+       msgp("\n_zb_send_to_local_rsp()");
+       msg("  length : 0x%04X", length);
+       msg("  data : ");
+       msgn("      ");
+       for (i = 0 ; i < length; i++) {
+               msgn("%X ", data[i]);
+       }
+       msgn("\n");
+}
+
+static int run_aps_send(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char aps_frame_ctl = ZB_APS_DELIVERY_UNICAST | ZB_APS_NO_ACK_REQUEST;
+       unsigned char src_ep = 1;
+       unsigned char dst_ep = 1;
+       unsigned short cluster_id = 0xFC05;
+       unsigned short profile_id = 0xFC01;
+       unsigned char zcl_frame_ctl = ZB_ZCL_FC_GLOBALLY_USED | ZB_ZCL_CLIENT_TO_SERVER |
+                                                               ZB_ZCL_FC_NOT_MANUFACTURER | ZB_ZCL_DISABLE_DEFAULT_RESPONSE;
+       unsigned short mfg_code = 0x110A;
+       unsigned short payload_len = 4;
+       unsigned char payload[4] = { 0x00, 0x01, 0x02, 0x03 };
+
+       ret = zb_aps_send(handle, dest_addr16, aps_frame_ctl, src_ep, dst_ep,
+                               cluster_id, profile_id, zcl_frame_ctl, mfg_code,
+                               payload_len, payload, _zb_aps_send_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_aps_send(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_aps_send_data() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_zcl_send(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char src_ep = 2;
+       unsigned char dst_ep = 2;
+       unsigned short cluster_id = 0x0000;
+       unsigned char zcl_frame_ctl = ZB_ZCL_FC_GLOBALLY_USED | ZB_ZCL_CLIENT_TO_SERVER |
+                                                               ZB_ZCL_FC_NOT_MANUFACTURER | ZB_ZCL_DISABLE_DEFAULT_RESPONSE;
+       unsigned char cmd = 0x0;
+       unsigned short payload_len = 4;
+       unsigned char payload[4] = { 0x00, 0x01, 0x02, 0x03 };
+
+       ret = zb_zcl_send(handle, dest_addr16, src_ep, dst_ep, cluster_id,
+                               zcl_frame_ctl, cmd, payload_len, payload, _zb_zcl_send_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_send(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_send() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_send_to_local(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short length = 4;
+       unsigned char data[4] = { 0x00, 0x01, 0x02, 0x03 };
+
+       ret = zb_send_to_local(handle, length, data, _zb_send_to_local_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_send_to_local(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_send_to_local() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data menu_custom_aps_send[] = {
+       { "1", "run", NULL, run_aps_send, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_custom_zcl_send[] = {
+       { "1", "run", NULL, run_zcl_send, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_custom_local_send[] = {
+       { "1", "run", NULL, run_send_to_local, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_custom[] = {
+       { "1", "APS send data", menu_custom_aps_send, NULL, NULL },
+       { "2", "ZCL send data", menu_custom_zcl_send, NULL, NULL },
+       { "3", "Local send data", menu_custom_local_send, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/main.c b/test/main.c
new file mode 100644 (file)
index 0000000..1e6c197
--- /dev/null
@@ -0,0 +1,950 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+zigbee_h handle;
+
+extern struct menu_data menu_zdo_binding[];
+extern struct menu_data menu_zdo_device[];
+extern struct menu_data menu_zdo_network[];
+
+extern struct menu_data menu_zcl_global[];
+extern struct menu_data menu_zcl_cluster[];
+extern struct menu_data menu_custom[];
+
+static char data_remove_children[MENU_DATA_SIZE + 1] = "1";
+static char data_rejoin[MENU_DATA_SIZE + 1] = "0";
+static char data_pj_timeout[MENU_DATA_SIZE + 1] = "90";
+static char data_choose_target[MENU_DATA_SIZE + 1] = "0";
+static char data_dest_addr16[MENU_DATA_SIZE + 1] = "";
+
+nwk_addr panid = 0x615F;
+ieee_addr co_addr64 = { 0xD0, 0x52, 0xA8, 0xA9, 0x8F, 0xB7, 0x00, 0x01 };
+
+nwk_addr  st_addr16 = 0x708B;
+ieee_addr st_addr64 = { 0x00, 0x0D, 0x6F, 0x00, 0x04, 0x2B, 0xBE, 0x14 };
+
+nwk_addr  sj_addr16 = 0x4756;
+ieee_addr sj_addr64 = { 0x24, 0xFD, 0x5B, 0x00, 0x01, 0x01, 0x86, 0xB6 };
+
+nwk_addr  dest_addr16 = 0x1D1A;
+ieee_addr dest_addr64 = { 0x00, 0x12, 0x4B, 0x00, 0x02, 0xF2, 0x58, 0x5B };
+
+simple_desc_s st_ep1, st_ep2, st_ep3, st_ep4, sj_ep1;
+simple_desc_s dimmer_ep1, s_thermostat_ep1, huebulb_ep1;
+
+zb_end_device_info_h *target_list = NULL;
+int target_list_count;
+
+static const char* zb_event_str[] = {
+       /* 0x00 */
+       "ZB_ZDP_ENABLE_EVENT",
+       "ZB_ZDP_FORM_NETWORK_DONE",
+       "ZB_ZDP_JOIN_EVENT",
+       "ZB_ZDP_REJOIN_EVENT",
+       "ZB_ZDP_CHILD_LEFT",
+       "ZB_ZDP_LEAVE_DONE_EVENT",
+       "ZB_ZDP_UPDATED_NETWORK_NOTIFICATION_EVENT",
+       "ZB_ZDP_BIND_RSP_EVENT",
+       "ZB_ZDP_UNBIND_RSP_EVENT",
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+       /* 0x10 */
+       "ZB_ZCL_GLOBAL_DEFAULT_RSP_EVENT",
+       "ZB_ZCL_GLOBAL_ATTRIBUTE_REPORT_EVENT",
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+       /* 0x20 */
+       "ZB_ZCL_ALARM_EVENT",
+       "ZB_ZCL_IAS_ZONE_ENROLL_REQUEST_EVENT",
+       "ZB_ZCL_IAS_ZONE_STATUS_CHANGE_NOTIFICATION_EVENT",
+       "ZB_ZCL_IAS_ZONE_STATUS_CHANGE_EXTENDED_NOTIFICATION_EVENT",
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL,
+
+       /* 0x30 */
+       "ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_ATTRIBUTE_REPORT_EVENT",
+       "ZB_ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_REPORT_EVENT",
+       "ZB_ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_REPORT_EVENT",
+       "ZB_ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_REPORT_EVENT",
+       "ZB_ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_REPORT_EVENT",
+       "ZB_ZCL_COLOR_CONTROL_CURRENT_TEMPERATURE_ATTRIBUTE_REPORT_EVENT",
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL,
+
+       /* 0x40 */
+       "ZB_ZCL_DOOR_LOCK_OPERATIONAL_NOTIFICATION_EVENT",
+       "ZB_ZCL_DOOR_LOCK_PROGRAMING_NOTIFICATION_EVENT",
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+       /* 0x50 */
+       "ZB_ZCL_SIMPLE_METERING_REMOVE_MIRROR_EVENT",
+       "ZB_ZCL_SIMPLE_METERING_REQUEST_MIRROR_EVENT",
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+       /* 0x60 */
+       NULL,
+};
+
+static void _init_endpoints()
+{
+       /* Samjin power outlet EP1 */
+       sj_ep1.ep = 1;
+       sj_ep1.profile_id = 0x0104;
+       sj_ep1.device_id = 0x0002;
+       sj_ep1.num_of_in_clusters = 8;
+       sj_ep1.num_of_out_clusters = 1;
+       /* In clusters : 0000 0003 0004 0005 0006 0009 0B04 0B05 */
+       sj_ep1.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       sj_ep1.in_clusters[1] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       sj_ep1.in_clusters[2] = ZB_ZCL_GROUPS_CLUSTER_ID;
+       sj_ep1.in_clusters[3] = ZB_ZCL_SCENES_CLUSTER_ID;
+       sj_ep1.in_clusters[4] = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       sj_ep1.in_clusters[5] = ZB_ZCL_ALARM_CLUSTER_ID;
+       sj_ep1.in_clusters[6] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       /* Out clusters : 0019 */
+       unsigned short sj_out_clusters[] = { ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID };
+
+       /* SmartThings open/close sensor EP1 */
+       st_ep1.ep = 1;
+       st_ep1.profile_id = 0x0104;
+       st_ep1.device_id = 0x0402;
+       st_ep1.num_of_in_clusters = 7;
+       st_ep1.num_of_out_clusters = 1;
+       st_ep1.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       st_ep1.in_clusters[1] = ZB_ZCL_POWER_CONFIG_CLUSTER_ID;
+       st_ep1.in_clusters[2] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       st_ep1.in_clusters[3] = ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID;
+       st_ep1.in_clusters[4] = ZB_ZCL_IAS_ZONE_CLUSTER_ID;
+       st_ep1.in_clusters[5] = ZB_ZCL_POLL_CONTROL_CLUSTER_ID;
+       st_ep1.in_clusters[6] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       st_ep1.out_clusters[0] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+
+       /* SmartThings open/close sensor EP2 */
+       st_ep2.ep = 2;
+       st_ep2.profile_id = 0xC2DF;
+       st_ep2.device_id = 0x000C;
+       st_ep2.num_of_in_clusters = 4;
+       st_ep2.num_of_out_clusters = 1;
+       st_ep2.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       st_ep2.in_clusters[1] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       st_ep2.in_clusters[2] = ZB_ZCL_SCENES_CLUSTER_ID;
+       st_ep2.in_clusters[3] = 0xFC0F;
+       st_ep2.out_clusters[0] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+
+       /* SmartThings Motion Sensor EP1 */
+       st_ep3.ep = 1;
+       st_ep3.profile_id = 0x0104;
+       st_ep3.device_id = 0x0402;
+       st_ep3.num_of_in_clusters = 7;
+       st_ep3.num_of_out_clusters = 1;
+       st_ep3.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       st_ep3.in_clusters[1] = ZB_ZCL_POWER_CONFIG_CLUSTER_ID;
+       st_ep3.in_clusters[2] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       st_ep3.in_clusters[3] = ZB_ZCL_POLL_CONTROL_CLUSTER_ID;
+       st_ep3.in_clusters[4] = ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID;
+       st_ep3.in_clusters[5] = ZB_ZCL_IAS_ZONE_CLUSTER_ID;
+       st_ep3.in_clusters[6] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       st_ep3.out_clusters[0] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+
+       /* SmartThings Motion Sensor EP2 */
+       st_ep4.ep = 2;
+       st_ep4.profile_id = 0xC2DF;
+       st_ep4.device_id = 0x0107;
+       st_ep4.num_of_in_clusters = 5;
+       st_ep4.num_of_out_clusters = 1;
+       st_ep4.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       st_ep4.in_clusters[1] = ZB_ZCL_POWER_CONFIG_CLUSTER_ID;
+       st_ep4.in_clusters[2] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       st_ep4.in_clusters[3] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       st_ep4.in_clusters[4] = 0xFC46;
+       st_ep4.out_clusters[0] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+
+       /* Things Simulator - GE_ZigBeeDimmer */
+       dimmer_ep1.ep = 1;
+       dimmer_ep1.profile_id = 0x0104;
+       dimmer_ep1.device_id = 0xffff;
+       dimmer_ep1.num_of_in_clusters = 7;
+       dimmer_ep1.num_of_out_clusters = 1;
+       dimmer_ep1.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       dimmer_ep1.in_clusters[1] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       dimmer_ep1.in_clusters[2] = ZB_ZCL_GROUPS_CLUSTER_ID;
+       dimmer_ep1.in_clusters[3] = ZB_ZCL_SCENES_CLUSTER_ID;
+       dimmer_ep1.in_clusters[4] = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       dimmer_ep1.in_clusters[5] = ZB_ZCL_LEVEL_CONTROL_CLUSTER_ID;
+       dimmer_ep1.in_clusters[6] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       /*dimmer_ep1.in_clusters[7] = ZB_ZCL_SIMPLE_METERING_CLUSTER_ID;*/
+       dimmer_ep1.out_clusters[0] = ZB_ZCL_TIME_CLUSTER_ID;
+       /*dimmer_ep1.out_clusters[1] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;*/
+
+       /* Things Simulator - CentraLite_Thermostat */
+       s_thermostat_ep1.ep = 1;
+       s_thermostat_ep1.profile_id = 0x0104;
+       s_thermostat_ep1.device_id = 0xffff;
+       s_thermostat_ep1.num_of_in_clusters = 8;
+       s_thermostat_ep1.num_of_out_clusters = 2;
+       s_thermostat_ep1.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       s_thermostat_ep1.in_clusters[1] = ZB_ZCL_POWER_CONFIG_CLUSTER_ID;
+       s_thermostat_ep1.in_clusters[2] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       s_thermostat_ep1.in_clusters[3] = ZB_ZCL_POLL_CONTROL_CLUSTER_ID;
+       s_thermostat_ep1.in_clusters[4] = ZB_ZCL_THERMOSTAT_CLUSTER_ID;
+       s_thermostat_ep1.in_clusters[5] = ZB_ZCL_FAN_CONTROL_CLUSTER_ID;
+       s_thermostat_ep1.in_clusters[6] = ZB_ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_ID;
+       s_thermostat_ep1.in_clusters[7] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       s_thermostat_ep1.out_clusters[0] = ZB_ZCL_TIME_CLUSTER_ID;
+       s_thermostat_ep1.out_clusters[1] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+
+       /* Things Simulator - Zigbee_HueBulb */
+       huebulb_ep1.ep = 1;
+       huebulb_ep1.profile_id = 0x0104;
+       huebulb_ep1.device_id = 0xffff;
+       huebulb_ep1.num_of_in_clusters = 8;
+       huebulb_ep1.num_of_out_clusters = 1;
+       huebulb_ep1.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       huebulb_ep1.in_clusters[1] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       huebulb_ep1.in_clusters[2] = ZB_ZCL_GROUPS_CLUSTER_ID;
+       huebulb_ep1.in_clusters[3] = ZB_ZCL_SCENES_CLUSTER_ID;
+       huebulb_ep1.in_clusters[4] = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       huebulb_ep1.in_clusters[5] = ZB_ZCL_LEVEL_CONTROL_CLUSTER_ID;
+       huebulb_ep1.in_clusters[6] = ZB_ZCL_COLOR_CONTROL_CLUSTER_ID;
+       huebulb_ep1.in_clusters[7] = ZB_ZCL_ZLL_COMMISSIONING_CLUSTER_ID;
+       huebulb_ep1.out_clusters[0] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+}
+
+static void zigbee_event_cb(nwk_addr addr16, ieee_addr addr64, zb_event_e e, zb_event_data_s ev)
+{
+       unsigned char status, count, ep, command_id;
+       unsigned short cluster_id;
+       msg("");
+       msgp("Event received = %s [0x%02X]", zb_event_str[e], e);
+
+       switch (e) {
+       case ZB_ZDP_ENABLE_EVENT:
+       {
+               status = ev.data.enable->status;
+               msg("  service enabled = %d", status);
+               break;
+       }
+       case ZB_ZDP_FORM_NETWORK_DONE:
+       {
+               msg("  form network done");
+               break;
+       }
+       case ZB_ZDP_JOIN_EVENT:
+       {
+               count = ev.data.join->count;
+               msg("  %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X joined",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+               msg("end-point count=%d", count);
+               break;
+       }
+       case ZB_ZDP_REJOIN_EVENT:
+       {
+               msg("  %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X rejoined",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+               break;
+       }
+       case ZB_ZDP_CHILD_LEFT:
+       {
+               msg("  %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X left",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+               break;
+       }
+       case ZB_ZDP_LEAVE_DONE_EVENT:
+       {
+               msg("  0x%04X leave done\n", addr16);
+               break;
+       }
+       case ZB_ZDP_UPDATED_NETWORK_NOTIFICATION_EVENT:
+       {
+               msg("  Update network notification received\n");
+               break;
+       }
+       case ZB_ZDP_BIND_RSP_EVENT:
+       {
+               /* zb_parse_bind_rsp(ev, &status); */
+               /* msg("binding %04X, result=%0X\n", addr16, status); */
+               msg("  Not implemented");
+               break;
+       }
+       case ZB_ZDP_UNBIND_RSP_EVENT:
+       {
+               /* zb_parse_unbind_rsp(ev, &status); */
+               /* msg("unbinding %04X, result=%0X\n", addr16, status); */
+               msg("  Not implemented");
+               break;
+       }
+       case ZB_ZCL_GLOBAL_DEFAULT_RSP_EVENT:
+       {
+               ep = ev.data.global_default_rsp->ep;
+               cluster_id = ev.data.global_default_rsp->cluster_id;
+               command_id = ev.data.global_default_rsp->command_id;
+               status = ev.data.global_default_rsp->status;
+
+               msg("  addr16     = %04X", addr16);
+               msg("  endpoint   = %02X", ep);
+               msg("  cluster_id = %04X", cluster_id);
+               msg("  command_id = %02X", command_id);
+               msg("  status     = %02X", status);
+               break;
+       }
+       case ZB_ZCL_GLOBAL_ATTRIBUTE_REPORT_EVENT:
+       {
+               int i, j, count, rec_len;
+               int ret;
+               unsigned char *buf = NULL;
+               unsigned short id;
+               unsigned char type;
+               attr_report_h *t;
+               zb_value_h value;
+
+               t = ev.data.global_attr_report->records;
+               rec_len = ev.data.global_attr_report->count;
+               msg("Global Attribute Report Event Received from = 0x%04X record_len=%d",
+                       addr16, rec_len);
+               for (j = 0; j < rec_len; j++) {
+                       zb_get_id_from_attr_report(t[j], &id);
+                       msg("  id   = [0x%04X]", id);
+                       zb_get_type_from_attr_report(t[j], &type);
+                       msg("  type = [0x%02X]", type);
+                       zb_create_value(&value);
+                       zb_get_value_from_attr_report(t[j], value);
+                       ret = zb_get_value(value, &type, &buf, &count);
+                       if (ZIGBEE_ERROR_NONE == ret) {
+                               for (i = 0; i < count; i++)
+                                       msg("    0x%02X ", buf[i]);
+                       }
+                       msg("");
+                       if (buf) {
+                               free(buf);
+                               buf = NULL;
+                       }
+                       zb_destroy_value(value);
+               }
+               break;
+       }
+       case ZB_ZCL_ALARM_EVENT:
+       {
+               msg("Alarm Event Received\n");
+               break;
+       }
+       case ZB_ZCL_IAS_ZONE_ENROLL_REQUEST_EVENT:
+       {
+               /*nwk_addr addr16;*/
+               unsigned short zone_type;
+               unsigned char ep, mfg_code;
+               msg("IAS Zone Request Received\n");
+
+               ep = ev.data.ias_enroll_request->src_ep;
+               zone_type = ev.data.ias_enroll_request->zone_type;
+               mfg_code = ev.data.ias_enroll_request->mfg_code;
+
+               /*msg("Network Address from 0x%04X\n", addr16);*/
+               msg("  End-Point from 0x%02X", ep);
+               msg("  Zone Type = 0x%04X", zone_type);
+               msg("  Manufacturer Code = 0x%02X", mfg_code);
+               zb_zcl_zone_enroll_response(handle, addr16, ep, ZB_ZCL_IAS_ZONE_ENROLL_SUCCESS,
+                       0x0001);
+               break;
+       }
+       case ZB_ZCL_IAS_ZONE_STATUS_CHANGE_NOTIFICATION_EVENT:
+       {
+               unsigned short zone_status;
+
+               zone_status = ev.data.ias_noti->zone_status;
+               ep = ev.data.ias_noti->src_ep;
+               msg("  addr16      = 0x%04X", addr16);
+               msg("  endpoint    = 0x%02X", ep);
+               msg("  zone_status = 0x%04X", zone_status);
+               break;
+       }
+       case ZB_ZCL_IAS_ZONE_STATUS_CHANGE_EXTENDED_NOTIFICATION_EVENT:
+       {
+               unsigned short zone_status, zone_id, delay;
+               unsigned char extended_status;
+
+               ep = ev.data.ias_extended_noti->src_ep;
+               zone_status = ev.data.ias_extended_noti->zone_status;
+               extended_status = ev.data.ias_extended_noti->extended_status;
+               zone_id = ev.data.ias_extended_noti->zone_id;
+               delay = ev.data.ias_extended_noti->delay;
+
+               msg("  addr16          = 0x%04X", addr16);
+               msg("  endpoint        = 0x%02X", ep);
+               msg("  zone_status     = 0x%04X", zone_status);
+               msg("  extended_status = 0x%02X", extended_status);
+               msg("  zone_id         = 0x%04X", zone_id);
+               msg("  delay           = 0x%04X", delay);
+
+               /* Closed or not alarmed */
+               if (0x01 == (zone_status & 0x01))
+                       zb_zcl_onoff_control(handle, dest_addr16, 1, ZB_ZCL_OFF);
+               /* Opened or alarmed */
+               else if (0x00 == (zone_status & 0x01))
+                       zb_zcl_onoff_control(handle, dest_addr16, 1, ZB_ZCL_ON);
+               break;
+       }
+       case ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_TEMPERATURE_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_DOOR_LOCK_OPERATIONAL_NOTIFICATION_EVENT:
+               break;
+       case ZB_ZCL_DOOR_LOCK_PROGRAMING_NOTIFICATION_EVENT:
+               break;
+       case ZB_ZCL_SIMPLE_METERING_REMOVE_MIRROR_EVENT:
+               break;
+       case ZB_ZCL_SIMPLE_METERING_REQUEST_MIRROR_EVENT:
+               break;
+       default:
+               msgp("Unhandled Event received = [0x%02X]", e);
+               break;
+       }
+       msg("");
+}
+
+static int run_create(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       if (handle) {
+               msg("Already handle exist.");
+               return RET_FAILURE;
+       }
+
+       ret = zb_create(&handle);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_create(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       return RET_SUCCESS;
+}
+
+static int run_destroy(MManager *mm, struct menu_data *menu)
+{
+       if (NULL == handle) {
+               msg("Already destroyed or not created.");
+               return RET_FAILURE;
+       }
+
+       zb_destroy(handle);
+       handle = NULL;
+
+       return RET_SUCCESS;
+}
+
+static int run_enable(MManager *mm, struct menu_data *menu)
+{
+       /* Register event callback */
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_enable(handle, zigbee_event_cb);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_enable(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_enable() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+static int run_disable(MManager *mm, struct menu_data *menu)
+{
+       /* De-register event callback */
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_disable(handle);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_disable(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_disable() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+static int run_hw_reset(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_hw_reset(handle);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_hw_reset(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_hw_reset() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+static int run_coex_start(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char channel = 11;
+
+       ret = zb_coex_start(handle, channel);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_coex_start(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_coex_start() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+static int run_coex_stop(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_coex_stop(handle);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_coex_stop(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_coex_stop() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+static int run_get_network_info(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       nwk_addr nodeid;
+       nwk_addr panid;
+       unsigned char channel;
+       unsigned char tx_power;
+
+       ret = zb_get_network_info(handle, co_addr64, &nodeid, &panid, &channel, &tx_power);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_get_network_info(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_get_network_info() ret: [0x%X]", ret);
+       msg("  IEEE ADDR : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                       co_addr64[0], co_addr64[1], co_addr64[2],
+                       co_addr64[3], co_addr64[4], co_addr64[5],
+                       co_addr64[6], co_addr64[7]);
+       msg("  nodeID [0x%02X]", nodeid);
+       msg("  PanID [0x%02X]", panid);
+       msg("  Channel [%d] Tx Power [%d]", channel, tx_power);
+
+       return RET_SUCCESS;
+}
+
+static int run_get_controller_mac_address(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_get_controller_mac_address(handle, co_addr64);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_get_controller_mac_address(%d) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_get_controller_mac_address() ret: [0x%X]", ret);
+       msg("IEEE ADDR 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X",
+               co_addr64[0], co_addr64[1], co_addr64[2], co_addr64[3],
+               co_addr64[4], co_addr64[5], co_addr64[6], co_addr64[7]);
+
+       return RET_SUCCESS;
+}
+
+static int run_get_end_device_list(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       int i, j;
+       int count;
+       nwk_addr addr16;
+       ieee_addr addr64;
+       unsigned char num_of_ep;
+       unsigned char ep_list[10];
+       zb_end_device_info_h *list = NULL;
+
+       ret = zb_get_all_device_list(handle, &count, &list);
+       for (i = 0; i < count && list; i++) {
+               zb_get_network_address(list[i], &addr16);
+               zb_get_ieee_address((list)[i], addr64);
+
+               if (!strncmp((char *)sj_addr64, (char *)addr64, sizeof(addr64))) {
+                       sj_addr16 = addr16;
+                       msgb("Samjin Power Outlet Find!!");
+               }
+               if (!strncmp((char *)st_addr64, (char *)addr64, sizeof(addr64))) {
+                       st_addr16 = addr16;
+                       msgb("ST Open/Close Sensor Find!!");
+               }
+               msg("network address = 0x%02X", addr16);
+               msg("   ieee address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+
+               zb_get_num_of_ep((list)[i], &num_of_ep);
+               msg("number of end-points = 0x%04X", num_of_ep);
+
+               memset(ep_list, 0, sizeof(ep_list));
+               zb_get_ep_list((list)[i], ep_list);
+               msgn("  ");
+               for (j = 0; j < num_of_ep; j++)
+                       msgn("%04x ", ep_list[j]);
+               msg("\n");
+       }
+       zb_device_list_free(list);
+
+       msg(" - zb_get_all_device_list() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+static int run_choose_end_device_list(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       int i, j;
+       nwk_addr addr16;
+       ieee_addr addr64;
+       unsigned char num_of_ep;
+       unsigned char ep_list[10];
+
+       if (NULL != target_list)
+               zb_device_list_free(target_list);
+
+       ret = zb_get_all_device_list(handle, &target_list_count, &target_list);
+       for (i = 0; i < target_list_count && target_list; i++) {
+               zb_get_network_address(target_list[i], &addr16);
+               zb_get_ieee_address((target_list)[i], addr64);
+
+               msgb("End device [%d]", (i+1));
+               if (!strncmp((char *)sj_addr64, (char *)addr64, sizeof(addr64))) {
+                       sj_addr16 = addr16;
+                       msgb("   Samjin Power Outlet Find!!");
+               }
+               if (!strncmp((char *)st_addr64, (char *)addr64, sizeof(addr64))) {
+                       st_addr16 = addr16;
+                       msgb("ST Open/Close Sensor Find!!");
+               }
+               msg("    nwk address = 0x%02X", addr16);
+               msg("   ieee address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+
+               zb_get_num_of_ep((target_list)[i], &num_of_ep);
+               msg("   number of end-points = 0x%04X", num_of_ep);
+
+               memset(ep_list, 0, sizeof(ep_list));
+               zb_get_ep_list((target_list)[i], ep_list);
+               msgn("      ");
+               for (j = 0; j < num_of_ep; j++)
+                       msgn("%04x ", ep_list[j]);
+               msg("\n");
+       }
+
+       return RET_SUCCESS;
+}
+
+static int run_select_device(MManager *mm, struct menu_data *menu)
+{
+       int i;
+       int selected = (int)strtol(data_choose_target, NULL, 10);
+       nwk_addr addr16;
+
+       /* Apply manual address first */
+       if (data_dest_addr16 && strlen(data_dest_addr16) > 0) {
+               dest_addr16 = (unsigned short)strtol(data_dest_addr16, NULL, 16);
+               msg("  network addr [0x%04X] selected.", dest_addr16);
+               snprintf(data_dest_addr16, MENU_DATA_SIZE+1, "");
+               return RET_SUCCESS;
+       }
+
+       if (NULL == target_list) {
+               msg("Please select device list first !");
+               return RET_FAILURE;
+       }
+
+       if (selected <= 0) {
+               msg("Please input valid device index !");
+               return RET_FAILURE;
+       }
+
+       for (i = 0; i < target_list_count && target_list; i++) {
+               if (selected == (i+1)) {
+                       zb_get_network_address(target_list[i], &addr16);
+                       dest_addr16 = addr16;
+                       msg("  network addr [0x%04X] selected.", dest_addr16);
+                       return RET_SUCCESS;
+               }
+       }
+
+       msg("  Index [%d] was not found from end device list", selected);
+
+       return RET_FAILURE;
+}
+
+static int run_form_network(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_form_network(handle);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_form_network(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_form_network() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+static int run_disable_network(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_disable_network(handle);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_disable_network(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_disable_network() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+static int run_leave_device(MManager *mm, struct menu_data *menu)
+{
+       int ret1 = ZIGBEE_ERROR_NONE;
+       int ret2 = ZIGBEE_ERROR_NONE;
+       bool remove_children = true;
+       bool rejoin = false;
+       unsigned char var = 0;
+
+       if (strlen(data_remove_children)) {
+               var = (unsigned char)strtol(data_remove_children, NULL, 10);
+               remove_children = (var == 0) ? false : true;
+       }
+       if (strlen(data_rejoin)) {
+               var = (unsigned char)strtol(data_rejoin, NULL, 10);
+               rejoin = (var == 0) ? false : true;
+       }
+
+       ret1 = zb_leave_device(handle, st_addr64, remove_children, rejoin);
+       ret2 = zb_leave_device(handle, sj_addr64, remove_children, rejoin);
+       if (ret1 != ZIGBEE_ERROR_NONE || ret2 != ZIGBEE_ERROR_NONE) {
+               msg("zb_leave_device(0x%X) - FAILED!!!", ret1);
+               msg("zb_leave_device(0x%X) - FAILED!!!", ret2);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_leave_device() ret: [0x%X]", ret1);
+       msg(" - zb_leave_device() ret: [0x%X]", ret2);
+
+       return RET_SUCCESS;
+}
+
+static int run_permit_join(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char timeout = 90;
+
+       if (strlen(data_pj_timeout))
+               timeout = (unsigned char)strtol(data_pj_timeout, NULL, 10);
+
+       ret = zb_permit_join(handle, timeout);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_permit_join(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_permit_join() ret: [0x%X]", ret);
+
+       return RET_SUCCESS;
+}
+
+struct menu_data menu_sel_device[] = {
+       { "1", "Device list", NULL, run_choose_end_device_list, data_choose_target },
+       { "2", "Input network addr manually (hex)", NULL, NULL, data_dest_addr16 },
+       { "3", "Apply", NULL, run_select_device, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_device[] = {
+       { "1", "zb_create", NULL, run_create, NULL },
+       { "2", "zb_destroy", NULL, run_destroy, NULL },
+       { "3", "zb_enable", NULL, run_enable, NULL },
+       { "4", "zb_disable", NULL, run_disable, NULL },
+       { "5", "zb_hw_reset", NULL, run_hw_reset, NULL },
+       { "6", "zb_coex_start", NULL, run_coex_start, NULL },
+       { "7", "zb_coex_stop", NULL, run_coex_stop, NULL },
+       { "8", "zb_get_all_device_list", NULL, run_get_end_device_list, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_leave_device[] = {
+       { "1", "Remove children", NULL, NULL, data_remove_children },
+       { "2", "Rejoin", NULL, NULL, data_rejoin },
+       { "3", "Run", NULL, run_leave_device, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_permit_join[] = {
+       { "1", "Timeout", NULL, NULL, data_pj_timeout },
+       { "2", "Run", NULL, run_permit_join, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_network[] = {
+       { "1", "zb_get_network_info", NULL, run_get_network_info, NULL },
+       { "2", "zb_get_controller_mac_address", NULL, run_get_controller_mac_address, NULL },
+       { "3", "zb_form_network", NULL, run_form_network, NULL },
+       { "4", "zb_disable_network", NULL, run_disable_network, NULL },
+       { "5", "zb_leave_device", _menu_leave_device, NULL, NULL },
+       { "6", "zb_permit_join", _menu_permit_join, NULL, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_zcl[] = {
+       { "1", "Global Commands", menu_zcl_global, NULL, NULL },
+       { "2", "Cluster Commands", menu_zcl_cluster, NULL, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_zdo[] = {
+       { "1", "Binding Manager", menu_zdo_binding, NULL, NULL },
+       { "2", "Device Discovery", menu_zdo_device, NULL, NULL },
+       { "3", "Network Manager", menu_zdo_network, NULL, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_main[] = {
+       { "1", "Device", menu_device, NULL, NULL },
+       { "2", "Network", menu_network, NULL, NULL },
+       { "3", "Cluster Library", menu_zcl, NULL, NULL },
+       { "4", "Device Object", menu_zdo, NULL, NULL },
+       { "5", "Custom", menu_custom, NULL, NULL },
+       { NULL, NULL, },
+};
+
+static int __select_handle_register_event(MManager *mm, struct menu_data *menu)
+{
+       int ret = -1;
+
+       if (NULL == handle) {
+               zb_destroy(handle);
+               handle = NULL;
+       }
+       _init_endpoints();
+
+       ret = zb_create(&handle);
+
+       msg("");
+
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_create(%d) - FAILED!!!.", ret);
+               return RET_FAILURE;
+       } else {
+               msg("zb_create(%d) - SUCCESS!!!. handle [%p]", ret, handle);
+       }
+
+       /* Register event callback */
+       ret = zb_enable(handle, zigbee_event_cb);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_enable(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+       msg("zb_enable(%d) - SUCCESS!!!. handle [%p]", ret, handle);
+
+       menu_manager_set_user_data(mm, handle);
+
+       return RET_SUCCESS;
+}
+
+static gboolean __create_init_menu(struct menu_data init_menu[1])
+{
+       init_menu[0].key = "1";
+       init_menu[0].title = "Init";
+       init_menu[0].sub_menu = menu_main;
+       init_menu[0].callback = __select_handle_register_event;
+       init_menu[0].data = NULL;
+
+       return TRUE;
+}
+
+int main(int arg, char **argv)
+{
+       GMainLoop *mainloop = NULL;
+       GIOChannel *channel = g_io_channel_unix_new(STDIN_FILENO);
+       MManager *manager;
+       struct menu_data init_menu[1+1] = { {NULL, NULL, } };
+
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
+#endif
+       mainloop = g_main_loop_new(NULL, FALSE);
+
+       msg("");
+       msg("* ZigBee Test application ");
+       msg("* Build On: %s  %s", __DATE__, __TIME__);
+
+       if (__create_init_menu(init_menu) == FALSE)
+               goto OUT;
+
+       manager = menu_manager_new(init_menu, mainloop);
+       if (!manager)
+               goto OUT;
+
+       menu_manager_run(manager);
+
+       g_io_add_watch(channel, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL),
+                               on_menu_manager_keyboard, manager);
+       g_main_loop_run(mainloop);
+
+OUT:
+       g_main_loop_unref(mainloop);
+       msg("******* Bye bye *******");
+
+       return 0;
+}
diff --git a/test/main.h b/test/main.h
new file mode 100644 (file)
index 0000000..c243d4f
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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_UNIT_TEST_MAIN_H__
+#define __ZIGBEE_UNIT_TEST_MAIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct simple_desc {
+       unsigned char ep; /**< Endpoint ID */
+       unsigned short profile_id; /**< Profile ID */
+       unsigned short device_id; /**< Device ID */
+       unsigned char device_ver; /**< Device Version */
+       unsigned char num_of_in_clusters; /**< Number of In-Cluster */
+       unsigned char num_of_out_clusters; /**< Number of Out-Cluster */
+       unsigned short in_clusters[32]; /**< In-Cluster list */
+       unsigned short out_clusters[32]; /**< Out-Cluster list */
+} simple_desc_s;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ZIGBEE_UNIT_TEST_MAIN_H__ */
diff --git a/test/menu.c b/test/menu.c
new file mode 100644 (file)
index 0000000..5c597f1
--- /dev/null
@@ -0,0 +1,392 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <glib.h>
+#include <asm/unistd.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#include "menu.h"
+
+#define DEFAULT_MENU_MENU      "m"
+#define DEFAULT_MENU_PREV      "p"
+#define DEFAULT_MENU_QUIT      "q"
+#define DEFAULT_MENU_TARGET    "t"
+#define DEFAULT_MENU_NONE      "-"
+#define TAB_SPACE     "  "
+
+struct menu_manager {
+       GQueue *stack;
+       GQueue *title_stack;
+
+       struct menu_data *menu;
+
+       char *buf;
+
+       void *user_data;
+       GMainLoop *mainloop;
+};
+
+
+char key_buffer[MENU_DATA_SIZE];
+int flag_pid_display = 1;
+
+extern unsigned short dest_addr16;
+extern struct menu_data menu_sel_device[];
+
+static void _show_prompt(void)
+{
+       msgn("(%5d) >> ", get_tid());
+}
+
+static void _show_reserved_menu(void)
+{
+       msg(ANSI_COLOR_DARKGRAY HR_SINGLE2 ANSI_COLOR_NORMAL);
+       msg(ANSI_COLOR_DARKGRAY " [ " ANSI_COLOR_NORMAL "%s" ANSI_COLOR_DARKGRAY
+                       " ] " ANSI_COLOR_NORMAL "Target addr ["
+                       ANSI_COLOR_YELLOW "0x%04X" ANSI_COLOR_NORMAL "]",
+                       DEFAULT_MENU_TARGET, dest_addr16);
+       msg(ANSI_COLOR_DARKGRAY HR_SINGLE2 ANSI_COLOR_NORMAL);
+       msg(ANSI_COLOR_DARKGRAY " [ " ANSI_COLOR_NORMAL "%s" ANSI_COLOR_DARKGRAY
+                       " ] " ANSI_COLOR_NORMAL "Previous menu " , DEFAULT_MENU_PREV);
+       msg(ANSI_COLOR_DARKGRAY " [ " ANSI_COLOR_NORMAL "%s" ANSI_COLOR_DARKGRAY
+                       " ] " ANSI_COLOR_NORMAL "Show Menu " , DEFAULT_MENU_MENU);
+       msg(ANSI_COLOR_DARKGRAY " [ " ANSI_COLOR_NORMAL "%s" ANSI_COLOR_DARKGRAY
+                       " ] " ANSI_COLOR_NORMAL "Quit " , DEFAULT_MENU_QUIT);
+}
+
+static void _show_input_ok(void)
+{
+       msg("OK.");
+}
+
+static void _show_menu(MManager *m, struct menu_data menu[])
+{
+       int i = 0;
+       int len = 0;
+       struct menu_data *item;
+       char title_buf[256] = { 0, };
+
+       if (!menu)
+               return;
+
+       msg("");
+       msg(HR_DOUBLE);
+
+       len = g_queue_get_length(m->title_stack);
+       msgn(ANSI_COLOR_YELLOW " Main");
+       if (len > 0) {
+               for (i = 0; i < len; i++) {
+                       msgn(ANSI_COLOR_NORMAL " >> " ANSI_COLOR_YELLOW "%s",
+                                       (char *)g_queue_peek_nth(m->title_stack, i));
+               }
+       }
+       msg(ANSI_COLOR_NORMAL);
+       msg(HR_SINGLE);
+
+       hide_pid();
+       i = 0;
+
+       while (1) {
+               item = menu + i;
+               if (item->key == NULL)
+                       break;
+
+               if (!g_strcmp0(item->key, "-")) {
+                       msgn("       ");
+               } else if (!g_strcmp0(item->key, "_")) {
+                       msg(ANSI_COLOR_DARKGRAY HR_SINGLE2 ANSI_COLOR_NORMAL);
+
+                       if (item->callback)
+                               item->callback(m, item);
+
+                       i++;
+
+                       continue;
+               } else if (!g_strcmp0(item->key, "*")) {
+                       msg(" %s", item->title);
+                       if (item->callback)
+                               item->callback(m, item);
+               } else {
+                       msgn(ANSI_COLOR_DARKGRAY " [" ANSI_COLOR_NORMAL "%3s"
+                                       ANSI_COLOR_DARKGRAY "] " ANSI_COLOR_NORMAL,     item->key);
+               }
+
+               memset(title_buf, 0, 256);
+               if (item->title) {
+                       snprintf(title_buf, MAX_TITLE, "%s", item->title);
+
+                       if (strlen(item->title) >= MAX_TITLE) {
+                               title_buf[MAX_TITLE - 2] = '.';
+                               title_buf[MAX_TITLE - 1] = '.';
+                       }
+               }
+
+               if (item->data) {
+                       msg("%s " ANSI_COLOR_LIGHTBLUE "(%s)" ANSI_COLOR_NORMAL,
+                                       title_buf, item->data);
+               } else if (!g_strcmp0(item->key, "*")) {
+                       /* none */
+               } else {
+                       msg("%s", title_buf);
+               }
+
+               if (item->sub_menu)
+                       msg("\e[1A\e[%dC >", (int)POS_MORE);
+
+               i++;
+       }
+
+       show_pid();
+
+       _show_reserved_menu();
+
+       msg(HR_DOUBLE);
+
+       _show_prompt();
+}
+
+static void _show_item_data_input_msg(struct menu_data *item)
+{
+       msg("");
+       msg(HR_DOUBLE);
+       msg(" Input [%s] data ", item->title);
+       msg(HR_SINGLE);
+       msg(" current = [%s]", item->data);
+       msgn(" new >> ");
+}
+
+static void _move_menu(MManager *mm, struct menu_data menu[], char *key)
+{
+       struct menu_data *item;
+       int i = 0;
+
+       if (!mm->menu)
+               return;
+
+       if (!g_strcmp0(DEFAULT_MENU_PREV, key)) {
+               if (g_queue_get_length(mm->stack) > 0) {
+                       mm->menu = g_queue_pop_tail(mm->stack);
+                       g_queue_pop_tail(mm->title_stack);
+               }
+
+               _show_menu(mm, mm->menu);
+               mm->buf = key_buffer;
+
+               return;
+       } else if (!g_strcmp0(DEFAULT_MENU_MENU, key)) {
+               _show_menu(mm, mm->menu);
+               return;
+       } else if (!g_strcmp0(DEFAULT_MENU_QUIT, key)) {
+               g_main_loop_quit(mm->mainloop);
+               return;
+       } else if (!g_strcmp0(DEFAULT_MENU_NONE, key)) {
+               _show_prompt();
+               return;
+       } else if (!g_strcmp0(DEFAULT_MENU_TARGET, key)) {
+               g_queue_push_tail(mm->stack, mm->menu);
+               g_queue_push_tail(mm->title_stack, (gpointer *)"Select target");
+
+               mm->menu = menu_sel_device;
+               _show_menu(mm, mm->menu);
+               mm->buf = key_buffer;
+               return;
+       }
+
+       while (1) {
+               int ret = RET_SUCCESS;
+               item = menu + i;
+               if (item->key == NULL)
+                       break;
+
+               if (!g_strcmp0(item->key, key)) {
+                       if (item->callback) {
+                               ret = item->callback(mm, item);
+                               _show_prompt();
+                       }
+
+                       if (RET_SUCCESS == ret) {
+                               if (item->sub_menu) {
+                                       g_queue_push_tail(mm->stack, mm->menu);
+                                       g_queue_push_tail(mm->title_stack, (gpointer *)item->title);
+
+                                       mm->menu = item->sub_menu;
+                                       _show_menu(mm, mm->menu);
+                                       mm->buf = key_buffer;
+                               }
+
+                               if (item->data) {
+                                       _show_item_data_input_msg(item);
+                                       mm->buf = item->data;
+                               }
+                       }
+
+                       return;
+               }
+
+               i++;
+       }
+
+       _show_prompt();
+}
+
+MManager *menu_manager_new(struct menu_data items[], GMainLoop *mainloop)
+{
+       MManager *mm;
+
+       mm = calloc(sizeof(struct menu_manager), 1);
+       if (!mm)
+               return NULL;
+
+       mm->stack = g_queue_new();
+       mm->title_stack = g_queue_new();
+       mm->menu = items;
+       mm->mainloop = mainloop;
+
+       return mm;
+}
+
+int menu_manager_run(MManager *mm)
+{
+       _show_menu(mm, mm->menu);
+
+       mm->buf = key_buffer;
+
+       return 0;
+}
+
+int menu_manager_set_user_data(MManager *mm, void *user_data)
+{
+       if (!mm)
+               return -1;
+
+       mm->user_data = user_data;
+
+       return 0;
+}
+
+void *menu_manager_ref_user_data(MManager *mm)
+{
+       if (!mm)
+               return NULL;
+
+       return mm->user_data;
+}
+
+gboolean on_menu_manager_keyboard(GIOChannel *src, GIOCondition con,
+               gpointer data)
+{
+       MManager *mm = data;
+       char local_buf[MENU_DATA_SIZE + 1] = { 0, };
+
+       if (fgets(local_buf, MENU_DATA_SIZE, stdin) == NULL)
+               return TRUE;
+
+       if (strlen(local_buf) > 0) {
+               if (local_buf[strlen(local_buf) - 1] == '\n')
+                       local_buf[strlen(local_buf) - 1] = '\0';
+       }
+
+       if (mm->buf == key_buffer) {
+               if (strlen(local_buf) < 1) {
+                       _show_prompt();
+                       return TRUE;
+               }
+
+               _move_menu(mm, mm->menu, local_buf);
+       } else {
+               if (mm->buf) {
+                       memset(mm->buf, 0, MENU_DATA_SIZE);
+                       memcpy(mm->buf, local_buf, MENU_DATA_SIZE);
+                       _show_input_ok();
+               }
+               mm->buf = key_buffer;
+               _move_menu(mm, mm->menu, (char *)DEFAULT_MENU_MENU);
+       }
+
+       return TRUE;
+}
+
+pid_t get_tid()
+{
+       return syscall(__NR_gettid);
+}
+
+void hide_pid()
+{
+       flag_pid_display = 0;
+}
+
+void show_pid()
+{
+       flag_pid_display = 1;
+}
+
+int is_pid_show()
+{
+       return flag_pid_display;
+}
+
+static void _hex_dump(const char *pad, int size, const void *data)
+{
+       char buf[255] = {0, };
+       char hex[4] = {0, };
+       int i;
+       unsigned char *p;
+
+       if (size <= 0) {
+               msg("%sno data", pad);
+               return;
+       }
+       p = (unsigned char *)data;
+
+       snprintf(buf, 255, "%s%04X: ", pad, 0);
+       for (i = 0; i < size; i++) {
+               snprintf(hex, 4, "%02X ", p[i]);
+               strncat(buf, hex, strlen(hex));
+
+               if ((i + 1) % 8 == 0) {
+                       if ((i + 1) % 16 == 0) {
+                               msg("%s", buf);
+                               memset(buf, 0, 255);
+                               snprintf(buf, 255, "%s%04X: ", pad, i + 1);
+                       } else {
+                               strncat(buf, TAB_SPACE, strlen(TAB_SPACE));
+                       }
+               }
+       }
+
+       msg("%s", buf);
+}
+
+void menu_print_dump(int data_len, void *data)
+{
+       if (!data)
+               return;
+
+       msg("");
+       msg("  \tlen=%d", data_len);
+       _hex_dump("        ", data_len, data);
+
+       msg("");
+}
+
diff --git a/test/menu.h b/test/menu.h
new file mode 100644 (file)
index 0000000..95c4453
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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 __MENU_H__
+#define __MENU_H__
+
+__BEGIN_DECLS
+
+#define ANSI_COLOR_NORMAL              "\e[0m"
+
+#define ANSI_COLOR_BLACK               "\e[0;30m"
+#define ANSI_COLOR_RED                 "\e[0;31m"
+#define ANSI_COLOR_GREEN               "\e[0;32m"
+#define ANSI_COLOR_BROWN               "\e[0;33m"
+#define ANSI_COLOR_BLUE                        "\e[0;34m"
+#define ANSI_COLOR_MAGENTA             "\e[0;35m"
+#define ANSI_COLOR_CYAN                        "\e[0;36m"
+#define ANSI_COLOR_LIGHTGRAY   "\e[0;37m"
+
+#define ANSI_COLOR_DARKGRAY            "\e[1;30m"
+#define ANSI_COLOR_LIGHTRED            "\e[1;31m"
+#define ANSI_COLOR_LIGHTGREEN  "\e[1;32m"
+#define ANSI_COLOR_YELLOW              "\e[1;33m"
+#define ANSI_COLOR_LIGHTBLUE   "\e[1;34m"
+#define ANSI_COLOR_LIGHTMAGENTA "\e[1;35m"
+#define ANSI_COLOR_LIGHTCYAN   "\e[1;36m"
+#define ANSI_COLOR_WHITE               "\e[1;37m"
+
+
+#define msg(fmt,args...)       do { fprintf(stdout, fmt "\n", ##args); \
+               fflush(stdout); } while (0)
+#define msgn(fmt,args...)      do { fprintf(stdout, fmt, ##args); \
+               fflush(stdout); } while (0)
+
+/* Bold (green) */
+#define msgb(fmt,args...)  do { fprintf(stdout, ANSI_COLOR_LIGHTGREEN fmt \
+               ANSI_COLOR_NORMAL "\n", ##args); fflush(stdout); } while (0)
+
+/* Property message */
+#define msgp(fmt,args...) do { fprintf(stdout, ANSI_COLOR_LIGHTMAGENTA fmt \
+               ANSI_COLOR_NORMAL "\n", ##args); fflush(stdout); } while (0)
+
+#define msgt(n,fmt,args...) do { fprintf(stdout, "\e[%dC" fmt "\n", \
+               3 + ((n) * 2), ##args); fflush(stdout); } while (0)
+
+#define pmsg(fmt,args...) do { \
+       if (is_pid_show()) { fprintf(stdout, "(%5d) ", get_tid()); } \
+       fprintf(stdout, fmt "\n", ##args); fflush(stdout); } while (0)
+
+#define pmsgb(fmt,args...) do { \
+       if (is_pid_show()) { fprintf(stdout, "(%5d) ", get_tid()); } \
+       fprintf(stdout, ANSI_COLOR_LIGHTGREEN fmt \
+                       ANSI_COLOR_NORMAL "\n", ##args); fflush(stdout); } while (0)
+
+#define pmsgt(n,fmt,args...) do { \
+       if (is_pid_show()) { fprintf(stdout, "(%5d) ", get_tid()); } \
+       fprintf(stdout, "\e[%dC" fmt "\n", \
+                       3 + ((n) * 2), ##args); fflush(stdout); } while (0)
+
+#define MENU_DATA_SIZE 255
+
+
+
+/*
+ * Horizontal Line - width: 65
+ *                                     .12345678901234567890123456789012345678901234567890.
+ */
+#define HR_SINGLE      "----------------------------------------" \
+                                       "-------------------------"
+#define HR_DOUBLE      "========================================" \
+                                       "========================="
+#define HR_SINGLE2     " ---------------------------------------" \
+                                       "------------------------ "
+
+#define MAX_WIDTH      strlen (HR_SINGLE)
+#define MAX_TITLE      ((MAX_WIDTH) - 10)
+#define POS_MORE       ((MAX_WIDTH) - 3)
+#define RET_SUCCESS 0
+#define RET_FAILURE -1
+
+typedef struct menu_manager MManager;
+
+struct menu_data {
+       const char *key;
+       const char *title;
+       struct menu_data *sub_menu;
+       int (*callback)(MManager *mm, struct menu_data *menu);
+       char *data;
+};
+
+MManager* menu_manager_new(struct menu_data items[], GMainLoop *mainloop);
+int       menu_manager_run(MManager *mm);
+int       menu_manager_set_user_data(MManager *mm, void *user_data);
+void*     menu_manager_ref_user_data(MManager *mm);
+
+gboolean  on_menu_manager_keyboard(GIOChannel *src, GIOCondition con,
+               gpointer data);
+
+pid_t     get_tid ();
+void      hide_pid ();
+void      show_pid ();
+int       is_pid_show ();
+void      menu_print_dump(int data_len, void *data);
+
+__END_DECLS
+
+#endif
diff --git a/test/test-zigbee.c b/test/test-zigbee.c
new file mode 100644 (file)
index 0000000..0043a56
--- /dev/null
@@ -0,0 +1,2347 @@
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ *
+ * 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.
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+#include <assert.h>
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <zigbee.h>
+
+#define RESET_COLOR "\e[m"
+#define MAKE_RED "\e[31m"
+#define MAKE_GREEN "\e[32m"
+
+#define __FUNC_ENTER__ printf("%s() entering...\n", __func__)
+#define __FUNC_EXIT__ printf("%s() leaving...\n", __func__)
+
+#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
+#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
+
+zigbee_h handle;
+
+nwk_addr panid = 0x615F;
+ieee_addr co_addr64 = { 0xD0, 0x52, 0xA8, 0xA9, 0x8F, 0xB7, 0x00, 0x01 };
+
+nwk_addr st_addr16 = 0x708B;
+/* ST Motion Sensor */
+/*ieee_addr st_addr64 = {0x00, 0x0D, 0x6F, 0x00, 0x0B ,0x19, 0x58, 0xF8};*/
+/* ST New Open/Close Sensor */
+/*ieee_addr st_addr64 ={0x24, 0xFD, 0x5B, 0x00, 0x01, 0x01, 0x86, 0xB6 };*/
+/* ST Old Open/Close Sensor */
+ieee_addr st_addr64 = { 0x00, 0x0D, 0x6F, 0x00, 0x04, 0x2B, 0xBE, 0x14 };
+
+nwk_addr sj_addr16 = 0x4756;
+ieee_addr sj_addr64 = { 0x24, 0xFD, 0x5B, 0x00, 0x01, 0x01, 0x86, 0xB6 };
+
+nwk_addr simul_addr16 = 0x1D1A;
+ieee_addr simul_addr64 = { 0x00, 0x12, 0x4B, 0x00, 0x02, 0xF2, 0x58, 0x5B };
+/*ieee_addr sj_addr64 = { 0x24, 0xFD, 0x5B, 0x00, 0x01, 0x01, 0x86, 0xAF };*/
+
+typedef struct simple_desc {
+       unsigned char ep; /**< Endpoint ID */
+       unsigned short profile_id; /**< Profile ID */
+       unsigned short device_id; /**< Device ID */
+       unsigned char device_ver; /**< Device Version */
+       unsigned char num_of_in_clusters; /**< Number of In-Cluster */
+       unsigned char num_of_out_clusters; /**< Number of Out-Cluster */
+       unsigned short in_clusters[32]; /**< In-Cluster list */
+       unsigned short out_clusters[32]; /**< Out-Cluster list */
+} simple_desc_s;
+
+simple_desc_s st_ep1, st_ep2, st_ep3, st_ep4, sj_ep1, simul_ep1;
+
+#if 0
+static const char *test_zigbee_convert_error_to_string(int err_type)
+{
+       switch (err_type) {
+       case ZIGBEE_ERROR_NONE:
+               return "NONE";
+       case ZIGBEE_ERROR_INVALID_PARAMETER:
+               return "INVALID_PARAMETER";
+       case ZIGBEE_ERROR_IO_ERROR:
+               return "DBUS_ERROR";
+       case ZIGBEE_ERROR_PARAMETER_OUT_OF_RANGE:
+               return "PARAMETER OUT OF RANGE";
+       case ZIGBEE_ERROR_INVALID_ENDPOINT:
+               return "INVALIED_ENDPOINT";
+       case ZIGBEE_ERROR_INVALID_ADDRESS:
+               return "INVALID_ADDRESS";
+       case ZIGBEE_ERROR_OUT_OF_MEMORY:
+               return "OUT_OF_MEMORY";
+       }
+       return "UNKNOWN";
+}
+#endif
+/* test command */
+enum {
+       CMD_QUIT,
+       CMD_INITIALIZE,
+       CMD_ENABLE,
+       CMD_GET_NETWORK_INFO,
+       CMD_GET_COORDINATOR_MAC_ADDR,
+       CMD_GET_END_DEVICE_LIST,
+       CMD_DISABLE,
+       CMD_RESET,
+       CMD_COEX_START,
+       CMD_COEX_STOP,
+       CMD_FORM_NETWORK,
+       CMD_DISABLE_NETWORK,
+       CMD_LEAVE_NODE,
+       CMD_PERMIT_JOIN,
+       CMD_NWK_ADDR_REQ,
+       CMD_IEEE_ADDR_REQ,
+       CMD_ACTIVE_EP_REQ,
+       CMD_SIMPLE_DESC_REQ,
+       CMD_EXTENDED_SIMPLE_DESC_REQ,
+       CMD_MATCHED_DESC_REQ,
+       CMD_NODE_DESC_REQ,
+       CMD_POWER_DESC_REQ,
+       CMD_COMPLEX_DESC_REQ,
+       CMD_USER_DESC_REQ,
+       CMD_USER_DESC_SET_REQ,
+       CMD_DEVICE_ANNCE,
+       CMD_BIND_REQ,
+       CMD_UNBIND_REQ,
+       CMD_MGMT_NWK_DISC_REQ,
+       CMD_MGMT_NWK_UPDATE_REQ,
+       CMD_MGMT_LQI_REQ,
+       CMD_MGMT_RTG_REQ,
+       CMD_MGMT_BIND_REQ,
+       CMD_MGMT_LEAVE_REQ,
+       CMD_MGMT_PERMIT_JOINING_REQ,
+       CMD_READ_ATTRIBUTES_REQ,
+       CMD_WRITE_ATTRIBUTES_REQ,
+       CMD_WRITE_ATTRIBUTES_UNDEVIDEDED_REQ,
+       CMD_WRITE_ATTRIBUTES_NO_RSP_REQ,
+       CMD_CONFIGURE_REPORTING_REQ,
+       CMD_READ_CONFIGURE_REPORTING,
+       CMD_DISCOVER_ATTRIBUTES,
+       CMD_READ_ATTRIBUTES_STRUCTURED,
+       CMD_WRITE_ATTRIBUTES_STRUCTURED,
+       CMD_DISCOVER_COMMANDS_RECEIVED,
+       CMD_DISCOVER_COMMANDS_GENERATED,
+       CMD_DISCOVER_ATTRIBUTES_EXTENDED,
+       CMD_ALARM_RESET_ALARM,
+       CMD_ALARM_RESET_ALL_ALARM,
+       CMD_ALARM_GET_ALARM,
+       CMD_ALARM_RESET_ALL_ALARM_LOG,
+       CMD_IDENTITY,
+       CMD_IDENTITY_QUERY,
+       CMD_ADD_GROUP,
+       CMD_VIEW_GROUP,
+       CMD_GET_GROUP_MEMBERSHIP,
+       CMD_REMOVE_GROUP,
+       CMD_REMOVE_ALL_GROUP,
+       CMD_ADD_GROUP_IF_IDENTIFY,
+       CMD_ADD_SCENE,
+       CMD_VIEW_SCENE,
+       CMD_GET_SCENE_MEMBERSHIP,
+       CMD_REMOVE_SCENE,
+       CMD_REMOVE_ALL_SCENE,
+       CMD_STORE_SCENE,
+       CMD_RECALL_SCENE,
+       CMD_ON_OFF_CLUSTER_ON,
+       CMD_ON_OFF_CLUSTER_OFF,
+       CMD_ON_OFF_CLUSTER_TOGGLE,
+       CMD_POLLCONTROL_CHECKIN_RESPONSE,
+       CMD_POLLCONTROL_FAST_POLL_STOP,
+       CMD_POLLCONTROL_SET_LONG_POLL_INTERVAL,
+       CMD_POLLCONTROL_SET_SHORT_POLL_INTERVAL,
+       /*CMD_SIMPLE_DESCRIPTION_GET_SET,*/
+       CMD_LEVELCONTROL_MOVE_TO_LEVEL,
+       CMD_LEVELCONTROL_MOVE,
+       CMD_LEVELCONTROL_STEP,
+       CMD_LEVELCONTROL_STOP,
+       CMD_LEVELCONTROL_MOVE_WITH_ONOFF,
+       CMD_LEVELCONTROL_MOVE_TO_LEVEL_WITH_ONOFF,
+       CMD_LEVELCONTROL_STEP_WITH_ONOFF,
+       CMD_THERMOSTAT_ADJUST_SETPOINT,
+       CMD_COLORCONTROL_MOVE_TO_HUE,
+       CMD_COLORCONTROL_MOVE_HUE,
+       CMD_COLORCONTROL_STEP_HUE,
+       CMD_COLORCONTROL_MOVE_TO_SATURATION,
+       CMD_COLORCONTROL_MOVE_SATURATION,
+       CMD_COLORCONTROL_STEP_SATURATION,
+       CMD_COLORCONTROL_MOVE_TO_HUE_AND_SATURATION,
+       CMD_COLORCONTROL_MOVE_TO_COLOR,
+       CMD_COLORCONTROL_MOVE_COLOR,
+       CMD_COLORCONTROL_STEP_COLOR,
+       CMD_COLORCONTROL_MOVE_COLOR_TEMPERATURE,
+       CMD_FULL_MENU,
+       CMD_INVALID = 255,
+};
+
+typedef struct {
+       int cmd;
+       char *menu_str;
+} menu_str_t;
+
+menu_str_t g_menu_str[] = {
+       {CMD_QUIT, "CMD_QUIT"},
+       {CMD_INITIALIZE, "CMD_INITIALIZE"},
+       {CMD_ENABLE, "CMD_ENABLE"},
+       {CMD_GET_NETWORK_INFO, "CMD_GET_NETWORK_INFO"},
+       {CMD_GET_COORDINATOR_MAC_ADDR, "CMD_GET_COORDINATOR_MAC_ADDR"},
+       {CMD_GET_END_DEVICE_LIST, "CMD_GET_END_DEVICE_LIST"},
+       {CMD_DISABLE, "CMD_DISABLE"},
+       {CMD_RESET, "CMD_RESET"},
+       {CMD_COEX_START, "CMD_COEX_START"},
+       {CMD_COEX_STOP, "CMD_COEX_STOP"},
+       {CMD_FORM_NETWORK, "CMD_FORM_NETWORK"},
+       {CMD_DISABLE_NETWORK, "CMD_DISABLE_NETWORK"},
+       {CMD_LEAVE_NODE, "CMD_LEAVE_NODE"},
+       {CMD_PERMIT_JOIN, "CMD_PERMIT_JOIN"},
+       {CMD_NWK_ADDR_REQ, "CMD_NWK_ADDR_REQ"},
+       {CMD_IEEE_ADDR_REQ, "CMD_IEEE_ADDR_REQ"},
+       {CMD_ACTIVE_EP_REQ, "CMD_ACTIVE_EP_REQ"},
+       {CMD_SIMPLE_DESC_REQ, "CMD_SIMPLE_DESC_REQ"},
+       {CMD_EXTENDED_SIMPLE_DESC_REQ, "CMD_EXTENDED_SIMPLE_DESC_REQ"},
+       {CMD_MATCHED_DESC_REQ, "CMD_MATCHED_DESC_REQ"},
+       {CMD_NODE_DESC_REQ, "CMD_NODE_DESC_REQ"},
+       {CMD_POWER_DESC_REQ, "CMD_POWER_DESC_REQ"},
+       {CMD_COMPLEX_DESC_REQ, "CMD_COMPLEX_DESC_REQ"},
+       {CMD_USER_DESC_REQ, "CMD_USER_DESC_REQ"},
+       {CMD_USER_DESC_SET_REQ, "CMD_USER_DESC_SET_REQ"},
+       {CMD_DEVICE_ANNCE, "CMD_DEVICE_ANNCE"},
+       {CMD_BIND_REQ, "CMD_BIND_REQ"},
+       {CMD_UNBIND_REQ, "CMD_UNBIND_REQ"},
+       {CMD_MGMT_NWK_DISC_REQ, "CMD_MGMT_NWK_DISC_REQ"},
+       {CMD_MGMT_NWK_UPDATE_REQ, "CMD_MGMT_NWK_UPDATE_REQ"},
+       {CMD_MGMT_LQI_REQ, "CMD_MGMT_LQI_REQ"},
+       {CMD_MGMT_RTG_REQ, "CMD_MGMT_RTG_REQ"},
+       {CMD_MGMT_BIND_REQ, "CMD_MGMT_BIND_REQ"},
+       {CMD_MGMT_LEAVE_REQ, "CMD_MGMT_LEAVE_REQ"},
+       {CMD_MGMT_PERMIT_JOINING_REQ, "CMD_MGMT_PERMIT_JOINING_REQ"},
+       {CMD_READ_ATTRIBUTES_REQ, "CMD_READ_ATTRIBUTES_REQ"},
+       {CMD_WRITE_ATTRIBUTES_REQ, "CMD_WRITE_ATTRIBUTES_REQ"},
+       {CMD_WRITE_ATTRIBUTES_UNDEVIDEDED_REQ, "CMD_WRITE_ATTRIBUTES_UNDEVIDEDED_REQ"},
+       {CMD_WRITE_ATTRIBUTES_NO_RSP_REQ, "CMD_WRITE_ATTRIBUTES_NO_RSP_REQ"},
+       {CMD_CONFIGURE_REPORTING_REQ, "CMD_CONFIGURE_REPORTING_REQ"},
+       {CMD_READ_CONFIGURE_REPORTING, "CMD_READ_CONFIGURE_REPORTING"},
+       {CMD_DISCOVER_ATTRIBUTES, "CMD_DISCOVER_ATTRIBUTES"},
+       {CMD_READ_ATTRIBUTES_STRUCTURED, "CMD_READ_ATTRIBUTES_STRUCTURED"},
+       {CMD_WRITE_ATTRIBUTES_STRUCTURED, "CMD_WRITE_ATTRIBUTES_STRUCTURED"},
+       {CMD_DISCOVER_COMMANDS_RECEIVED, "CMD_DISCOVER_COMMANDS_RECEIVED"},
+       {CMD_DISCOVER_COMMANDS_GENERATED, "CMD_DISCOVER_COMMANDS_GENERATED"},
+       {CMD_DISCOVER_ATTRIBUTES_EXTENDED, "CMD_DISCOVER_ATTRIBUTES_EXTENDED"},
+       {CMD_ALARM_RESET_ALARM, "CMD_ALARM_RESET_ALARM"},
+       {CMD_ALARM_RESET_ALL_ALARM, "CMD_ALARM_RESET_ALL_ALARM"},
+       {CMD_ALARM_GET_ALARM, "CMD_ALARM_GET_ALARM"},
+       {CMD_ALARM_RESET_ALL_ALARM_LOG, "CMD_ALARM_RESET_ALL_ALARM_LOG"},
+       {CMD_IDENTITY, "CMD_IDENTITY"},
+       {CMD_IDENTITY_QUERY, "CMD_IDENTITY_QUERY"},
+       {CMD_ADD_GROUP, "CMD_ADD_GROUP"},
+       {CMD_VIEW_GROUP, "CMD_VIEW_GROUP"},
+       {CMD_GET_GROUP_MEMBERSHIP, "CMD_GET_GROUP_MEMBERSHIP"},
+       {CMD_REMOVE_GROUP, "CMD_REMOVE_GROUP"},
+       {CMD_REMOVE_ALL_GROUP, "CMD_REMOVE_ALL_GROUP"},
+       {CMD_ADD_GROUP_IF_IDENTIFY, "CMD_ADD_GROUP_IF_IDENTIFY"},
+       {CMD_ADD_SCENE, "CMD_ADD_SCENE"},
+       {CMD_VIEW_SCENE, "CMD_VIEW_SCENE"},
+       {CMD_GET_SCENE_MEMBERSHIP, "CMD_GET_SCENE_MEMBERSHIP"},
+       {CMD_REMOVE_SCENE, "CMD_REMOVE_SCENE"},
+       {CMD_REMOVE_ALL_SCENE, "CMD_REMOVE_ALL_SCENE"},
+       {CMD_STORE_SCENE, "CMD_STORE_SCENE"},
+       {CMD_RECALL_SCENE, "CMD_RECALL_SCENE"},
+       {CMD_ON_OFF_CLUSTER_ON, "CMD_ON_OFF_CLUSTER_ON"},
+       {CMD_ON_OFF_CLUSTER_OFF, "CMD_ON_OFF_CLUSTER_OFF"},
+       {CMD_ON_OFF_CLUSTER_TOGGLE, "CMD_ON_OFF_CLUSTER_TOGGLE"},
+       {CMD_POLLCONTROL_CHECKIN_RESPONSE, "CMD_POLLCONTROL_CHECKIN_RESPONSE"},
+       {CMD_POLLCONTROL_FAST_POLL_STOP, "CMD_POLLCONTROL_FAST_POLL_STOP"},
+       {CMD_POLLCONTROL_SET_LONG_POLL_INTERVAL, "CMD_POLLCONTROL_SET_LONG_POLL_INTERVAL"},
+       {CMD_POLLCONTROL_SET_SHORT_POLL_INTERVAL, "CMD_POLLCONTROL_SET_SHORT_POLL_INTERVAL"},
+       /*{ CMD_SIMPLE_DESCRIPTION_GET_SET, "CMD_SIMPLE_DESCRIPTION_GET_SET" },*/
+       {CMD_LEVELCONTROL_MOVE_TO_LEVEL, "CMD_LEVELCONTROL_MOVE_TO_LEVEL"},
+       {CMD_LEVELCONTROL_MOVE, "CMD_LEVELCONTROL_MOVE"},
+       {CMD_LEVELCONTROL_STEP, "CMD_LEVELCONTROL_STEP"},
+       {CMD_LEVELCONTROL_STOP, "CMD_LEVELCONTROL_STOP"},
+       {CMD_LEVELCONTROL_MOVE_WITH_ONOFF, "CMD_LEVELCONTROL_MOVE_WITH_ONOFF"},
+       {CMD_LEVELCONTROL_MOVE_TO_LEVEL_WITH_ONOFF, "CMD_LEVELCONTROL_MOVE_TO_LEVEL_WITH_ONOFF"},
+       {CMD_LEVELCONTROL_STEP_WITH_ONOFF, "CMD_LEVELCONTROL_STEP_WITH_ONOFF"},
+       {CMD_THERMOSTAT_ADJUST_SETPOINT, "CMD_THERMOSTAT_ADJUST_SETPOINT"},
+       {CMD_COLORCONTROL_MOVE_TO_HUE, "CMD_COLORCONTROL_MOVE_TO_HUE"},
+       {CMD_COLORCONTROL_MOVE_HUE, "CMD_COLORCONTROL_MOVE_HUE"},
+       {CMD_COLORCONTROL_STEP_HUE, "CMD_COLORCONTROL_STEP_HUE"},
+       {CMD_COLORCONTROL_MOVE_TO_SATURATION, "CMD_COLORCONTROL_MOVE_TO_SATURATION"},
+       {CMD_COLORCONTROL_MOVE_SATURATION, "CMD_COLORCONTROL_MOVE_SATURATION"},
+       {CMD_COLORCONTROL_STEP_SATURATION, "CMD_COLORCONTROL_STEP_SATURATION"},
+       {CMD_COLORCONTROL_MOVE_TO_HUE_AND_SATURATION, "CMD_COLORCONTROL_MOVE_TO_HUE_AND_SATURATION"},
+       {CMD_COLORCONTROL_MOVE_TO_COLOR, "CMD_COLORCONTROL_MOVE_TO_COLOR"},
+       {CMD_COLORCONTROL_MOVE_COLOR, "CMD_COLORCONTROL_MOVE_COLOR"},
+       {CMD_COLORCONTROL_STEP_COLOR, "CMD_COLORCONTROL_STEP_COLOR"},
+       {CMD_COLORCONTROL_MOVE_COLOR_TEMPERATURE, "CMD_COLORCONTROL_MOVE_COLOR_TEMPERATURE"},
+       {CMD_FULL_MENU, "CMD_FULL_MENU"},
+       {-1, NULL},
+};
+
+struct appdata {
+       GMainLoop *main_loop;
+       int peer_count;
+};
+
+struct appdata *g_test_appdata;
+
+struct appdata *get_appdata()
+{
+       return g_test_appdata;
+}
+
+void set_appdata(struct appdata *p)
+{
+       g_test_appdata = p;
+}
+
+static inline void prt_help(const char *cmd)
+{
+       printf("%s -t [dest ID]\n", cmd);
+       printf("   -u [my ID]\n");
+       printf("   -p [passwd]\n");
+       printf("   -a [alias]\n");
+}
+
+#if 0
+static int get_param(int argc, char **argv, struct appdata *ad)
+{
+       printf("Parsing argument...\n");
+       int opt;
+       while ((opt = getopt(argc, argv, "t:u:p:a:")) != -1) {
+               printf("Parsing argument...:%c\n", opt);
+               switch (opt) {
+               case 't':
+               default:
+                       prt_help(argv[0]);
+                       return -1;
+               }
+       }
+
+       printf("Argument: \n");
+
+       return 0;
+}
+#endif
+void usage()
+{
+       printf("Call Test Program\n");
+       printf(" %d: quit\n", CMD_QUIT);
+       printf(" %d: Full menu\n", CMD_FULL_MENU);
+}
+
+char *cmd_transform(char *str)
+{
+       int i, j;
+       int len;
+       static char static_buffer[255];
+
+       if (str == NULL)
+               return "";
+
+       len = strlen(str);
+       if (len == 0)
+               return "";
+
+       /* remove "CMD_" */
+       /* lower char */
+       /* replance "_" to space */
+       for (i = 0, j = 4; i < len; i++, j++) {
+               if (str[j] >= 'A' && str[j] <= 'Z')
+                       static_buffer[i] = str[j] + 'a' - 'A';
+               else if (str[j] == '_')
+                       static_buffer[i] = ' ';
+               else
+                       static_buffer[i] = str[j];
+       }
+       static_buffer[j] = '\0';
+
+       return static_buffer;
+}
+
+void usage_full()
+{
+       int i;
+       printf("Call Test Program\n");
+
+       for (i = 0; g_menu_str[i].cmd != -1; i++) {
+               if (i % 4 == 0)
+                       printf("\n");
+               printf(" %02d: %-32s \n", g_menu_str[i].cmd, cmd_transform(g_menu_str[i].menu_str));
+
+       }
+       printf("\n");
+}
+
+int is_digit(const char *str)
+{
+       int len;
+       int i;
+
+       if (str == NULL)
+               return -1;
+
+       if (strlen(str) == 0)
+               return -1;
+
+       len = strlen(str);
+       for (i = 0; i < len; i++) {
+               if (str[i] < '0' || str[i] > '9')
+                       return -2;
+       }
+
+       return 0;
+}
+
+static void zigbee_event_cb(nwk_addr addr16, ieee_addr addr64, zb_event_e e, zb_event_data_s ev)
+{
+       unsigned char status, count, ep, command_id;
+       unsigned short cluster_id;
+       printf("event received = 0x%02X\n", e);
+
+       switch (e) {
+       case ZB_ZDP_ENABLE_EVENT:
+       {
+               status = ev.data.enable->status;
+               printf("service enabled = %d\n", status);
+               break;
+       }
+       case ZB_ZDP_FORM_NETWORK_DONE:
+       {
+               printf("form network done\n");
+               break;
+       }
+       case ZB_ZDP_JOIN_EVENT:
+       {
+               count = ev.data.join->count;
+               printf("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X joined\n",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+               printf("end-point count=%d\n", count);
+               break;
+       }
+       case ZB_ZDP_REJOIN_EVENT:
+       {
+               printf("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X rejoined\n",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+               break;
+       }
+       case ZB_ZDP_CHILD_LEFT:
+       {
+               printf("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X left\n",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+               break;
+       }
+       case ZB_ZDP_LEAVE_DONE_EVENT:
+       {
+               printf("%04X leave done\n", addr16);
+               break;
+       }
+       case ZB_ZDP_UPDATED_NETWORK_NOTIFICATION_EVENT:
+       {
+               printf("Update network notification received\n");
+               break;
+       }
+       case ZB_ZDP_BIND_RSP_EVENT:
+       {
+               /* zb_parse_bind_rsp(ev, &status); */
+               /* printf("binding %04X, result=%0X\n", addr16, status); */
+               printf("Not implemented");
+               break;
+       }
+       case ZB_ZDP_UNBIND_RSP_EVENT:
+       {
+               /* zb_parse_unbind_rsp(ev, &status); */
+               /* printf("unbinding %04X, result=%0X\n", addr16, status); */
+               printf("Not implemented");
+               break;
+       }
+       case ZB_ZCL_GLOBAL_DEFAULT_RSP_EVENT:
+       {
+               ep = ev.data.global_default_rsp->ep;
+               cluster_id = ev.data.global_default_rsp->cluster_id;
+               command_id = ev.data.global_default_rsp->command_id;
+               status = ev.data.global_default_rsp->status;
+
+               printf("addr16 = %04X\n", addr16);
+               printf("endpoint=%02X\n", ep);
+               printf("cluster_id=%04X\n", cluster_id);
+               printf("command_id=%02X\n", command_id);
+               printf("status=%02X\n", status);
+               break;
+       }
+       case ZB_ZCL_GLOBAL_ATTRIBUTE_REPORT_EVENT:
+       {
+               int i, j, count, rec_len;
+               int ret;
+               unsigned char *buf = NULL;
+               unsigned short id;
+               unsigned char type;
+               attr_report_h *t;
+               zb_value_h value;
+
+               t = ev.data.global_attr_report->records;
+               rec_len = ev.data.global_attr_report->count;
+               printf("Global Attribute Report Event Received from = 0x%04X record_len=%d\n",
+                       addr16, rec_len);
+               for (j = 0; j < rec_len; j++) {
+                       zb_get_id_from_attr_report(t[j], &id);
+                       printf("id = %04X\n", id);
+                       zb_get_type_from_attr_report(t[j], &type);
+                       printf("type = %02X\n", type);
+                       zb_create_value(&value);
+                       zb_get_value_from_attr_report(t[j], value);
+                       ret = zb_get_value(value, &type, &buf, &count);
+                       if (ZIGBEE_ERROR_NONE == ret) {
+                               for (i = 0; i < count; i++)
+                                       printf("%02X ", buf[i]);
+                       }
+                       printf("\n");
+                       if (buf) {
+                               free(buf);
+                               buf = NULL;
+                       }
+                       zb_destroy_value(value);
+               }
+               break;
+       }
+       case ZB_ZCL_ALARM_EVENT:
+       {
+               printf("Alarm Event Received\n");
+               break;
+       }
+       case ZB_ZCL_IAS_ZONE_ENROLL_REQUEST_EVENT:
+       {
+               /*nwk_addr addr16;*/
+               unsigned short zone_type;
+               unsigned char ep, mfg_code;
+               printf("IAS Zone Request Received\n");
+
+               ep = ev.data.ias_enroll_request->src_ep;
+               zone_type = ev.data.ias_enroll_request->zone_type;
+               mfg_code = ev.data.ias_enroll_request->mfg_code;
+
+               /*printf("Network Address from 0x%04X\n", addr16);*/
+               printf("End-Point from 0x%02X\n", ep);
+               printf("Zone Type = 0x%04X\n", zone_type);
+               printf("Manufacturer Code = 0x%02X\n", mfg_code);
+               zb_zcl_zone_enroll_response(handle, addr16, ep, ZB_ZCL_IAS_ZONE_ENROLL_SUCCESS,
+                       0x0001);
+               break;
+       }
+       case ZB_ZCL_IAS_ZONE_STATUS_CHANGE_NOTIFICATION_EVENT:
+       {
+               unsigned short zone_status;
+
+               zone_status = ev.data.ias_noti->zone_status;
+               ep = ev.data.ias_noti->src_ep;
+               printf("addr16 = %04X\n", addr16);
+               printf("endpoint = %02X\n", ep);
+               printf("zone_status = %04X\n", zone_status);
+               break;
+       }
+       case ZB_ZCL_IAS_ZONE_STATUS_CHANGE_EXTENDED_NOTIFICATION_EVENT:
+       {
+               unsigned short zone_status, zone_id, delay;
+               unsigned char extended_status;
+
+               ep = ev.data.ias_extended_noti->src_ep;
+               zone_status = ev.data.ias_extended_noti->zone_status;
+               extended_status = ev.data.ias_extended_noti->extended_status;
+               zone_id = ev.data.ias_extended_noti->zone_id;
+               delay = ev.data.ias_extended_noti->delay;
+
+               printf("addr16 = %04X\n", addr16);
+               printf("endpoint = %02X\n", ep);
+               printf("zone_status = %04X\n", zone_status);
+               printf("extended_status = %02X\n", extended_status);
+               printf("zone_id = %04X\n", zone_id);
+               printf("delay = %04X\n", delay);
+
+               /* Closed or not alarmed */
+               if (0x01 == (zone_status & 0x01))
+                       zb_zcl_onoff_control(handle, sj_addr16, 1, ZB_ZCL_OFF);
+               /* Opened or alarmed */
+               else if (0x00 == (zone_status & 0x01))
+                       zb_zcl_onoff_control(handle, sj_addr16, 1, ZB_ZCL_ON);
+               break;
+       }
+       case ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_COLOR_CONTROL_CURRENT_TEMPERATURE_ATTRIBUTE_REPORT_EVENT:
+               break;
+       case ZB_ZCL_DOOR_LOCK_OPERATIONAL_NOTIFICATION_EVENT:
+               break;
+       case ZB_ZCL_DOOR_LOCK_PROGRAMING_NOTIFICATION_EVENT:
+               break;
+       case ZB_ZCL_SIMPLE_METERING_REMOVE_MIRROR_EVENT:
+               break;
+       case ZB_ZCL_SIMPLE_METERING_REQUEST_MIRROR_EVENT:
+               break;
+       }
+}
+
+#if 0
+static int zigbee_simple_description_get_set()
+{
+       unsigned char param_u8;
+       unsigned short param_u16;
+       int ret = ZIGBEE_ERROR_NONE;
+       zb_zdo_simple_desc_h handle, handle1;
+       unsigned short clusters[MAX_ENDPOINT_CLUSTERS] = { 0, };
+
+       ret = zb_simple_desc_create(&handle);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               printf("zb_simple_desc_create() Fail(%d)\n", ret);
+               return ret;
+       }
+
+       param_u8 = 1;
+       ret = zb_simple_desc_set_ep(handle, param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_set_ep() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_get_ep(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_ep() Fail(%d)\n", ret);
+       printf("ep = %d\n", param_u8);
+
+       ret = zb_simple_desc_set_profile_id(handle, ZB_HA_PROFILE_ID);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_set_profile_id() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_get_profile_id(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_profile_id() Fail(%d)\n", ret);
+       printf("profile_id = 0x%x\n", param_u16);
+
+       ret = zb_simple_desc_set_device_id(handle, ZB_HA_ISA_ZONE);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_set_device_id() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_get_device_id(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_device_id() Fail(%d)\n", ret);
+       printf("device_id = 0x%x\n", param_u16);
+
+       ret = zb_simple_desc_set_device_ver(handle, 0x0001);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_set_device_ver() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_get_device_ver(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_device_ver() Fail(%d)\n", ret);
+       printf("device_ver = %d\n", param_u16);
+
+       ret = zb_simple_desc_set_num_of_in_clusters(handle, 6);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_set_num_of_in_clusters() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_get_num_of_in_clusters(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_num_of_in_clusters() Fail(%d)\n", ret);
+       printf("num_of_in_cluster = %d\n", param_u8);
+
+       /* In clusters : 0000 0003 0004 0005 0006 0B04 0B05 */
+       clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       clusters[1] = ZB_ZCL_GROUPS_CLUSTER_ID;
+       clusters[2] = ZB_ZCL_SCENES_CLUSTER_ID;
+       clusters[3] = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       clusters[4] = ZB_ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID;
+       clusters[5] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       ret = zb_simple_desc_set_in_clusters(handle, clusters, param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_set_in_clusters() Fail(%d)\n", ret);
+
+       memset(clusters, 0, sizeof(clusters));
+       ret = zb_simple_desc_get_in_clusters(handle, (unsigned short **)&clusters);
+       if (ZIGBEE_ERROR_NONE != ret && clusters[1] != ZB_ZCL_GROUPS_CLUSTER_ID &&
+               clusters[5] != ZB_ZCL_DIAGNOSTICS_CLUSTER_ID) {
+               printf("zb_simple_desc_set_num_of_out_clusters() Fail(%d)\n", ret);
+       }
+
+       ret = zb_simple_desc_set_num_of_out_clusters(handle, 1);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_set_num_of_out_clusters() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_get_num_of_out_clusters(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_num_of_out_clusters() Fail(%d)\n", ret);
+       printf("num_of_out_cluster = %d\n", param_u8);
+
+       /* Out cluster : 0019 */
+       clusters[0] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+       ret = zb_simple_desc_set_out_clusters(handle, clusters, param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_set_out_clusters() Fail(%d)\n", ret);
+
+       memset(clusters, 0, sizeof(clusters));
+       ret = zb_simple_desc_get_out_clusters(handle, (unsigned short **)&clusters);
+       if (ZIGBEE_ERROR_NONE != ret && clusters[0] != ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID)
+               printf("zb_simple_desc_set_num_of_out_clusters() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_create(&handle1);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               printf("zb_simple_desc_create()-1 Fail(%d)\n", ret);
+               return ret;
+       }
+
+       ret = zb_simple_desc_copy(handle, handle);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_copy() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_destroy(handle);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_destroy() Fail(%d)\n", ret);
+
+       ret = zb_simple_desc_destroy(handle1);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_destroy() Fail(%d)\n", ret);
+
+       return ret;
+}
+#endif
+
+static void zigbee_addr_rsp(unsigned char status, ieee_addr addr64, nwk_addr addr16,
+       unsigned char num_of_assoc_dev, unsigned char start_idx, unsigned short
+       *assoc_dev_addr_list, void *user_data)
+{
+       printf("status = %02X\n", status);
+       if (addr64) {
+               printf("IEEE Address : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:\n",
+                       addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5],
+                       addr64[6], addr64[7]);
+       } else
+               printf("IEEE Address : 00:00:00:00:00:00:00:00:\n");
+       printf("Network Address : %04X\n", addr16);
+       printf("Number of Associated Device : %d\n", num_of_assoc_dev);
+       printf("Start Index : %d\n", start_idx);
+}
+
+static void zigbee_active_ep_rsp(unsigned char status, nwk_addr addr16,
+       unsigned char count, unsigned char *ep_list, void *user_data)
+{
+       printf("status = %02X\n", status);
+}
+
+static void zigbee_simple_desc_rsp(nwk_addr addr16, unsigned char len,
+       const zb_zdo_simple_desc_h handle, void *user_data)
+{
+       int ret;
+       unsigned char param_u8;
+       unsigned short param_u16;
+       unsigned short *in_clusters;
+       unsigned short *out_clusters;
+
+       ret = zb_simple_desc_get_ep(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_ep() Fail(%X)\n", ret);
+       else
+               printf("ep = %d\n", param_u8);
+
+       ret = zb_simple_desc_get_profile_id(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_profile_id() Fail(%X)\n", ret);
+       else
+               printf("profile_id = 0x%x\n", param_u16);
+
+       ret = zb_simple_desc_get_device_id(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_device_id() Fail(%X)\n", ret);
+       else
+               printf("device_id = 0x%x\n", param_u16);
+
+       ret = zb_simple_desc_get_device_ver(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_device_ver() Fail(%X)\n", ret);
+       else
+               printf("device_ver = %d\n", param_u16);
+
+       ret = zb_simple_desc_get_num_of_in_clusters(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_num_of_in_clusters() Fail(%X)\n", ret);
+       else
+               printf("num_of_in_cluster = %d\n", param_u8);
+
+       ret = zb_simple_desc_get_in_clusters(handle, &in_clusters);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               printf("zb_simple_desc_get_in_clusters() Fail(%X)\n", ret);
+       } else {
+               printf("%04X %04X %04X %04X %04X %04X %04X\n",
+                       in_clusters[0], in_clusters[1], in_clusters[2], in_clusters[3],
+                       in_clusters[4], in_clusters[5], in_clusters[6]);
+       }
+
+       ret = zb_simple_desc_get_num_of_out_clusters(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_num_of_out_clusters() Fail(%X)\n", ret);
+       else
+               printf("num_of_out_cluster = %d\n", param_u8);
+
+       ret = zb_simple_desc_get_out_clusters(handle, &out_clusters);
+       if (ZIGBEE_ERROR_NONE != ret)
+               printf("zb_simple_desc_get_out_clusters() Fail(%X)\n", ret);
+       else
+               printf("%04X \n", out_clusters[0]);
+}
+
+static void zigbee_match_desc_rsp(unsigned char status, nwk_addr addr16,
+       unsigned char match_length, unsigned char **match_list, void *user_data)
+{
+       unsigned char i;
+       printf("nwk_addr = %04X status = %02X match_length = %d\n", addr16, status, match_length);
+       for (i = 0; i < match_length; i++)
+               printf("match_list[%d]=%02x\n", i, (unsigned int)match_list[i]);
+}
+
+static void zigbee_zdo_node_desc_rsp(unsigned char status, nwk_addr addr16,
+       const zb_zdo_node_descriptor_h desc, void *user_data)
+{
+       unsigned char logical_type;
+       unsigned char complex_desciptor_available;
+       unsigned char user_descriptor_available;
+       unsigned char aps_flags;
+       unsigned char frequency_band;
+       unsigned char mac_capability_flags;
+       unsigned short manufacturer_code;
+       unsigned char maximum_buffer_size;
+       unsigned short maximum_incoming_transfer_size;
+       unsigned short server_mask;
+       unsigned short maximum_outgoing_transfer_size;
+       unsigned short descriptor_capability_field;
+
+       printf("nwk_addr = %04X status = %02X\n", addr16, status);
+       zb_node_desc_get_logical_type(desc, &logical_type);
+       printf("logical_type = %02X\n", logical_type);
+       zb_node_desc_get_complex_desciptor_available(desc, &complex_desciptor_available);
+       printf("complex_desciptor_available = %02X\n", complex_desciptor_available);
+       zb_node_desc_get_user_descriptor_available(desc, &user_descriptor_available);
+       printf("complex_desciptor_available = %02X\n", complex_desciptor_available);
+       zb_node_desc_get_aps_flags(desc, &aps_flags);
+       printf("aps_flags = %02X\n", aps_flags);
+       zb_node_desc_get_frequency_band(desc, &frequency_band);
+       printf("frequency_band = %02X\n", frequency_band);
+       zb_node_desc_get_mac_capability_flags(desc, &mac_capability_flags);
+       printf("mac_capability_flags = %02X\n", mac_capability_flags);
+       zb_node_desc_get_manufacturer_code(desc, &manufacturer_code);
+       printf("manufacturer_code = %04X\n", manufacturer_code);
+       zb_node_desc_get_maximum_buffer_size(desc, &maximum_buffer_size);
+       printf("maximum_buffer_size = %02X\n", maximum_buffer_size);
+       zb_node_desc_get_maximum_incoming_transfer_size(desc, &maximum_incoming_transfer_size);
+       printf("maximum_incoming_transfer_size = %04X\n", maximum_incoming_transfer_size);
+       zb_node_desc_get_server_mask(desc, &server_mask);
+       printf("server_mask = %04X\n", server_mask);
+       zb_node_desc_get_maximum_outgoing_transfer_size(desc, &maximum_outgoing_transfer_size);
+       printf("maximum_outgoing_transfer_size = %04X\n", maximum_outgoing_transfer_size);
+       zb_node_desc_get_descriptor_capability_field(desc, &descriptor_capability_field);
+       printf("descriptor_capability_field = %04X\n", descriptor_capability_field);
+}
+
+static void zigbee_zdo_power_desc_rsp(unsigned char status, nwk_addr addr16,
+               const zb_zdo_node_power_descriptor_h power_desc, void *user_data)
+{
+       unsigned char current_power_mode;
+       unsigned char available_power_source;
+       unsigned char current_power_source;
+       unsigned char current_power_source_lv;
+       printf("status = %02X\n", status);
+       zb_node_power_desc_get_current_power_mode(power_desc, &current_power_mode);
+       printf("current_power_mode = %02X\n", current_power_mode);
+       zb_node_power_desc_get_available_power_sources(power_desc, &available_power_source);
+       printf("available_power_source = %02X\n", available_power_source);
+       zb_node_power_desc_get_current_power_source(power_desc, &current_power_source);
+       printf("current_power_source = %02X\n", current_power_source);
+       zb_node_power_desc_get_current_power_source_level(power_desc, &current_power_source_lv);
+       printf("current_power_source_level = %02X\n", current_power_source_lv);
+}
+
+static void zigbee_zdo_complex_desc_rsp(unsigned char status, nwk_addr addr16,
+               unsigned char length, unsigned char *complex_desc, void *user_data)
+{
+       printf("status = %02X length = %d\n", status, length);
+}
+
+static void zigbee_zdo_user_desc_conf(unsigned char status, void *user_data)
+{
+       printf("status = %02X\n", status);
+}
+
+static void zigbee_zdo_mgmt_lqi_rsp(unsigned char status,
+       unsigned char neighbor_table_entries, unsigned char start_idx,
+       unsigned char neighbor_table_list_count,
+       const zb_zdo_neighbor_table_desc_h *neighbor_table_list, void *user_data)
+{
+       int i;
+       ieee_addr extended_pan_id;
+       ieee_addr addr64;
+       nwk_addr addr16;
+       unsigned char device_type;
+       unsigned char rx_on_when_idle;
+       unsigned char releationship;
+       unsigned char permit_joining;
+       unsigned char depth;
+       unsigned char lqi;
+       printf("status = %02X start_idx=%d count=%d\n", status, start_idx, neighbor_table_list_count);
+       for (i = start_idx; i < neighbor_table_list_count; i++) {
+               zb_neighbor_table_desc_get_extended_pan_id(neighbor_table_list[i], extended_pan_id);
+               printf("ext PAN ID = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+               extended_pan_id[0], extended_pan_id[1], extended_pan_id[2], extended_pan_id[3],
+               extended_pan_id[4], extended_pan_id[5], extended_pan_id[6], extended_pan_id[7]);
+               zb_neighbor_table_desc_get_ieee_addr(neighbor_table_list[i], addr64);
+               printf("IEEE address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+               addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5], addr64[6], addr64[7]);
+               zb_neighbor_table_desc_get_nwk_addr(neighbor_table_list[i], &addr16);
+               printf("Network address = 0x%04X\n", addr16);
+               zb_neighbor_table_desc_get_device_type(neighbor_table_list[i], &device_type);
+               printf("Device Type = %02X\n", device_type);
+               zb_neighbor_table_desc_get_rx_on_when_idle(neighbor_table_list[i], &rx_on_when_idle);
+               printf("Rx on idle = %02X\n", rx_on_when_idle);
+               zb_neighbor_table_desc_get_relationship(neighbor_table_list[i], &releationship);
+               printf("Relationship = %02X\n", releationship);
+               zb_neighbor_table_desc_get_permit_joining(neighbor_table_list[i], &permit_joining);
+               printf("Permit Joining = %02X\n", permit_joining);
+               zb_neighbor_table_desc_get_depth(neighbor_table_list[i], &depth);
+               printf("Depth = %02X\n", depth);
+               zb_neighbor_table_desc_get_lqi(neighbor_table_list[i], &lqi);
+               printf("LQI = %02X\n", lqi);
+       }
+}
+
+static void zigbee_zdo_mgmt_rtg_rsp(unsigned char status,
+       unsigned char routing_table_entries, unsigned char start_idx,
+       unsigned char routing_table_list_count,
+       const zb_zdo_routing_table_h *routing_table_list, void *user_data)
+{
+       int i;
+       nwk_addr dst_addr;
+       unsigned char mode;
+       unsigned char memory_constrained;
+       unsigned char many_to_one;
+       unsigned char route_record_required;
+       nwk_addr next_hop_addr;
+       printf("status = %02X routing_table_entries=%d start_idx=%d count=%d\n",
+                       status, routing_table_entries, start_idx, routing_table_list_count);
+       for (i = start_idx; i < routing_table_list_count; i++) {
+               zb_routing_table_get_dst_addr(routing_table_list[i], &dst_addr);
+               printf("[%d] Destination address = 0x%04X\n", i, dst_addr);
+               zb_routing_table_get_dst_status(routing_table_list[i], &mode);
+               printf("[%d] Status = 0x%02X\n", i, mode);
+               zb_routing_table_get_memory_constrained(routing_table_list[i], &memory_constrained);
+               printf("[%d] memory_constrained = 0x%02X\n", i, memory_constrained);
+               zb_routing_table_get_many_to_one(routing_table_list[i], &many_to_one);
+               printf("[%d] many_to_one = 0x%02X\n", i, many_to_one);
+               zb_routing_table_get_route_record_required(routing_table_list[i], &route_record_required);
+               printf("[%d] route_record_required = 0x%02X\n", i, route_record_required);
+               zb_routing_table_get_next_hop_addr(routing_table_list[i], &next_hop_addr);
+               printf("[%d] next_hop_addr = 0x%04X\n", i, next_hop_addr);
+               printf("\n");
+       }
+}
+
+static bool zigbee_binding_table_cb(int index, zb_zdo_binding_table_h child,
+               void *user_data)
+{
+       nwk_addr addr16;
+       ieee_addr addr64;
+       unsigned short cluster_id;
+       unsigned char src_ep, dst_ep, dst_addr_mode;
+
+       printf("Binding Table Index = %d\n", index);
+
+       zb_binding_table_get_src_addr(child, addr64);
+       printf("Src IEEE address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+               addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5], addr64[6], addr64[7]);
+       zb_binding_table_get_src_ep(child, &src_ep);
+       printf("Src End-Point = %02X\n", src_ep);
+       zb_binding_table_get_cluster_id(child, &cluster_id);
+       printf("Cluster ID = %04X\n", cluster_id);
+       zb_binding_table_get_dst_addr_mode(child, &dst_addr_mode);
+       printf("Dst Address Mode = %02X\n", dst_addr_mode);
+       zb_binding_table_get_dst_addr16(child, &addr16);
+       printf("Dst Network address = %04X\n", addr16);
+       memset(addr64, 0, sizeof(ieee_addr));
+       zb_binding_table_get_dst_addr64(child, addr64);
+       printf("Dst IEEE address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+               addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5], addr64[6], addr64[7]);
+       zb_binding_table_get_dst_ep(child, &dst_ep);
+       printf("Dst End-Point = %02X\n", src_ep);
+
+       return true;
+}
+
+static void zigbee_zdo_mgmt_bind_rsp(unsigned char status, unsigned char entries,
+       unsigned char start_idx, unsigned char binding_table_list_count, const zb_zdo_binding_table_h *list,
+       void *user_data)
+{
+       int i;
+       nwk_addr addr16;
+       ieee_addr addr64;
+       unsigned short cluster_id;
+       unsigned char src_ep, dst_ep, dst_addr_mode;
+
+       printf("status = %02X start_idx = %d number of records = %d\n", status, start_idx,
+               binding_table_list_count);
+
+       for (i = 0; i < binding_table_list_count; i++) {
+               zb_binding_table_get_src_addr(list[i], addr64);
+               printf("Src IEEE address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+                       addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5], addr64[6], addr64[7]);
+               zb_binding_table_get_src_ep(list[i], &src_ep);
+               printf("Src End-Point = %02X\n", src_ep);
+               zb_binding_table_get_cluster_id(list[i], &cluster_id);
+               printf("Cluster ID = %04X\n", cluster_id);
+               zb_binding_table_get_dst_addr_mode(list[i], &dst_addr_mode);
+               printf("Dst Address Mode = %02X\n", dst_addr_mode);
+               zb_binding_table_get_dst_addr16(list[i], &addr16);
+               printf("Dst Network address = %04X\n", addr16);
+               memset(addr64, 0, sizeof(ieee_addr));
+               zb_binding_table_get_dst_addr64(list[i], addr64);
+               printf("Dst IEEE address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+                       addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5], addr64[6], addr64[7]);
+               zb_binding_table_get_dst_ep(list[i], &dst_ep);
+               printf("Dst End-Point = %02X\n\n", src_ep);
+       }
+}
+
+static void zigbee_zcl_global_read_attributes_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
+       int records_len, void *user_data)
+{
+       int count;
+       unsigned short id;
+       unsigned char type;
+       unsigned char status;
+       unsigned char *buf = NULL;
+       zb_value_h value = NULL;
+       read_attr_status_record_h *records;
+
+       if (NULL == records_info || ZB_GLOBAL_READ_ATTR != records_info->type
+                || NULL == records_info->record.read_attr) {
+               printf("Invalid records info");
+               return;
+       }
+       records = records_info->record.read_attr;
+
+       zb_create_value(&value);
+       printf("Cluster ID : 0x%04x\n", cluster_id);
+       printf("Node ID : 0x%04X\n", addr16);
+       printf("End-Point : 0x%02X\n", ep);
+       printf("Msg length %d\n", records_len);
+
+       if (records && *records) {
+               zb_get_id_from_read_attr_status_record(*records, &id);
+               printf("Attribute ID : 0x%04X\n", id);
+       }
+       if (records && *records) {
+               zb_get_type_from_read_attr_status_record(*records, &type);
+               printf("Type : 0x%02X\n", type);
+       }
+       if (records && *records) {
+               zb_get_status_from_read_attr_status_record(*records, &status);
+               printf("Status : 0x%02X\n", status);
+       }
+       if (records && *records) {
+               zb_get_value_from_read_attr_status_record(*records, type, value);
+               if (value) {
+                       zb_get_value(value, &type, &buf, &count);
+                       if (buf) {
+                               printf("value[0] = 0x%02x\n", buf[0]);
+                               free(buf);
+                       }
+                       zb_destroy_value(value);
+               }
+       }
+}
+
+static void zigbee_zcl_global_write_attributes_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
+       int records_len, void *user_data)
+{
+       unsigned short id;
+       unsigned char status;
+       zb_value_h value = NULL;
+       write_attr_status_record_h *records;
+
+       if (NULL == records_info || ZB_GLOBAL_WRITE_ATTR != records_info->type
+                || NULL == records_info->record.write_attr) {
+               printf("Invalid records info");
+               return;
+       }
+       records = records_info->record.write_attr;
+
+       zb_create_value(&value);
+       printf("Cluster ID : 0x%04X\n", cluster_id);
+       printf("Node ID : 0x%04X\n", addr16);
+       printf("End-Point : 0x%02X\n", ep);
+       printf("Msg length %d\n", records_len);
+       if (records) {
+               zb_get_id_from_write_attr_status(*records, &id);
+               printf("AttributeId 0x%04X\n", id);
+       }
+       if (records) {
+               zb_get_status_from_write_attr_status(*records, &status);
+               printf("status 0x%02X\n", status);
+       }
+       zb_destroy_value(value);
+}
+
+static void zigbee_zcl_global_configure_reporting_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
+       int records_len, void *user_data)
+{
+       int i;
+       unsigned char status;
+       report_config_response_record_h *records;
+
+       if (NULL == records_info || ZB_GLOBAL_CONFIG_REPORT != records_info->type
+                || NULL == records_info->record.report_config_rsp) {
+               printf("Invalid records info");
+               return;
+       }
+       records = records_info->record.report_config_rsp;
+
+       printf("records_len=%d\n", records_len);
+       for (i = 0; i < records_len; i++) {
+               zb_get_status_from_report_config_response_record(records[i], &status);
+               printf("[%d] status = 0x%02X\n", i, status);
+       }
+}
+
+static void zigbee_zcl_global_discover_attributes_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, unsigned char discovery_complete,
+       discover_attr_info_record_h * records, int records_len, void *user_data)
+{
+       int i;
+       unsigned char type;
+       unsigned short id;
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Cluster ID = 0x%02X\n", cluster_id);
+       printf("discovery_complete = %d\n", discovery_complete);
+       for (i = 0; i < records_len; i++) {
+               zb_get_type_from_discover_attr_info(records[i], &type);
+               printf("[%d] type = 0x%02X\n", i, type);
+               zb_get_id_from_discover_attr_info(records[i], &id);
+               printf("[%d] id = 0x%04X\n", i, id);
+       }
+}
+
+static void zigbee_zcl_global_discover_cmds_received_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, unsigned char discovery_complete,
+       unsigned char *command_ids, int command_ids_len, void *user_data)
+{
+       int i;
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point =0x%02X\n", ep);
+       printf("Cluster ID = 0x%02X\n", cluster_id);
+       printf("discovery_complete = %d\n", discovery_complete);
+       for (i = 0; i < command_ids_len; i++)
+               printf("command_id[%d] = 0x%02X\n", i, command_ids[i]);
+}
+
+static void zigbee_zcl_global_discover_cmds_generated_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, unsigned char discovery_complete,
+       unsigned char *command_ids, int command_ids_len, void *user_data)
+{
+       int i;
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Cluster ID = 0x%02X\n", cluster_id);
+       printf("discovery_complete = %d\n", discovery_complete);
+       for (i = 0; i < command_ids_len; i++)
+               printf("command_id[%d] = 0x%02X\n", i, command_ids[i]);
+}
+
+static void zigbee_zcl_global_discover_attr_extended_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, unsigned char discovery_complete,
+       extended_attr_info_h *records, unsigned short records_len, void *user_data)
+{
+       int i;
+       unsigned char type;
+       unsigned short id;
+       unsigned char acl;
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Cluster ID = 0x%02X\n", cluster_id);
+       printf("discovery_complete = %d\n", discovery_complete);
+       for (i = 0; i < records_len; i++) {
+               zb_get_id_from_extended_attr_info(records[i], &id);
+               printf("[%d] id = 0x%02X\n", i, id);
+               zb_get_type_from_extended_attr_info(records[i], &type);
+               printf("[%d] type = 0x%04X\n", i, type);
+               zb_get_acl_from_extended_attr_info(records[i], &acl);
+               printf("[%d] acl = 0x%04X\n", i, acl);
+       }
+}
+
+static void zigbee_zdo_bind_unbind_rsp(unsigned char status, void *user_data)
+{
+       printf("status = 0x%02X\n", status);
+}
+
+static void zigbee_zdo_mgmt_nwk_disc_rsp(unsigned char status,
+       unsigned char network_count, unsigned char start_idx, unsigned char network_list_count,
+       const zb_zdo_network_list_record_h *records, void *user_data)
+{
+       int i = 0;
+       ieee_addr extended_pan_id;
+       unsigned char logical_channel;
+       unsigned char stack_profile;
+       unsigned char zigbee_version;
+       unsigned char beacon_order;
+       unsigned char superframe_order;
+       unsigned char permit_joining;
+
+       printf("Status 0x%02X\n", status);
+       if (!status) {
+               printf("network_count 0x%02X\n", network_count);
+               printf("start_idx  0x%02X\n", start_idx);
+               printf("network_list_count  0x%02X\n", network_list_count);
+               for (i = 0; i < network_list_count; i++) {
+                       zb_network_list_record_get_extended_pan_id(records[i], extended_pan_id);
+                       printf("Extended PanId %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+                               extended_pan_id[7], extended_pan_id[6],
+                               extended_pan_id[5], extended_pan_id[4],
+                               extended_pan_id[3],     extended_pan_id[2],
+                               extended_pan_id[1],     extended_pan_id[0]);
+                       zb_network_list_record_get_logical_channel(records[i], &logical_channel);
+                       printf("Logical Channel 0x%02X\n", logical_channel);
+                       zb_network_list_record_get_stack_profile(records[i], &stack_profile);
+                       printf("stack_profile 0x%02X\n", stack_profile);
+                       zb_network_list_record_get_zigbee_version(records[i], &zigbee_version);
+                       printf("zigbee_version 0x%02X\n", zigbee_version);
+                       zb_network_list_record_get_beacon_order(records[i], &beacon_order);
+                       printf("Beacon_order  0x%02X\n", beacon_order);
+                       zb_network_list_record_get_superframe_order(records[i], &superframe_order);
+                       printf("Superframe_order  0x%02X\n", superframe_order);
+                       zb_network_list_record_get_permit_joining(records[i], &permit_joining);
+                       printf("Permit joining 0x%02X\n", permit_joining);
+               }
+       } else {
+               printf("Unsuccessful Nwk discovery\n");
+       }
+}
+static void zigbee_zdo_mgmt_leave_rsp(unsigned char status, void *user_data)
+{
+       printf("status = 0x%02X\n", status);
+}
+
+static void zigbee_zdo_mgmt_permit_joining_rsp(unsigned char status, void *user_data)
+{
+       printf("status = 0x%02X\n", status);
+}
+
+static void zigbee_zcl_global_read_reporting_configuration_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
+       int records_len, void *user_data)
+{
+       zb_value_h val;
+       int i = 0;
+       int j = 0;
+       int count;
+       unsigned char type, *buf;
+       unsigned short id, max_i, min_i;
+       report_config_record_h *records;
+
+       if (NULL == records_info || ZB_GLOBAL_READ_REPORT_CONFIG != records_info->type
+                || NULL == records_info->record.report_config) {
+               printf("Invalid records info");
+               return;
+       }
+
+       records = records_info->record.report_config;
+
+       printf("cluster_id 0x%04X\n", cluster_id);
+       printf("nodeId 0x%04X\n", addr16);
+       printf("endpoint 0x%02X\n", ep);
+       printf("Msg length %d\n", records_len);
+
+       while (i < records_len) {
+               printf("records[%d] 0x%08X\n", i, id);
+               zb_get_id_from_report_config_record(records[i], &id);
+               printf("AttributeId 0x%04X\n", id);
+               zb_get_type_from_report_config_record(records[i], &type);
+               /*if ((zb_get_analog_or_discret(type) == DATA_TYPE_ANALOG)) {*/
+                       printf("type 0x%02X\n", type);
+                       zb_get_max_i_from_report_config_record(records[i], &max_i);
+                       printf("Max Interval 0x%04X\n", max_i);
+                       zb_get_min_i_from_report_config_record(records[i], &min_i);
+                       printf("Min Interval 0x%04X\n", min_i);
+                       zb_create_value(&val);
+                       zb_get_change_from_report_config_record1(records[i], val);
+                       zb_get_value(val, &type, &buf, &count);
+                       for (j = 0; j < count; j++)
+                               printf("value[j] = 0x%02x\n", buf[j]);
+                       printf("\n");
+                       free(buf);
+                       zb_destroy_value(val);
+               /*
+               } else {
+                       printf("Unsuccessful Attempt\n");
+               }
+               */
+               i++;
+       }
+}
+
+static void zigbee_zcl_alarm_get_alarm_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned char alarm_code, unsigned short cluster_id,
+       unsigned int time_stamp, void *user_data)
+{
+       printf("Network Address = 0x%04X status = 0x%02X\n", addr16, status);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("alarm_code = 0x%02X\n", alarm_code);
+       printf("cluster_id = 0x%04X\n", cluster_id);
+       printf("time_stamp = 0x%08X\n", time_stamp);
+}
+
+static void zigbee_zcl_poll_control_check_in(nwk_addr addr16, unsigned char ep,
+       void *user_data)
+{
+       printf("Network Address = 0x%04X End-Point = 0x%02X\n", addr16, ep);
+}
+
+static void zigbee_zcl_identify_query_cb(nwk_addr addr16, unsigned short identify_time,
+       void *user_data)
+{
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("identify_time = %d\n", identify_time);
+}
+
+static void zigbee_zcl_group_add_group_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, void *user_data)
+{
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Group ID = 0x%04X\n", group_id);
+}
+
+static void zigbee_zcl_group_view_group_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, const char *group_name, void *user_data)
+{
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Group ID = 0x%04X\n", group_id);
+       printf("Group Name = %s\n", group_name);
+}
+
+static void zigbee_zcl_group_get_group_membership_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned char capacity, unsigned char group_count,
+       unsigned short *group_list, void *user_data)
+{
+       int i;
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("capacity = 0x%02X\n", capacity);
+       for (i = 0; i < group_count; i++)
+               printf("[%d] group_list=%04X\n", i, group_list[i]);
+}
+
+static void zigbee_zcl_group_remove_group_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, void *user_data)
+{
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Group ID = 0x%04X\n", group_id);
+}
+
+static void zigbee_zcl_scene_add_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, unsigned char scene_id, void *user_data)
+{
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Group ID = 0x%04X\n", group_id);
+       printf("Scene ID = 0x%02X\n", scene_id);
+}
+
+static void zigbee_zcl_scene_view_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, unsigned char scene_id,
+       unsigned short transition_time, const char *scene_name, const char *extension_field_set,
+       unsigned short ext_len, void *user_data)
+{
+       int i;
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Group ID = 0x%04X\n", group_id);
+       printf("Scene ID = 0x%02X\n", scene_id);
+       printf("Transition Time = 0x%04X\n", transition_time);
+       printf("Scene Name = %s\n", scene_name);
+       for (i = 0; i < ext_len; i++)
+               printf("extension_field_set[%d] = 0x%02X\n", i, extension_field_set[i]);
+}
+
+static void zigbee_zcl_scene_remove_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, unsigned char scene_id, void *user_data)
+{
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Group ID = 0x%04X\n", group_id);
+       printf("Scene ID = 0x%02X\n", scene_id);
+}
+
+static void zigbee_zcl_scene_remove_all_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, void *user_data)
+{
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Group ID = 0x%04X\n", group_id);
+}
+
+static void zigbee_zcl_scene_store_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, unsigned char scene_id, void *user_data)
+{
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Group ID = 0x%04X\n", group_id);
+       printf("Scene ID = 0x%02X\n", scene_id);
+}
+
+static void zigbee_zcl_scene_get_scene_membership_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned char status, unsigned char capacity, unsigned short group_id,
+       unsigned char scene_count, unsigned char *scene_list, void *user_data)
+{
+       int i;
+       printf("Network Address = 0x%04X\n", addr16);
+       printf("End-Point = 0x%02X\n", ep);
+       printf("Status = 0x%02X\n", status);
+       printf("Capacity = 0x%02X\n", capacity);
+       printf("Group ID = 0x%02X\n", group_id);
+       for (i = 0; i < scene_count && ZB_ZCL_SUCCESS == status; i++)
+               printf("scene_list[%d] = 0x%02X\n", i, scene_list[i]);
+}
+
+void process_input(const char *input, gpointer user_data)
+{
+       /* Samjin power outlet EP1 */
+       sj_ep1.ep = 1;
+       sj_ep1.profile_id = 0x0104;
+       sj_ep1.device_id = 0x0002;
+       sj_ep1.num_of_in_clusters = 8;
+       sj_ep1.num_of_out_clusters = 1;
+       /* In clusters : 0000 0003 0004 0005 0006 0009 0B04 0B05 */
+       sj_ep1.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       sj_ep1.in_clusters[1] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       sj_ep1.in_clusters[2] = ZB_ZCL_GROUPS_CLUSTER_ID;
+       sj_ep1.in_clusters[3] = ZB_ZCL_SCENES_CLUSTER_ID;
+       sj_ep1.in_clusters[4] = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       sj_ep1.in_clusters[5] = ZB_ZCL_ALARM_CLUSTER_ID;
+       sj_ep1.in_clusters[6] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       /* Out clusters : 0019 */
+       unsigned short sj_out_clusters[] = { ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID };
+
+       /* SmartThings open/close sensor EP1 */
+       st_ep1.ep = 1;
+       st_ep1.profile_id = 0x0104;
+       st_ep1.device_id = 0x0402;
+       st_ep1.num_of_in_clusters = 7;
+       st_ep1.num_of_out_clusters = 1;
+       st_ep1.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       st_ep1.in_clusters[1] = ZB_ZCL_POWER_CONFIG_CLUSTER_ID;
+       st_ep1.in_clusters[2] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       st_ep1.in_clusters[3] = ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID;
+       st_ep1.in_clusters[4] = ZB_ZCL_IAS_ZONE_CLUSTER_ID;
+       st_ep1.in_clusters[5] = ZB_ZCL_POLL_CONTROL_CLUSTER_ID;
+       st_ep1.in_clusters[6] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       st_ep1.out_clusters[0] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+
+       /* SmartThings open/close sensor EP2 */
+       st_ep2.ep = 2;
+       st_ep2.profile_id = 0xC2DF;
+       st_ep2.device_id = 0x000C;
+       st_ep2.num_of_in_clusters = 4;
+       st_ep2.num_of_out_clusters = 1;
+       st_ep2.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       st_ep2.in_clusters[1] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       st_ep2.in_clusters[2] = ZB_ZCL_SCENES_CLUSTER_ID;
+       st_ep2.in_clusters[3] = 0xFC0F;
+       st_ep2.out_clusters[0] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+
+       /* SmartThings Motion Sensor EP1 */
+       st_ep3.ep = 1;
+       st_ep3.profile_id = 0x0104;
+       st_ep3.device_id = 0x0402;
+       st_ep3.num_of_in_clusters = 7;
+       st_ep3.num_of_out_clusters = 1;
+       st_ep3.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       st_ep3.in_clusters[1] = ZB_ZCL_POWER_CONFIG_CLUSTER_ID;
+       st_ep3.in_clusters[2] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       st_ep3.in_clusters[3] = ZB_ZCL_POLL_CONTROL_CLUSTER_ID;
+       st_ep3.in_clusters[4] = ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID;
+       st_ep3.in_clusters[5] = ZB_ZCL_IAS_ZONE_CLUSTER_ID;
+       st_ep3.in_clusters[6] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       st_ep3.out_clusters[0] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+
+       /* SmartThings Motion Sensor EP2 */
+       st_ep4.ep = 2;
+       st_ep4.profile_id = 0xC2DF;
+       st_ep4.device_id = 0x0107;
+       st_ep4.num_of_in_clusters = 5;
+       st_ep4.num_of_out_clusters = 1;
+       st_ep4.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       st_ep4.in_clusters[1] = ZB_ZCL_POWER_CONFIG_CLUSTER_ID;
+       st_ep4.in_clusters[2] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       st_ep4.in_clusters[3] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       st_ep4.in_clusters[4] = 0xFC46;
+       st_ep4.out_clusters[0] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;
+
+       /* Things Simulator */
+       simul_ep1.ep = 1;
+       simul_ep1.profile_id = 0x0104;
+       simul_ep1.device_id = 0xffff;
+       simul_ep1.num_of_in_clusters = 7;
+       simul_ep1.num_of_out_clusters = 1;
+       simul_ep1.in_clusters[0] = ZB_ZCL_BASIC_CLUSTER_ID;
+       simul_ep1.in_clusters[1] = ZB_ZCL_IDENTIFY_CLUSTER_ID;
+       simul_ep1.in_clusters[2] = ZB_ZCL_GROUPS_CLUSTER_ID;
+       simul_ep1.in_clusters[3] = ZB_ZCL_SCENES_CLUSTER_ID;
+       simul_ep1.in_clusters[4] = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       simul_ep1.in_clusters[5] = ZB_ZCL_LEVEL_CONTROL_CLUSTER_ID;
+       simul_ep1.in_clusters[6] = ZB_ZCL_DIAGNOSTICS_CLUSTER_ID;
+       /*simul_ep1.in_clusters[7] = ZB_ZCL_SIMPLE_METERING_CLUSTER_ID;*/
+       simul_ep1.out_clusters[0] = ZB_ZCL_TIME_CLUSTER_ID;
+       /*simul_ep1.out_clusters[1] = ZB_ZCL_OTA_BOOTLOAD_CLUSTER_ID;*/
+
+
+       struct appdata *ad = (struct appdata *)user_data;
+       int ret = -1;
+       int cmd = strtol(input, NULL, 0);
+       if (is_digit(input) < 0 || strlen(input) == 0 || errno == ERANGE || errno == EINVAL)
+               cmd = CMD_INVALID;
+
+       printf("cmd=[%d]\n", cmd);
+
+       switch (cmd) {
+       case CMD_QUIT:
+               printf("Bye\n");
+               g_main_loop_quit(ad->main_loop);
+               break;
+       case CMD_INITIALIZE:
+               handle = NULL;
+               ret = zb_create(&handle);
+               printf("zb_create ret=[0x%x]\n", (int)handle);
+               break;
+       case CMD_ENABLE:
+               ret = zb_enable(handle, zigbee_event_cb);
+               printf("zb_enable ret=[0x%x]\n", ret);
+               break;
+       case CMD_GET_NETWORK_INFO:
+       {
+               nwk_addr nodeid;
+               nwk_addr panid;
+               unsigned char channel;
+               unsigned char tx_power;
+
+               ret = zb_get_network_info(handle, co_addr64, &nodeid, &panid, &channel, &tx_power);
+               printf("zb_get_network_info ret=[0x%02X]\n", (int)ret);
+               printf("  IEEE ADDR : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+                                       co_addr64[0], co_addr64[1], co_addr64[2],
+                                       co_addr64[3], co_addr64[4], co_addr64[5],
+                                       co_addr64[6], co_addr64[7]);
+               printf("  nodeID [0x%02X]\n", nodeid);
+               printf("  PanID [0x%02X]\n", panid);
+               printf("  Channel [%d] Tx Power [%d]\n", channel, tx_power);
+               break;
+       }
+       case CMD_GET_COORDINATOR_MAC_ADDR:
+               ret = zb_get_controller_mac_address(handle, co_addr64);
+               printf("zb_get_controller_mac_address ret=[0x%02X]\n", (int)ret);
+               printf("IEEE ADDR 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n",
+                       co_addr64[0], co_addr64[1], co_addr64[2], co_addr64[3],
+                       co_addr64[4], co_addr64[5], co_addr64[6], co_addr64[7]);
+               break;
+       case CMD_GET_END_DEVICE_LIST:
+       {
+               int i, j;
+               int count;
+               nwk_addr addr16;
+               ieee_addr addr64;
+               unsigned char num_of_ep;
+               unsigned char ep_list[10];
+               zb_end_device_info_h *list = NULL;
+               ret = zb_get_all_device_list(handle, &count, &list);
+               for (i = 0; i < count && list; i++) {
+                       zb_get_network_address(list[i], &addr16);
+                       printf("network address = 0x%02X\n", addr16);
+
+                       zb_get_ieee_address((list)[i], addr64);
+                       printf("ieee address = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
+                               addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5],
+                               addr64[6], addr64[7]);
+
+                       if (!strncmp((char *)sj_addr64, (char *)addr64, sizeof(addr64))) {
+                               sj_addr16 = addr16;
+                               printf("Samjin Power Outlet Find!!\n");
+                       }
+                       if (!strncmp((char *)st_addr64, (char *)addr64, sizeof(addr64))) {
+                               st_addr16 = addr16;
+                               printf("ST Open/Close Sensor Find!!\n");
+                       }
+
+                       zb_get_num_of_ep((list)[i], &num_of_ep);
+                       printf("number of end-points = 0x%04X\n", num_of_ep);
+
+                       memset(ep_list, 0, sizeof(ep_list));
+                       zb_get_ep_list((list)[i], ep_list);
+                       for (j = 0; j < num_of_ep; j++)
+                               printf("%04x ", ep_list[j]);
+                       printf("\n");
+               }
+               zb_device_list_free(list);
+
+               break;
+       }
+       case CMD_DISABLE:
+               ret = zb_disable(handle);
+               printf("zb_disable ret=[0x%x]\n", ret);
+               break;
+       case CMD_RESET:
+               ret = zb_hw_reset(handle);
+               printf("zb_hw_reset ret=[0x%x]\n", ret);
+               break;
+       case CMD_COEX_START:
+               ret = zb_coex_start(handle, 11);
+               printf("zb_coex_start ret=[0x%x]\n", ret);
+               break;
+       case CMD_COEX_STOP:
+               ret = zb_coex_stop(handle);
+               printf("zb_coex_stop ret=[0x%x]\n", ret);
+               break;
+       case CMD_FORM_NETWORK:
+               ret = zb_form_network(handle);
+               printf("zb_form_network ret=[0x%x]\n", ret);
+               break;
+       case CMD_DISABLE_NETWORK:
+               ret = zb_disable_network(handle);
+               printf("zb_disable_network ret=[0x%x]\n", ret);
+               break;
+       case CMD_LEAVE_NODE:
+               ret = zb_leave_device(handle, st_addr64, true, false);
+               printf("zb_leave_device ret=[0x%x]\n", ret);
+               ret = zb_leave_device(handle, sj_addr64, true, false);
+               printf("zb_leave_device ret=[0x%x]\n", ret);
+               break;
+       case CMD_PERMIT_JOIN:
+               ret = zb_permit_join(handle, 90);
+               printf("zb_permit_join ret=[0x%x]\n", ret);
+               break;
+       case CMD_NWK_ADDR_REQ:
+               ret = zb_zdo_nwk_addr_req(handle, st_addr64, 0x00, 0x00,
+                       zigbee_addr_rsp, NULL);
+               ret = zb_zdo_nwk_addr_req(handle, sj_addr64, 0x00, 0x00,
+                       zigbee_addr_rsp, NULL);
+               break;
+       case CMD_IEEE_ADDR_REQ:
+               ret = zb_zdo_ieee_addr_req(handle, st_addr16, zigbee_addr_rsp, NULL);
+               ret = zb_zdo_ieee_addr_req(handle, sj_addr16, zigbee_addr_rsp, NULL);
+               break;
+       case CMD_ACTIVE_EP_REQ:
+               ret = zb_zdo_active_ep(handle, st_addr16, zigbee_active_ep_rsp, NULL);
+               ret = zb_zdo_active_ep(handle, sj_addr16, zigbee_active_ep_rsp, NULL);
+               break;
+       case CMD_SIMPLE_DESC_REQ:
+       case CMD_EXTENDED_SIMPLE_DESC_REQ:
+               ret = zb_zdo_simple_desc_req(handle, simul_addr16, 1, zigbee_simple_desc_rsp, NULL);
+               /*ret = zb_zdo_simple_desc_req(handle, st_addr16, 1, zigbee_simple_desc_rsp, NULL);*/
+               /*ret = zb_zdo_simple_desc_req(handle, sj_addr16, 1, zigbee_simple_desc_rsp, NULL);*/
+               break;
+       case CMD_MATCHED_DESC_REQ:
+               /* for ST open/close sensor */
+               ret = zb_zdo_match_desc_req(handle, st_addr16, st_ep1.profile_id,
+                       st_ep1.num_of_in_clusters, st_ep1.in_clusters, st_ep1.num_of_out_clusters,
+                       st_ep1.out_clusters, zigbee_match_desc_rsp, user_data);
+               /* for SJ power outlet */
+               ret = zb_zdo_match_desc_req(handle, sj_addr16, sj_ep1.profile_id,
+                       sj_ep1.num_of_in_clusters, sj_ep1.in_clusters, sj_ep1.num_of_out_clusters,
+                       sj_ep1.out_clusters, zigbee_match_desc_rsp, user_data);
+               break;
+       case CMD_POWER_DESC_REQ:
+               ret = zb_zdo_power_desc_req(handle, sj_addr16, zigbee_zdo_power_desc_rsp, NULL);
+               break;
+       case CMD_COMPLEX_DESC_REQ:
+               ret = zb_zdo_complex_desc_req(handle, sj_addr16, zigbee_zdo_complex_desc_rsp, NULL);
+               break;
+       case CMD_USER_DESC_REQ:
+               ret = zb_zdo_user_desc_req(handle, sj_addr16, zigbee_zdo_complex_desc_rsp, NULL);
+               break;
+       case CMD_USER_DESC_SET_REQ:
+               ret = zb_zdo_user_desc_set(handle, sj_addr16, 4, (unsigned char*)"test",
+                       zigbee_zdo_user_desc_conf, NULL);
+               break;
+       case CMD_NODE_DESC_REQ:
+               /*zb_zdo_node_desc_req(handle, st_addr16, zigbee_zdo_node_desc_rsp, NULL);*/
+               zb_zdo_node_desc_req(handle, sj_addr16, zigbee_zdo_node_desc_rsp, NULL);
+               break;
+       case CMD_DEVICE_ANNCE:
+               ret = zb_zdo_device_annce(handle, st_addr16, st_addr64,
+                       ZB_ZDP_ALTERNATIVE_PAN_COORDINATOR | ZB_ZDP_DEVICE_TYPE | ZB_ZDP_POWER_SOURCE |
+                       ZB_ZDP_RECEIVER_ON_WHEN_IDLE | ZB_ZDP_ALLOCATE_ADDRESS);
+               break;
+       case CMD_BIND_REQ:
+               /* Samjin Power Outlet */
+#if 0
+               ret = zb_zdo_bind_req(handle, sj_addr16, sj_addr64, 1, ZB_ZCL_DIAGNOSTICS_CLUSTER_ID,
+                       co_addr64, ZB_UNICAST_BINDING, 0x0004, 1, zigbee_zdo_bind_unbind_rsp, NULL);
+#endif
+               ret = zb_zdo_bind_req(handle, sj_addr16, sj_addr64, 1, ZB_ZCL_ON_OFF_CLUSTER_ID,
+                       co_addr64, ZB_UNICAST_BINDING, 0x0004, 1, zigbee_zdo_bind_unbind_rsp, NULL);
+#if 0
+               /* For ST Open/Close Sensor */
+               ret = zb_zdo_bind_req(handle, st_addr16, st_addr64, 1, ZB_ZCL_IAS_ZONE_CLUSTER_ID,
+                       co_addr64, ZB_UNICAST_BINDING, panid, 1, zigbee_zdo_bind_unbind_rsp, NULL);
+#endif
+               break;
+       case CMD_UNBIND_REQ:
+               ret = zb_zdo_unbind_req(handle, sj_addr16, co_addr64, 1, ZB_ZCL_ON_OFF_CLUSTER_ID,
+                       sj_addr64, ZB_UNICAST_BINDING, panid, 1, zigbee_zdo_bind_unbind_rsp, NULL);
+               break;
+       case CMD_MGMT_NWK_DISC_REQ:
+       {
+               unsigned int scan_channels = ZB_802_15_4_CHANNELS_MASK;
+               ret = zb_zdo_mgmt_nwk_disc_req(handle, sj_addr16, scan_channels, 5, 4, 0,
+                       zigbee_zdo_mgmt_nwk_disc_rsp, NULL);
+               break;
+       }
+       case CMD_MGMT_NWK_UPDATE_REQ:
+       {
+               unsigned int scan_channels = ZB_802_15_4_CHANNELS_MASK;
+               unsigned char nwk_update_id = 0x00;
+               ret = zb_zdo_mgmt_nwk_update_req(handle, scan_channels, 5, 4, nwk_update_id, sj_addr16);
+               break;
+       }
+       case CMD_MGMT_LQI_REQ:
+               ret = zb_zdo_mgmt_lqi_req(handle, sj_addr16, 0, zigbee_zdo_mgmt_lqi_rsp, NULL);
+               /*ret = zb_zdo_mgmt_lqi_req(handle, st_addr16, 0, zigbee_zdo_mgmt_lqi_rsp, NULL);*/
+               break;
+       case CMD_MGMT_RTG_REQ:
+               ret = zb_zdo_mgmt_rtg_req(handle, sj_addr16, 0, zigbee_zdo_mgmt_rtg_rsp, NULL);
+               /*ret = zb_zdo_mgmt_rtg_req(handle, st_addr16, 0, zigbee_zdo_mgmt_rtg_rsp, NULL);*/
+               break;
+       case CMD_MGMT_BIND_REQ:
+               ret = zb_zdo_mgmt_bind_req(handle, sj_addr16, 0, zigbee_zdo_mgmt_bind_rsp, NULL);
+               /*ret = zb_zdo_mgmt_bind_req(handle, st_addr16, 0, zigbee_zdo_mgmt_bind_rsp, NULL);*/
+               break;
+       case CMD_MGMT_LEAVE_REQ:
+               ret = zb_zdo_mgmt_leave_req(handle, sj_addr64, true, true, zigbee_zdo_mgmt_leave_rsp, NULL);
+               break;
+       case CMD_MGMT_PERMIT_JOINING_REQ:
+               ret = zb_zdo_mgmt_permit_joining_req(handle, sj_addr16, 90, 0,
+                               zigbee_zdo_mgmt_permit_joining_rsp, NULL);
+               break;
+       case CMD_READ_ATTRIBUTES_REQ:
+       {
+               /* For SmartThings open/close sensor */
+               unsigned short st_cluster_id = ZB_ZCL_IAS_ZONE_CLUSTER_ID;
+               unsigned short st_attribute_id[] = { ZB_ZCL_ZONE_STATE_ATTRIBUTE_ID,
+                       ZB_ZCL_ZONE_TYPE_ATTRIBUTE_ID,
+                       ZB_ZCL_ZONE_STATUS_ATTRIBUTE_ID,
+                       ZB_ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID,
+                       ZB_ZCL_ZONE_ID_ATTRIBUTE_ID
+               };
+#if 1
+               int st_len_of_attr = sizeof(st_attribute_id) / sizeof(st_attribute_id[0]);
+               /* Reading zone state attribute */
+               ret = zb_zcl_global_read_attr(handle, st_addr16, 1, st_ep1.ep,
+                               -1, st_cluster_id, st_attribute_id, st_len_of_attr,
+                               zigbee_zcl_global_read_attributes_rsp, NULL);
+#endif
+               /* For Samjin power outlet */
+               /* Reading attributs in on/off cluster */
+               unsigned short sj_cluster_id = ZB_ZCL_ON_OFF_CLUSTER_ID;
+               unsigned short sj_attribute_id[] = { ZB_ZCL_ON_OFF_ATTRIBUTE_ID,
+                       ZB_ZCL_GLOBAL_SCENE_CONTROL_ATTRIBUTE_ID,
+                       ZB_ZCL_ON_TIME_ATTRIBUTE_ID,
+                       ZB_ZCL_OFF_WAIT_TIME_ATTRIBUTE_ID
+               };
+               int sj_len_of_attr = sizeof(sj_attribute_id) / sizeof(sj_attribute_id[0]);
+
+               ret = zb_zcl_global_read_attr(handle, sj_addr16, 1, sj_ep1.ep,
+                               -1, sj_cluster_id, sj_attribute_id, sj_len_of_attr,
+                               zigbee_zcl_global_read_attributes_rsp, NULL);
+#if 1
+               /* Reading active power report in electrical measurement cluster */
+               sj_cluster_id = ZB_ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID;
+               sj_attribute_id[0] = ZB_ZCL_ACTIVE_POWER_ATTRIBUTE_ID;
+               sj_len_of_attr = 1;
+
+               ret = zb_zcl_global_read_attr(handle, sj_addr16, 1, sj_ep1.ep,
+                               -1, sj_cluster_id, sj_attribute_id, sj_len_of_attr,
+                               zigbee_zcl_global_read_attributes_rsp, NULL);
+#endif
+               break;
+       }
+       case CMD_WRITE_ATTRIBUTES_REQ:
+       {
+               unsigned char value[] = { 0x02, 0x01};
+               /* Samjin Power Outlet */
+               write_attr_record_h attr;
+               zb_create_write_attr_record(&attr);
+               zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
+               zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
+               zb_set_buf_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER, value,
+                       zb_get_data_size(ZB_ZCL_UNSIGNED_16_BIT_INTEGER));
+               ret = zb_zcl_global_write_attr(handle, sj_addr16, 1, sj_ep1.ep, ZB_ZCL_FC_DEFAULT,
+                               ZB_ZCL_IDENTIFY_CLUSTER_ID, &attr, 1,
+                               zigbee_zcl_global_write_attributes_rsp, NULL);
+               zb_destroy_write_attr_record(attr);
+               break;
+       }
+       case CMD_WRITE_ATTRIBUTES_UNDEVIDEDED_REQ:
+       {
+               unsigned char value[] = { 0x02, 0x01};
+               /* Samjin Power Outlet */
+               write_attr_record_h attr;
+               zb_create_write_attr_record(&attr);
+               zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
+               zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
+               zb_set_buf_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER, value,
+                       zb_get_data_size(ZB_ZCL_UNSIGNED_16_BIT_INTEGER));
+               ret = zb_zcl_global_write_attr_undivided(handle, sj_addr16, 1,
+                               sj_ep1.ep, ZB_ZCL_FC_DEFAULT, ZB_ZCL_IDENTIFY_CLUSTER_ID, &attr, 1,
+                               zigbee_zcl_global_write_attributes_rsp, NULL);
+               zb_destroy_write_attr_record(attr);
+               break;
+       }
+       case CMD_WRITE_ATTRIBUTES_NO_RSP_REQ:
+       {
+               unsigned char value[] = { 0x02, 0x01};
+               /* Samjin Power Outlet */
+               write_attr_record_h attr;
+               zb_create_write_attr_record(&attr);
+               zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
+               zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
+               zb_set_buf_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER, value,
+                       zb_get_data_size(ZB_ZCL_UNSIGNED_16_BIT_INTEGER));
+               ret = zb_zcl_global_write_attr_no_rsp(handle, sj_addr16, 1, sj_ep1.ep,
+                       ZB_ZCL_FC_DEFAULT, ZB_ZCL_IDENTIFY_CLUSTER_ID, &attr, 1);
+               zb_destroy_write_attr_record(attr);
+               break;
+       }
+       case CMD_CONFIGURE_REPORTING_REQ:
+       {
+               /* Samjin Power Outlet */
+               char val1 = 0;
+               report_config_record_h config, config1;
+               zb_create_report_config_record(&config);
+               zb_set_dir_to_report_config_record(config, ZB_ZCL_CLIENT_TO_SERVER);
+               zb_set_id_to_report_config_record(config, ZB_ZCL_ON_OFF_ATTRIBUTE_ID);
+               zb_set_type_to_report_config_record(config, ZB_ZCL_BOOLEAN);
+               zb_set_min_i_to_report_config_record(config, 0x01);
+               zb_set_max_i_to_report_config_record(config, 0x1000);
+               zb_set_change_to_report_config_record2(config, ZB_ZCL_BOOLEAN, &val1);
+               /*zb_set_timeout_to_report_config_record(config, 10);*/
+               ret = zb_zcl_global_config_report(handle, sj_addr16, 1, sj_ep1.ep,
+                               ZB_ZCL_FC_DEFAULT, ZB_ZCL_ON_OFF_CLUSTER_ID, &config, 1,
+                               zigbee_zcl_global_configure_reporting_rsp, NULL);
+               zb_destroy_report_config_record(config);
+#if 1
+               /* ST Open/Close Sensor  */
+               unsigned short val2 = 0x007f;
+               zb_create_report_config_record(&config1);
+               zb_set_dir_to_report_config_record(config1, ZB_ZCL_CLIENT_TO_SERVER);
+               zb_set_id_to_report_config_record(config1, ZB_ZCL_ZONE_STATE_ATTRIBUTE_ID);
+               zb_set_type_to_report_config_record(config1, ZB_ZCL_SIGNED_16_BIT_INTEGER);
+               zb_set_min_i_to_report_config_record(config1, 0);
+               zb_set_max_i_to_report_config_record(config1, 60);
+               zb_set_change_to_report_config_record2(config1, ZB_ZCL_SIGNED_16_BIT_INTEGER, &val2);
+               zb_set_timeout_to_report_config_record(config1, 60);
+               ret = zb_zcl_global_config_report(handle, st_addr16, 1, st_ep1.ep,
+                               ZB_ZCL_FC_DEFAULT, ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID, &config1, 1,
+                               zigbee_zcl_global_configure_reporting_rsp, NULL);
+               zb_destroy_report_config_record(config1);
+#endif
+               break;
+       }
+       case CMD_READ_CONFIGURE_REPORTING:
+       {
+               read_report_config_record_h read_report_conf;
+               zb_create_read_report_config_record(&read_report_conf);
+               zb_set_dir_to_read_report_config_record(read_report_conf, ZB_ZCL_CLIENT_TO_SERVER);
+               zb_set_id_to_read_report_config_record(read_report_conf, ZB_ZCL_ON_OFF_ATTRIBUTE_ID);
+
+               /* Samjin Power Outlet */
+               zb_zcl_global_read_config_report(handle, sj_addr16, 1, sj_ep1.ep,
+                       ZB_ZCL_FC_DEFAULT, ZB_ZCL_ON_OFF_CLUSTER_ID, &read_report_conf, 1,
+                       zigbee_zcl_global_read_reporting_configuration_rsp, NULL);
+               zb_destroy_read_report_config_record(read_report_conf);
+               break;
+       }
+       case CMD_DISCOVER_ATTRIBUTES:
+       {
+               /* For ST Open/Close Sensor */
+               ret = zb_zcl_global_discover_attr(handle, st_addr16, 1, st_ep1.ep,
+                       ZB_ZCL_FC_DEFAULT, ZB_ZCL_IDENTIFY_CLUSTER_ID, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID,
+                       2, zigbee_zcl_global_discover_attributes_rsp, NULL);
+               /* For SJ Power Outlet */
+               ret = zb_zcl_global_discover_attr(handle, sj_addr16, 1, sj_ep1.ep,
+                       ZB_ZCL_FC_DEFAULT, ZB_ZCL_ON_OFF_CLUSTER_ID, ZB_ZCL_ON_OFF_ATTRIBUTE_ID, 5,
+                       zigbee_zcl_global_discover_attributes_rsp, NULL);
+               break;
+       }
+       case CMD_READ_ATTRIBUTES_STRUCTURED:
+               break;
+       case CMD_WRITE_ATTRIBUTES_STRUCTURED:
+               break;
+       case CMD_DISCOVER_COMMANDS_RECEIVED:
+       {
+               ret = zb_zcl_global_discover_cmds_received(handle, sj_addr16, 1, sj_ep1.ep,
+                       ZB_ZCL_DISABLE_DEFAULT_RESPONSE, ZB_ZCL_ON_OFF_CLUSTER_ID,
+                       ZB_ZCL_ON_OFF_ATTRIBUTE_ID, 5, zigbee_zcl_global_discover_cmds_received_rsp, NULL);
+               break;
+       }
+       case CMD_DISCOVER_COMMANDS_GENERATED:
+       {
+               ret = zb_zcl_global_discover_cmds_generated(handle, sj_addr16, 1, sj_ep1.ep,
+                       ZB_ZCL_DISABLE_DEFAULT_RESPONSE, ZB_ZCL_GROUPS_CLUSTER_ID, 0x00, 4,
+                       zigbee_zcl_global_discover_cmds_generated_rsp, NULL);
+               break;
+       }
+       case CMD_DISCOVER_ATTRIBUTES_EXTENDED:
+       {
+               ret = zb_zcl_global_discover_attr_extended(handle, sj_addr16, 1, sj_ep1.ep,
+                       ZB_ZCL_DISABLE_DEFAULT_RESPONSE, ZB_ZCL_ON_OFF_CLUSTER_ID, ZB_ZCL_ON_OFF_ATTRIBUTE_ID, 5,
+                       zigbee_zcl_global_discover_attr_extended_rsp, NULL);
+               break;
+       }
+       case CMD_ALARM_RESET_ALARM:
+               ret = zb_zcl_alarm_reset_alarm(handle, simul_addr16, 1, 0x01, ZB_ZCL_ON_OFF_CLUSTER_ID);
+               break;
+       case CMD_ALARM_RESET_ALL_ALARM:
+               ret = zb_zcl_alarm_reset_all_alarm(handle, simul_addr16, 1);
+               break;
+       case CMD_ALARM_GET_ALARM:
+               ret = zb_zcl_alarm_get_alarm(handle, simul_addr16, 1,
+                               zigbee_zcl_alarm_get_alarm_rsp, NULL);
+               break;
+       case CMD_ALARM_RESET_ALL_ALARM_LOG:
+               ret = zb_zcl_alarm_reset_all_alarm_log(handle, simul_addr16, 1);
+               break;
+       case CMD_IDENTITY:
+               ret = zb_zcl_identify(handle, sj_addr16, sj_ep1.ep, 10);
+               break;
+       case CMD_IDENTITY_QUERY:
+               ret = zb_zcl_identify_query(handle, sj_addr16, sj_ep1.ep,
+                       zigbee_zcl_identify_query_cb, NULL);
+               break;
+#if 0
+       case CMD_SIMPLE_DESCRIPTION_GET_SET:
+               ret = zigbee_simple_description_get_set();
+               printf("zigbee_simple_description_get_set() ret=[%d]\n", ret);
+               break;
+#endif
+       case CMD_ON_OFF_CLUSTER_ON:
+               ret = zb_zcl_onoff_control(handle, sj_addr16, sj_ep1.ep, ZB_ZCL_ON);
+               break;
+       case CMD_ON_OFF_CLUSTER_OFF:
+               ret = zb_zcl_onoff_control(handle, sj_addr16, sj_ep1.ep, ZB_ZCL_OFF);
+               break;
+       case CMD_ON_OFF_CLUSTER_TOGGLE:
+               ret = zb_zcl_onoff_control(handle, sj_addr16, sj_ep1.ep, ZB_ZCL_TOGGLE);
+               break;
+       case CMD_ADD_GROUP:
+       {
+               char group_name[8] = "6grpone";
+               unsigned short group_id = 0x0002;
+               ret = zb_zcl_group_add_group(handle, sj_addr16, sj_ep1.ep, group_id, group_name,
+                       zigbee_zcl_group_add_group_rsp, NULL);
+               break;
+       }
+       case CMD_VIEW_GROUP:
+       {
+               unsigned short group_id = 0x0002;
+               ret = zb_zcl_group_view_group(handle, sj_addr16, sj_ep1.ep, group_id,
+                       zigbee_zcl_group_view_group_rsp, NULL);
+               break;
+       }
+       case CMD_GET_GROUP_MEMBERSHIP:
+       {
+               unsigned short group_list[2] = { 0x0001, 0x0002};
+               ret = zb_zcl_group_get_group_membership(handle, sj_addr16, sj_ep1.ep, 2,
+                       group_list, zigbee_zcl_group_get_group_membership_rsp, NULL);
+               break;
+       }
+       case CMD_REMOVE_GROUP:
+       {
+               unsigned short group_id = 0x0002;
+               ret = zb_zcl_group_remove_group(handle, sj_addr16, sj_ep1.ep, group_id,
+                       zigbee_zcl_group_remove_group_rsp, NULL);
+               break;
+       }
+       case CMD_REMOVE_ALL_GROUP:
+       {
+               char group_name[8] = "6grpone";
+               unsigned short group_id = 0x0002;
+               ret = zb_zcl_group_remove_all_group(handle, sj_addr16, sj_ep1.ep);
+               break;
+       }
+       case CMD_ADD_GROUP_IF_IDENTIFY:
+       {
+               char group_name[8] = "6grpone";
+               unsigned short group_id = 0x0002;
+               ret = zb_zcl_group_add_group_if_identifying(handle, sj_addr16, sj_ep1.ep,
+                       group_id, group_name);
+               break;
+       }
+       case CMD_ADD_SCENE:
+       {
+               char scene_name[8] = "6scnone";
+               unsigned short group_id = 0x0002;
+               unsigned char scene_id = 0x01;
+               unsigned short trans_time = 0x0000;
+               const char ext_field_set[] = {0x00, 0x06, 0x01, 0x00};
+               unsigned short ext_len = sizeof(ext_field_set)/sizeof(ext_field_set[0]);
+               ret = zb_zcl_scene_add_scene(handle, sj_addr16, sj_ep1.ep, group_id, scene_id,
+                       trans_time, scene_name, ext_len, ext_field_set, zigbee_zcl_scene_add_scene_rsp, NULL);
+               break;
+       }
+       case CMD_VIEW_SCENE:
+       {
+               unsigned short group_id = 0x0002;
+               unsigned char scene_id = 0x01;
+               ret = zb_zcl_scene_view_scene(handle, sj_addr16, sj_ep1.ep, group_id, scene_id,
+                       zigbee_zcl_scene_view_scene_rsp, NULL);
+               break;
+       }
+       case CMD_GET_SCENE_MEMBERSHIP:
+       {
+               unsigned short group_id = 0x0002;
+               ret = zb_zcl_scene_get_scene_membership(handle, sj_addr16, sj_ep1.ep, group_id,
+                       zigbee_zcl_scene_get_scene_membership_rsp, NULL);
+               break;
+       }
+       case CMD_REMOVE_SCENE:
+       {
+               unsigned short group_id = 0x0002;
+               unsigned char scene_id = 0x01;
+               ret = zb_zcl_scene_remove_scene(handle, sj_addr16, sj_ep1.ep, group_id, scene_id,
+                       zigbee_zcl_scene_remove_scene_rsp, NULL);
+               break;
+       }
+       case CMD_REMOVE_ALL_SCENE:
+       {
+               unsigned short group_id = 0x0002;
+               ret = zb_zcl_scene_remove_all_scene(handle, sj_addr16, sj_ep1.ep, group_id,
+                       zigbee_zcl_scene_remove_all_scene_rsp, NULL);
+               break;
+       }
+       case CMD_STORE_SCENE:
+       {
+               unsigned short group_id = 0x0002;
+               unsigned char scene_id = 0x01;
+               ret = zb_zcl_scene_store_scene(handle, sj_addr16, sj_ep1.ep, group_id, scene_id,
+                       zigbee_zcl_scene_store_scene_rsp, NULL);
+               break;
+       }
+       case CMD_RECALL_SCENE:
+       {
+               unsigned short group_id = 0x0002;
+               unsigned char scene_id = 0x01;
+               ret = zb_zcl_scene_recall_scene(handle, sj_addr16, sj_ep1.ep, group_id, scene_id);
+               break;
+       }
+       case CMD_POLLCONTROL_CHECKIN_RESPONSE:
+               ret = zb_zcl_pollctrl_check_in_response(handle, sj_addr16, sj_ep1.ep, 10, 100);
+               break;
+       case CMD_POLLCONTROL_FAST_POLL_STOP:
+               ret = zb_zcl_pollctrl_fast_poll_stop(handle, sj_addr16, sj_ep1.ep);
+               break;
+       case CMD_POLLCONTROL_SET_LONG_POLL_INTERVAL:
+               ret = zb_zcl_pollctrl_set_long_poll_interval(handle, sj_addr16, sj_ep1.ep,
+                       200,  zigbee_zcl_poll_control_check_in, NULL);
+               break;
+       case CMD_POLLCONTROL_SET_SHORT_POLL_INTERVAL:
+               ret = zb_zcl_pollctrl_set_long_poll_interval(handle, sj_addr16, sj_ep1.ep,
+                       5,  zigbee_zcl_poll_control_check_in, NULL);
+               break;
+       case CMD_LEVELCONTROL_MOVE_TO_LEVEL:
+       {
+               unsigned char level = 100;
+               unsigned short transition_time = 10;
+               ret = zb_zcl_levelctrl_move_to_level(handle, simul_addr16, simul_ep1.ep,
+                       level, transition_time);
+               printf("zb_zcl_levelctrl_move_to_level ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_LEVELCONTROL_MOVE:
+       {
+               unsigned char move_mode = 0x00; /* Up */
+               unsigned char rate = 0xFF;
+               ret = zb_zcl_levelctrl_move(handle, simul_addr16, simul_ep1.ep, move_mode, rate);
+               printf("zb_zcl_levelctrl_move ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_LEVELCONTROL_STEP:
+       {
+               unsigned char step_mode = 0x00; /* Up */
+               unsigned char step_size = 0x10;
+               unsigned short transition_time = 10;
+               ret = zb_zcl_levelctrl_step(handle, simul_addr16, simul_ep1.ep,
+                       step_mode, step_size, transition_time);
+               printf("zb_zcl_levelctrl_step ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_LEVELCONTROL_STOP:
+               ret = zb_zcl_levelctrl_stop(handle, simul_addr16, simul_ep1.ep);
+               break;
+       case CMD_LEVELCONTROL_MOVE_WITH_ONOFF:
+       {
+               unsigned char move_mode = 0x00; /* Up */
+               unsigned char rate = 10;
+               ret = zb_zcl_levelctrl_move_with_on_off(handle, simul_addr16, simul_ep1.ep,
+                       move_mode, rate);
+               printf("zb_zcl_levelctrl_move_with_on_off ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_LEVELCONTROL_MOVE_TO_LEVEL_WITH_ONOFF:
+       {
+               unsigned char level = 100;
+               unsigned short transition_time = 10;
+               ret = zb_zcl_levelctrl_move_to_level_with_on_off(handle, simul_addr16, simul_ep1.ep,
+                       level, transition_time);
+               printf("zb_zcl_levelctrl_move_to_level_with_on_off ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_LEVELCONTROL_STEP_WITH_ONOFF:
+       {
+               unsigned char step_mode = 0x00; /* Up */
+               unsigned char step_size = 0x10;
+               unsigned short transition_time = 10;
+               ret = zb_zcl_levelctrl_step_with_on_off(handle, simul_addr16, simul_ep1.ep,
+                       step_mode, step_size, transition_time);
+               printf("zb_zcl_levelctrl_step_with_on_off ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_THERMOSTAT_ADJUST_SETPOINT:
+       {
+               unsigned char mode = 0x00; /* HEAT_MODE */
+               unsigned char amount = 0x01;
+               ret = zb_zcl_thermostat_adjust_setpoint(handle, simul_addr16, simul_ep1.ep,
+                       mode, amount);
+               printf("zb_zcl_thermostat_adjust_setpoint ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_MOVE_TO_HUE:
+       {
+               unsigned char move_hue = 0x20;
+               unsigned char COLOR_DIRECTION_SHORTEST = 0x00;
+               unsigned short trans_time16 = 0x00C8;
+
+               ret = zb_zcl_ccontrol_move_to_hue(handle, simul_addr16, simul_ep1.ep,
+                               move_hue, COLOR_DIRECTION_SHORTEST, trans_time16);
+               printf("zb_zcl_ccontrol_move_to_hue ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_MOVE_HUE:
+       {
+               unsigned char COLOR_MOVE_MODE_DOWN = 0x03;
+               unsigned char color_rate = 2;
+
+               ret = zb_zcl_ccontrol_move_hue(handle, simul_addr16, simul_ep1.ep,
+                               COLOR_MOVE_MODE_DOWN, color_rate);
+               printf("zb_zcl_ccontrol_move_hue ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_STEP_HUE:
+       {
+               unsigned char COLOR_STEP_MODE_DOWN = 0x03;
+               unsigned char step_size = 0x20;
+               unsigned char trans_time8 = 0x0A;
+
+               ret = zb_zcl_ccontrol_step_hue(handle, simul_addr16, simul_ep1.ep,
+                               COLOR_STEP_MODE_DOWN, step_size, trans_time8);
+               printf("zb_zcl_ccontrol_step_hue ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_MOVE_TO_SATURATION:
+       {
+               unsigned char saturation = 0x0A;
+               unsigned short trans_time16 = 0x00C8;
+
+               ret = zb_zcl_ccontrol_move_to_saturation(handle, simul_addr16, simul_ep1.ep,
+                               saturation, trans_time16);
+               printf("zb_zcl_ccontrol_move_to_saturation ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_MOVE_SATURATION:
+       {
+               unsigned char COLOR_MOVE_MODE_DOWN = 0x03;
+               unsigned char color_rate = 2;
+
+               ret = zb_zcl_ccontrol_move_saturation(handle, simul_addr16, simul_ep1.ep,
+                               COLOR_MOVE_MODE_DOWN, color_rate);
+               printf("zb_zcl_ccontrol_move_saturation ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_STEP_SATURATION:
+       {
+               unsigned char COLOR_STEP_MODE_DOWN = 0x03;
+               unsigned char step_size = 0x20;
+               unsigned char trans_time8 = 0x0A;
+
+               ret = zb_zcl_ccontrol_step_saturation(handle, simul_addr16, simul_ep1.ep,
+                               COLOR_STEP_MODE_DOWN, step_size, trans_time8);
+               printf("zb_zcl_ccontrol_step_saturation ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_MOVE_TO_HUE_AND_SATURATION:
+       {
+               unsigned char move_hue = 0x20;
+               unsigned char saturation = 0x0A;
+               unsigned short trans_time16 = 0x00C8;
+
+               ret = zb_zcl_ccontrol_move_to_hue_and_saturation(handle, simul_addr16, simul_ep1.ep,
+                               move_hue, saturation, trans_time16);
+               printf("zb_zcl_ccontrol_move_to_hue_and_saturation ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_MOVE_TO_COLOR:
+       {
+               unsigned short color_x = 0x280A;
+               unsigned short color_y = 0x2710;
+               unsigned short trans_time16 = 0x00C8;
+
+               ret = zb_zcl_ccontrol_move_to_color(handle, simul_addr16, simul_ep1.ep,
+                               color_x, color_y, trans_time16);
+               printf("zb_zcl_ccontrol_move_to_color ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_MOVE_COLOR:
+       {
+               unsigned short rate_x = 0x0002;
+               unsigned short rate_y = 0x0002;
+
+               ret = zb_zcl_ccontrol_move_color(handle, simul_addr16, simul_ep1.ep,
+                               rate_x, rate_y);
+               printf("zb_zcl_ccontrol_move_color ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_STEP_COLOR:
+       {
+               unsigned short step_x = 0x3961;
+               unsigned short step_y = 0x396D;
+               unsigned short trans_time16 = 0x00C8;
+
+               ret = zb_zcl_ccontrol_step_color(handle, simul_addr16, simul_ep1.ep,
+                               step_x, step_y, trans_time16);
+               printf("zb_zcl_ccontrol_step_color ret=[0x%x]\n", ret);
+               break;
+       }
+       case CMD_COLORCONTROL_MOVE_COLOR_TEMPERATURE:
+       {
+               unsigned char color_temp = 0x78;
+               unsigned short trans_time16 = 0x00C8;
+
+               ret = zb_zcl_ccontrol_move_to_color_temperature(handle, simul_addr16, simul_ep1.ep,
+                               color_temp, trans_time16);
+               printf("zb_zcl_ccontrol_move_to_color_temperature ret=[0x%x]\n", ret);
+               break;
+       }
+       default:
+               usage_full();
+               break;
+       }
+}
+
+static gboolean test_terminal_read_std_input(GIOChannel * source,
+       GIOCondition condition, gpointer user_data)
+{
+       int fd = 0;
+
+       static char buf[1024];
+       static char errbuf[1024];
+       int n;
+
+       errno = 0;
+       n = read(fd, buf, 1024);
+
+       buf[n - 1] = '\0'; /* remove new line... */
+       if (n == 0) {
+               printf("Error: read() from stdin returns 0.\n");
+       } else if (n < 0) {
+               strerror_r(errno, errbuf, strlen(errbuf));
+               printf("input: read, err=%s\n", errbuf);
+       } else {
+               printf("\n\n");
+               /* printf("Read [%d]bytes data: [%s]\n", n, buf); */
+               /* printf("Processing it ---------------------\n", n, buf); */
+       }
+
+       process_input(buf, user_data);
+
+       return TRUE;
+}
+
+int main(int argc, char **argv)
+{
+       GMainLoop *main_loop;
+       struct appdata *ad = NULL;
+
+/*#if !GLIB_CHECK_VERSION(2, 36, 0)*/
+       g_type_init();
+/*#endif*/
+
+       main_loop = g_main_loop_new(NULL, FALSE);
+       ad = (struct appdata *)malloc(sizeof(struct appdata));
+       ad->main_loop = main_loop;
+       ad->peer_count = 0;
+       set_appdata(ad);
+#if 0
+       int r = get_param(argc, argv, ad);
+       if (r)
+               return -1;
+#endif
+
+       /* Get destination network address into simul_addr
+        * : Network address of simulator is changed for each thing item. */
+       if (argc == 2) {
+               simul_addr16 = (nwk_addr)strtol(argv[1], NULL, 16);
+               printf("Network Address : [0x%X]\n\n", simul_addr16);
+       }
+
+       int std_input_fd = 0;
+       GIOChannel *gio2 = g_io_channel_unix_new(std_input_fd);
+       g_io_add_watch(gio2, G_IO_IN, (GIOFunc) test_terminal_read_std_input, ad);
+       g_io_channel_unref(gio2);
+
+       usage_full();
+
+       g_main_loop_run(main_loop);
+       g_main_loop_unref(main_loop);
+
+       return 0;
+}
diff --git a/test/test-zigbee.h b/test/test-zigbee.h
new file mode 100644 (file)
index 0000000..dfb7c46
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __TIZEN_NETWORK_ZIGBEE_UNIT_TEST_H__
+#define __TIZEN_NETWORK_ZIGBEE_UNIT_TEST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TEST_NETWORK_ZIGBEE_UNIT_TEST_H__ */
diff --git a/test/zcl-cluster-alarm.c b/test/zcl-cluster-alarm.c
new file mode 100644 (file)
index 0000000..62c581d
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+
+static char data_alarm_code[MENU_DATA_SIZE + 1] = "1";
+
+static void zigbee_zcl_alarm_get_alarm_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned char alarm_code, unsigned short cluster_id,
+       unsigned int time_stamp, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_alarm_get_alarm_rsp()");
+
+       msg("  Network Address = 0x%04X status = 0x%02X", addr16, status);
+       msg("  End-Point  = 0x%02X", ep);
+       msg("  alarm_code = 0x%02X", alarm_code);
+       msg("  cluster_id = 0x%04X", cluster_id);
+       msg("  time_stamp = 0x%08X", time_stamp);
+}
+
+static int run_alarm_reset_alarm(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char alarm_code = 0x01;
+
+       if (strlen(data_alarm_code))
+               alarm_code = (unsigned char)strtol(data_alarm_code, NULL, 10);
+
+       ret = zb_zcl_alarm_reset_alarm(handle, dest_addr16, 1, alarm_code,
+                       ZB_ZCL_ON_OFF_CLUSTER_ID);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_alarm_reset_alarm(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_alarm_reset_alarm() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_alarm_reset_all_alarm(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_alarm_reset_all_alarm(handle, dest_addr16, 1);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_alarm_reset_all_alarm(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_alarm_reset_all_alarm() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_alarm_get_alarm(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_alarm_get_alarm(handle, dest_addr16, 1,
+                       zigbee_zcl_alarm_get_alarm_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_alarm_get_alarm(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_alarm_get_alarm() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_alarm_reset_all_alarm_log(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_alarm_reset_all_alarm_log(handle, dest_addr16, 1);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_alarm_reset_all_alarm_log(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_alarm_reset_all_alarm_log() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_alarm_code[] = {
+       { "1", "Alarm code", NULL, NULL, data_alarm_code },
+       { "2", "Run", NULL, run_alarm_reset_alarm, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_alarm[] = {
+       { "1", "zb_zcl_alarm_reset_alarm",
+                       _menu_alarm_code, NULL, NULL },
+       { "2", "zb_zcl_alarm_reset_all_alarm",
+                       NULL, run_alarm_reset_all_alarm, NULL },
+       { "3", "zb_zcl_alarm_get_alarm",
+                       NULL, run_alarm_get_alarm, NULL },
+       { "4", "zb_zcl_alarm_reset_all_alarm_log",
+                       NULL, run_alarm_reset_all_alarm_log, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-cluster-colorctrl.c b/test/zcl-cluster-colorctrl.c
new file mode 100644 (file)
index 0000000..a56e4a5
--- /dev/null
@@ -0,0 +1,442 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern simple_desc_s huebulb_ep1;
+
+static char data_hue[MENU_DATA_SIZE + 1] = "32";
+static char data_rate[MENU_DATA_SIZE + 1] = "2";
+static char data_trans_time16[MENU_DATA_SIZE + 1] = "200";
+static char data_trans_time8[MENU_DATA_SIZE + 1] = "10";
+static char data_direction[MENU_DATA_SIZE + 1] = "0";
+static char data_move_mode[MENU_DATA_SIZE + 1] = "3";
+static char data_step_mode[MENU_DATA_SIZE + 1] = "3";
+static char data_step_size[MENU_DATA_SIZE + 1] = "32";
+static char data_saturation[MENU_DATA_SIZE + 1] = "10";
+static char data_color_x[MENU_DATA_SIZE + 1] = "10250";
+static char data_color_y[MENU_DATA_SIZE + 1] = "10000";
+static char data_rate_x[MENU_DATA_SIZE + 1] = "2";
+static char data_rate_y[MENU_DATA_SIZE + 1] = "2";
+static char data_step_x[MENU_DATA_SIZE + 1] = "14689";
+static char data_step_y[MENU_DATA_SIZE + 1] = "14701";
+static char data_color_temperature[MENU_DATA_SIZE + 1] = "120";
+
+static int run_move_to_hue(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char move_hue = 0x20;
+       unsigned char direction = 0x00; /* Shortest distance */
+       unsigned short trans_time16 = 0x00C8;
+
+       if (strlen(data_hue))
+               move_hue = (unsigned char)strtol(data_hue, NULL, 10);
+       if (strlen(data_direction))
+               direction = (unsigned char)strtol(data_direction, NULL, 10);
+       if (strlen(data_trans_time16))
+               trans_time16 = (unsigned short)strtol(data_trans_time16, NULL, 10);
+
+       ret = zb_zcl_ccontrol_move_to_hue(handle, dest_addr16, huebulb_ep1.ep,
+                       move_hue, direction, trans_time16);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_move_to_hue(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_move_to_hue() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_hue(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char move_mode = 0x03; /* Down */
+       unsigned char color_rate = 2;
+
+       if (strlen(data_move_mode))
+               move_mode = (unsigned char)strtol(data_move_mode, NULL, 10);
+       if (strlen(data_rate))
+               color_rate = (unsigned char)strtol(data_rate, NULL, 10);
+
+       ret = zb_zcl_ccontrol_move_hue(handle, dest_addr16, huebulb_ep1.ep,
+                       move_mode, color_rate);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_move_hue(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_move_hue() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_step_hue(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char step_mode = 0x03; /* Down */
+       unsigned char step_size = 0x20;
+       unsigned char trans_time8 = 0x0A;
+
+       if (strlen(data_step_mode))
+               step_mode = (unsigned char)strtol(data_step_mode, NULL, 10);
+       if (strlen(data_step_size))
+               step_size = (unsigned char)strtol(data_step_size, NULL, 10);
+       if (strlen(data_trans_time8))
+               trans_time8 = (unsigned char)strtol(data_trans_time8, NULL, 10);
+
+       ret = zb_zcl_ccontrol_step_hue(handle, dest_addr16, huebulb_ep1.ep,
+                       step_mode, step_size, trans_time8);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_step_hue(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_step_hue() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_to_saturation(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char saturation = 0x0A;
+       unsigned short trans_time16 = 0x00C8;
+
+       if (strlen(data_saturation))
+               saturation = (unsigned char)strtol(data_saturation, NULL, 10);
+       if (strlen(data_trans_time16))
+               trans_time16 = (unsigned short)strtol(data_trans_time16, NULL, 10);
+
+       ret = zb_zcl_ccontrol_move_to_saturation(handle, dest_addr16, huebulb_ep1.ep,
+                       saturation, trans_time16);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_move_to_saturation(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_move_to_saturation() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_saturation(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char move_mode = 0x03; /* Down */
+       unsigned char color_rate = 2;
+
+       if (strlen(data_move_mode))
+               move_mode = (unsigned char)strtol(data_move_mode, NULL, 10);
+       if (strlen(data_rate))
+               color_rate = (unsigned char)strtol(data_rate, NULL, 10);
+
+       ret = zb_zcl_ccontrol_move_saturation(handle, dest_addr16, huebulb_ep1.ep,
+                       move_mode, color_rate);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_move_saturation(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_move_saturation() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_step_saturation(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char step_mode = 0x03; /* Down */
+       unsigned char step_size = 0x20;
+       unsigned char trans_time8 = 0x0A;
+
+       if (strlen(data_step_mode))
+               step_mode = (unsigned char)strtol(data_step_mode, NULL, 10);
+       if (strlen(data_step_size))
+               step_size = (unsigned char)strtol(data_step_size, NULL, 10);
+       if (strlen(data_trans_time8))
+               trans_time8 = (unsigned char)strtol(data_trans_time8, NULL, 10);
+
+       ret = zb_zcl_ccontrol_step_saturation(handle, dest_addr16, huebulb_ep1.ep,
+                       step_mode, step_size, trans_time8);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_step_saturation(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_step_saturation() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_to_hue_and_saturation(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char move_hue = 0x20;
+       unsigned char saturation = 0x0A;
+       unsigned short trans_time16 = 0x00C8;
+
+       if (strlen(data_hue))
+               move_hue = (unsigned char)strtol(data_hue, NULL, 10);
+       if (strlen(data_saturation))
+               saturation = (unsigned char)strtol(data_saturation, NULL, 10);
+       if (strlen(data_trans_time16))
+               trans_time16 = (unsigned short)strtol(data_trans_time16, NULL, 10);
+
+       ret = zb_zcl_ccontrol_move_to_hue_and_saturation(handle, dest_addr16,
+                       huebulb_ep1.ep, move_hue, saturation, trans_time16);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_move_to_hue_and_saturation(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_move_to_hue_and_saturation() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_to_color(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short color_x = 0x280A;
+       unsigned short color_y = 0x2710;
+       unsigned short trans_time16 = 0x00C8;
+
+       if (strlen(data_color_x))
+               color_x = (unsigned short)strtol(data_color_x, NULL, 10);
+       if (strlen(data_color_y))
+               color_y = (unsigned short)strtol(data_color_y, NULL, 10);
+       if (strlen(data_trans_time16))
+               trans_time16 = (unsigned short)strtol(data_trans_time16, NULL, 10);
+
+       ret = zb_zcl_ccontrol_move_to_color(handle, dest_addr16, huebulb_ep1.ep,
+                       color_x, color_y, trans_time16);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_move_to_color(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_move_to_color() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_color(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short rate_x = 0x0002;
+       unsigned short rate_y = 0x0002;
+
+       if (strlen(data_rate_x))
+               rate_x = (unsigned short)strtol(data_rate_x, NULL, 10);
+       if (strlen(data_rate_y))
+               rate_y = (unsigned short)strtol(data_rate_y, NULL, 10);
+
+       ret = zb_zcl_ccontrol_move_color(handle, dest_addr16, huebulb_ep1.ep,
+                       rate_x, rate_y);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_move_color(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_move_color() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_step_color(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short step_x = 0x3961;
+       unsigned short step_y = 0x396D;
+       unsigned short trans_time16 = 0x00C8;
+
+       if (strlen(data_step_x))
+               step_x = (unsigned short)strtol(data_step_x, NULL, 10);
+       if (strlen(data_step_y))
+               step_y = (unsigned short)strtol(data_step_y, NULL, 10);
+       if (strlen(data_trans_time16))
+               trans_time16 = (unsigned short)strtol(data_trans_time16, NULL, 10);
+
+       ret = zb_zcl_ccontrol_step_color(handle, dest_addr16, huebulb_ep1.ep,
+                       step_x, step_y, trans_time16);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_step_color(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_step_color() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_to_color_temperature(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char color_temp = 0x78;
+       unsigned short trans_time16 = 0x00C8;
+
+       if (strlen(data_color_temperature))
+               color_temp = (unsigned short)strtol(data_color_temperature, NULL, 10);
+       if (strlen(data_trans_time16))
+               trans_time16 = (unsigned short)strtol(data_trans_time16, NULL, 10);
+
+       ret = zb_zcl_ccontrol_move_to_color_temperature(handle, dest_addr16,
+                       huebulb_ep1.ep, color_temp, trans_time16);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_ccontrol_move_to_color_temperature(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_ccontrol_move_to_color_temperature() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_move_to_hue[] = {
+       { "1", "Hue", NULL, NULL, data_hue },
+       { "2", "Direction", NULL, NULL, data_direction },
+       { "3", "Transition time (2 bytes)", NULL, NULL, data_trans_time16 },
+       { "4", "Run", NULL, run_move_to_hue, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_hue[] = {
+       { "1", "Move mode", NULL, NULL, data_move_mode },
+       { "2", "Rate", NULL, NULL, data_rate },
+       { "3", "Run", NULL, run_move_hue, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_step_hue[] = {
+       { "1", "Step mode", NULL, NULL, data_step_mode },
+       { "2", "Step size", NULL, NULL, data_step_size },
+       { "3", "Transition time (1 byte)", NULL, NULL, data_trans_time8 },
+       { "4", "Run", NULL, run_step_hue, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_to_saturation[] = {
+       { "1", "Saturation", NULL, NULL, data_saturation },
+       { "2", "Transition time (2 bytes)", NULL, NULL, data_trans_time16 },
+       { "3", "Run", NULL, run_move_to_saturation, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_saturation[] = {
+       { "1", "Move mode", NULL, NULL, data_move_mode },
+       { "2", "Rate", NULL, NULL, data_rate },
+       { "3", "Run", NULL, run_move_saturation, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_step_saturation[] = {
+       { "1", "Step mode", NULL, NULL, data_step_mode },
+       { "2", "Step size", NULL, NULL, data_step_size },
+       { "3", "Transition time (1 byte)", NULL, NULL, data_trans_time8 },
+       { "4", "Run", NULL, run_step_saturation, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_to_hue_and_saturation[] = {
+       { "1", "Hue", NULL, NULL, data_hue },
+       { "2", "Saturation", NULL, NULL, data_saturation },
+       { "3", "Transition time (2 bytes)", NULL, NULL, data_trans_time16 },
+       { "4", "Run", NULL, run_move_to_hue_and_saturation, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_to_color[] = {
+       { "1", "Color X", NULL, NULL, data_color_x },
+       { "2", "Color Y", NULL, NULL, data_color_y },
+       { "3", "Transition time (2 bytes)", NULL, NULL, data_trans_time16 },
+       { "4", "Run", NULL, run_move_to_color, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_color[] = {
+       { "1", "Rate X", NULL, NULL, data_rate_x },
+       { "2", "Rate Y", NULL, NULL, data_rate_y },
+       { "3", "Run", NULL, run_move_color, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_step_color[] = {
+       { "1", "Step X", NULL, NULL, data_step_x },
+       { "2", "Step Y", NULL, NULL, data_step_y },
+       { "3", "Transition time (2 bytes)", NULL, NULL, data_trans_time16 },
+       { "4", "Run", NULL, run_step_color, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_to_color_temperature[] = {
+       { "1", "Color Temperature", NULL, NULL, data_color_temperature },
+       { "2", "Transition time (2 bytes)", NULL, NULL, data_trans_time16 },
+       { "3", "Run", NULL, run_move_to_color_temperature, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_colorctrl[] = {
+       { "1", "zb_zcl_ccontrol_move_to_hue",
+                       _menu_move_to_hue, NULL, NULL },
+       { "2", "zb_zcl_ccontrol_move_hue",
+                       _menu_move_hue, NULL, NULL },
+       { "3", "zb_zcl_ccontrol_step_hue",
+                       _menu_step_hue, NULL, NULL },
+       { "4", "zb_zcl_ccontrol_move_to_saturation",
+                       _menu_move_to_saturation, NULL, NULL },
+       { "5", "zb_zcl_ccontrol_move_saturation",
+                       _menu_move_saturation, NULL, NULL },
+       { "6", "zb_zcl_ccontrol_step_saturation",
+                       _menu_step_saturation, NULL, NULL },
+       { "7", "zb_zcl_ccontrol_move_to_hue_and_saturation",
+                       _menu_move_to_hue_and_saturation, NULL, NULL },
+       { "8", "zb_zcl_ccontrol_move_to_color",
+                       _menu_move_to_color, NULL, NULL },
+       { "9", "zb_zcl_ccontrol_move_color",
+                       _menu_move_color, NULL, NULL },
+       { "10", "zb_zcl_ccontrol_step_color",
+                       _menu_step_color, NULL, NULL },
+       { "11", "zb_zcl_ccontrol_move_to_color_temperature",
+                       _menu_move_to_color_temperature, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-cluster-group.c b/test/zcl-cluster-group.c
new file mode 100644 (file)
index 0000000..54eee99
--- /dev/null
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern simple_desc_s sj_ep1;
+
+static char data_group_name[MENU_DATA_SIZE + 1] = "6grpone";
+static char data_group_id[MENU_DATA_SIZE + 1] = "2";
+
+static void zigbee_zcl_group_add_group_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_group_add_group_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point = 0x%02X", ep);
+       msg("  Status    = 0x%02X", status);
+       msg("  Group ID  = 0x%04X", group_id);
+}
+
+static void zigbee_zcl_group_view_group_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, const char *group_name, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_group_view_group_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point  = 0x%02X", ep);
+       msg("  Status     = 0x%02X", status);
+       msg("  Group ID   = 0x%04X", group_id);
+       msg("  Group Name = %s", group_name);
+}
+
+static void zigbee_zcl_group_get_group_membership_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned char capacity, unsigned char group_count,
+       unsigned short *group_list, void *user_data)
+{
+       int i;
+
+       msg("");
+       msgp("zigbee_zcl_group_get_group_membership_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point = 0x%02X", ep);
+       msg("  capacity  = 0x%02X", capacity);
+       for (i = 0; i < group_count; i++)
+               msg("    [%d] group_list = %04X", i, group_list[i]);
+}
+
+static void zigbee_zcl_group_remove_group_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_group_remove_group_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point = 0x%02X", ep);
+       msg("  Status    = 0x%02X", status);
+       msg("  Group ID  = 0x%04X", group_id);
+}
+
+static int run_group_add_group(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+
+       ret = zb_zcl_group_add_group(handle, dest_addr16, sj_ep1.ep,
+                       group_id, data_group_name, zigbee_zcl_group_add_group_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_group_add_group(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_group_add_group() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_group_view_group(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+
+       ret = zb_zcl_group_view_group(handle, dest_addr16, sj_ep1.ep,
+                       group_id, zigbee_zcl_group_view_group_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_group_view_group(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_group_view_group() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_group_get_group_membership(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_list[2] = { 0x0001, 0x0002 };
+
+       ret = zb_zcl_group_get_group_membership(handle, dest_addr16, sj_ep1.ep, 2,
+                       group_list, zigbee_zcl_group_get_group_membership_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_group_get_group_membership(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_group_get_group_membership() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_group_remove_group(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+
+       ret = zb_zcl_group_remove_group(handle, dest_addr16, sj_ep1.ep,
+                       group_id, zigbee_zcl_group_remove_group_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_group_remove_group(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_group_remove_group() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_group_remove_all_group(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_group_remove_all_group(handle, dest_addr16, sj_ep1.ep);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_group_remove_all_group(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_group_remove_all_group() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_group_add_group_if_identifying(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+
+       ret = zb_zcl_group_add_group_if_identifying(handle, dest_addr16, sj_ep1.ep,
+                       group_id, data_group_name);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_group_add_group_if_identifying(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_group_add_group_if_identifying() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_group_add_group[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Group name", NULL, NULL, data_group_name },
+       { "3", "Run", NULL, run_group_add_group, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_group_view_group[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Run", NULL, run_group_view_group, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_group_get_group_membership[] = {
+       { "1", "Run", NULL, run_group_get_group_membership, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_group_remove_group[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Run", NULL, run_group_remove_group, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_group_remove_all_group[] = {
+       { "1", "Run", NULL, run_group_remove_all_group, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_group_add_group_if_identifying[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Group name", NULL, NULL, data_group_name },
+       { "3", "Run", NULL, run_group_add_group_if_identifying, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_group[] = {
+       { "1", "zb_zcl_group_add_group",
+                       _menu_group_add_group, NULL, NULL },
+       { "2", "zb_zcl_group_view_group",
+                       _menu_group_view_group, NULL, NULL },
+       { "3", "zb_zcl_group_get_group_membership",
+                       _menu_group_get_group_membership, NULL, NULL },
+       { "4", "zb_zcl_group_remove_group",
+                       _menu_group_remove_group, NULL, NULL },
+       { "5", "zb_zcl_group_remove_all_group",
+                       _menu_group_remove_all_group, NULL, NULL },
+       { "6", "zb_zcl_group_add_group_if_identifying",
+                       _menu_group_add_group_if_identifying, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-cluster-identity.c b/test/zcl-cluster-identity.c
new file mode 100644 (file)
index 0000000..437dbf1
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern simple_desc_s sj_ep1;
+
+static char data_identify_time[MENU_DATA_SIZE + 1] = "10";
+
+static void zigbee_zcl_identify_query_cb(nwk_addr addr16,
+       unsigned short identify_time, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_identify_query_cb()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  identify_time   = %d", identify_time);
+}
+
+static int run_identify(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short identify_time = 10;
+
+       if (strlen(data_identify_time))
+               identify_time = (unsigned short)strtol(data_identify_time, NULL, 10);
+
+       ret = zb_zcl_identify(handle, dest_addr16, sj_ep1.ep, identify_time);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_identify(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_identify() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_identify_query(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_identify_query(handle, dest_addr16, sj_ep1.ep,
+                       zigbee_zcl_identify_query_cb, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_identify_query(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_identify_query() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_identify[] = {
+       { "1", "Identify time", NULL, NULL, data_identify_time },
+       { "2", "Run", NULL, run_identify, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_identity[] = {
+       { "1", "zb_zcl_identify", _menu_identify, NULL, NULL },
+       { "2", "zb_zcl_identify_query", NULL, run_identify_query, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-cluster-levelctrl.c b/test/zcl-cluster-levelctrl.c
new file mode 100644 (file)
index 0000000..6d7a66d
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern simple_desc_s dimmer_ep1;
+
+static char data_level[MENU_DATA_SIZE + 1] = "100";
+static char data_time[MENU_DATA_SIZE + 1] = "10";
+static char data_rate[MENU_DATA_SIZE + 1] = "255";
+static char data_move_mode[MENU_DATA_SIZE + 1] = "0";
+static char data_step_mode[MENU_DATA_SIZE + 1] = "0";
+static char data_step_size[MENU_DATA_SIZE + 1] = "16";
+
+static int run_move_to_level(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char level = 100;
+       unsigned short transition_time = 10;
+
+       if (strlen(data_level))
+               level = (unsigned char)strtol(data_level, NULL, 10);
+       if (strlen(data_time))
+               transition_time = (unsigned short)strtol(data_time, NULL, 10);
+
+       ret = zb_zcl_levelctrl_move_to_level(handle, dest_addr16, dimmer_ep1.ep,
+                       level, transition_time);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_levelctrl_move_to_level(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_levelctrl_move_to_level() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char move_mode = 0x00;
+       unsigned char rate = 0xFF;
+
+       if (strlen(data_move_mode))
+               move_mode = (unsigned char)strtol(data_move_mode, NULL, 10);
+       if (strlen(data_rate))
+               rate = (unsigned char)strtol(data_rate, NULL, 10);
+
+       ret = zb_zcl_levelctrl_move(handle, dest_addr16, dimmer_ep1.ep,
+                       move_mode, rate);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_levelctrl_move(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_levelctrl_move() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_step(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char step_mode = 0x00; /* Up */
+       unsigned char step_size = 0x10;
+       unsigned short transition_time = 10;
+
+       if (strlen(data_step_mode))
+               step_mode = (unsigned char)strtol(data_step_mode, NULL, 10);
+       if (strlen(data_step_size))
+               step_size = (unsigned char)strtol(data_step_size, NULL, 10);
+       if (strlen(data_time))
+               transition_time = (unsigned short)strtol(data_time, NULL, 10);
+
+       ret = zb_zcl_levelctrl_step(handle, dest_addr16, dimmer_ep1.ep,
+                       step_mode, step_size, transition_time);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_levelctrl_step(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_levelctrl_step() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_stop(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_levelctrl_stop(handle, dest_addr16, dimmer_ep1.ep);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_levelctrl_stop(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_levelctrl_stop() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_with_on_off(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char move_mode = 0x00; /* Up */
+       unsigned char rate = 10;
+
+       if (strlen(data_move_mode))
+               move_mode = (unsigned char)strtol(data_move_mode, NULL, 10);
+       if (strlen(data_rate))
+               rate = (unsigned char)strtol(data_rate, NULL, 10);
+
+       ret = zb_zcl_levelctrl_move_with_on_off(handle, dest_addr16, dimmer_ep1.ep,
+                       move_mode, rate);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_levelctrl_move_with_on_off(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_levelctrl_move_with_on_off() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_move_to_level_with_on_off(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char level = 100;
+       unsigned short transition_time = 10;
+
+       if (strlen(data_level))
+               level = (unsigned char)strtol(data_level, NULL, 10);
+       if (strlen(data_time))
+               transition_time = (unsigned short)strtol(data_time, NULL, 10);
+
+       ret = zb_zcl_levelctrl_move_to_level_with_on_off(handle, dest_addr16,
+                       dimmer_ep1.ep, level, transition_time);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_levelctrl_move_to_level_with_on_off(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_levelctrl_move_to_level_with_on_off() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_step_with_on_off(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char step_mode = 0x00; /* Up */
+       unsigned char step_size = 0x10;
+       unsigned short transition_time = 10;
+
+       if (strlen(data_step_mode))
+               step_mode = (unsigned char)strtol(data_step_mode, NULL, 10);
+       if (strlen(data_step_size))
+               step_size = (unsigned char)strtol(data_step_size, NULL, 10);
+       if (strlen(data_time))
+               transition_time = (unsigned short)strtol(data_time, NULL, 10);
+
+       ret = zb_zcl_levelctrl_step_with_on_off(handle, dest_addr16, dimmer_ep1.ep,
+                       step_mode, step_size, transition_time);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_levelctrl_step_with_on_off(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_levelctrl_step_with_on_off() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_move_to_level[] = {
+       { "1", "Level", NULL, NULL, data_level },
+       { "2", "Transition Time", NULL, NULL, data_time },
+       { "3", "Run", NULL, run_move_to_level, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move[] = {
+       { "1", "Move mode", NULL, NULL, data_move_mode },
+       { "2", "Rate", NULL, NULL, data_rate },
+       { "3", "Run", NULL, run_move, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_step[] = {
+       { "1", "Step mode", NULL, NULL, data_step_mode },
+       { "2", "Step size", NULL, NULL, data_step_size },
+       { "3", "Transition Time", NULL, NULL, data_time },
+       { "4", "Run", NULL, run_step, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_stop[] = {
+       { "1", "Run", NULL, run_stop, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_with_onoff[] = {
+       { "1", "Move mode", NULL, NULL, data_move_mode },
+       { "2", "Rate", NULL, NULL, data_rate },
+       { "3", "Run", NULL, run_move_with_on_off, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_move_to_level_with_onoff[] = {
+       { "1", "Level", NULL, NULL, data_level },
+       { "2", "Transition Time", NULL, NULL, data_time },
+       { "3", "Run", NULL, run_move_to_level_with_on_off, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_step_with_onoff[] = {
+       { "1", "Step mode", NULL, NULL, data_step_mode },
+       { "2", "Step size", NULL, NULL, data_step_size },
+       { "3", "Transition Time", NULL, NULL, data_time },
+       { "4", "Run", NULL, run_step_with_on_off, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_levelctrl[] = {
+       { "1", "zb_zcl_levelctrl_move_to_level",
+                       _menu_move_to_level, NULL, NULL },
+       { "2", "zb_zcl_levelctrl_move", _menu_move, NULL, NULL },
+       { "3", "zb_zcl_levelctrl_step", _menu_step, NULL, NULL },
+       { "4", "zb_zcl_levelctrl_stop", _menu_stop, NULL, NULL },
+       { "5", "zb_zcl_levelctrl_move_with_on_off",
+                       _menu_move_with_onoff, NULL, NULL },
+       { "6", "zb_zcl_levelctrl_move_to_level_with_on_off",
+                       _menu_move_to_level_with_onoff, NULL, NULL },
+       { "7", "zb_zcl_levelctrl_step_with_on_off",
+                       _menu_step_with_onoff, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-cluster-onoff.c b/test/zcl-cluster-onoff.c
new file mode 100644 (file)
index 0000000..3bd254a
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern simple_desc_s sj_ep1;
+
+static int run_on(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_onoff_control(handle, dest_addr16, sj_ep1.ep, ZB_ZCL_ON);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_onoff_control(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_onoff_control() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_off(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_onoff_control(handle, dest_addr16, sj_ep1.ep, ZB_ZCL_OFF);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_onoff_control(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_onoff_control() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_toggle(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_onoff_control(handle, dest_addr16, sj_ep1.ep, ZB_ZCL_TOGGLE);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_onoff_control(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_onoff_control() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data menu_zcl_cluster_onoff_control[] = {
+       { "1", "On", NULL, run_on, NULL },
+       { "2", "Off", NULL, run_off, NULL },
+       { "3", "Toggle", NULL, run_toggle, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_onoff[] = {
+       { "1", "zb_zcl_onoff_control",
+                       menu_zcl_cluster_onoff_control, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-cluster-pollctrl.c b/test/zcl-cluster-pollctrl.c
new file mode 100644 (file)
index 0000000..778575c
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern simple_desc_s sj_ep1;
+
+static char data_poll_state[MENU_DATA_SIZE + 1] = "1";
+static char data_poll_timeout[MENU_DATA_SIZE + 1] = "100";
+static char data_long_interval[MENU_DATA_SIZE + 1] = "200";
+static char data_short_interval[MENU_DATA_SIZE + 1] = "5";
+
+static void zigbee_zcl_poll_control_check_in(nwk_addr addr16, unsigned char ep,
+       void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_poll_control_check_in()");
+
+       msg("  Network Address = 0x%04X End-Point = 0x%02X", addr16, ep);
+}
+
+static int run_check_in_response(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char start_fast_polling = 1; /* True */
+       unsigned short fast_poll_timeout = 100;
+
+       if (strncmp(data_poll_state, "0", MENU_DATA_SIZE) == 0)
+               start_fast_polling = 0; /* False */
+       if (strlen(data_poll_timeout))
+               fast_poll_timeout = (unsigned short)strtol(data_poll_timeout, NULL, 10);
+
+       ret = zb_zcl_pollctrl_check_in_response(handle, dest_addr16, sj_ep1.ep,
+                       start_fast_polling, fast_poll_timeout);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_pollctrl_check_in_response(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_pollctrl_check_in_response() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_fast_poll_stop(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zcl_pollctrl_fast_poll_stop(handle, dest_addr16, sj_ep1.ep);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_pollctrl_fast_poll_stop(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_pollctrl_fast_poll_stop() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_set_long_poll_interval(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned int long_poll_interval = 200;
+
+       if (strlen(data_long_interval))
+               long_poll_interval = (unsigned short)strtol(data_long_interval, NULL, 10);
+
+       ret = zb_zcl_pollctrl_set_long_poll_interval(handle, dest_addr16, sj_ep1.ep,
+                       long_poll_interval,  zigbee_zcl_poll_control_check_in, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_pollctrl_set_long_poll_interval(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_pollctrl_set_long_poll_interval() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_set_short_poll_interval(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned int short_poll_interval = 5;
+
+       if (strlen(data_short_interval))
+               short_poll_interval = (unsigned short)strtol(data_short_interval, NULL, 10);
+
+       ret = zb_zcl_pollctrl_set_short_poll_interval(handle, dest_addr16, sj_ep1.ep,
+                       short_poll_interval, zigbee_zcl_poll_control_check_in, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_pollctrl_set_short_poll_interval(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_pollctrl_set_short_poll_interval() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_check_in_response[] = {
+       { "1", "Start Fast Polling", NULL, NULL, data_poll_state },
+       { "2", "Fast poll timeout", NULL, NULL, data_poll_timeout },
+       { "3", "Run", NULL, run_check_in_response, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_fast_poll_stop[] = {
+       { "1", "Run", NULL, run_fast_poll_stop, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_set_long_poll_interval[] = {
+       { "1", "Long poll interval", NULL, NULL, data_long_interval },
+       { "2", "Run", NULL, run_set_long_poll_interval, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_set_short_poll_interval[] = {
+       { "1", "Short poll interval", NULL, NULL, data_short_interval },
+       { "2", "Run", NULL, run_set_short_poll_interval, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_pollctrl[] = {
+       { "1", "zb_zcl_pollctrl_check_in_response",
+                       _menu_check_in_response, NULL, NULL },
+       { "2", "zb_zcl_pollctrl_fast_poll_stop",
+                       _menu_fast_poll_stop, NULL, NULL },
+       { "3", "zb_zcl_pollctrl_set_long_poll_interval",
+                       _menu_set_long_poll_interval, NULL, NULL },
+       { "4", "zb_zcl_pollctrl_set_short_poll_interval",
+                       _menu_set_short_poll_interval, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-cluster-scene.c b/test/zcl-cluster-scene.c
new file mode 100644 (file)
index 0000000..d2549da
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern simple_desc_s sj_ep1;
+
+static char data_group_id[MENU_DATA_SIZE + 1] = "2";
+static char data_scene_id[MENU_DATA_SIZE + 1] = "1";
+static char data_trans_time[MENU_DATA_SIZE + 1] = "0";
+static char data_scene_name[MENU_DATA_SIZE + 1] = "6scnone";
+
+static void zigbee_zcl_scene_add_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, unsigned char scene_id, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_scene_add_scene_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point = 0x%02X", ep);
+       msg("  Status    = 0x%02X", status);
+       msg("  Group ID  = 0x%04X", group_id);
+       msg("  Scene ID  = 0x%02X", scene_id);
+}
+
+static void zigbee_zcl_scene_view_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, unsigned char scene_id,
+       unsigned short transition_time, const char *scene_name,
+       const char *extension_field_set, unsigned short ext_len, void *user_data)
+{
+       int i;
+       msg("");
+       msgp("zigbee_zcl_scene_view_scene_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point       = 0x%02X", ep);
+       msg("  Status          = 0x%02X", status);
+       msg("  Group ID        = 0x%04X", group_id);
+       msg("  Scene ID        = 0x%02X", scene_id);
+       msg("  Transition Time = 0x%04X", transition_time);
+       msg("  Scene Name      = %s\n", scene_name);
+       for (i = 0; i < ext_len; i++)
+               msg("    extension_field_set[%d] = 0x%02X", i, extension_field_set[i]);
+}
+
+static void zigbee_zcl_scene_remove_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, unsigned char scene_id, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_scene_remove_scene_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point = 0x%02X", ep);
+       msg("  Status    = 0x%02X", status);
+       msg("  Group ID  = 0x%04X", group_id);
+       msg("  Scene ID  = 0x%02X", scene_id);
+}
+
+static void zigbee_zcl_scene_remove_all_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_scene_remove_all_scene_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point = 0x%02X", ep);
+       msg("  Status    = 0x%02X", status);
+       msg("  Group ID  = 0x%04X", group_id);
+}
+
+static void zigbee_zcl_scene_store_scene_rsp(nwk_addr addr16, unsigned char ep,
+       unsigned char status, unsigned short group_id, unsigned char scene_id, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zcl_scene_store_scene_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point = 0x%02X", ep);
+       msg("  Status    = 0x%02X", status);
+       msg("  Group ID  = 0x%04X", group_id);
+       msg("  Scene ID  = 0x%02X", scene_id);
+}
+
+static void zigbee_zcl_scene_get_scene_membership_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned char status, unsigned char capacity, unsigned short group_id,
+       unsigned char scene_count, unsigned char *scene_list, void *user_data)
+{
+       int i;
+
+       msg("");
+       msgp("zigbee_zcl_scene_get_scene_membership_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point = 0x%02X", ep);
+       msg("  Status    = 0x%02X", status);
+       msg("  Capacity  = 0x%02X", capacity);
+       msg("  Group ID  = 0x%02X", group_id);
+       for (i = 0; i < scene_count && ZB_ZCL_SUCCESS == status; i++)
+               msg("    scene_list[%d] = 0x%02X", i, scene_list[i]);
+}
+
+static int run_scene_add_scene(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+       unsigned char scene_id = 0x01;
+       unsigned short trans_time = 0x0000;
+       const char ext_field_set[] = {0x00, 0x06, 0x01, 0x00};
+       unsigned short ext_len = sizeof(ext_field_set) / sizeof(ext_field_set[0]);
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+       if (strlen(data_scene_id))
+               scene_id = (unsigned char)strtol(data_scene_id, NULL, 10);
+
+       ret = zb_zcl_scene_add_scene(handle, dest_addr16,
+                       sj_ep1.ep, group_id, scene_id, trans_time, data_scene_name,
+                       ext_len, ext_field_set, zigbee_zcl_scene_add_scene_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_scene_add_scene(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_scene_add_scene() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_scene_view_scene(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+       unsigned char scene_id = 0x01;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+       if (strlen(data_scene_id))
+               scene_id = (unsigned char)strtol(data_scene_id, NULL, 10);
+
+       ret = zb_zcl_scene_view_scene(handle, dest_addr16, sj_ep1.ep, group_id,
+                       scene_id, zigbee_zcl_scene_view_scene_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_scene_view_scene(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_scene_view_scene() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_scene_get_scene_membership(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+
+       ret = zb_zcl_scene_get_scene_membership(handle, dest_addr16, sj_ep1.ep,
+                       group_id, zigbee_zcl_scene_get_scene_membership_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_scene_get_scene_membership(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_scene_get_scene_membership() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_scene_remove_scene(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+       unsigned char scene_id = 0x01;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+       if (strlen(data_scene_id))
+               scene_id = (unsigned char)strtol(data_scene_id, NULL, 10);
+
+       ret = zb_zcl_scene_remove_scene(handle, dest_addr16, sj_ep1.ep, group_id,
+                       scene_id, zigbee_zcl_scene_remove_scene_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_scene_remove_scene(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_scene_remove_scene() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_scene_remove_all_scene(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+
+       ret = zb_zcl_scene_remove_all_scene(handle, dest_addr16, sj_ep1.ep, group_id,
+                       zigbee_zcl_scene_remove_all_scene_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_scene_remove_all_scene(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_scene_remove_all_scene() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_scene_store_scene(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+       unsigned char scene_id = 0x01;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+       if (strlen(data_scene_id))
+               scene_id = (unsigned char)strtol(data_scene_id, NULL, 10);
+
+       ret = zb_zcl_scene_store_scene(handle, dest_addr16, sj_ep1.ep, group_id,
+                       scene_id, zigbee_zcl_scene_store_scene_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_scene_store_scene(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_scene_store_scene() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_scene_recall_scene(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short group_id = 0x0002;
+       unsigned char scene_id = 0x01;
+
+       if (strlen(data_group_id))
+               group_id = (unsigned short)strtol(data_group_id, NULL, 10);
+       if (strlen(data_scene_id))
+               scene_id = (unsigned char)strtol(data_scene_id, NULL, 10);
+
+       ret = zb_zcl_scene_recall_scene(handle, dest_addr16, sj_ep1.ep,
+                       group_id, scene_id);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_scene_recall_scene(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_scene_recall_scene() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_add_scene[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Scene ID", NULL, NULL, data_scene_id },
+       { "3", "Transition time", NULL, NULL, data_trans_time },
+       { "4", "Scene name", NULL, NULL, data_scene_name },
+       { "5", "Run", NULL, run_scene_add_scene, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_view_scene[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Scene ID", NULL, NULL, data_scene_id },
+       { "3", "Run", NULL, run_scene_view_scene, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_get_scene_membership[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Run", NULL, run_scene_get_scene_membership, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_remove_scene[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Scene ID", NULL, NULL, data_scene_id },
+       { "3", "Run", NULL, run_scene_remove_scene, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_remove_all_scene[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Run", NULL, run_scene_remove_all_scene, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_store_scene[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Scene ID", NULL, NULL, data_scene_id },
+       { "3", "Run", NULL, run_scene_store_scene, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_recall_scene[] = {
+       { "1", "Group ID", NULL, NULL, data_group_id },
+       { "2", "Scene ID", NULL, NULL, data_scene_id },
+       { "3", "Run", NULL, run_scene_recall_scene, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_scene[] = {
+       { "1", "zb_zcl_scene_add_scene",
+                       _menu_add_scene, NULL, NULL },
+       { "2", "zb_zcl_scene_view_scene",
+                       _menu_view_scene, NULL, NULL },
+       { "3", "zb_zcl_scene_get_scene_membership",
+                       _menu_get_scene_membership, NULL, NULL },
+       { "4", "zb_zcl_scene_remove_scene",
+                       _menu_remove_scene, NULL, NULL },
+       { "5", "zb_zcl_scene_remove_all_scene",
+                       _menu_remove_all_scene, NULL, NULL },
+       { "6", "zb_zcl_scene_store_scene",
+                       _menu_store_scene, NULL, NULL },
+       { "7", "zb_zcl_scene_recall_scene",
+                       _menu_recall_scene, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-cluster-thermostat.c b/test/zcl-cluster-thermostat.c
new file mode 100644 (file)
index 0000000..76a9c20
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern simple_desc_s s_thermostat_ep1;
+
+static char data_mode[MENU_DATA_SIZE + 1] = "0";
+static char data_amount[MENU_DATA_SIZE + 1] = "1";
+
+static int run_adjust_setpoint(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char mode = 0x00; /* HEAT_MODE */
+       unsigned char amount = 0x01;
+
+       if (strlen(data_mode))
+               mode = (unsigned char)strtol(data_mode, NULL, 10);
+       if (strlen(data_amount))
+               amount = (unsigned char)strtol(data_amount, NULL, 10);
+
+       ret = zb_zcl_thermostat_adjust_setpoint(handle, dest_addr16,
+                       s_thermostat_ep1.ep, mode, amount);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_thermostat_adjust_setpoint(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_thermostat_adjust_setpoint() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_adjust_setpoint[] = {
+       { "1", "Mode", NULL, NULL, data_mode },
+       { "2", "Amount", NULL, NULL, data_amount },
+       { "3", "Run", NULL, run_adjust_setpoint, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster_thermostat[] = {
+       { "1", "zb_zcl_thermostat_adjust_setpoint",
+                       _menu_adjust_setpoint, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zcl-global-cmd.c b/test/zcl-global-cmd.c
new file mode 100644 (file)
index 0000000..2714ac6
--- /dev/null
@@ -0,0 +1,708 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern struct menu_data menu_zcl_cluster_alarm[];
+extern struct menu_data menu_zcl_cluster_colorctrl[];
+extern struct menu_data menu_zcl_cluster_group[];
+extern struct menu_data menu_zcl_cluster_identity[];
+extern struct menu_data menu_zcl_cluster_levelctrl[];
+extern struct menu_data menu_zcl_cluster_onoff[];
+extern struct menu_data menu_zcl_cluster_pollctrl[];
+extern struct menu_data menu_zcl_cluster_scene[];
+extern struct menu_data menu_zcl_cluster_thermostat[];
+
+extern zigbee_h  handle;
+
+extern nwk_addr  panid;
+extern ieee_addr co_addr64;
+
+extern ieee_addr st_addr64;
+extern ieee_addr sj_addr64;
+
+extern nwk_addr  dest_addr16;
+extern ieee_addr dest_addr64;
+
+extern simple_desc_s st_ep1, st_ep2, st_ep3, st_ep4, sj_ep1, simul_ep1;
+
+static char data_cluster_id[MENU_DATA_SIZE + 1] = "6";
+static char data_attr_id[MENU_DATA_SIZE + 1] = "0";
+static char data_min_i[MENU_DATA_SIZE + 1] = "A";
+static char data_max_i[MENU_DATA_SIZE + 1] = "3C";
+static char data_timeout[MENU_DATA_SIZE + 1] = "10";
+
+static void zigbee_zcl_global_read_attributes_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
+       int records_len, void *user_data)
+{
+       int count;
+       unsigned short id;
+       unsigned char type;
+       unsigned char status;
+       unsigned char *buf = NULL;
+       zb_value_h value = NULL;
+       read_attr_status_record_h *records;
+
+       msg("");
+       msgp("zigbee_zcl_global_read_attributes_rsp()");
+
+       if (NULL == records_info || ZB_GLOBAL_READ_ATTR != records_info->type
+                || NULL == records_info->record.read_attr) {
+               msg("Invalid records info");
+               msg("records_info : [%p]", records_info);
+               if (records_info) {
+                       msg("    type: [%x]", records_info->type);
+                       msg("    type: [%p]", records_info->record.read_attr);
+               }
+               return;
+       }
+       records = records_info->record.read_attr;
+
+       zb_create_value(&value);
+       msg("  Cluster ID   : 0x%04x", cluster_id);
+       msg("  Node ID      : 0x%04X", addr16);
+       msg("  End-Point    : 0x%02X", ep);
+       msg("  Msg length     %d", records_len);
+
+       if (records && *records) {
+               zb_get_id_from_read_attr_status_record(*records, &id);
+               msg("  Attribute ID : 0x%04X", id);
+       }
+       if (records && *records) {
+               zb_get_type_from_read_attr_status_record(*records, &type);
+               msg("  Type         : 0x%02X", type);
+       }
+       if (records && *records) {
+               zb_get_status_from_read_attr_status_record(*records, &status);
+               msg("  Status       : 0x%02X", status);
+       }
+       if (records && *records) {
+               zb_get_value_from_read_attr_status_record(*records, type, value);
+               if (value) {
+                       zb_get_value(value, &type, &buf, &count);
+                       if (buf) {
+                               msg("  value[0] = 0x%02x", buf[0]);
+                               free(buf);
+                       }
+                       zb_destroy_value(value);
+               }
+       }
+}
+
+static void zigbee_zcl_global_write_attributes_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
+       int records_len, void *user_data)
+{
+       unsigned short id;
+       unsigned char status;
+       zb_value_h value = NULL;
+       write_attr_status_record_h *records;
+
+       msg("");
+       msgp("zigbee_zcl_global_write_attributes_rsp()");
+
+       if (NULL == records_info || ZB_GLOBAL_WRITE_ATTR != records_info->type
+                || NULL == records_info->record.write_attr) {
+               msg("Invalid records info");
+               return;
+       }
+       records = records_info->record.write_attr;
+
+       zb_create_value(&value);
+       msg("  Cluster ID  : 0x%04X", cluster_id);
+       msg("  Node ID     : 0x%04X", addr16);
+       msg("  End-Point   : 0x%02X", ep);
+       msg("  Msg length    %d", records_len);
+
+       if (records) {
+               zb_get_id_from_write_attr_status(*records, &id);
+               msg("  AttributeId : 0x%04X", id);
+       }
+       if (records) {
+               zb_get_status_from_write_attr_status(*records, &status);
+               msg("  status      : 0x%02X", status);
+       }
+       zb_destroy_value(value);
+}
+
+static void zigbee_zcl_global_configure_reporting_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
+       int records_len, void *user_data)
+{
+       int i;
+       unsigned char status;
+       report_config_response_record_h *records;
+
+       msg("");
+       msgp("zigbee_zcl_global_configure_reporting_rsp()");
+
+       if (NULL == records_info || ZB_GLOBAL_CONFIG_REPORT != records_info->type
+                || NULL == records_info->record.report_config_rsp) {
+               msg("Invalid records info");
+               return;
+       }
+       records = records_info->record.report_config_rsp;
+
+       msg("  records_len=%d", records_len);
+       for (i = 0; i < records_len; i++) {
+               zb_get_status_from_report_config_response_record(records[i], &status);
+               msg("    [%d] status = 0x%02X", i, status);
+       }
+}
+
+static void zigbee_zcl_global_read_reporting_configuration_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
+       int records_len, void *user_data)
+{
+       zb_value_h val;
+       int i = 0;
+       int j = 0;
+       int count;
+       int ret;
+       unsigned char type, *buf = NULL;
+       unsigned short id, max_i, min_i;
+       report_config_record_h *records;
+
+       msg("");
+       msgp("zigbee_zcl_global_read_reporting_configuration_rsp()");
+
+       if (NULL == records_info || ZB_GLOBAL_READ_REPORT_CONFIG != records_info->type
+                || NULL == records_info->record.report_config) {
+               msg("Invalid records info");
+               return;
+       }
+
+       records = records_info->record.report_config;
+       msg("  cluster_id 0x%04X", cluster_id);
+       msg("  nodeId     0x%04X", addr16);
+       msg("  endpoint   0x%02X", ep);
+       msg("  Msg length   %d", records_len);
+
+       while (i < records_len) {
+               msg("    records[%d] 0x%08X", i, id);
+               zb_get_id_from_report_config_record(records[i], &id);
+               msg("    AttributeId 0x%04X", id);
+               zb_get_type_from_report_config_record(records[i], &type);
+               /*if ((zb_get_analog_or_discret(type) == DATA_TYPE_ANALOG)) {*/
+                       msg("    type 0x%02X", type);
+                       zb_get_max_i_from_report_config_record(records[i], &max_i);
+                       msg("    Max Interval 0x%04X", max_i);
+                       zb_get_min_i_from_report_config_record(records[i], &min_i);
+                       msg("    Min Interval 0x%04X", min_i);
+                       zb_create_value(&val);
+                       zb_get_change_from_report_config_record1(records[i], val);
+                       ret = zb_get_value(val, &type, &buf, &count);
+                       if (ZIGBEE_ERROR_NONE == ret) {
+                               for (j = 0; j < count; j++)
+                                       msg("      value[j] = 0x%02x", buf[j]);
+                       }
+
+                       if (buf) {
+                               free(buf);
+                               buf = NULL;
+                       }
+
+                       msg("");
+                       zb_destroy_value(val);
+               /*
+               } else {
+                       msg("Unsuccessful Attempt\n");
+               }
+               */
+               i++;
+       }
+}
+
+static void zigbee_zcl_global_discover_attributes_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, unsigned char discovery_complete,
+       discover_attr_info_record_h * records, int records_len, void *user_data)
+{
+       int i;
+       unsigned char type;
+       unsigned short id;
+
+       msg("");
+       msgp("zigbee_zcl_global_discover_attributes_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point       = 0x%02X", ep);
+       msg("  Cluster ID      = 0x%02X", cluster_id);
+       msg("  discovery_complete = %d", discovery_complete);
+
+       for (i = 0; i < records_len; i++) {
+               zb_get_type_from_discover_attr_info(records[i], &type);
+               msg("    [%d] type = 0x%02X", i, type);
+               zb_get_id_from_discover_attr_info(records[i], &id);
+               msg("    [%d] id   = 0x%04X", i, id);
+       }
+}
+
+static void zigbee_zcl_global_discover_cmds_received_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, unsigned char discovery_complete,
+       unsigned char *command_ids, int command_ids_len, void *user_data)
+{
+       int i;
+
+       msg("");
+       msgp("zigbee_zcl_global_discover_cmds_received_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point       = 0x%02X", ep);
+       msg("  Cluster ID      = 0x%02X", cluster_id);
+       msg("  discovery_complete = %d", discovery_complete);
+
+       for (i = 0; i < command_ids_len; i++)
+               msg("    command_id[%d]   = 0x%02X", i, command_ids[i]);
+}
+
+static void zigbee_zcl_global_discover_cmds_generated_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, unsigned char discovery_complete,
+       unsigned char *command_ids, int command_ids_len, void *user_data)
+{
+       int i;
+
+       msg("");
+       msgp("zigbee_zcl_global_discover_cmds_generated_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point       = 0x%02X", ep);
+       msg("  Cluster ID      = 0x%02X", cluster_id);
+       msg("  discovery_complete = %d", discovery_complete);
+
+       for (i = 0; i < command_ids_len; i++)
+               msg("    command_id[%d]   = 0x%02X", i, command_ids[i]);
+}
+
+static void zigbee_zcl_global_discover_attr_extended_rsp(nwk_addr addr16,
+       unsigned char ep, unsigned short cluster_id, unsigned char discovery_complete,
+       extended_attr_info_h *records, unsigned short records_len, void *user_data)
+{
+       int i;
+       unsigned char type;
+       unsigned short id;
+       unsigned char acl;
+
+       msg("");
+       msgp("zigbee_zcl_global_discover_attr_extended_rsp()");
+
+       msg("  Network Address = 0x%04X", addr16);
+       msg("  End-Point       = 0x%02X", ep);
+       msg("  Cluster ID      = 0x%02X", cluster_id);
+       msg("  discovery_complete = %d", discovery_complete);
+
+       for (i = 0; i < records_len; i++) {
+               zb_get_id_from_extended_attr_info(records[i], &id);
+               msg("    [%d] id   = 0x%02X", i, id);
+               zb_get_type_from_extended_attr_info(records[i], &type);
+               msg("    [%d] type = 0x%04X", i, type);
+               zb_get_acl_from_extended_attr_info(records[i], &acl);
+               msg("    [%d] acl  = 0x%04X", i, acl);
+       }
+}
+
+static int run_global_read_attr(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+#if 0
+       /* For SmartThings open/close sensor */
+       unsigned short st_cluster_id = ZB_ZCL_IAS_ZONE_CLUSTER_ID;
+       unsigned short st_attribute_id[] = {
+               ZB_ZCL_ZONE_STATE_ATTRIBUTE_ID,
+               ZB_ZCL_ZONE_TYPE_ATTRIBUTE_ID,
+               ZB_ZCL_ZONE_STATUS_ATTRIBUTE_ID,
+               ZB_ZCL_IAS_CIE_ADDRESS_ATTRIBUTE_ID,
+               ZB_ZCL_ZONE_ID_ATTRIBUTE_ID
+       };
+
+       int st_len_of_attr = sizeof(st_attribute_id) / sizeof(st_attribute_id[0]);
+       /* Reading zone state attribute */
+       ret = zb_zcl_global_read_attr(handle, dest_addr16, 1, st_ep1.ep,
+                       -1, st_cluster_id, st_attribute_id, st_len_of_attr,
+                       zigbee_zcl_global_read_attributes_rsp, NULL);
+#endif
+#if 0
+       /* Reading active power report in electrical measurement cluster */
+       sj_cluster_id = ZB_ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID;
+       sj_attribute_id[0] = ZB_ZCL_ACTIVE_POWER_ATTRIBUTE_ID;
+       sj_len_of_attr = 1;
+
+       ret = zb_zcl_global_read_attr(handle, dest_addr16, 1, sj_ep1.ep,
+                       -1, sj_cluster_id, sj_attribute_id, sj_len_of_attr,
+                       zigbee_zcl_global_read_attributes_rsp, NULL);
+#endif
+
+       unsigned short cluster_id = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       unsigned short attribute_id[] = {
+               ZB_ZCL_ON_OFF_ATTRIBUTE_ID
+       };
+       int len_of_attr = sizeof(attribute_id) / sizeof(attribute_id[0]);
+
+       if (strlen(data_cluster_id))
+               cluster_id = (unsigned short)strtol(data_cluster_id, NULL, 16);
+       if (strlen(data_attr_id))
+               attribute_id[0] = (unsigned short)strtol(data_attr_id, NULL, 16);
+
+       ret = zb_zcl_global_read_attr(handle, dest_addr16, 1, 1,
+                       -1, cluster_id, attribute_id, len_of_attr,
+                       zigbee_zcl_global_read_attributes_rsp, NULL);
+
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_read_attr(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_read_attr() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_write_attr(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char value[] = { 0x02, 0x01};
+       /* Samjin Power Outlet */
+       write_attr_record_h attr;
+
+       unsigned short cluster_id = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       unsigned short attribute_id = ZB_ZCL_ON_OFF_ATTRIBUTE_ID;
+
+       if (strlen(data_cluster_id))
+               cluster_id = (unsigned short)strtol(data_cluster_id, NULL, 16);
+       if (strlen(data_attr_id))
+               attribute_id = (unsigned short)strtol(data_attr_id, NULL, 16);
+
+       zb_create_write_attr_record(&attr);
+       //zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
+       zb_set_id_to_write_attr_record(attr, attribute_id);
+       zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
+       zb_set_buf_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER, value,
+                       zb_get_data_size(ZB_ZCL_UNSIGNED_16_BIT_INTEGER));
+
+       ret = zb_zcl_global_write_attr(handle, dest_addr16, 1, sj_ep1.ep,
+                       ZB_ZCL_FC_DEFAULT,
+                       cluster_id, &attr, 1,
+                       zigbee_zcl_global_write_attributes_rsp, NULL);
+       zb_destroy_write_attr_record(attr);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_write_attr(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_write_attr() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_write_attr_undivided(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char value[] = { 0x02, 0x01};
+       /* Samjin Power Outlet */
+       write_attr_record_h attr;
+
+       zb_create_write_attr_record(&attr);
+       zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
+       zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
+       zb_set_buf_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER, value,
+                       zb_get_data_size(ZB_ZCL_UNSIGNED_16_BIT_INTEGER));
+       ret = zb_zcl_global_write_attr_undivided(handle, dest_addr16, 1,
+                       sj_ep1.ep, ZB_ZCL_FC_DEFAULT, ZB_ZCL_IDENTIFY_CLUSTER_ID, &attr, 1,
+                       zigbee_zcl_global_write_attributes_rsp, NULL);
+       zb_destroy_write_attr_record(attr);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_write_attr_undivided(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_write_attr_undivided() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_write_attr_no_rsp(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char value[] = { 0x02, 0x01};
+       /* Samjin Power Outlet */
+       write_attr_record_h attr;
+
+       zb_create_write_attr_record(&attr);
+       zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
+       zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
+       zb_set_buf_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER, value,
+                       zb_get_data_size(ZB_ZCL_UNSIGNED_16_BIT_INTEGER));
+       ret = zb_zcl_global_write_attr_no_rsp(handle, dest_addr16, 1, sj_ep1.ep,
+               ZB_ZCL_FC_DEFAULT, ZB_ZCL_IDENTIFY_CLUSTER_ID, &attr, 1);
+       zb_destroy_write_attr_record(attr);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_write_attr_no_rsp(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_write_attr_no_rsp() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_config_report(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       /* Samjin Power Outlet */
+       unsigned char val1 = 1;
+       report_config_record_h config, config1;
+       unsigned short cluster_id = ZB_ZCL_ON_OFF_CLUSTER_ID;
+       unsigned short attribute_id = ZB_ZCL_ON_OFF_ATTRIBUTE_ID;
+       unsigned short min_i;
+       unsigned short max_i;
+       unsigned short timeout;
+
+       if (strlen(data_cluster_id))
+               cluster_id = (unsigned short)strtol(data_cluster_id, NULL, 16);
+       if (strlen(data_attr_id))
+               attribute_id = (unsigned short)strtol(data_attr_id, NULL, 16);
+
+       if (strlen(data_min_i))
+               min_i = (unsigned short)strtol(data_min_i, NULL, 16);
+       if (strlen(data_max_i))
+               max_i = (unsigned short)strtol(data_max_i, NULL, 16);
+       if (strlen(data_timeout))
+               timeout = (unsigned short)strtol(data_timeout, NULL, 10);
+
+       zb_create_report_config_record(&config);
+       zb_set_dir_to_report_config_record(config, ZB_ZCL_CLIENT_TO_SERVER);
+       zb_set_id_to_report_config_record(config, attribute_id);
+       zb_set_type_to_report_config_record(config, ZB_ZCL_BOOLEAN);
+       zb_set_min_i_to_report_config_record(config, min_i);
+       zb_set_max_i_to_report_config_record(config, max_i);
+       zb_set_change_to_report_config_record2(config, ZB_ZCL_BOOLEAN, &val1);
+       zb_set_timeout_to_report_config_record(config, timeout);
+
+       ret = zb_zcl_global_config_report(handle, dest_addr16, 1, sj_ep1.ep,
+                       ZB_ZCL_FC_DEFAULT, cluster_id, &config, 1,
+                       zigbee_zcl_global_configure_reporting_rsp, NULL);
+       zb_destroy_report_config_record(config);
+#if 0
+       /* ST Open/Close Sensor  */
+       unsigned short val2 = 0x007f;
+       zb_create_report_config_record(&config1);
+       zb_set_dir_to_report_config_record(config1, ZB_ZCL_CLIENT_TO_SERVER);
+       zb_set_id_to_report_config_record(config1, ZB_ZCL_ZONE_STATE_ATTRIBUTE_ID);
+       zb_set_type_to_report_config_record(config1, ZB_ZCL_SIGNED_16_BIT_INTEGER);
+       zb_set_min_i_to_report_config_record(config1, 0);
+       zb_set_max_i_to_report_config_record(config1, 60);
+       zb_set_change_to_report_config_record(config1, ZB_ZCL_SIGNED_16_BIT_INTEGER, &val2);
+       zb_set_timeout_to_report_config_record(config1, 60);
+       ret = zb_zcl_global_config_report(handle, dest_addr16, 1, st_ep1.ep,
+                       ZB_ZCL_FC_DEFAULT, ZB_ZCL_TEMP_MEASUREMENT_CLUSTER_ID, &config1, 1,
+                       zigbee_zcl_global_configure_reporting_rsp, NULL);
+       zb_destroy_report_config_record(config1);
+#endif
+
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_config_report(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_config_report() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_read_config_report(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       read_report_config_record_h read_report_conf;
+
+       zb_create_read_report_config_record(&read_report_conf);
+       zb_set_dir_to_read_report_config_record(read_report_conf, ZB_ZCL_CLIENT_TO_SERVER);
+       zb_set_id_to_read_report_config_record(read_report_conf, ZB_ZCL_ON_OFF_ATTRIBUTE_ID);
+
+       /* Samjin Power Outlet */
+       ret = zb_zcl_global_read_config_report(handle, dest_addr16, 1, sj_ep1.ep,
+               ZB_ZCL_FC_DEFAULT, ZB_ZCL_ON_OFF_CLUSTER_ID, &read_report_conf, 1,
+               zigbee_zcl_global_read_reporting_configuration_rsp, NULL);
+       zb_destroy_read_report_config_record(read_report_conf);
+
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_read_config_report(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_read_config_report() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_discover_attr(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+#if 0
+       /* For ST Open/Close Sensor */
+       ret = zb_zcl_global_discover_attr(handle, dest_addr16, 1, st_ep1.ep,
+               ZB_ZCL_FC_DEFAULT, ZB_ZCL_IDENTIFY_CLUSTER_ID, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID,
+               2, zigbee_zcl_global_discover_attributes_rsp, NULL);
+#endif
+       /* For SJ Power Outlet */
+       ret = zb_zcl_global_discover_attr(handle, dest_addr16, 1, sj_ep1.ep,
+               ZB_ZCL_FC_DEFAULT, ZB_ZCL_ON_OFF_CLUSTER_ID, ZB_ZCL_ON_OFF_ATTRIBUTE_ID, 5,
+               zigbee_zcl_global_discover_attributes_rsp, NULL);
+
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_discover_attr(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_discover_attr() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_discover_cmds_received(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       ret = zb_zcl_global_discover_cmds_received(handle, dest_addr16, 1, sj_ep1.ep,
+               ZB_ZCL_DISABLE_DEFAULT_RESPONSE, ZB_ZCL_ON_OFF_CLUSTER_ID,
+               ZB_ZCL_ON_OFF_ATTRIBUTE_ID, 5,
+               zigbee_zcl_global_discover_cmds_received_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_discover_cmds_received(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_discover_cmds_received() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_discover_cmds_generated(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       ret = zb_zcl_global_discover_cmds_generated(handle, dest_addr16, 1, sj_ep1.ep,
+               ZB_ZCL_DISABLE_DEFAULT_RESPONSE, ZB_ZCL_GROUPS_CLUSTER_ID, 0x00, 4,
+               zigbee_zcl_global_discover_cmds_generated_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_discover_cmds_generated(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_discover_cmds_generated() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_global_discover_attr_extended(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       ret = zb_zcl_global_discover_attr_extended(handle, dest_addr16, 1, sj_ep1.ep,
+               ZB_ZCL_DISABLE_DEFAULT_RESPONSE, ZB_ZCL_ON_OFF_CLUSTER_ID,
+               ZB_ZCL_ON_OFF_ATTRIBUTE_ID, 5,
+               zigbee_zcl_global_discover_attr_extended_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zcl_global_discover_attr_extended(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zcl_global_discover_attr_extended() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+struct menu_data menu_zcl_global_read_attr[] = {
+       { "1", "Cluster ID (Hex)", NULL, NULL, data_cluster_id },
+       { "2", "Attribute ID (Hex)", NULL, NULL, data_attr_id },
+       { "3", "run", NULL, run_global_read_attr, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_global_write_attr[] = {
+       { "1", "Cluster ID (Hex)", NULL, NULL, data_cluster_id },
+       { "2", "Attribute ID (Hex)", NULL, NULL, data_attr_id },
+       { "3", "run", NULL, run_global_write_attr, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_global_config_report[] = {
+       { "1", "Cluster ID (Hex)", NULL, NULL, data_cluster_id },
+       { "2", "Attribute ID (Hex)", NULL, NULL, data_attr_id },
+       { "3", "Min interval (Hex)", NULL, NULL, data_min_i },
+       { "4", "Max interval (Hex)", NULL, NULL, data_max_i },
+       { "5", "Timeout", NULL, NULL, data_timeout },
+       { "6", "run", NULL, run_global_config_report, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_global[] = {
+       { "1", "zb_zcl_global_read_attr",
+                       menu_zcl_global_read_attr, NULL, NULL },
+       { "2", "zb_zcl_global_write_attr",
+                       menu_zcl_global_write_attr, NULL, NULL },
+       { "3", "zb_zcl_global_write_attr_undivided",
+                       NULL, run_global_write_attr_undivided, NULL },
+       { "4", "zb_zcl_global_write_attr_no_rsp",
+                       NULL, run_global_write_attr_no_rsp, NULL },
+       { "5", "zb_zcl_global_config_report",
+                       menu_zcl_global_config_report, NULL, NULL },
+       { "6", "zb_zcl_global_read_config_report",
+                       NULL, run_global_read_config_report, NULL },
+       { "7", "zb_zcl_global_discover_attr",
+                       NULL, run_global_discover_attr, NULL },
+       { "8", "zb_zcl_global_discover_cmds_received",
+                       NULL, run_global_discover_cmds_received, NULL },
+       { "9", "zb_zcl_global_discover_cmds_generated",
+                       NULL, run_global_discover_cmds_generated, NULL },
+       { "10", "zb_zcl_global_discover_attr_extended",
+                       NULL, run_global_discover_attr_extended, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zcl_cluster[] = {
+       { "1", "Alarm Cluster", menu_zcl_cluster_alarm, NULL, NULL },
+       { "2", "Basic Cluster", NULL, NULL, NULL },
+       { "3", "Color Control Cluster", menu_zcl_cluster_colorctrl, NULL, NULL },
+       { "4", "Group Cluster", menu_zcl_cluster_group, NULL, NULL },
+       { "5", "IAS zone Cluster", NULL, NULL, NULL },
+       { "6", "Identity Cluster", menu_zcl_cluster_identity, NULL, NULL },
+       { "7", "Level Control Cluster", menu_zcl_cluster_levelctrl, NULL, NULL },
+       { "8", "On/Off Cluster", menu_zcl_cluster_onoff, NULL, NULL },
+       { "9", "Poll Control Cluster", menu_zcl_cluster_pollctrl, NULL, NULL },
+       { "10", "Scene Cluster", menu_zcl_cluster_scene, NULL, NULL },
+       { "11", "Simple Metering Cluster", NULL, NULL, NULL },
+       { "12", "Thermostat Cluster", menu_zcl_cluster_thermostat, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zdo-binding.c b/test/zdo-binding.c
new file mode 100644 (file)
index 0000000..6651cb9
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  panid;
+extern ieee_addr co_addr64;
+
+extern ieee_addr st_addr64;
+extern ieee_addr sj_addr64;
+
+extern nwk_addr  dest_addr16;
+extern ieee_addr dest_addr64;
+
+extern simple_desc_s sj_ep1;
+
+/* ZB_ZCL_ON_OFF_CLUSTER_ID */
+static char data_cluster_id[MENU_DATA_SIZE + 1] = "6";
+
+static void zigbee_zdo_bind_unbind_rsp(unsigned char status, void *user_data)
+{
+       msg("");
+       msgp("zigbee_zdo_bind_unbind_rsp() status = 0x%02X", status);
+}
+
+static int run_bind_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char src_ep = 1;
+       unsigned short cluster_id = ZB_ZCL_ON_OFF_CLUSTER_ID;
+
+       if (strlen(data_cluster_id))
+               cluster_id = (unsigned short)strtol(data_cluster_id, NULL, 16);
+
+#if 0
+       /* Samjin Power Outlet */
+       ret = zb_zdo_bind_req(handle, sj_addr16, sj_addr64, 1,
+                       ZB_ZCL_DIAGNOSTICS_CLUSTER_ID, co_addr64,
+                       ZB_UNICAST_BINDING, 0x0004, 1, zigbee_zdo_bind_unbind_rsp, NULL);
+       /* For ST Open/Close Sensor */
+       ret = zb_zdo_bind_req(handle, st_addr16, st_addr64, 1,
+                       ZB_ZCL_IAS_ZONE_CLUSTER_ID, co_addr64,
+                       ZB_UNICAST_BINDING, panid, 1, zigbee_zdo_bind_unbind_rsp, NULL);
+#endif
+
+       ret = zb_zdo_bind_req(handle, dest_addr16, sj_addr64, src_ep, cluster_id,
+                       co_addr64, ZB_UNICAST_BINDING, 0x0004, sj_ep1.ep,
+                       zigbee_zdo_bind_unbind_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_bind_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_bind_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_unbind_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned short cluster_id = ZB_ZCL_ON_OFF_CLUSTER_ID;
+
+       if (strlen(data_cluster_id))
+               cluster_id = (unsigned short)strtol(data_cluster_id, NULL, 16);
+
+       ret = zb_zdo_unbind_req(handle, dest_addr16, co_addr64, 1, cluster_id,
+                       sj_addr64, ZB_UNICAST_BINDING, panid, 1,
+                       zigbee_zdo_bind_unbind_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_unbind_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_unbind_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_bind[] = {
+       { "1", "Cluster ID (in hex)", NULL, NULL, data_cluster_id },
+       { "2", "Run", NULL, run_bind_req, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_unbind[] = {
+       { "1", "Cluster ID (in hex)", NULL, NULL, data_cluster_id },
+       { "2", "Run", NULL, run_unbind_req, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zdo_binding[] = {
+       { "1", "zb_zdo_bind_req", _menu_bind, NULL, NULL },
+       { "2", "zb_zdo_unbind_req", _menu_unbind, NULL, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zdo-device.c b/test/zdo-device.c
new file mode 100644 (file)
index 0000000..ab25d53
--- /dev/null
@@ -0,0 +1,454 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern struct menu_data menu_zdo_network[];
+extern struct menu_data menu_zdo_binding[];
+
+extern nwk_addr  panid;
+extern ieee_addr co_addr64;
+
+extern nwk_addr  st_addr16;
+extern ieee_addr st_addr64;
+
+extern nwk_addr  sj_addr16;
+extern ieee_addr sj_addr64;
+
+extern nwk_addr  dest_addr16;
+extern ieee_addr dest_addr64;
+
+extern simple_desc_s st_ep1, sj_ep1;
+
+static void zigbee_addr_rsp(unsigned char status, ieee_addr addr64, nwk_addr addr16,
+       unsigned char num_of_assoc_dev, unsigned char start_idx, unsigned short
+       *assoc_dev_addr_list, void *user_data)
+{
+       msg("");
+       msgp("zb_zdo_addr_rsp() status = 0x%02X", status);
+       if (addr64) {
+               msg("IEEE Address    : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:",
+                       addr64[0], addr64[1], addr64[2], addr64[3],
+                       addr64[4], addr64[5], addr64[6], addr64[7]);
+       } else
+               msg("IEEE Address    : 00:00:00:00:00:00:00:00:");
+       msg("Network Address : 0x%04X", addr16);
+       msg("Number of Associated Device : %d", num_of_assoc_dev);
+       msg("Start Index : %d", start_idx);
+}
+
+static void zigbee_active_ep_rsp(unsigned char status, nwk_addr addr16,
+       unsigned char count, unsigned char *ep_list, void *user_data)
+{
+       msg("");
+       msgp("zb_zdo_active_ep_rsp() status = 0x%02X", status);
+}
+
+static void zigbee_simple_desc_rsp(nwk_addr addr16, unsigned char len,
+       const zb_zdo_simple_desc_h handle, void *user_data)
+{
+       int ret;
+       unsigned char param_u8;
+       unsigned short param_u16;
+       unsigned short *in_clusters;
+       unsigned short *out_clusters;
+
+       msg("");
+       msgp("zb_zdo_simple_desc_rsp()");
+
+       ret = zb_simple_desc_get_ep(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               msg("zb_simple_desc_get_ep() Fail(0x%X)", ret);
+       else
+               msg("  ep = %d", param_u8);
+
+       ret = zb_simple_desc_get_profile_id(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               msg("zb_simple_desc_get_profile_id() Fail(0x%X)", ret);
+       else
+               msg("  profile_id = 0x%x", param_u16);
+
+       ret = zb_simple_desc_get_device_id(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               msg("zb_simple_desc_get_device_id() Fail(0x%X)", ret);
+       else
+               msg("  device_id = 0x%x", param_u16);
+
+       ret = zb_simple_desc_get_device_ver(handle, &param_u16);
+       if (ZIGBEE_ERROR_NONE != ret)
+               msg("zb_simple_desc_get_device_ver() Fail(0x%X)", ret);
+       else
+               msg("  device_ver = %d", param_u16);
+
+       ret = zb_simple_desc_get_num_of_in_clusters(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               msg("zb_simple_desc_get_num_of_in_clusters() Fail(0x%X)", ret);
+       else
+               msg("  num_of_in_cluster = %d", param_u8);
+
+       ret = zb_simple_desc_get_in_clusters(handle, &in_clusters);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_simple_desc_get_in_clusters() Fail(0x%X)", ret);
+       } else {
+               msg("    %04X %04X %04X %04X %04X %04X %04X",
+                       in_clusters[0], in_clusters[1], in_clusters[2], in_clusters[3],
+                       in_clusters[4], in_clusters[5], in_clusters[6]);
+       }
+
+       ret = zb_simple_desc_get_num_of_out_clusters(handle, &param_u8);
+       if (ZIGBEE_ERROR_NONE != ret)
+               msg("zb_simple_desc_get_num_of_out_clusters() Fail(0x%X)", ret);
+       else
+               msg("  num_of_out_cluster = %d", param_u8);
+
+       ret = zb_simple_desc_get_out_clusters(handle, &out_clusters);
+       if (ZIGBEE_ERROR_NONE != ret)
+               msg("zb_simple_desc_get_out_clusters() Fail(0x%X)", ret);
+       else
+               msg("    %04X ", out_clusters[0]);
+}
+
+static void zigbee_match_desc_rsp(unsigned char status, nwk_addr addr16,
+       unsigned char match_length, unsigned char **match_list, void *user_data)
+{
+       unsigned char i;
+       msg("");
+       msgp("zb_zdo_match_desc_rsp()");
+
+       msg("  nwk_addr = 0x%04X status = 0x%02X match_length = %d",
+               addr16, status, match_length);
+
+       for (i = 0; i < match_length; i++)
+               msg("  match_list[%d] = 0x%02x", i, (unsigned int)match_list[i]);
+}
+
+static void zigbee_zdo_power_desc_rsp(unsigned char status, nwk_addr addr16,
+               const zb_zdo_node_power_descriptor_h power_desc, void *user_data)
+{
+       unsigned char current_power_mode;
+       unsigned char available_power_source;
+       unsigned char current_power_source;
+       unsigned char current_power_source_lv;
+
+       msg("");
+       msgp("zb_zdo_power_desc_rsp() status = 0x%02X", status);
+
+       zb_node_power_desc_get_current_power_mode(power_desc, &current_power_mode);
+       msg("  current_power_mode = %02X", current_power_mode);
+       zb_node_power_desc_get_available_power_sources(power_desc, &available_power_source);
+       msg("  available_power_source = %02X", available_power_source);
+       zb_node_power_desc_get_current_power_source(power_desc, &current_power_source);
+       msg("  current_power_source = %02X", current_power_source);
+       zb_node_power_desc_get_current_power_source_level(power_desc, &current_power_source_lv);
+       msg("  current_power_source_level = %02X", current_power_source_lv);
+}
+
+static void zigbee_zdo_complex_desc_rsp(unsigned char status, nwk_addr addr16,
+               unsigned char length, unsigned char *complex_desc, void *user_data)
+{
+       msg("");
+       msgp("zb_zdo_complex_desc_rsp() status = 0x%02X length = %d",
+                       status, length);
+}
+
+static void zigbee_zdo_user_desc_conf(unsigned char status, void *user_data)
+{
+       msg("");
+       msgp("zb_zdo_user_desc_conf() status = 0x%02X", status);
+}
+
+static void zigbee_zdo_node_desc_rsp(unsigned char status, nwk_addr addr16,
+       const zb_zdo_node_descriptor_h desc, void *user_data)
+{
+       unsigned char logical_type;
+       unsigned char complex_desciptor_available;
+       unsigned char user_descriptor_available;
+       unsigned char aps_flags;
+       unsigned char frequency_band;
+       unsigned char mac_capability_flags;
+       unsigned short manufacturer_code;
+       unsigned char maximum_buffer_size;
+       unsigned short maximum_incoming_transfer_size;
+       unsigned short server_mask;
+       unsigned short maximum_outgoing_transfer_size;
+       unsigned short descriptor_capability_field;
+
+       msg("");
+       msgp("zb_zdo_node_desc_rsp()");
+       msgp("  nwk_addr = 0x%04X status = 0x%02X", addr16, status);
+
+       zb_node_desc_get_logical_type(desc, &logical_type);
+       msg("  logical_type = 0x%02X", logical_type);
+       zb_node_desc_get_complex_desciptor_available(desc, &complex_desciptor_available);
+       msg("  complex_desciptor_available = 0x%02X", complex_desciptor_available);
+       zb_node_desc_get_user_descriptor_available(desc, &user_descriptor_available);
+       msg("  complex_desciptor_available = 0x%02X", complex_desciptor_available);
+       zb_node_desc_get_aps_flags(desc, &aps_flags);
+       msg("  aps_flags = 0x%02X", aps_flags);
+       zb_node_desc_get_frequency_band(desc, &frequency_band);
+       msg("  frequency_band = 0x%02X", frequency_band);
+       zb_node_desc_get_mac_capability_flags(desc, &mac_capability_flags);
+       msg("  mac_capability_flags = 0x%02X", mac_capability_flags);
+       zb_node_desc_get_manufacturer_code(desc, &manufacturer_code);
+       msg("  manufacturer_code = 0x%04X", manufacturer_code);
+       zb_node_desc_get_maximum_buffer_size(desc, &maximum_buffer_size);
+       msg("  maximum_buffer_size = 0x%02X", maximum_buffer_size);
+       zb_node_desc_get_maximum_incoming_transfer_size(desc, &maximum_incoming_transfer_size);
+       msg("  maximum_incoming_transfer_size = 0x%04X", maximum_incoming_transfer_size);
+       zb_node_desc_get_server_mask(desc, &server_mask);
+       msg("  server_mask = 0x%04X", server_mask);
+       zb_node_desc_get_maximum_outgoing_transfer_size(desc, &maximum_outgoing_transfer_size);
+       msg("  maximum_outgoing_transfer_size = 0x%04X", maximum_outgoing_transfer_size);
+       zb_node_desc_get_descriptor_capability_field(desc, &descriptor_capability_field);
+       msg("  descriptor_capability_field = 0x%04X", descriptor_capability_field);
+}
+
+static int run_nwk_addr_req(MManager *mm, struct menu_data *menu)
+{
+       int ret1 = ZIGBEE_ERROR_NONE;
+       int ret2 = ZIGBEE_ERROR_NONE;
+
+       msg("IEEE Address    : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:",
+                       st_addr64[0], st_addr64[1], st_addr64[2], st_addr64[3],
+                       st_addr64[4], st_addr64[5], st_addr64[6], st_addr64[7]);
+       msg("IEEE Address    : %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:",
+                       sj_addr64[0], sj_addr64[1], sj_addr64[2], sj_addr64[3],
+                       sj_addr64[4], sj_addr64[5], sj_addr64[6], sj_addr64[7]);
+
+       ret1 = zb_zdo_nwk_addr_req(handle, st_addr64, 0x00, 0x00,
+                       zigbee_addr_rsp, NULL);
+       ret2 = zb_zdo_nwk_addr_req(handle, sj_addr64, 0x00, 0x00,
+                       zigbee_addr_rsp, NULL);
+       if (ret1 != ZIGBEE_ERROR_NONE || ret2 != ZIGBEE_ERROR_NONE) {
+               msg("zb_zdo_nwk_addr_req(0x%X) - FAILED!!!", ret1);
+               msg("zb_zdo_nwk_addr_req(0x%X) - FAILED!!!", ret2);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_nwk_addr_req() ret: [0x%X]", ret1);
+       msg(" - zb_zdo_nwk_addr_req() ret: [0x%X]", ret2);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_ieee_addr_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_ieee_addr_req(handle, dest_addr16, zigbee_addr_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_ieee_addr_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_ieee_addr_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_active_ep(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_active_ep(handle, dest_addr16, zigbee_active_ep_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_active_ep(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_active_ep() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_simple_desc_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_simple_desc_req(handle, dest_addr16, 1,
+                       zigbee_simple_desc_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_simple_desc_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_simple_desc_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_match_desc_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+#if 0
+       /* for ST open/close sensor */
+       ret = zb_zdo_match_desc_req(handle, st_addr16, st_ep1.profile_id,
+               st_ep1.num_of_in_clusters, st_ep1.in_clusters,
+               st_ep1.num_of_out_clusters,     st_ep1.out_clusters,
+               zigbee_match_desc_rsp, user_data);
+#endif
+       /* for SJ power outlet */
+       ret = zb_zdo_match_desc_req(handle, dest_addr16, sj_ep1.profile_id,
+                       sj_ep1.num_of_in_clusters, sj_ep1.in_clusters,
+                       sj_ep1.num_of_out_clusters,     sj_ep1.out_clusters,
+                       zigbee_match_desc_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_match_desc_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_match_desc_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_power_desc_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_power_desc_req(handle, dest_addr16,
+                       zigbee_zdo_power_desc_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_power_desc_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_power_desc_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_complex_desc_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_complex_desc_req(handle, dest_addr16,
+                       zigbee_zdo_complex_desc_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_complex_desc_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_complex_desc_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_user_desc_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_user_desc_req(handle, dest_addr16,
+                       zigbee_zdo_complex_desc_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_user_desc_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_user_desc_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_user_desc_set(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_user_desc_set(handle, dest_addr16, 4, (unsigned char*)"test",
+                       zigbee_zdo_user_desc_conf, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_user_desc_set(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_user_desc_set() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_node_desc_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_node_desc_req(handle, dest_addr16,
+                       zigbee_zdo_node_desc_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_node_desc_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_node_desc_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_device_annce(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+
+       ret = zb_zdo_device_annce(handle, st_addr16, st_addr64,
+                       ZB_ZDP_ALTERNATIVE_PAN_COORDINATOR | ZB_ZDP_DEVICE_TYPE
+                        | ZB_ZDP_POWER_SOURCE | ZB_ZDP_RECEIVER_ON_WHEN_IDLE
+                        | ZB_ZDP_ALLOCATE_ADDRESS);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_device_annce(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_device_annce() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+struct menu_data menu_zdo_device[] = {
+       { "1", "zb_zdo_nwk_addr_req", NULL, run_nwk_addr_req, NULL },
+       { "2", "zb_zdo_ieee_addr_req", NULL, run_ieee_addr_req, NULL },
+       { "3", "zb_zdo_active_ep", NULL, run_active_ep, NULL },
+       { "4", "zb_zdo_simple_desc_req", NULL, run_simple_desc_req, NULL },
+       { "5", "zb_zdo_match_desc_req", NULL, run_match_desc_req, NULL },
+       { "6", "zb_zdo_power_desc_req", NULL, run_power_desc_req, NULL },
+       { "7", "zb_zdo_complex_desc_req", NULL, run_complex_desc_req, NULL },
+       { "8", "zb_zdo_user_desc_req", NULL, run_user_desc_req, NULL },
+       { "9", "zb_zdo_user_desc_set", NULL, run_user_desc_set, NULL },
+       { "10", "zb_zdo_node_desc_req", NULL, run_node_desc_req, NULL },
+       { "11", "zb_zdo_device_annce", NULL, run_device_annce, NULL },
+       { NULL, NULL, },
+};
diff --git a/test/zdo-network.c b/test/zdo-network.c
new file mode 100644 (file)
index 0000000..f7d33b8
--- /dev/null
@@ -0,0 +1,454 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <zigbee.h>
+
+#include "main.h"
+#include "menu.h"
+
+extern zigbee_h  handle;
+
+extern nwk_addr  dest_addr16;
+extern ieee_addr dest_addr64;
+
+static char data_duration[MENU_DATA_SIZE + 1] = "5";
+static char data_count[MENU_DATA_SIZE + 1] = "4";
+static char data_start_idx[MENU_DATA_SIZE + 1] = "0";
+static char data_nwk_update_id[MENU_DATA_SIZE + 1] = "0";
+static char data_remove_children[MENU_DATA_SIZE + 1] = "1";
+static char data_rejoin[MENU_DATA_SIZE + 1] = "1";
+static char data_permit_duration[MENU_DATA_SIZE + 1] = "1";
+static char data_tc[MENU_DATA_SIZE + 1] = "1";
+
+static void zigbee_active_ep_rsp(unsigned char status, nwk_addr addr16,
+       unsigned char count, unsigned char *ep_list, void *user_data)
+{
+       msg("");
+       msgp("zb_zdo_active_ep_rsp() status = 0x%02X", status);
+}
+
+static void zigbee_zdo_mgmt_nwk_disc_rsp(unsigned char status,
+       unsigned char network_count, unsigned char start_idx, unsigned char network_list_count,
+       const zb_zdo_network_list_record_h *records, void *user_data)
+{
+       int i = 0;
+       ieee_addr extended_pan_id;
+       unsigned char logical_channel;
+       unsigned char stack_profile;
+       unsigned char zigbee_version;
+       unsigned char beacon_order;
+       unsigned char superframe_order;
+       unsigned char permit_joining;
+
+       msg("");
+       msgp("zb_zdo_mgmt_nwk_disc_rsp() status = 0x%02X", status);
+
+       if (!status) {
+               msg("  network_count 0x%02X", network_count);
+               msg("  start_idx  0x%02X", start_idx);
+               msg("  network_list_count  0x%02X", network_list_count);
+               for (i = 0; i < network_list_count; i++) {
+                       zb_network_list_record_get_extended_pan_id(records[i], extended_pan_id);
+                       msg("  Extended PanId %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                               extended_pan_id[7], extended_pan_id[6],
+                               extended_pan_id[5], extended_pan_id[4],
+                               extended_pan_id[3],     extended_pan_id[2],
+                               extended_pan_id[1],     extended_pan_id[0]);
+                       zb_network_list_record_get_logical_channel(records[i], &logical_channel);
+                       msg("  Logical Channel  0x%02X", logical_channel);
+                       zb_network_list_record_get_stack_profile(records[i], &stack_profile);
+                       msg("  stack_profile    0x%02X", stack_profile);
+                       zb_network_list_record_get_zigbee_version(records[i], &zigbee_version);
+                       msg("  zigbee_version   0x%02X", zigbee_version);
+                       zb_network_list_record_get_beacon_order(records[i], &beacon_order);
+                       msg("  Beacon_order     0x%02X", beacon_order);
+                       zb_network_list_record_get_superframe_order(records[i], &superframe_order);
+                       msg("  Superframe_order 0x%02X", superframe_order);
+                       zb_network_list_record_get_permit_joining(records[i], &permit_joining);
+                       msg("  Permit joining   0x%02X", permit_joining);
+               }
+       } else {
+               msg("  Unsuccessful Nwk discovery");
+       }
+}
+
+static void zigbee_zdo_mgmt_lqi_rsp(unsigned char status,
+       unsigned char neighbor_table_entries, unsigned char start_idx,
+       unsigned char neighbor_table_list_count,
+       const zb_zdo_neighbor_table_desc_h *neighbor_table_list, void *user_data)
+{
+       int i;
+       ieee_addr extended_pan_id;
+       ieee_addr addr64;
+       nwk_addr addr16;
+       unsigned char device_type;
+       unsigned char rx_on_when_idle;
+       unsigned char releationship;
+       unsigned char permit_joining;
+       unsigned char depth;
+       unsigned char lqi;
+
+       msg("");
+       msgp("zb_zdo_mgmt_lqi_rsp()");
+       msgp("  status = 0x%02X start_idx=%d count=%d", status, start_idx, neighbor_table_list_count);
+       for (i = start_idx; i < neighbor_table_list_count; i++) {
+               zb_neighbor_table_desc_get_extended_pan_id(neighbor_table_list[i], extended_pan_id);
+               msg("  ext PAN ID      = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+               extended_pan_id[0], extended_pan_id[1], extended_pan_id[2], extended_pan_id[3],
+               extended_pan_id[4], extended_pan_id[5], extended_pan_id[6], extended_pan_id[7]);
+               zb_neighbor_table_desc_get_ieee_addr(neighbor_table_list[i], addr64);
+               msg("  IEEE address    = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+               addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5], addr64[6], addr64[7]);
+               zb_neighbor_table_desc_get_nwk_addr(neighbor_table_list[i], &addr16);
+               msg("  Network address = 0x%04X", addr16);
+               zb_neighbor_table_desc_get_device_type(neighbor_table_list[i], &device_type);
+               msg("  Device Type     = 0x%02X", device_type);
+               zb_neighbor_table_desc_get_rx_on_when_idle(neighbor_table_list[i], &rx_on_when_idle);
+               msg("  Rx on idle      = 0x%02X", rx_on_when_idle);
+               zb_neighbor_table_desc_get_relationship(neighbor_table_list[i], &releationship);
+               msg("  Relationship    = 0x%02X", releationship);
+               zb_neighbor_table_desc_get_permit_joining(neighbor_table_list[i], &permit_joining);
+               msg("  Permit Joining  = 0x%02X", permit_joining);
+               zb_neighbor_table_desc_get_depth(neighbor_table_list[i], &depth);
+               msg("  Depth           = 0x%02X", depth);
+               zb_neighbor_table_desc_get_lqi(neighbor_table_list[i], &lqi);
+               msg("  LQI             = 0x%02X", lqi);
+       }
+}
+
+static void zigbee_zdo_mgmt_rtg_rsp(unsigned char status,
+       unsigned char routing_table_entries, unsigned char start_idx,
+       unsigned char routing_table_list_count,
+       const zb_zdo_routing_table_h *routing_table_list, void *user_data)
+{
+       int i;
+       nwk_addr dst_addr;
+       unsigned char mode;
+       unsigned char memory_constrained;
+       unsigned char many_to_one;
+       unsigned char route_record_required;
+       nwk_addr next_hop_addr;
+
+       msg("");
+       msgp("zb_zdo_mgmt_rtg_rsp()");
+       msgp("  status = 0x%02X routing_table_entries=%d start_idx=%d count=%d",
+                       status, routing_table_entries, start_idx, routing_table_list_count);
+       for (i = start_idx; i < routing_table_list_count; i++) {
+               zb_routing_table_get_dst_addr(routing_table_list[i], &dst_addr);
+               msg("  [%d] Destination address   = 0x%04X", i, dst_addr);
+               zb_routing_table_get_dst_status(routing_table_list[i], &mode);
+               msg("  [%d] Status                = 0x%02X", i, mode);
+               zb_routing_table_get_memory_constrained(routing_table_list[i], &memory_constrained);
+               msg("  [%d] memory_constrained    = 0x%02X", i, memory_constrained);
+               zb_routing_table_get_many_to_one(routing_table_list[i], &many_to_one);
+               msg("  [%d] many_to_one           = 0x%02X", i, many_to_one);
+               zb_routing_table_get_route_record_required(routing_table_list[i], &route_record_required);
+               msg("  [%d] route_record_required = 0x%02X", i, route_record_required);
+               zb_routing_table_get_next_hop_addr(routing_table_list[i], &next_hop_addr);
+               msg("  [%d] next_hop_addr         = 0x%04X", i, next_hop_addr);
+               msg("");
+       }
+}
+
+static void zigbee_zdo_mgmt_bind_rsp(unsigned char status, unsigned char entries,
+       unsigned char start_idx, unsigned char binding_table_list_count, const zb_zdo_binding_table_h *list,
+       void *user_data)
+{
+       int i;
+       nwk_addr addr16;
+       ieee_addr addr64;
+       unsigned short cluster_id;
+       unsigned char src_ep, dst_ep, dst_addr_mode;
+
+       msg("");
+       msgp("zb_zdo_mgmt_bind_rsp()");
+       msgp("  status = 0x%02X start_idx = %d number of records = %d",
+               status, start_idx, binding_table_list_count);
+
+       for (i = 0; i < binding_table_list_count; i++) {
+               zb_binding_table_get_src_addr(list[i], addr64);
+               msg("  Src IEEE address    = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                       addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5], addr64[6], addr64[7]);
+               zb_binding_table_get_src_ep(list[i], &src_ep);
+               msg("  Src End-Point       = 0x%02X", src_ep);
+               zb_binding_table_get_cluster_id(list[i], &cluster_id);
+               msg("  Cluster ID          = 0x%04X", cluster_id);
+               zb_binding_table_get_dst_addr_mode(list[i], &dst_addr_mode);
+               msg("  Dst Address Mode    = 0x%02X", dst_addr_mode);
+               zb_binding_table_get_dst_addr16(list[i], &addr16);
+               msg("  Dst Network address = 0x%04X", addr16);
+               memset(addr64, 0, sizeof(ieee_addr));
+               zb_binding_table_get_dst_addr64(list[i], addr64);
+               msg("  Dst IEEE address    = %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+                       addr64[0], addr64[1], addr64[2], addr64[3], addr64[4], addr64[5], addr64[6], addr64[7]);
+               zb_binding_table_get_dst_ep(list[i], &dst_ep);
+               msg("  Dst End-Point       = 0x%02X", src_ep);
+               msg("");
+       }
+}
+
+static void zigbee_zdo_mgmt_leave_rsp(unsigned char status, void *user_data)
+{
+       msg("");
+       msgp("zb_zdo_mgmt_leave_rsp() status = 0x%02X", status);
+}
+
+static void zigbee_zdo_mgmt_permit_joining_rsp(unsigned char status, void *user_data)
+{
+       msg("");
+       msgp("zb_zdo_mgmt_permit_joining_rsp() status = 0x%02X", status);
+}
+
+static int run_mgmt_nwk_disc_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned int scan_channels = ZB_802_15_4_CHANNELS_MASK;
+       unsigned char scan_duration = 5;
+       unsigned char scan_count = 4;
+       unsigned char start_idx = 0;
+
+       if (strlen(data_duration))
+               scan_duration = (unsigned char)strtol(data_duration, NULL, 10);
+       if (strlen(data_count))
+               scan_count = (unsigned char)strtol(data_count, NULL, 10);
+       if (strlen(data_start_idx))
+               start_idx = (unsigned char)strtol(data_start_idx, NULL, 10);
+
+       ret = zb_zdo_mgmt_nwk_disc_req(handle, dest_addr16, scan_channels,
+                       scan_duration, scan_count, start_idx,
+                       zigbee_zdo_mgmt_nwk_disc_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_mgmt_nwk_disc_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_mgmt_nwk_disc_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_mgmt_nwk_update_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned int scan_channels = ZB_802_15_4_CHANNELS_MASK;
+       unsigned char nwk_update_id = 0x00;
+       unsigned char scan_duration = 5;
+       unsigned char scan_count = 4;
+
+       if (strlen(data_duration))
+               scan_duration = (unsigned char)strtol(data_duration, NULL, 10);
+       if (strlen(data_count))
+               scan_count = (unsigned char)strtol(data_count, NULL, 10);
+       if (strlen(data_nwk_update_id))
+               nwk_update_id = (unsigned char)strtol(data_nwk_update_id, NULL, 10);
+
+       ret = zb_zdo_mgmt_nwk_update_req(handle, scan_channels, scan_duration,
+                       scan_count, nwk_update_id, dest_addr16);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_mgmt_nwk_update_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_mgmt_nwk_update_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_mgmt_lqi_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char start_idx = 0;
+
+       if (strlen(data_start_idx))
+               start_idx = (unsigned char)strtol(data_start_idx, NULL, 10);
+
+       ret = zb_zdo_mgmt_lqi_req(handle, dest_addr16, start_idx,
+                       zigbee_zdo_mgmt_lqi_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_mgmt_lqi_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_mgmt_lqi_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_mgmt_rtg_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char start_idx = 0;
+
+       if (strlen(data_start_idx))
+               start_idx = (unsigned char)strtol(data_start_idx, NULL, 10);
+
+       ret = zb_zdo_mgmt_rtg_req(handle, dest_addr16, start_idx,
+                       zigbee_zdo_mgmt_rtg_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_mgmt_rtg_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_mgmt_rtg_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_mgmt_bind_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char start_idx = 0;
+
+       if (strlen(data_start_idx))
+               start_idx = (unsigned char)strtol(data_start_idx, NULL, 10);
+
+       ret = zb_zdo_mgmt_bind_req(handle, dest_addr16, start_idx,
+                       zigbee_zdo_mgmt_bind_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_mgmt_bind_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_mgmt_bind_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_mgmt_leave_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char var = 0;
+       bool remove_children = true;
+       bool rejoin = true;
+
+       if (strlen(data_remove_children)) {
+               var = (unsigned char)strtol(data_remove_children, NULL, 10);
+               remove_children = (var == 0) ? false : true;
+       }
+       if (strlen(data_rejoin)) {
+               var = (unsigned char)strtol(data_rejoin, NULL, 10);
+               rejoin = (var == 0) ? false : true;
+       }
+
+       ret = zb_zdo_mgmt_leave_req(handle, dest_addr64, remove_children, rejoin,
+                       zigbee_zdo_mgmt_leave_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_mgmt_leave_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_mgmt_leave_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static int run_mgmt_permit_joining_req(MManager *mm, struct menu_data *menu)
+{
+       int ret = ZIGBEE_ERROR_NONE;
+       unsigned char permit_duration = 1;
+       unsigned char tc_significance = 1;
+
+       if (strlen(data_permit_duration))
+               permit_duration = (unsigned char)strtol(data_permit_duration, NULL, 10);
+       if (strlen(data_tc))
+               tc_significance = (unsigned char)strtol(data_tc, NULL, 10);
+
+       ret = zb_zdo_mgmt_permit_joining_req(handle, dest_addr64,
+                       permit_duration, tc_significance, zigbee_zdo_mgmt_leave_rsp, NULL);
+       if (ZIGBEE_ERROR_NONE != ret) {
+               msg("zb_zdo_mgmt_permit_joining_req(0x%X) - FAILED!!!", ret);
+               return RET_FAILURE;
+       }
+
+       msg(" - zb_zdo_mgmt_permit_joining_req() ret: [0x%X]", ret);
+       msg("");
+
+       return RET_SUCCESS;
+}
+
+static struct menu_data _menu_nwk_disc[] = {
+       { "1", "Scan duration", NULL, NULL, data_duration },
+       { "2", "Scan count", NULL, NULL, data_count },
+       { "3", "Start index", NULL, NULL, data_start_idx },
+       { "4", "Run", NULL, run_mgmt_nwk_disc_req, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_nwk_update[] = {
+       { "1", "Scan duration", NULL, NULL, data_duration },
+       { "2", "Scan count", NULL, NULL, data_count },
+       { "3", "Start index", NULL, NULL, data_start_idx },
+       { "4", "Run", NULL, run_mgmt_nwk_update_req, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_lqi[] = {
+       { "1", "Start index", NULL, NULL, data_start_idx },
+       { "2", "Run", NULL, run_mgmt_lqi_req, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_rtg[] = {
+       { "1", "Start index", NULL, NULL, data_start_idx },
+       { "2", "Run", NULL, run_mgmt_rtg_req, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_bind[] = {
+       { "1", "Start index", NULL, NULL, data_start_idx },
+       { "2", "Run", NULL, run_mgmt_bind_req, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_leave[] = {
+       { "1", "Remove children", NULL, NULL, data_remove_children },
+       { "2", "Rejoin", NULL, NULL, data_rejoin },
+       { "3", "Run", NULL, run_mgmt_leave_req, NULL },
+       { NULL, NULL, },
+};
+
+static struct menu_data _menu_permit[] = {
+       { "1", "Permit duration", NULL, NULL, data_permit_duration },
+       { "2", "TC significance", NULL, NULL, data_tc },
+       { "3", "Run", NULL, run_mgmt_permit_joining_req, NULL },
+       { NULL, NULL, },
+};
+
+struct menu_data menu_zdo_network[] = {
+       { "1", "zb_zdo_mgmt_nwk_disc_req", _menu_nwk_disc, NULL, NULL },
+       { "2", "zb_zdo_mgmt_nwk_update_req", _menu_nwk_update, NULL, NULL },
+       { "3", "zb_zdo_mgmt_lqi_req", _menu_lqi, NULL, NULL },
+       { "4", "zb_zdo_mgmt_rtg_req", _menu_rtg, NULL, NULL },
+       { "5", "zb_zdo_mgmt_bind_req", _menu_bind, NULL, NULL },
+       { "6", "zb_zdo_mgmt_leave_req", _menu_leave, NULL, NULL },
+       { "7", "zb_zdo_mgmt_permit_joining_req", _menu_permit, NULL, NULL },
+       { NULL, NULL, },
+};