#define ZIGBEE_FEATURE "http://tizen.org/feature/network.zigbee"
-#if 0
#define CHECK_FEATURE_SUPPORTED(feature_name) { \
bool zigbee_supported = FALSE; \
- if (!system_info_get_platform_bool(feature_name, &zigbee_supported)) { \
+ int si_ret = system_info_get_platform_bool(feature_name, &zigbee_supported); \
+ if (si_ret == SYSTEM_INFO_ERROR_NONE) { \
if (zigbee_supported == FALSE) { \
ERR("zigbee feature is disabled"); \
return ZIGBEE_ERROR_NOT_SUPPORTED; \
} \
} else { \
- ERR("Error - Feature getting from System Info"); \
+ ERR("Error - Feature getting from System Info [0x%X]", si_ret); \
return ZIGBEE_ERROR_OPERATION_FAILED; \
} \
}
-#else
-#define CHECK_FEATURE_SUPPORTED(feature_name) { \
- ERR("Should be check !"); \
- }
-#endif
#define CHECK_ZIGBEE_PRIVILEGE() { \
int zb_check_priv = zbl_check_privilege(); \
RETV_IF(NULL == zdo_dev_proxy, ZIGBEE_ERROR_IO_ERROR);
RETVM_IF(len > MAX_USER_DESC_SIZE || len < 0x00, ZIGBEE_ERROR_INVALID_PARAMETER,
"invalid length=%d", len);
- RETVM_IF(NULL == user_data, ZIGBEE_ERROR_INVALID_PARAMETER, "invalid data");
container = calloc(1, sizeof(zbl_req_cb_s));
RETVM_IF(NULL == container, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
unsigned short *out_clusters, zb_zdo_match_desc_rsp cb, void *user_data);
int zbl_device_annce(zigbee_h handle, nwk_addr addr16, ieee_addr addr64,
unsigned char capability);
+
int zbl_node_desc_req(nwk_addr addr16, zb_zdo_node_desc_rsp cb, void *user_data);
int zbl_power_desc_req(nwk_addr addr16, zb_zdo_power_desc_rsp cb, void *user_data);
int zbl_complex_desc_req(nwk_addr addr16, zb_zdo_complex_desc_rsp cb, void *user_data);
int zbl_user_desc_req(nwk_addr addr16, zb_zdo_user_desc_rsp cb, void *user_data);
+int zbl_user_desc_set(zigbee_h handle, nwk_addr addr16, unsigned char len,
+ unsigned char *user_desc, zb_zdo_user_desc_conf cb, void *user_data);
int zbl_bind_req(nwk_addr dst_addr16, ieee_addr src_addr64,
unsigned char src_ep, unsigned short cluster_id, ieee_addr dst_addr64,
unsigned char type, nwk_addr group_addr, unsigned char dst_ep, zb_zdo_bind_rsp cb,
read_attr_status_record_h simple = NULL;
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);
-
CHECK_ZIGBEE_PRIVILEGE();
simple = calloc(1, sizeof(struct read_attribute_status_record_s));
+ RETVM_IF(NULL == simple, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
*handle = simple;
return ZIGBEE_ERROR_NONE;
write_attr_record_h t = NULL;
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);
-
CHECK_ZIGBEE_PRIVILEGE();
t = calloc(1, sizeof(struct write_attribute_record_s));
+ RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
+
*handle = t;
return ZIGBEE_ERROR_NONE;
}
write_attr_status_record_h simple = NULL;
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);
-
CHECK_ZIGBEE_PRIVILEGE();
simple = calloc(1, sizeof(struct write_attribute_status_record_s));
+ RETVM_IF(NULL == simple, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
*handle = simple;
return ZIGBEE_ERROR_NONE;
read_report_config_record_h t = NULL;
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);
-
CHECK_ZIGBEE_PRIVILEGE();
t = calloc(1, sizeof(struct read_reporting_configuration_record_s));
+ RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
*handle = t;
return ZIGBEE_ERROR_NONE;
report_config_response_record_h t = NULL;
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);
-
CHECK_ZIGBEE_PRIVILEGE();
t = calloc(1, sizeof(struct reporting_configuration_response_record_s));
+ RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
*handle = t;
return ZIGBEE_ERROR_NONE;
attr_report_h t = NULL;
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);
-
CHECK_ZIGBEE_PRIVILEGE();
t = calloc(1, sizeof(struct attribute_report_s));
+ RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
*handle = t;
return ZIGBEE_ERROR_NONE;
extended_attr_info_h t = NULL;
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);
-
CHECK_ZIGBEE_PRIVILEGE();
t = calloc(1, sizeof(struct extended_attribute_infomation_s));
+ RETVM_IF(NULL == t, ZIGBEE_ERROR_OUT_OF_MEMORY, "calloc() Fail(%d)", errno);
*handle = t;
return ZIGBEE_ERROR_NONE;
API 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)
{
+ 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);
RETV_IF(NULL == user_desc, ZIGBEE_ERROR_INVALID_PARAMETER);
- return ZIGBEE_ERROR_NONE;
+ ret = zbl_user_desc_set(handle, addr16, len, user_desc, cb, user_data);
+ return ret;
}
API int zb_zdo_device_annce(zigbee_h handle, nwk_addr addr16, ieee_addr addr64,
/* Enable */
ret = zb_enable(handle, zigbee_enable_cb, NULL);
if (ZIGBEE_ERROR_NONE != ret) {
- msg("zb_enable(0x%X) - FAILED!!!", ret);
+ msg("zb_enable(0x%X) - FAILED!!! [%s]", ret, zigbee_error_to_string(ret));
return RET_FAILURE;
}
ret = zb_get_endpoint_list(handle, dest_addr64, &count, ep_list);
if (ZIGBEE_ERROR_NONE != ret) {
- msg("zb_get_endpoint_list(%d) - FAILED!!!", ret);
+ msg("zb_get_endpoint_list(%d) - FAILED!!! [%s]", ret, zigbee_error_to_string(ret));
return RET_FAILURE;
}
- msg(" - zb_get_endpoint_list() ret: [0x%X] [%s]", ret, zigbee_error_to_string(ret));
+ msg(" - zb_get_endpoint_list() ret: [0x%X]", ret);
msgb("Endpoints count [%d] : ", count);
for(i = 0; i < count; i++) {
msgn(" %04d", ep_list[i]);
&in_count, in_cluster_list,
&out_count, out_cluster_list);
if (ZIGBEE_ERROR_NONE != ret) {
- msg("zb_get_cluster_list(%d) - FAILED!!!", ret);
+ msg("zb_get_cluster_list(%d) - FAILED!!! [%s]", ret, zigbee_error_to_string(ret));
return RET_FAILURE;
}
- msg(" - zb_get_cluster_list() ret: [0x%X] [%s]", ret, zigbee_error_to_string(ret));
+ msg(" - zb_get_cluster_list() ret: [0x%X]", ret);
msgb("In Clusters count [%d] : ", in_count);
for(i = 0; i < in_count; i++) {
msgn(" %04X (%s)\n", in_cluster_list[i], zb_get_cluster_name(in_cluster_list[i]));
/* Enable */
ret = zb_enable(handle, zigbee_enable_cb, NULL);
- if (ZIGBEE_ERROR_NONE != ret) {
+ if (ZIGBEE_ERROR_PERMISSION_DENIED == ret) {
+ /* Admin permission is not set, but we can do normal operations */
+ msg("zb_enable(0x%X) - FAILED!!!", ret);
+ }
+ else if (ZIGBEE_ERROR_NONE != ret) {
msg("zb_enable(0x%X) - FAILED!!! [%s]", ret, zigbee_error_to_string(ret));
return RET_FAILURE;
}
int records_len, void *user_data)
{
int count;
+ int ret;
unsigned short id;
unsigned char type;
unsigned char status;
}
records = records_info->record.read_attr;
- zb_create_value(&value);
+ ret = zb_create_value(&value);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_value(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ return RET_FAILURE;
+ }
+
msg(" Cluster ID : 0x%04X (%s)", cluster_id, zb_get_cluster_name(cluster_id));
msg(" Node ID : 0x%04X", addr16);
msg(" End-Point : 0x%02X", ep);
unsigned char ep, unsigned short cluster_id, zb_global_record_data_s *records_info,
int records_len, void *user_data)
{
+ int ret;
unsigned short id = 0;
unsigned char status;
zb_value_h value = NULL;
}
records = records_info->record.write_attr;
- zb_create_value(&value);
+ ret = zb_create_value(&value);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_value(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ return RET_FAILURE;
+ }
+
msg(" Cluster ID : 0x%04X (%s)", cluster_id, zb_get_cluster_name(cluster_id));
msg(" Node ID : 0x%04X", addr16);
msg(" End-Point : 0x%02X", ep);
msg(" Max Interval 0x%04X", max_i);
zb_get_min_i_from_report_config_record(records[i], &min_i);
msg(" Min Interval 0x%04X", min_i);
- zb_create_value(&val);
+ ret = zb_create_value(&val);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_read_report_config_record(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ continue;
+ }
+
zb_get_change_from_report_config_record1(records[i], val);
ret = zb_get_value(val, &type, &buf, &count);
if (ZIGBEE_ERROR_NONE == ret) {
memcpy(attribute_value, &temp, sizeof(unsigned short));
}
- zb_create_write_attr_record(&attr);
+ ret = zb_create_write_attr_record(&attr);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_write_attr_record(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ return RET_FAILURE;
+ }
+
//zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
zb_set_id_to_write_attr_record(attr, attribute_id);
zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
/* Samjin Power Outlet */
write_attr_record_h attr;
- zb_create_write_attr_record(&attr);
+ ret = zb_create_write_attr_record(&attr);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_write_attr_record(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ return RET_FAILURE;
+ }
+
zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
zb_set_buf_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER, value,
/* Samjin Power Outlet */
write_attr_record_h attr;
- zb_create_write_attr_record(&attr);
+ ret = zb_create_write_attr_record(&attr);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_write_attr_record(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ return RET_FAILURE;
+ }
+
zb_set_id_to_write_attr_record(attr, ZB_ZCL_IDENTIFY_TIME_ATTRIBUTE_ID);
zb_set_type_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER);
zb_set_buf_to_write_attr_record(attr, ZB_ZCL_UNSIGNED_16_BIT_INTEGER, value,
if (strlen(data_timeout))
timeout = (unsigned short)strtol(data_timeout, NULL, 10);
- zb_create_report_config_record(&config);
+ ret = zb_create_report_config_record(&config);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_report_config_record(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ return RET_FAILURE;
+ }
+
zb_set_dir_to_report_config_record(config, ZB_ZCL_CLIENT_TO_SERVER);
zb_set_id_to_report_config_record(config, attribute_id);
zb_set_type_to_report_config_record(config, ZB_ZCL_BOOLEAN);
report_config_record_h config1;
unsigned short val2 = 0x007f;
- zb_create_report_config_record(&config1);
+ ret = zb_create_report_config_record(&config1);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_report_config_record(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ return RET_FAILURE;
+ }
+
zb_set_dir_to_report_config_record(config1, ZB_ZCL_CLIENT_TO_SERVER);
zb_set_id_to_report_config_record(config1, ZB_ZCL_ZONE_STATE_ATTRIBUTE_ID);
zb_set_type_to_report_config_record(config1, ZB_ZCL_SIGNED_16_BIT_INTEGER);
int ret = ZIGBEE_ERROR_NONE;
read_report_config_record_h read_report_conf;
- zb_create_read_report_config_record(&read_report_conf);
+ ret = zb_create_read_report_config_record(&read_report_conf);
+ if (ZIGBEE_ERROR_NONE != ret) {
+ msg("zb_create_read_report_config_record(0x%X) - FAILED!!! [%s]",
+ ret, zigbee_error_to_string(ret));
+ return RET_FAILURE;
+ }
+
zb_set_dir_to_read_report_config_record(read_report_conf, ZB_ZCL_CLIENT_TO_SERVER);
zb_set_id_to_read_report_config_record(read_report_conf, ZB_ZCL_ON_OFF_ATTRIBUTE_ID);