*
* @param[in] handle handle of simple data value
*
- * @return None
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
*
* @see zb_create_value()
*/
-void zb_destroy_value(
+int zb_destroy_value(
zb_value_h handle);
/**
* @see zb_get_value_from_read_attr_status_record()
* @see zb_zcl_global_read_attr_rsp()
*/
-void zb_destroy_read_attr_status_record(read_attr_status_record_h handle);
+int zb_destroy_read_attr_status_record(read_attr_status_record_h handle);
/**
* @brief Gets identifier from read attribute status record
* @see zb_get_type_from_discover_attr_info()
* @see zb_zcl_global_discover_attr_rsp()
*/
-void zb_destroy_discover_attr_info(discover_attr_info_record_h handle);
+int zb_destroy_discover_attr_info(discover_attr_info_record_h handle);
/**
* @brief Gets identifier from discover attribute info
*
* @param[in] handle handle of write attribute record
*
- * @return None
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
*
* @see zb_zcl_global_write_attr()
* @see zb_zcl_global_write_attr_undivided()
* @see zb_set_buf_to_write_attr_record()
* @see zb_set_value_to_write_attr_record()
*/
-void zb_destroy_write_attr_record(
+int zb_destroy_write_attr_record(
write_attr_record_h handle);
/**
*
* @param[in] handle handle of write attribute status record
*
- * @return None
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
*
* @see zb_zcl_global_write_attr_rsp()
* @see zb_create_write_attr_status()
* @see zb_get_type_from_discover_attr_info()
*/
-void zb_destroy_write_attr_status(write_attr_status_record_h handle);
+int zb_destroy_write_attr_status(write_attr_status_record_h handle);
/**
* @brief Gets status from write attribute status record
* @see zb_get_timeout_from_report_config_record()
* @see zb_set_timeout_to_report_config_record()
*/
-void zb_destroy_report_config_record(
+int zb_destroy_report_config_record(
report_config_record_h handle);
/**
*
* @param[in] handle handle of write attribute record
*
- * @return None
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
*
* @see zb_create_read_report_config_record()
* @see zb_destroy_read_report_config_record()
* @see zb_get_dir_from_read_report_config_record()
* @see zb_set_dir_to_read_report_config_record()
*/
-void zb_destroy_read_report_config_record(
+int zb_destroy_read_report_config_record(
read_report_config_record_h handle);
/**
* @see zb_get_id_from_report_config_response_record()
* @see zb_set_id_to_report_config_response_record()
*/
-void zb_destroy_report_config_response_record(
+int zb_destroy_report_config_response_record(
report_config_response_record_h handle);
/**
* @see zb_get_value_from_attr_report()
* @see zb_set_value_to_attr_report()
*/
-void zb_destroy_attr_report(
+int zb_destroy_attr_report(
attr_report_h handle);
/**
* @see zb_get_acl_from_extended_attr_info()
* @see zb_set_acl_to_extended_attr_info()
*/
-void zb_destroy_extended_attr_info(
+int zb_destroy_extended_attr_info(
extended_attr_info_h handle);
/**
*
* @param[in] handle The handle of zigbee
*
- * @return None
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #ZIGBEE_ERROR_NONE Successful
+ * @retval #ZIGBEE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #ZIGBEE_ERROR_NOT_SUPPORTED Not supported
*
* @see zb_create()
*/
-void zb_destroy(zigbee_h handle);
+int zb_destroy(zigbee_h handle);
/**
* @brief Called after receiving events from zigbee service
return ret;
}
-API void zb_destroy(zigbee_h handle)
+API int zb_destroy(zigbee_h handle)
{
- RET_IF(NULL == handle);
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == handle, ZIGBEE_ERROR_INVALID_PARAMETER);
+
zbl_dbus_stop(handle);
+ return ZIGBEE_ERROR_NONE;
}
API int zb_enable(zigbee_h handle, zb_enable_cb cb, void *user_data)
return ZIGBEE_ERROR_NONE;
}
-void zbl_dbus_stop(zigbee_h handle)
+int zbl_dbus_stop(zigbee_h handle)
{
struct zbl_zigbee_s *h = handle;
DBG("zbl_dbus_stop()");
if (0 >= zbl_ref_count) {
WARN("dbus does not initiaized\n");
- return;
+ return ZIGBEE_ERROR_NONE;
}
if (0 > --zbl_ref_count) {
DBG("all connections closed\n");
zbl_ref_count = 0;
- return;
+ return ZIGBEE_ERROR_NONE;
}
if (gdbus_conn) {
DBG("zbl_dbus_stop() finished");
}
+
+ return ZIGBEE_ERROR_NONE;
}
GDBusConnection* zbl_dbus_get_object(void)
#include <zb_type.h>
int zbl_dbus_start(zigbee_h handle);
-void zbl_dbus_stop(zigbee_h handle);
+int zbl_dbus_stop(zigbee_h handle);
GDBusConnection* zbl_dbus_get_object(void);
int zbl_dbus_get_timeout(GDBusProxy *proxy);
int zbl_check_privilege();
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_read_attr_status_record(read_attr_status_record_h handle)
+API int zb_destroy_read_attr_status_record(read_attr_status_record_h handle)
{
struct read_attribute_status_record_s* h = handle;
- RET_IF(NULL == h);
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
if (h->value)
free(h->value);
free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_get_id_from_read_attr_status_record(read_attr_status_record_h handle,
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_value(zb_value_h handle)
+API int zb_destroy_value(zb_value_h handle)
{
struct zb_value_s* h = handle;
- RET_IF(NULL == h);
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
if (h->str) {
if (h->str->v)
free(h->wstr);
}
free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_set_value(zb_value_h handle, unsigned char type, unsigned char *value,
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_discover_attr_info(discover_attr_info_record_h handle)
+API int zb_destroy_discover_attr_info(discover_attr_info_record_h handle)
{
struct discover_attribute_info_record_s *h = handle;
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
+
free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_get_id_from_discover_attr_info(
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_write_attr_record(write_attr_record_h handle)
+API int zb_destroy_write_attr_record(write_attr_record_h handle)
{
struct write_attribute_record_s* h = handle;
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
+
if (h->value)
free(h->value);
free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_set_id_to_write_attr_record(write_attr_record_h handle,
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_write_attr_status(write_attr_status_record_h handle)
+API int zb_destroy_write_attr_status(write_attr_status_record_h handle)
{
struct write_attribute_status_record_s *h = handle;
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
+
free(h);
+ return ZIGBEE_ERROR_NONE;
}
API int zb_get_status_from_write_attr_status(write_attr_status_record_h handle,
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_report_config_record(report_config_record_h handle)
+API int zb_destroy_report_config_record(report_config_record_h handle)
{
struct reporting_configuration_record_s *h = handle;
- RET_IF(NULL == h);
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
if (h->change)
free(h->change);
free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_get_dir_from_report_config_record(report_config_record_h handle,
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_read_report_config_record(read_report_config_record_h handle)
+API int zb_destroy_read_report_config_record(read_report_config_record_h handle)
{
struct read_reporting_configuration_record_s *h = handle;
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
+
free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_set_dir_to_read_report_config_record(read_report_config_record_h handle,
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_report_config_response_record(
+API int zb_destroy_report_config_response_record(
report_config_response_record_h handle)
{
struct reporting_configuration_response_record_s *h = handle;
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
+
free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_get_status_from_report_config_response_record(
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_attr_report(attr_report_h handle)
+API int zb_destroy_attr_report(attr_report_h handle)
{
struct attribute_report_s *h = handle;
- if (h) {
- if (h->value)
- free(h->value);
- free(h);
- }
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
+
+ if (h->value)
+ free(h->value);
+ free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_get_id_from_attr_report(attr_report_h handle, unsigned short *id)
return ZIGBEE_ERROR_NONE;
}
-API void zb_destroy_extended_attr_info(extended_attr_info_h handle)
+API int zb_destroy_extended_attr_info(extended_attr_info_h handle)
{
struct extended_attribute_infomation_s *h = handle;
+ CHECK_FEATURE_SUPPORTED(ZIGBEE_FEATURE);
+ RETV_IF(NULL == h, ZIGBEE_ERROR_INVALID_PARAMETER);
+
free(h);
+
+ return ZIGBEE_ERROR_NONE;
}
API int zb_get_id_from_extended_attr_info(extended_attr_info_h handle,