From 752abee3891f048f03a630a5a64cb71b24021a9b Mon Sep 17 00:00:00 2001 From: youngman Date: Tue, 30 Aug 2016 15:25:01 +0900 Subject: [PATCH] modify return value of some APIs (IOTCON_ERROR_ALREADY, IOTCON_ERROR_NO_DATA) Change-Id: I84e1b53ef410479f563e39cf2dacf9487b87d303 Signed-off-by: youngman --- include/iotcon-resource-interfaces.h | 1 + include/iotcon-resource-types.h | 1 + include/iotcon-resource.h | 3 +++ src/ic-resource-interfaces.c | 2 +- src/ic-resource-types.c | 2 +- src/ic-resource.c | 2 +- 6 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/iotcon-resource-interfaces.h b/include/iotcon-resource-interfaces.h index 709d044..01bd0eb 100644 --- a/include/iotcon-resource-interfaces.h +++ b/include/iotcon-resource-interfaces.h @@ -155,6 +155,7 @@ void iotcon_resource_interfaces_destroy(iotcon_resource_interfaces_h ifaces); * @retval #IOTCON_ERROR_NONE Successful * @retval #IOTCON_ERROR_NOT_SUPPORTED Not supported * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #IOTCON_ERROR_ALREADY Already done * * @see iotcon_resource_interfaces_create() * @see iotcon_resource_interfaces_destroy() diff --git a/include/iotcon-resource-types.h b/include/iotcon-resource-types.h index 6247bac..c2ce105 100644 --- a/include/iotcon-resource-types.h +++ b/include/iotcon-resource-types.h @@ -157,6 +157,7 @@ void iotcon_resource_types_destroy(iotcon_resource_types_h types); * @retval #IOTCON_ERROR_NONE Successful * @retval #IOTCON_ERROR_NOT_SUPPORTED Not supported * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #IOTCON_ERROR_ALREADY Already done * * @see iotcon_resource_types_create() * @see iotcon_resource_types_destroy() diff --git a/include/iotcon-resource.h b/include/iotcon-resource.h index 30d462e..2bf0f2f 100644 --- a/include/iotcon-resource.h +++ b/include/iotcon-resource.h @@ -306,6 +306,7 @@ int iotcon_resource_destroy(iotcon_resource_h resource_handle); * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter * @retval #IOTCON_ERROR_SYSTEM System error * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied + * @retval #IOTCON_ERROR_ALREADY Already done * * @pre iotcon_initialize() should be called to initialize. * @@ -339,6 +340,7 @@ int iotcon_resource_bind_interface(iotcon_resource_h resource, const char *iface * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter * @retval #IOTCON_ERROR_SYSTEM System error * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied + * @retval #IOTCON_ERROR_ALREADY Already done * * @pre iotcon_initialize() should be called to initialize. * @@ -429,6 +431,7 @@ int iotcon_resource_bind_child_resource(iotcon_resource_h parent, * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter * @retval #IOTCON_ERROR_SYSTEM System error * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied + * @retval #IOTCON_ERROR_NO_DATA No data available * * @pre iotcon_initialize() should be called to initialize. * diff --git a/src/ic-resource-interfaces.c b/src/ic-resource-interfaces.c index fdfc6fe..3d57280 100644 --- a/src/ic-resource-interfaces.c +++ b/src/ic-resource-interfaces.c @@ -106,7 +106,7 @@ API int iotcon_resource_interfaces_add(iotcon_resource_interfaces_h ifaces, if (true == _icl_resource_interfaces_duplicate_check(ifaces, iface)) { ERR("%s is already contained.", iface); - return IOTCON_ERROR_INVALID_PARAMETER; + return IOTCON_ERROR_ALREADY; } resource_iface = strdup(iface); diff --git a/src/ic-resource-types.c b/src/ic-resource-types.c index 3dc43e4..edf5a18 100644 --- a/src/ic-resource-types.c +++ b/src/ic-resource-types.c @@ -106,7 +106,7 @@ API int iotcon_resource_types_add(iotcon_resource_types_h types, const char *typ if (true == _icl_resource_types_duplicate_check(types, type)) { ERR("%s is already contained.", type); - return IOTCON_ERROR_INVALID_PARAMETER; + return IOTCON_ERROR_ALREADY; } resource_type = strdup(type); diff --git a/src/ic-resource.c b/src/ic-resource.c index d6353f9..ef8bdfb 100644 --- a/src/ic-resource.c +++ b/src/ic-resource.c @@ -254,7 +254,7 @@ API int iotcon_resource_unbind_child_resource(iotcon_resource_h parent, if (NULL == g_list_find(parent->children, child)) { ERR("child resource is not bound to parent resource."); - return IOTCON_ERROR_INVALID_PARAMETER; + return IOTCON_ERROR_NO_DATA; } ret = icl_ioty_resource_unbind_child_resource(parent, child); -- 2.34.1