Fix ACR issue
authorsaerome.kim <saerome.kim@samsung.com>
Wed, 22 Mar 2017 13:44:37 +0000 (22:44 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 11 May 2017 09:07:20 +0000 (18:07 +0900)
 - Add feature check routines for feature dependent APIs

Change-Id: I07e84a869f9ce363887bf409b15db06ff512dd8c
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
32 files changed:
common/zb-common.h [deleted file]
common/zb-log.h [deleted file]
common/zb-utils.c [deleted file]
common/zb-utils.h [deleted file]
common/zb_common.h [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]
include/zb_error.h
lib/CMakeLists.txt
lib/zbl.c
lib/zbl_custom.c
lib/zbl_dbus.c
lib/zbl_zcl.c
lib/zbl_zcl_alarm.c
lib/zbl_zcl_basic.c
lib/zbl_zcl_color_control.c
lib/zbl_zcl_global_commands.c
lib/zbl_zcl_groups.c
lib/zbl_zcl_identify.c
lib/zbl_zcl_isa_zone.c
lib/zbl_zcl_level_control.c
lib/zbl_zcl_on_off.c
lib/zbl_zcl_poll_control.c
lib/zbl_zcl_scenes.c
lib/zbl_zcl_thermostat.c
lib/zbl_zdo.c
lib/zbl_zdo_bind_mgr.c
lib/zbl_zdo_dev_disc.c
lib/zbl_zdo_nwk_mgr.c
lib/zbl_zdo_svc_disc.c
packaging/capi-network-zigbee.spec

diff --git a/common/zb-common.h b/common/zb-common.h
deleted file mode 100644 (file)
index 08de6e3..0000000
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * 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_CONTROL_OBJECT_PATH "/org/tizen/zigbee/control"
-
-#define ZIGBEE_MANAGER_INTERFACE "org.tizen.zigbee.manager"
-#define ZIGBEE_SERVICE_INTERFACE "org.tizen.zigbee.service"
-#define ZIGBEE_SERVICE_OBJECT_PATH "/org/tizen/zigbee/service"
-
-#define ZIGBEE_ZDO_DEV_CONTROL_INTERFACE "org.tizen.zigbee.zdo_dev_control"
-#define ZIGBEE_ZDO_BIND_INTERFACE "org.tizen.zigbee.zdo_bind"
-#define ZIGBEE_ZCL_GLOBAL_CONTROL_INTERFACE "org.tizen.zigbee.zcl_global_control"
-#define ZIGBEE_ZCL_ALARM_INTERFACE "org.tizen.zigbee.zcl_alarm"
-#define ZIGBEE_ZCL_BASIC_INTERFACE "org.tizen.zigbee.zcl_basic"
-#define ZIGBEE_ZCL_COLOR_CONTROL_INTERFACE "org.tizen.zigbee.zcl_color_control"
-#define ZIGBEE_ZCL_ON_OFF_INTERFACE "org.tizen.zigbee.zcl_on_off"
-#define ZIGBEE_ZCL_DOOR_LOCK_INTERFACE "org.tizen.zigbee.zcl_door_lock"
-#define ZIGBEE_ZCL_GROUP_INTERFACE "org.tizen.zigbee.zcl_group"
-#define ZIGBEE_ZCL_FAN_CONTROL_INTERFACE "org.tizen.zigbee.zcl_fan_control"
-#define ZIGBEE_ZCL_IAS_ZONE_INTERFACE "org.tizen.zigbee.zcl_ias_zone"
-#define ZIGBEE_ZCL_IDENTIFY_INTERFACE "org.tizen.zigbee.zcl_identify"
-#define ZIGBEE_ZCL_LEVEL_CONTROL_INTERFACE "org.tizen.zigbee.zcl_level_control"
-#define ZIGBEE_ZCL_POLL_CONTROL_INTERFACE "org.tizen.zigbee.zcl_poll_control"
-#define ZIGBEE_ZCL_SCENE_INTERFACE "org.tizen.zigbee.zcl_scene"
-#define ZIGBEE_ZCL_THERMOSTAT_INTERFACE "org.tizen.zigbee.zcl_thermostat"
-#define ZIGBEE_CUSTOM_INTERFACE "org.tizen.zigbee.custom"
-#define ZIGBEE_MFGLIB_CONTROL_INTERFACE "org.tizen.zigbee.mfglib_control"
-
-
-#define ZIGBEE_BROADCAST_TIMEOUT (9.5 + 2) * 1000 /**< default timeout for gdbus */
-
-#define MAX_DEVICE_LIST 32 /**< maximum end-devices in device list */
-
-#define NOT_USED(var) ((var) = (var))
-
-/*---------------------------------------------------------------------------------------
- * For ZDO
- *--------------------------------------------------------------------------------------*/
-
-/**
- * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
- * @brief Fields of the Simple Descriptor
- * @details Device descriptions contained in node.
- *
- * @since_tizen 4.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 Fields of the Node Power Descriptor .
- * @details Node power characteristics.
- *
- * @since_tizen 4.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 4.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 Fields of the Node Descriptor
- * @details Type and capabilities of the node.
- *
- * @since_tizen 4.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 NetworkList Record Format.
- *
- * @since_tizen 4.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 NeighborTableList Record Format.
- *
- * @since_tizen 4.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 RoutingTableList Record Format.
- *
- * @since_tizen 4.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 BindingTableList Record Format.
- *
- * @since_tizen 4.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 DiscoveryCacheList Record Format.
- *
- * @since_tizen 4.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 4.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 4.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 in Zigbee Cluster Libarry
- *
- * @since_tizen 4.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 4.0
- */
-struct attribute_element_value {
-       unsigned char t; /**< element type */
-       zb_value_h v; /**< element value */
-};
-
-/**
- * @brief Format of the Attribute Value Field for a Structure
- *
- * @since_tizen 4.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 4.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 Format of the Read Attribute Status Record Field
- *
- * @since_tizen 4.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 4.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 4.0
- */
-struct write_attribute_status_record_s {
-       unsigned char status; /**< attribute status */
-       unsigned short id; /**< attribute identifier */
-};
-
-/**
- * @brief reporting configuration record structure
- *
- * @since_tizen 4.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 Format of the Attribute Status Record Field
- *
- * @since_tizen 4.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 4.0
- */
-struct read_reporting_configuration_record_s {
-       unsigned char dir; /**< direction */
-       unsigned short id; /**< attribute identifier */
-};
-
-/**
- * @brief Format of the Attribute Report Fields
- *
- * @since_tizen 4.0
- */
-struct attribute_report_s {
-       unsigned short id; /**< attribute identifier */
-       unsigned char type; /**< attribute type */
-       unsigned char *value; /**< attribute value */
-};
-
-/**
- * @brief Format of the Attribute Report Fields
- *
- * @since_tizen 4.0
- */
-struct discover_attribute_info_record_s {
-       unsigned short id; /**< attribute identifier */
-       unsigned char type; /**< attribute data type */
-};
-
-/**
- * @brief Format of the Extended Attribute Information Fields
- *
- * @since_tizen 4.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 4.0
- */
-
-struct zbl_event_s {
-       unsigned char *data; /**< Event data buffer */
-       unsigned char len; /**< Event */
-};
-
-#endif /* __TIZTN_NETWORK_ZIGBEE_INTERNAL_COMMON_H__ */
diff --git a/common/zb-log.h b/common/zb-log.h
deleted file mode 100644 (file)
index e3e1303..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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
deleted file mode 100644 (file)
index aea0bd1..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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
deleted file mode 100644 (file)
index 0a78999..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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/common/zb_common.h b/common/zb_common.h
new file mode 100644 (file)
index 0000000..758ce2c
--- /dev/null
@@ -0,0 +1,440 @@
+/*
+ * 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 <system_info.h>
+
+#include <zb_type.h>
+#include <zb_error.h>
+#include <zdo/zb_zdo_type.h>
+#include <zcl/zb_zcl_type.h>
+
+#define ZIGBEE_ADMIN_FEATURE "http://tizen.org/feature/zigbee.admin"
+#define ZIGBEE_FEATURE "http://tizen.org/feature/zigbee"
+
+#if 1
+#define CHECK_FEATURE_SUPPORTED(feature_name) { \
+       bool zigbee_supported = FALSE; \
+       if (!system_info_get_platform_bool(feature_name, &zigbee_supported)) { \
+               if (zigbee_supported == FALSE) { \
+                       ERR("zigbee feature is disabled"); \
+                       return ZIGBEE_ERROR_NOT_SUPPORTED; \
+               } \
+       } else { \
+               ERR("Error - Feature getting from System Info"); \
+               return ZIGBEE_ERROR_OPERATION_FAILED; \
+       } \
+}
+#else
+#define CHECK_FEATURE_SUPPORTED(feature_name) { \
+               ERR("Should be check !"); \
+       }
+#endif
+
+#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_CONTROL_OBJECT_PATH "/org/tizen/zigbee/control"
+
+#define ZIGBEE_MANAGER_INTERFACE "org.tizen.zigbee.manager"
+#define ZIGBEE_SERVICE_INTERFACE "org.tizen.zigbee.service"
+#define ZIGBEE_SERVICE_OBJECT_PATH "/org/tizen/zigbee/service"
+
+#define ZIGBEE_ZDO_DEV_CONTROL_INTERFACE "org.tizen.zigbee.zdo_dev_control"
+#define ZIGBEE_ZDO_BIND_INTERFACE "org.tizen.zigbee.zdo_bind"
+#define ZIGBEE_ZCL_GLOBAL_CONTROL_INTERFACE "org.tizen.zigbee.zcl_global_control"
+#define ZIGBEE_ZCL_ALARM_INTERFACE "org.tizen.zigbee.zcl_alarm"
+#define ZIGBEE_ZCL_BASIC_INTERFACE "org.tizen.zigbee.zcl_basic"
+#define ZIGBEE_ZCL_COLOR_CONTROL_INTERFACE "org.tizen.zigbee.zcl_color_control"
+#define ZIGBEE_ZCL_ON_OFF_INTERFACE "org.tizen.zigbee.zcl_on_off"
+#define ZIGBEE_ZCL_DOOR_LOCK_INTERFACE "org.tizen.zigbee.zcl_door_lock"
+#define ZIGBEE_ZCL_GROUP_INTERFACE "org.tizen.zigbee.zcl_group"
+#define ZIGBEE_ZCL_FAN_CONTROL_INTERFACE "org.tizen.zigbee.zcl_fan_control"
+#define ZIGBEE_ZCL_IAS_ZONE_INTERFACE "org.tizen.zigbee.zcl_ias_zone"
+#define ZIGBEE_ZCL_IDENTIFY_INTERFACE "org.tizen.zigbee.zcl_identify"
+#define ZIGBEE_ZCL_LEVEL_CONTROL_INTERFACE "org.tizen.zigbee.zcl_level_control"
+#define ZIGBEE_ZCL_POLL_CONTROL_INTERFACE "org.tizen.zigbee.zcl_poll_control"
+#define ZIGBEE_ZCL_SCENE_INTERFACE "org.tizen.zigbee.zcl_scene"
+#define ZIGBEE_ZCL_THERMOSTAT_INTERFACE "org.tizen.zigbee.zcl_thermostat"
+#define ZIGBEE_CUSTOM_INTERFACE "org.tizen.zigbee.custom"
+#define ZIGBEE_MFGLIB_CONTROL_INTERFACE "org.tizen.zigbee.mfglib_control"
+
+
+#define ZIGBEE_BROADCAST_TIMEOUT (9.5 + 2) * 1000 /**< default timeout for gdbus */
+
+#define MAX_DEVICE_LIST 32 /**< maximum end-devices in device list */
+
+#define NOT_USED(var) ((var) = (var))
+
+/*---------------------------------------------------------------------------------------
+ * For ZDO
+ *--------------------------------------------------------------------------------------*/
+
+/**
+ * @ingroup CAPI_NETWORK_ZIGBEE_ZDO_MODULE
+ * @brief Fields of the Simple Descriptor
+ * @details Device descriptions contained in node.
+ *
+ * @since_tizen 4.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 Fields of the Node Power Descriptor .
+ * @details Node power characteristics.
+ *
+ * @since_tizen 4.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 4.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 Fields of the Node Descriptor
+ * @details Type and capabilities of the node.
+ *
+ * @since_tizen 4.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 NetworkList Record Format.
+ *
+ * @since_tizen 4.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 NeighborTableList Record Format.
+ *
+ * @since_tizen 4.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 RoutingTableList Record Format.
+ *
+ * @since_tizen 4.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 BindingTableList Record Format.
+ *
+ * @since_tizen 4.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 DiscoveryCacheList Record Format.
+ *
+ * @since_tizen 4.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 4.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 4.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 in Zigbee Cluster Libarry
+ *
+ * @since_tizen 4.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 4.0
+ */
+struct attribute_element_value {
+       unsigned char t; /**< element type */
+       zb_value_h v; /**< element value */
+};
+
+/**
+ * @brief Format of the Attribute Value Field for a Structure
+ *
+ * @since_tizen 4.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 4.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 Format of the Read Attribute Status Record Field
+ *
+ * @since_tizen 4.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 4.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 4.0
+ */
+struct write_attribute_status_record_s {
+       unsigned char status; /**< attribute status */
+       unsigned short id; /**< attribute identifier */
+};
+
+/**
+ * @brief reporting configuration record structure
+ *
+ * @since_tizen 4.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 Format of the Attribute Status Record Field
+ *
+ * @since_tizen 4.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 4.0
+ */
+struct read_reporting_configuration_record_s {
+       unsigned char dir; /**< direction */
+       unsigned short id; /**< attribute identifier */
+};
+
+/**
+ * @brief Format of the Attribute Report Fields
+ *
+ * @since_tizen 4.0
+ */
+struct attribute_report_s {
+       unsigned short id; /**< attribute identifier */
+       unsigned char type; /**< attribute type */
+       unsigned char *value; /**< attribute value */
+};
+
+/**
+ * @brief Format of the Attribute Report Fields
+ *
+ * @since_tizen 4.0
+ */
+struct discover_attribute_info_record_s {
+       unsigned short id; /**< attribute identifier */
+       unsigned char type; /**< attribute data type */
+};
+
+/**
+ * @brief Format of the Extended Attribute Information Fields
+ *
+ * @since_tizen 4.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 4.0
+ */
+
+struct zbl_event_s {
+       unsigned char *data; /**< Event data buffer */
+       unsigned char len; /**< Event */
+};
+
+#endif /* __TIZTN_NETWORK_ZIGBEE_INTERNAL_COMMON_H__ */
diff --git a/common/zb_log.h b/common/zb_log.h
new file mode 100644 (file)
index 0000000..e3e1303
--- /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..8886d21
--- /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__ */
index 1a4fc152eff6faa39bb26c4a8b603d574ee08beb..3b8f502a5c4b0f2cfd8ed68c77fe9377c90092e6 100644 (file)
@@ -44,6 +44,7 @@ typedef enum {
        ZIGBEE_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
        ZIGBEE_ERROR_INVALID_ENDPOINT = TIZEN_ERROR_ZIGBEE | 0x01, /**< Endpoint 0 is reserved for ZDP */
        ZIGBEE_ERROR_INVALID_ADDRESS = TIZEN_ERROR_ZIGBEE | 0x02, /**< Wrong address */
+       ZIGBEE_ERROR_OPERATION_FAILED = TIZEN_ERROR_ZIGBEE | 0x03, /**< Operation failed */
 } zb_error_e;
 
 /**
index e283b001406d1a78c256b043ef769e10488c0e95..1a50b5edec0337e3b4ee4ecf3df1b57d5b64a161 100644 (file)
@@ -8,7 +8,7 @@ FILE(GLOB CLIENT_SRCS *.c ${CMAKE_SOURCE_DIR}/common/*.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)
+pkg_check_modules(client_pkgs REQUIRED glib-2.0 gio-2.0 gio-unix-2.0 dlog capi-base-common capi-system-info)
 INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS})
 
 # Temporary debug info enable : -g
index 8494fc893a622613d1d200e5be27d8f619e65415..630874c475b9f925d2bee7350f48d92266117c3a 100644 (file)
--- a/lib/zbl.c
+++ b/lib/zbl.c
@@ -18,8 +18,8 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
-#include <zb-log.h>
-#include <zb-common.h>
+#include <zb_log.h>
+#include <zb_common.h>
 
 #include "zbl.h"
 #include "zbl_dbus.h"
index 15ead9fd01506e59ed01f48de31959eff4615453..ff103cd22aa576a9ea37c5380708ed3f854d02d4 100644 (file)
@@ -18,8 +18,8 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
-#include <zb-log.h>
-#include <zb-common.h>
+#include <zb_log.h>
+#include <zb_common.h>
 #include <zb_custom.h>
 
 #include "zbl.h"
index be28d60b84cef3c5c156ac4e9d7a9a6be606fd48..99e217d1d5642d01032513206c429f961a0e4325 100644 (file)
 #include <glib.h>
 #include <gio/gio.h>
 
-#include <zb-log.h>
+#include <zb_log.h>
 #include <zb_type.h>
-#include <zb-utils.h>
+#include <zb_utils.h>
 #include <zb_error.h>
-#include <zb-common.h>
+#include <zb_common.h>
 #include <zcl/zb_zcl_type.h>
 #include <zdo/zb_zdo_type.h>
 
index e49a9ff2c34a4d69da76df04543b48a25c6817d9..6ccb1e805c84b967b212ae568352d2183b9dee85 100644 (file)
@@ -8,8 +8,8 @@
 #include <zcl/zb_zcl_attribute_type.h>
 
 #include "zbl.h"
-#include "zb-log.h"
-#include "zb-common.h"
+#include "zb_log.h"
+#include "zb_common.h"
 #include "zcl/zb_zcl_type.h"
 
 API const char* zb_get_zcl_error_message(int id)
@@ -428,17 +428,24 @@ API int zb_get_data_size(unsigned char type)
 
 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));
+
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        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)
 {
        struct read_attribute_status_record_s* h = handle;
+
        RET_IF(NULL == h);
+
        if (h->value)
                free(h->value);
        free(h);
@@ -610,6 +617,7 @@ API int zb_set_value_to_read_attr_status_record(read_attr_status_record_h handle
 
 API int zb_create_value(zb_value_h *handle)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -622,6 +630,7 @@ API void zb_destroy_value(zb_value_h handle)
        struct zb_value_s* h = handle;
 
        RET_IF(NULL == h);
+
        if (h->str) {
                if (h->str->v)
                        free(h->str->v);
@@ -729,6 +738,8 @@ API int zb_get_value(zb_value_h handle, unsigned char *type, unsigned char **val
 
 API int zb_create_discover_attr_info(discover_attr_info_record_h *handle)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+
        RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        discover_attr_info_record_h simple = calloc(1,
                sizeof(struct discover_attribute_info_record_s));
@@ -740,6 +751,7 @@ API int zb_create_discover_attr_info(discover_attr_info_record_h *handle)
 API void zb_destroy_discover_attr_info(discover_attr_info_record_h handle)
 {
        struct discover_attribute_info_record_s *h = handle;
+
        free(h);
 }
 
@@ -788,9 +800,13 @@ API int zb_set_type_to_discover_attr_info(
 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));
+
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
        *handle = t;
        return ZIGBEE_ERROR_NONE;
 }
@@ -798,7 +814,9 @@ API int zb_create_write_attr_record(
 API void zb_destroy_write_attr_record(write_attr_record_h handle)
 {
        struct write_attribute_record_s* h = handle;
+
        RET_IF(NULL == h);
+
        if (h->value)
                free(h->value);
        free(h);
@@ -905,17 +923,23 @@ API int zb_set_value_to_write_attr_record(write_attr_record_h handle, zb_value_h
 
 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));
+
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        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)
 {
        struct write_attribute_status_record_s *h = handle;
+
        free(h);
 }
 
@@ -970,7 +994,9 @@ API int zb_create_report_config_record(report_config_record_h *handle)
 API void zb_destroy_report_config_record(report_config_record_h handle)
 {
        struct reporting_configuration_record_s *h = handle;
+
        RET_IF(NULL == h);
+
        if (h->change)
                free(h->change);
        free(h);
@@ -1236,17 +1262,23 @@ API int zb_get_change_from_report_config_record3(report_config_record_h handle,
 
 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));
+
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        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)
 {
        struct read_reporting_configuration_record_s *h = handle;
+
        free(h);
 }
 
@@ -1292,11 +1324,16 @@ API int zb_get_id_from_read_report_config_record(read_report_config_record_h han
 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));
+
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
        *handle = t;
+
        return ZIGBEE_ERROR_NONE;
 }
 
@@ -1304,6 +1341,7 @@ API void zb_destroy_report_config_response_record(
                report_config_response_record_h handle)
 {
        struct reporting_configuration_response_record_s *h = handle;
+
        free(h);
 }
 
@@ -1366,16 +1404,22 @@ API int zb_set_id_to_report_config_response_record(
 
 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));
+
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        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)
 {
        struct attribute_report_s *h = handle;
+
        if (h) {
                if (h->value)
                        free(h->value);
@@ -1573,16 +1617,22 @@ struct write_attribute_structured_record_s {
 
 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));
+
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+
+       RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        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)
 {
        struct extended_attribute_infomation_s *h = handle;
+
        free(h);
 }
 
index ac6c1a63cd11cc394c00bc964bbbda2630576107..b58b66016346af66a6ddf03264dce17a1161da1b 100644 (file)
 #include <zcl/zb_zcl_alarm_cluster.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -38,6 +40,7 @@ API int zb_zcl_alarm_reset_all_alarm(zigbee_h handle, nwk_addr addr16,
                unsigned char ep)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -51,6 +54,7 @@ API int zb_zcl_alarm_get_alarm(zigbee_h handle, nwk_addr addr16, unsigned char e
                zb_zcl_alarm_get_alarm_rsp cb, void *user_data)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -64,6 +68,7 @@ API int zb_zcl_alarm_reset_all_alarm_log(zigbee_h handle, nwk_addr addr16,
                unsigned char ep)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index a56607e28008cad9f3d1da648c1d31528639be60..110aef62219a4adf26807888a2dd8a50dc3ad4ea 100644 (file)
 #include <zb_error.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.h"
 
 API int zb_zcl_basic_reset_factory_default(zigbee_h handle, nwk_addr addr16,
                unsigned char ep)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index 027a74848415fa123d55edb79d27a0b7dca8768a..0069a3055183d38d3782b07dbf737d4993b46a49 100644 (file)
 #include <zcl/zb_zcl_color_control_cluster.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -39,6 +41,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -53,6 +56,7 @@ API int zb_zcl_ccontrol_step_hue(zigbee_h handle, nwk_addr addr16,
                unsigned char transition_time)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -67,6 +71,7 @@ API int zb_zcl_ccontrol_move_to_saturation(zigbee_h handle,
                unsigned short transition_time)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -80,6 +85,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -94,6 +100,7 @@ API int zb_zcl_ccontrol_step_saturation(zigbee_h handle, nwk_addr addr16,
                unsigned char transition_time)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -108,6 +115,7 @@ API int zb_zcl_ccontrol_move_to_hue_and_saturation(zigbee_h handle,
                unsigned short transition_time)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -122,6 +130,7 @@ API int zb_zcl_ccontrol_move_to_color(zigbee_h handle, nwk_addr addr16,
                unsigned short transition_time)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -135,6 +144,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -149,6 +159,7 @@ API int zb_zcl_ccontrol_step_color(zigbee_h handle, nwk_addr addr16,
                unsigned short transition_time)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -163,6 +174,7 @@ API int zb_zcl_ccontrol_move_to_color_temperature(zigbee_h handle,
                unsigned short transition_time)
 {
        int ret = ZIGBEE_ERROR_NONE;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index bb9b103a1d73a952332fee7048a7015c790bf721..5dd8f11d0f6985a617a4fd3dc4a5e104bbd5a819 100644 (file)
 #include <zcl/zb_zcl_global_commands.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
-#include "zb-utils.h"
+#include "zb_utils.h"
+#include "zb_common.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,
@@ -28,6 +29,7 @@ API int zb_zcl_global_read_attr(zigbee_h handle, nwk_addr addr16,
                zb_zcl_global_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -45,6 +47,7 @@ API int zb_zcl_global_write_attr(zigbee_h handle, nwk_addr addr16,
                zb_zcl_global_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -62,6 +65,7 @@ API int zb_zcl_global_write_attr_undivided(zigbee_h handle,
                zb_zcl_global_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -78,6 +82,7 @@ API int zb_zcl_global_write_attr_no_rsp(zigbee_h handle, nwk_addr addr16,
                unsigned short cluster_id, write_attr_record_h *records, int records_len)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -95,6 +100,7 @@ API int zb_zcl_global_config_report(zigbee_h handle, nwk_addr addr16,
                zb_zcl_global_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -112,6 +118,7 @@ API int zb_zcl_global_read_config_report(zigbee_h handle, nwk_addr addr16,
                zb_zcl_global_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -129,6 +136,7 @@ API int zb_zcl_global_discover_attr(zigbee_h handle, nwk_addr addr16,
                zb_zcl_global_discover_attr_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -146,6 +154,7 @@ API int zb_zcl_global_read_attr_structured(zigbee_h handle, nwk_addr addr16,
 #if (0 == ZIGBEE_SUPPORT_ORDERED_SEQUENCE_DATA)
        return ZIGBEE_ERROR_NOT_SUPPORTED;
 #endif
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -164,6 +173,7 @@ API int zb_zcl_global_write_attr_structured(zigbee_h handle, nwk_addr addr16,
 #if (0 == ZIGBEE_SUPPORT_ORDERED_SEQUENCE_DATA)
        return ZIGBEE_ERROR_NOT_SUPPORTED;
 #endif
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -180,6 +190,7 @@ API int zb_zcl_global_discover_cmds_received(zigbee_h handle,
                unsigned char max_command_ids, zb_zcl_global_discover_cmds_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -195,6 +206,7 @@ API int zb_zcl_global_discover_cmds_generated(zigbee_h handle,
                unsigned char max_command_ids, zb_zcl_global_discover_cmds_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -211,6 +223,7 @@ API int zb_zcl_global_discover_attr_extended(zigbee_h handle,
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index ae00aeb81bcf09bdfa1a5c179ead303dcb2c633f..519067ec686ab7d6c6fc2b51c697631335359b2b 100644 (file)
 #include <zcl/zb_zcl_groups_cluster.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.h"
 
 API int zb_zcl_group_add_group(zigbee_h handle, nwk_addr addr16,
                unsigned char ep, unsigned short group_id, char *group_name,
                zb_zcl_group_add_group_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -40,6 +42,7 @@ API int zb_zcl_group_view_group(zigbee_h handle, nwk_addr addr16,
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -53,6 +56,7 @@ API int zb_zcl_group_get_group_membership(zigbee_h handle, nwk_addr addr16,
                zb_zcl_group_get_group_membership_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -67,6 +71,7 @@ API int zb_zcl_group_remove_group(zigbee_h handle, nwk_addr addr16,
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -79,6 +84,7 @@ API int zb_zcl_group_remove_all_group(zigbee_h handle, nwk_addr addr16,
                unsigned char ep)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -91,6 +97,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index 1246ba31a89a63e441f8048d2328a25a0c906a5c..4c0840690b539f92db9bd62ec23a65c6e9a75f5e 100644 (file)
 #include <zcl/zb_zcl_identify_cluster.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.h"
 
 API int zb_zcl_identify(zigbee_h handle, nwk_addr addr16, unsigned char ep,
                unsigned short identify_time)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -37,6 +39,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index fcc8dc260c4e45f8a942d16ba785b0898af96fa5..2dd6e7ccef40e43ccbf3878b732ab4691a9bcd5e 100644 (file)
 #include <zcl/zb_zcl_ias_zone_cluster.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index 80e031cb367e2e535bc6eeed3cc7d0e382adc233..13a648397a6111b9ff6fb2a7121bb5615910c102 100644 (file)
 #include <zb_error.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -37,6 +39,7 @@ API int zb_zcl_levelctrl_move(zigbee_h handle, nwk_addr addr16,
                unsigned char ep, unsigned char move_mode, unsigned char rate)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -50,6 +53,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -62,6 +66,7 @@ API int zb_zcl_levelctrl_step(zigbee_h handle, nwk_addr addr16, unsigned char ep
 API int zb_zcl_levelctrl_stop(zigbee_h handle, nwk_addr addr16, unsigned char ep)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -75,6 +80,7 @@ API int zb_zcl_levelctrl_move_to_level_with_on_off(zigbee_h handle, nwk_addr add
                unsigned char ep, unsigned char level, unsigned short transition_time)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -88,6 +94,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -102,6 +109,7 @@ API int zb_zcl_levelctrl_step_with_on_off(zigbee_h handle, nwk_addr addr16,
                unsigned short transition_time)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index 9c13857bfdf11bb1e2ac9e8f01587fcff99d8b63..935b212db2bd681a197a764b54c4f3da86b11a1d 100644 (file)
 #include <zb_error.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index 20afba66520b643530bcc77813f75ccdf12c5efd..cd461b2b78a33f236bb552f7197c7c0ac17845ed 100644 (file)
 #include <zcl/zb_zcl_poll_control_cluster.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -39,6 +41,7 @@ API int zb_zcl_pollctrl_fast_poll_stop(zigbee_h handle, nwk_addr addr16,
                unsigned char ep)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -52,6 +55,7 @@ API int zb_zcl_pollctrl_set_long_poll_interval(zigbee_h handle,
                zb_zcl_pollctrl_check_in cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -66,6 +70,7 @@ API int zb_zcl_pollctrl_set_short_poll_interval(zigbee_h handle,
                zb_zcl_pollctrl_check_in cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index c9c2d4f7d6f0635dc15bbe3413e0cb0217e62d3b..cbfdd0efda5f361b28cee9f6b0b00ede6487ae81 100644 (file)
@@ -18,8 +18,9 @@
 #include <zcl/zb_zcl_scenes_cluster.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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,
@@ -27,6 +28,7 @@ API int zb_zcl_scene_add_scene(zigbee_h handle, nwk_addr addr16, unsigned char e
                const char *extension_field_sets, zb_zcl_scene_add_scene_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -43,6 +45,7 @@ API int zb_zcl_scene_view_scene(zigbee_h handle, nwk_addr addr16, unsigned char
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -56,6 +59,7 @@ API int zb_zcl_scene_remove_scene(zigbee_h handle, nwk_addr addr16,
                zb_zcl_scene_remove_scene_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -69,6 +73,7 @@ API int zb_zcl_scene_remove_all_scene(zigbee_h handle, nwk_addr addr16,
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -82,6 +87,7 @@ API int zb_zcl_scene_store_scene(zigbee_h handle, nwk_addr addr16, unsigned char
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -94,6 +100,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -107,6 +114,7 @@ API int zb_zcl_scene_get_scene_membership(zigbee_h handle, nwk_addr addr16,
                zb_zcl_scene_get_scene_membership_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index e3c558c4abe01b4bc5c8651bcd38987b455592bb..4ec843bb9ec757ff7d20fa841656789717b038af 100644 (file)
 #include <zcl/zb_zcl_thermostat_cluster.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index 577c97369ead844e3f7116d95e74d89404ee4bd7..16546ccb38d6e462c29c4608383dea3d50eea9d2 100644 (file)
@@ -23,9 +23,9 @@
 #include <zdo/zb_zdo_type.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
-#include "zb-common.h"
+#include "zb_common.h"
 
 #define CASE_TO_STR(x) case x: return #x;
 
@@ -117,6 +117,7 @@ API const char* zb_get_device_id_string(int device_id)
 
 API int zb_simple_desc_create(zb_zdo_simple_desc_h *handle)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -126,6 +127,7 @@ API int zb_simple_desc_create(zb_zdo_simple_desc_h *handle)
 
 API int zb_simple_desc_copy(zb_zdo_simple_desc_h src, zb_zdo_simple_desc_h dst)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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));
@@ -134,6 +136,7 @@ API int zb_simple_desc_copy(zb_zdo_simple_desc_h src, zb_zdo_simple_desc_h dst)
 
 API int zb_simple_desc_destroy(zb_zdo_simple_desc_h handle)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        free(handle);
        return ZIGBEE_ERROR_NONE;
@@ -284,6 +287,7 @@ API int zb_get_all_device_list(zigbee_h handle, int *count, zb_end_device_info_h
 {
        int ret;
        unsigned char cnt;
+
        RETV_IF(NULL == count, ZIGBEE_ERROR_INVALID_PARAMETER);
        ret = zbl_get_all_device_info(list, &cnt);
        *count = cnt;
@@ -457,6 +461,7 @@ API int zb_get_security_capabilty(zb_end_device_info_h handle,
 
 API int zb_node_power_desc_create(zb_zdo_node_power_descriptor_h *handle)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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));
@@ -468,6 +473,7 @@ API int zb_node_power_desc_create(zb_zdo_node_power_descriptor_h *handle)
 API int zb_node_power_desc_copy(zb_zdo_node_power_descriptor_h src,
                zb_zdo_node_power_descriptor_h dst)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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));
@@ -476,6 +482,7 @@ API int zb_node_power_desc_copy(zb_zdo_node_power_descriptor_h src,
 
 API int zb_node_power_desc_destroy(zb_zdo_node_power_descriptor_h handle)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        free(handle);
        return ZIGBEE_ERROR_NONE;
@@ -555,6 +562,7 @@ API int zb_node_power_desc_set_current_power_source_level(
 
 API int zb_node_desc_create(zb_zdo_node_descriptor_h *handle)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -565,6 +573,7 @@ API int zb_node_desc_create(zb_zdo_node_descriptor_h *handle)
 API int zb_node_desc_copy(zb_zdo_node_descriptor_h src,
                zb_zdo_node_descriptor_h dst)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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));
@@ -573,6 +582,7 @@ API int zb_node_desc_copy(zb_zdo_node_descriptor_h src,
 
 API int zb_node_desc_destroy(zb_zdo_node_descriptor_h handle)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        free(handle);
        return ZIGBEE_ERROR_NONE;
index 22e9363c4af5600becf0791db569e1c20052179e..dc2f314040423d38130612185c841ffe65219838 100644 (file)
@@ -19,8 +19,9 @@
 #include <zdo/zb_zdo_bind_mgr.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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,
@@ -28,6 +29,7 @@ API int zb_zdo_bind_req(zigbee_h handle, nwk_addr dst_addr16,
                unsigned char dst_ep, zb_zdo_bind_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -42,6 +44,7 @@ API int zb_zdo_unbind_req(zigbee_h handle, nwk_addr dst_addr16,
                unsigned char dst_ep, zb_zdo_unbind_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index f7f8c188eede6b78a80120582a9694003d154be5..313bef1be5880d4b368f6f5b2c5f8caa1b2979ed 100644 (file)
 #include <zdo/zb_zdo_dev_disc.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -41,6 +43,7 @@ API int zb_zdo_ieee_addr_req(zigbee_h handle, nwk_addr addr16, zb_zdo_addr_rsp c
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -52,6 +55,7 @@ API int zb_zdo_active_ep(zigbee_h handle, nwk_addr addr16, zb_zdo_active_ep_rsp
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -63,6 +67,7 @@ API int zb_zdo_simple_desc_req(zigbee_h handle, nwk_addr addr16, unsigned char e
                zb_zdo_simple_desc_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -75,6 +80,7 @@ API int zb_zdo_simple_desc_req(zigbee_h handle, nwk_addr addr16, unsigned char e
 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -88,6 +94,7 @@ API int zb_zdo_match_desc_req(zigbee_h handle, nwk_addr addr16,
                unsigned short *out_clusters, zb_zdo_match_desc_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -104,6 +111,7 @@ API int zb_zdo_node_desc_req(zigbee_h handle, nwk_addr addr16,
                zb_zdo_node_desc_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -116,6 +124,7 @@ API int zb_zdo_power_desc_req(zigbee_h handle, nwk_addr addr16,
                zb_zdo_power_desc_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -128,6 +137,7 @@ API int zb_zdo_complex_desc_req(zigbee_h handle, nwk_addr addr16,
                zb_zdo_complex_desc_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -140,6 +150,7 @@ API int zb_zdo_user_desc_req(zigbee_h handle, nwk_addr addr16,
                zb_zdo_user_desc_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -151,6 +162,7 @@ API int zb_zdo_user_desc_req(zigbee_h handle, nwk_addr addr16,
 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -162,6 +174,7 @@ API int zb_zdo_device_annce(zigbee_h handle, nwk_addr addr16, ieee_addr addr64,
                unsigned char capability)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index 8252b1feda754140c088bddbe6190d39d7852370..3a32c4b1fe3c4f13deaea759c00c373aa13b78b1 100644 (file)
 #include <zdo/zb_zdo_nwk_mgr.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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,
@@ -38,6 +40,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -48,6 +51,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -58,6 +62,7 @@ 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;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -69,6 +74,7 @@ API int zb_zdo_mgmt_leave_req(zigbee_h handle, ieee_addr addr64,
                void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -80,6 +86,7 @@ API int zb_zdo_mgmt_leave_req(zigbee_h handle, ieee_addr addr64,
 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -92,6 +99,7 @@ API int zb_zdo_mgmt_permit_joining_req(zigbee_h handle, nwk_addr addr16,
                zb_zdo_mgmt_permit_joining_rsp cb, void *user_data)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -102,6 +110,7 @@ API int zb_zdo_mgmt_permit_joining_req(zigbee_h handle, nwk_addr addr16,
 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
        return ZIGBEE_ERROR_NONE;
@@ -113,6 +122,7 @@ API int zb_zdo_mgmt_nwk_update_req(zigbee_h handle, unsigned int scan_channels,
        nwk_addr nwk_manager_addr)
 {
        int ret;
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index 5d6f1d1b48f98ff3afb40cd235c76dd1a809a5cd..9316b3984d6c3bfc6ac40a91e9b6bed3cc3d8dc8 100644 (file)
 #include <zdo/zb_zdo_dev_disc.h>
 
 #include "zbl.h"
-#include "zb-log.h"
+#include "zb_log.h"
 #include "zbl_dbus.h"
+#include "zb_common.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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
        return ZIGBEE_ERROR_NONE;
@@ -35,6 +37,7 @@ API int zb_zdo_system_server_discover_req(zigbee_h handle,
 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -44,6 +47,7 @@ API int zb_zdo_find_node_cache_req(zigbee_h handle, nwk_addr addr16,
 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -56,6 +60,7 @@ API int zb_zdo_discovery_store_req(zigbee_h handle, nwk_addr addr16,
                unsigned char active_ep_size, unsigned char simple_desc_count,
                unsigned char *simple_desc_list, zb_zdo_discovery_store_rsp cb, void *user_data)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -68,6 +73,7 @@ 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -80,6 +86,7 @@ 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == zbl_dbus_get_object(), ZIGBEE_ERROR_IO_ERROR);
        return ZIGBEE_ERROR_NONE;
@@ -89,6 +96,7 @@ 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -101,6 +109,7 @@ 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
@@ -112,6 +121,7 @@ API int zb_zdo_simple_desc_store_req(zigbee_h handle, nwk_addr addr16,
 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)
 {
+       CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
        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);
index fe58f9abdc6da551ee8b876f0371b29549c90405..679e7695627e1ec8500678d69e4c2412a0a6b633 100644 (file)
@@ -13,6 +13,7 @@ BuildRequires: pkgconfig(dbus-glib-1)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
 %if 0%{?tizen_version_major} >= 3
 BuildRequires: pkgconfig(cynara-client)
 BuildRequires: pkgconfig(cynara-session)