From: sung.goo.kim Date: Thu, 19 Nov 2015 01:16:04 +0000 (+0900) Subject: Revise enumerations X-Git-Tag: submit/tizen/20151130.235229~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e719d7c6d1250ed8385f5726f540bb0483b95396;p=platform%2Fcore%2Fiot%2Fiotcon.git Revise enumerations Change-Id: Id902451fd99590688eb475bd3ad1984d97a6cd00 --- diff --git a/daemon/icd-ioty-ocprocess.c b/daemon/icd-ioty-ocprocess.c index 5caa70b..ced2f44 100644 --- a/daemon/icd-ioty-ocprocess.c +++ b/daemon/icd-ioty-ocprocess.c @@ -224,7 +224,7 @@ static int _ioty_oic_action_to_ioty_action(int oic_action) case OC_OBSERVE_NO_OPTION: default: ERR("Invalid action (%d)", oic_action); - action = IOTCON_OBSERVE_TYPE_NONE; + action = IOTCON_OBSERVE_NO_TYPE; } return action; } @@ -368,7 +368,7 @@ OCEntityHandlerResult icd_ioty_ocprocess_req_handler(OCEntityHandlerFlag flag, req_ctx->observe_id = request->obsInfo.obsId; req_ctx->observe_type = _ioty_oic_action_to_ioty_action(request->obsInfo.action); } else { - req_ctx->observe_type = IOTCON_OBSERVE_TYPE_NONE; + req_ctx->observe_type = IOTCON_OBSERVE_NO_TYPE; } /* header options */ @@ -587,20 +587,20 @@ static int _ocprocess_parse_oic_result(OCStackResult result) switch (result) { case OC_STACK_OK: - res = IOTCON_RESPONSE_RESULT_OK; + res = IOTCON_RESPONSE_OK; break; case OC_STACK_RESOURCE_CREATED: - res = IOTCON_RESPONSE_RESULT_RESOURCE_CREATED; + res = IOTCON_RESPONSE_RESOURCE_CREATED; break; case OC_STACK_RESOURCE_DELETED: - res = IOTCON_RESPONSE_RESULT_RESOURCE_DELETED; + res = IOTCON_RESPONSE_RESULT_DELETED; break; case OC_STACK_UNAUTHORIZED_REQ: - res = IOTCON_RESPONSE_RESULT_FORBIDDEN; + res = IOTCON_RESPONSE_FORBIDDEN; break; default: WARN("response error(%d)", result); - res = IOTCON_RESPONSE_RESULT_ERROR; + res = IOTCON_RESPONSE_ERROR; break; } @@ -892,7 +892,7 @@ static void _presence_cb_response_error(OCDoHandle handle, int ret_val) GVariant *value, *value2; value = g_variant_new("(iusiis)", ret_val, 0, IC_STR_NULL, IOTCON_CONNECTIVITY_ALL, - IOTCON_PRESENCE_TRIGGER_RESOURCE_CREATED, IC_STR_NULL); + IOTCON_PRESENCE_RESOURCE_CREATED, IC_STR_NULL); value2 = g_variant_ref(value); ret = _ocprocess_response_signal(NULL, IC_DBUS_SIGNAL_PRESENCE, @@ -919,13 +919,13 @@ static int _presence_trigger_to_ioty_trigger(OCPresenceTrigger src, switch (src) { case OC_PRESENCE_TRIGGER_CREATE: - *dest = IOTCON_PRESENCE_TRIGGER_RESOURCE_CREATED; + *dest = IOTCON_PRESENCE_RESOURCE_CREATED; break; case OC_PRESENCE_TRIGGER_CHANGE: - *dest = IOTCON_PRESENCE_TRIGGER_RESOURCE_UPDATED; + *dest = IOTCON_PRESENCE_RESOURCE_UPDATED; break; case OC_PRESENCE_TRIGGER_DELETE: - *dest = IOTCON_PRESENCE_TRIGGER_RESOURCE_DESTROYED; + *dest = IOTCON_PRESENCE_RESOURCE_DESTROYED; break; default: ERR("Invalid trigger(%d)", src); @@ -1174,9 +1174,9 @@ OCStackApplicationResult icd_ioty_ocprocess_get_tizen_info_cb(void *ctx, tizen_device_id = val->str; if (OC_STACK_OK == resp->result) - res = IOTCON_RESPONSE_RESULT_OK; + res = IOTCON_RESPONSE_OK; else - res = IOTCON_RESPONSE_RESULT_ERROR; + res = IOTCON_RESPONSE_ERROR; tizen_info = g_variant_new("(ssi)", device_name, tizen_device_id, res); diff --git a/daemon/icd-ioty.c b/daemon/icd-ioty.c index b809ec1..171928e 100644 --- a/daemon/icd-ioty.c +++ b/daemon/icd-ioty.c @@ -109,22 +109,22 @@ static int _ioty_properties_to_oic_properties(int properties) { int prop = OC_RES_PROP_NONE; - if (IOTCON_DISCOVERABLE & properties) + if (IOTCON_RESOURCE_DISCOVERABLE & properties) prop |= OC_DISCOVERABLE; - if (IOTCON_OBSERVABLE & properties) + if (IOTCON_RESOURCE_OBSERVABLE & properties) prop |= OC_OBSERVABLE; - if (IOTCON_ACTIVE & properties) + if (IOTCON_RESOURCE_ACTIVE & properties) prop |= OC_ACTIVE; - if (IOTCON_SLOW & properties) + if (IOTCON_RESOURCE_SLOW & properties) prop |= OC_SLOW; - if (IOTCON_SECURE & properties) + if (IOTCON_RESOURCE_SECURE & properties) prop |= OC_SECURE; - if (IOTCON_EXPLICIT_DISCOVERABLE & properties) + if (IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE & properties) prop |= OC_EXPLICIT_DISCOVERABLE; /* TODO: Secure option is not supported yet. */ diff --git a/doc/iotcon_doc.h b/doc/iotcon_doc.h index 47e70da..984a993 100644 --- a/doc/iotcon_doc.h +++ b/doc/iotcon_doc.h @@ -64,7 +64,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques if (IOTCON_ERROR_NONE != ret) return; - ret = iotcon_response_set_result(response, IOTCON_RESPONSE_RESULT_OK); + ret = iotcon_response_set_result(response, IOTCON_RESPONSE_OK); if (IOTCON_ERROR_NONE != ret) { iotcon_response_destroy(response); return; @@ -123,7 +123,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques { int ret; int interfaces = IOTCON_INTERFACE_DEFAULT; - int properties = (IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE); + int properties = (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE); const char *uri_path = "/door/1"; const char *type = "org.tizen.door"; iotcon_resource_types_h resource_types; @@ -295,7 +295,7 @@ static void _request_handler(iotcon_request_h request, void *user_data) { int ret; int interfaces = IOTCON_INTERFACE_DEFAULT; - int properties = (IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE); + int properties = (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE); const char *uri_path = "/door/1"; const char *type = "org.tizen.door"; iotcon_resource_types_h resource_types; diff --git a/lib/icl-list.c b/lib/icl-list.c index 78631f5..6e8ef1e 100644 --- a/lib/icl-list.c +++ b/lib/icl-list.c @@ -48,7 +48,7 @@ static bool _icl_list_dec_ref_count(iotcon_list_h val) return ret; } -static int _icl_list_create(iotcon_types_e type, iotcon_list_h *ret_list) +static int _icl_list_create(iotcon_type_e type, iotcon_list_h *ret_list) { iotcon_list_h list; @@ -65,7 +65,7 @@ static int _icl_list_create(iotcon_types_e type, iotcon_list_h *ret_list) return IOTCON_ERROR_NONE; } -API int iotcon_list_create(iotcon_types_e type, iotcon_list_h *ret_list) +API int iotcon_list_create(iotcon_type_e type, iotcon_list_h *ret_list) { int ret; iotcon_list_h list; @@ -410,7 +410,7 @@ API int iotcon_list_remove_nth(iotcon_list_h list, int pos) return ret; } -API int iotcon_list_get_type(iotcon_list_h list, iotcon_types_e *type) +API int iotcon_list_get_type(iotcon_list_h list, iotcon_type_e *type) { RETV_IF(NULL == list, IOTCON_ERROR_INVALID_PARAMETER); RETV_IF(NULL == type, IOTCON_ERROR_INVALID_PARAMETER); diff --git a/lib/icl-lite-resource.c b/lib/icl-lite-resource.c index ca8355c..0bc18b9 100644 --- a/lib/icl-lite-resource.c +++ b/lib/icl-lite-resource.c @@ -113,7 +113,7 @@ static int _icl_lite_resource_notify(iotcon_lite_resource_h lite_resource) struct icl_resource resource = {0}; RETV_IF(NULL == lite_resource, IOTCON_ERROR_INVALID_PARAMETER); - if (false == (IOTCON_OBSERVABLE & lite_resource->properties)) + if (false == (IOTCON_RESOURCE_OBSERVABLE & lite_resource->properties)) return IOTCON_ERROR_NONE; resource.handle = lite_resource->handle; @@ -150,7 +150,7 @@ static void _icl_lite_resource_request_handler(GDBusConnection *connection, if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_representation_create() Fail(%d)", ret); _icl_lite_resource_response_send(NULL, oic_request_h, oic_resource_h, - IOTCON_RESPONSE_RESULT_ERROR); + IOTCON_RESPONSE_ERROR); return; } @@ -158,7 +158,7 @@ static void _icl_lite_resource_request_handler(GDBusConnection *connection, if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_representation_set_uri_path() Fail(%d)", ret); _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h, - IOTCON_RESPONSE_RESULT_ERROR); + IOTCON_RESPONSE_ERROR); iotcon_representation_destroy(repr); return; } @@ -182,7 +182,7 @@ static void _icl_lite_resource_request_handler(GDBusConnection *connection, if (FALSE == g_variant_iter_loop(repr_iter, "v", &repr_gvar)) { ERR("Received representation is empty."); _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h, - IOTCON_RESPONSE_RESULT_ERROR); + IOTCON_RESPONSE_ERROR); iotcon_representation_destroy(repr); return; } @@ -194,7 +194,7 @@ static void _icl_lite_resource_request_handler(GDBusConnection *connection, if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_state_create() Fail(%d)", ret); _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h, - IOTCON_RESPONSE_RESULT_ERROR); + IOTCON_RESPONSE_ERROR); iotcon_representation_destroy(repr); return; } @@ -205,7 +205,7 @@ static void _icl_lite_resource_request_handler(GDBusConnection *connection, if (IOTCON_ERROR_NONE != ret) { ERR("_icl_lite_resource_set_state() Fail(%d)", ret); _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h, - IOTCON_RESPONSE_RESULT_ERROR); + IOTCON_RESPONSE_ERROR); iotcon_state_destroy(recv_state); iotcon_representation_destroy(repr); return; @@ -218,7 +218,7 @@ static void _icl_lite_resource_request_handler(GDBusConnection *connection, default: WARN("Not supported request (only GET / PUT / OBSERVE)"); ret = _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h, - IOTCON_RESPONSE_RESULT_FORBIDDEN); + IOTCON_RESPONSE_FORBIDDEN); if (IOTCON_ERROR_NONE != ret) ERR("_icl_lite_resource_response_send() Fail(%d)", ret); iotcon_representation_destroy(repr); @@ -229,13 +229,13 @@ static void _icl_lite_resource_request_handler(GDBusConnection *connection, if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_representation_set_state() Fail(%d)", ret); _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h, - IOTCON_RESPONSE_RESULT_ERROR); + IOTCON_RESPONSE_ERROR); iotcon_representation_destroy(repr); return; } ret = _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h, - IOTCON_RESPONSE_RESULT_OK); + IOTCON_RESPONSE_OK); if (IOTCON_ERROR_NONE != ret) { ERR("_icl_lite_resource_response_send() Fail(%d)", ret); iotcon_representation_destroy(repr); diff --git a/lib/icl-remote-resource-caching.c b/lib/icl-remote-resource-caching.c index 11e5a14..f3bce84 100644 --- a/lib/icl-remote-resource-caching.c +++ b/lib/icl-remote-resource-caching.c @@ -209,7 +209,7 @@ static void _caching_get_cb(iotcon_remote_resource_h resource, RETM_IF(IOTCON_ERROR_NONE != err, "_caching_get() Fail(%d)", err); ret = iotcon_response_get_result(resp, &result); - if (IOTCON_ERROR_NONE != ret || IOTCON_RESPONSE_RESULT_OK != result) { + if (IOTCON_ERROR_NONE != ret || IOTCON_RESPONSE_OK != result) { ERR("Invalid result (%d)", result); return; } diff --git a/lib/icl-remote-resource-monitoring.c b/lib/icl-remote-resource-monitoring.c index b032ba1..b37f432 100644 --- a/lib/icl-remote-resource-monitoring.c +++ b/lib/icl-remote-resource-monitoring.c @@ -42,10 +42,10 @@ static void _monitoring_get_cb(iotcon_remote_resource_h resource, return; } - if (IOTCON_RESPONSE_RESULT_OK <= response_result) - resource_state = IOTCON_REMOTE_RESOURCE_STATE_ALIVE; + if (IOTCON_RESPONSE_OK <= response_result) + resource_state = IOTCON_REMOTE_RESOURCE_ALIVE; else - resource_state = IOTCON_REMOTE_RESOURCE_STATE_LOST_SIGNAL; + resource_state = IOTCON_REMOTE_RESOURCE_LOST_SIGNAL; if (resource_state == resource->monitoring_handle->resource_state) return; @@ -99,7 +99,7 @@ static void _monitoring_presence_cb(iotcon_presence_h presence, iotcon_error_e e return; } - if (IOTCON_PRESENCE_TRIGGER_RESOURCE_DESTROYED != trigger) + if (IOTCON_PRESENCE_RESOURCE_DESTROYED != trigger) return; } diff --git a/lib/icl-response.c b/lib/icl-response.c index 4c54da0..44313d3 100644 --- a/lib/icl-response.c +++ b/lib/icl-response.c @@ -29,7 +29,7 @@ #include "icl-response.h" /* the last index of iotcon_response_result_e */ -#define ICL_RESPONSE_RESULT_MAX (IOTCON_RESPONSE_RESULT_FORBIDDEN + 1) +#define ICL_RESPONSE_RESULT_MAX (IOTCON_RESPONSE_FORBIDDEN + 1) API int iotcon_response_create(iotcon_request_h request, iotcon_response_h *response) @@ -103,7 +103,7 @@ API int iotcon_response_set_result(iotcon_response_h resp, { RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER); - if (result < IOTCON_RESPONSE_RESULT_OK || ICL_RESPONSE_RESULT_MAX <= result) { + if (result < IOTCON_RESPONSE_OK || ICL_RESPONSE_RESULT_MAX <= result) { ERR("Invalid result(%d)", result); return IOTCON_ERROR_INVALID_PARAMETER; } diff --git a/lib/icl-state.c b/lib/icl-state.c index 3aab0e4..7618bd8 100644 --- a/lib/icl-state.c +++ b/lib/icl-state.c @@ -437,7 +437,7 @@ API int iotcon_state_set_state(iotcon_state_h state, const char *key, iotcon_sta } API int iotcon_state_get_type(iotcon_state_h state, const char *key, - iotcon_types_e *type) + iotcon_type_e *type) { iotcon_value_h value = NULL; diff --git a/lib/include/iotcon-constant.h b/lib/include/iotcon-constant.h index 055bd07..70fd963 100644 --- a/lib/include/iotcon-constant.h +++ b/lib/include/iotcon-constant.h @@ -55,9 +55,9 @@ * @since_tizen 3.0 */ typedef enum { - IOTCON_OBSERVE_REGISTER = 0, /**< Indicates action of registering observation*/ - IOTCON_OBSERVE_DEREGISTER = 1, /**< Indicates action of unregistering observation */ - IOTCON_OBSERVE_TYPE_NONE = 2, /**< Indicates no option */ + IOTCON_OBSERVE_NO_TYPE = 0, /**< Indicates no option */ + IOTCON_OBSERVE_REGISTER = 1, /**< Indicates action of registering observation*/ + IOTCON_OBSERVE_DEREGISTER = 2, /**< Indicates action of unregistering observation */ } iotcon_observe_type_e; /** @@ -102,13 +102,13 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - IOTCON_HIDDEN = 0, /**< Indicates resource uninitialized */ - IOTCON_DISCOVERABLE = (1 << 0), /**< Indicates resource that is allowed to be discovered */ - IOTCON_OBSERVABLE = (1 << 1), /**< Indicates resource that is allowed to be observed */ - IOTCON_ACTIVE = (1 << 2), /**< Indicates resource initialized and activated */ - IOTCON_SLOW = (1 << 3), /**< Indicates resource which takes some delay to respond */ - IOTCON_SECURE = (1 << 4), /**< Indicates secure resource */ - IOTCON_EXPLICIT_DISCOVERABLE = (1 << 5), /**< When this bit is set, the resource is allowed to be discovered only if discovery request contains an explicit querystring. */ + IOTCON_RESOURCE_NO_PROPERTY = 0, /**< Indicates resource uninitialized */ + IOTCON_RESOURCE_DISCOVERABLE = (1 << 0), /**< Indicates resource that is allowed to be discovered */ + IOTCON_RESOURCE_OBSERVABLE = (1 << 1), /**< Indicates resource that is allowed to be observed */ + IOTCON_RESOURCE_ACTIVE = (1 << 2), /**< Indicates resource initialized and activated */ + IOTCON_RESOURCE_SLOW = (1 << 3), /**< Indicates resource which takes some delay to respond */ + IOTCON_RESOURCE_SECURE = (1 << 4), /**< Indicates secure resource */ + IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE = (1 << 5), /**< When this bit is set, the resource is allowed to be discovered only if discovery request contains an explicit querystring. */ } iotcon_resource_property_e; /** @@ -117,7 +117,7 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - IOTCON_REQUEST_NONE = 0, /**< Indicates none */ + IOTCON_REQUEST_UNKNOWN = 0, /**< Indicates none */ IOTCON_REQUEST_GET = 1, /**< Indicates get method of request */ IOTCON_REQUEST_PUT = 2, /**< Indicates put method of request */ IOTCON_REQUEST_POST = 3, /**< Indicates post method of request */ @@ -130,12 +130,12 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - IOTCON_RESPONSE_RESULT_OK = 0, /**< Indicates result of response for success */ - IOTCON_RESPONSE_RESULT_ERROR, /**< Indicates result of response for something error */ - IOTCON_RESPONSE_RESULT_RESOURCE_CREATED, /**< Indicates result of response for resource has created */ - IOTCON_RESPONSE_RESULT_RESOURCE_DELETED, /**< Indicates result of response for resource has deleted */ - IOTCON_RESPONSE_RESULT_SLOW, /**< Indicates result of response for slow resource */ - IOTCON_RESPONSE_RESULT_FORBIDDEN, /**< Indicates result of response for accessing unauthorized resource */ + IOTCON_RESPONSE_OK = 0, /**< Indicates result of response for success */ + IOTCON_RESPONSE_ERROR, /**< Indicates result of response for something error */ + IOTCON_RESPONSE_RESOURCE_CREATED, /**< Indicates result of response for resource has created */ + IOTCON_RESPONSE_RESULT_DELETED, /**< Indicates result of response for resource has deleted */ + IOTCON_RESPONSE_SLOW, /**< Indicates result of response for slow resource */ + IOTCON_RESPONSE_FORBIDDEN, /**< Indicates result of response for accessing unauthorized resource */ } iotcon_response_result_e; /** @@ -155,9 +155,9 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - IOTCON_PRESENCE_TRIGGER_RESOURCE_CREATED, /**< Indicates for resource creation operation of server */ - IOTCON_PRESENCE_TRIGGER_RESOURCE_UPDATED, /**< Indicates for resource update operation of server */ - IOTCON_PRESENCE_TRIGGER_RESOURCE_DESTROYED, /**< Indicates for resource destruction operation of server */ + IOTCON_PRESENCE_RESOURCE_CREATED, /**< Indicates for resource creation operation of server */ + IOTCON_PRESENCE_RESOURCE_UPDATED, /**< Indicates for resource update operation of server */ + IOTCON_PRESENCE_RESOURCE_DESTROYED, /**< Indicates for resource destruction operation of server */ } iotcon_presence_trigger_e; /** @@ -174,7 +174,7 @@ typedef enum { IOTCON_TYPE_NULL, /**< Indicates for representation that have null type */ IOTCON_TYPE_LIST, /**< Indicates for representation that have list type */ IOTCON_TYPE_STATE, /**< Indicates for representation that have another representation type */ -} iotcon_types_e; +} iotcon_type_e; /** * @brief Enumeration for properties of device information. @@ -223,8 +223,8 @@ typedef enum { * @since_tizen 3.0 */ typedef enum { - IOTCON_REMOTE_RESOURCE_STATE_ALIVE, /**< Indicates remote resource is alive */ - IOTCON_REMOTE_RESOURCE_STATE_LOST_SIGNAL, /**< Indicates remote resource is lost */ + IOTCON_REMOTE_RESOURCE_ALIVE, /**< Indicates remote resource is alive */ + IOTCON_REMOTE_RESOURCE_LOST_SIGNAL, /**< Indicates remote resource is lost */ } iotcon_remote_resource_state_e; /** diff --git a/lib/include/iotcon-list.h b/lib/include/iotcon-list.h index 24c57dd..e5631ad 100644 --- a/lib/include/iotcon-list.h +++ b/lib/include/iotcon-list.h @@ -175,7 +175,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter * @retval #IOTCON_ERROR_INVALID_TYPE Invalid type */ -int iotcon_list_create(iotcon_types_e type, iotcon_list_h *list); +int iotcon_list_create(iotcon_type_e type, iotcon_list_h *list); /** * @brief Destroys a list handle. @@ -436,7 +436,7 @@ int iotcon_list_remove_nth(iotcon_list_h list, int pos); /** * @brief Gets the type of the list. * @details It gets the data type of value related the @a key in @a state. - * The data type could be one of #iotcon_types_e. + * The data type could be one of #iotcon_type_e. * * @since_tizen 3.0 * @@ -447,7 +447,7 @@ int iotcon_list_remove_nth(iotcon_list_h list, int pos); * @retval #IOTCON_ERROR_NONE Successful * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter */ -int iotcon_list_get_type(iotcon_list_h list, iotcon_types_e *type); +int iotcon_list_get_type(iotcon_list_h list, iotcon_type_e *type); /** * @brief Gets the number of elements in a list. diff --git a/lib/include/iotcon-lite-resource.h b/lib/include/iotcon-lite-resource.h index 3e47f05..199002e 100644 --- a/lib/include/iotcon-lite-resource.h +++ b/lib/include/iotcon-lite-resource.h @@ -81,7 +81,7 @@ static void _create_light_resource() } ret = iotcon_lite_resource_create("/light/1", resource_types, - IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE, state, &resource); + IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE, state, &resource); if (IOTCON_ERROR_NONE != ret) { iotcon_state_destroy(state); iotcon_resource_types_destroy(resource_types); diff --git a/lib/include/iotcon-resource-types.h b/lib/include/iotcon-resource-types.h index 2ab619d..5db481a 100644 --- a/lib/include/iotcon-resource-types.h +++ b/lib/include/iotcon-resource-types.h @@ -61,7 +61,7 @@ static void _create_light_resource() } ret = iotcon_resource_create("/light/1", resource_types, IOTCON_INTERFACE_DEFAULT, - IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE, _request_handler, NULL, &resource); + IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE, _request_handler, NULL, &resource); if (IOTCON_ERROR_NONE != ret) { iotcon_resource_types_destroy(resource_types); return; diff --git a/lib/include/iotcon-resource.h b/lib/include/iotcon-resource.h index 3cc2bb4..223dac3 100644 --- a/lib/include/iotcon-resource.h +++ b/lib/include/iotcon-resource.h @@ -62,7 +62,7 @@ static void _create_resource() // 1. create room resource ifaces = IOTCON_INTERFACE_DEFAULT | IOTCON_INTERFACE_LINK | IOTCON_INTERFACE_BATCH; - properties = IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE; + properties = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE; ret = iotcon_resource_types_create(&resource_types); if (IOTCON_ERROR_NONE != ret) @@ -84,7 +84,7 @@ static void _create_resource() // 2. create door resource ifaces = IOTCON_INTERFACE_DEFAULT; - properties = IOTCON_OBSERVABLE; + properties = IOTCON_RESOURCE_OBSERVABLE; ret = iotcon_resource_types_create(&resource_types); if (IOTCON_ERROR_NONE != ret) { @@ -155,7 +155,7 @@ typedef void (*iotcon_request_handler_cb)(iotcon_resource_h resource, * @a ifaces can contain multiple interfaces like * IOTCON_INTERFACE_LINK | IOTCON_INTERFACE_BATCH.\n * @a properties also can contain multiple properties like - * IOTCON_ACTIVE | IOTCON_DISCOVERABLE.\n + * IOTCON_RESOURCE_ACTIVE | IOTCON_RESOURCE_DISCOVERABLE.\n * iotcon_request_handler_cb() will be called when receive CRUD request to the registered * resource. * diff --git a/lib/include/iotcon-response.h b/lib/include/iotcon-response.h index 5e7c28a..fb703e0 100644 --- a/lib/include/iotcon-response.h +++ b/lib/include/iotcon-response.h @@ -59,7 +59,7 @@ static void _on_get(iotcon_remote_resource_h resource, iotcon_error_e err, if (IOTCON_ERROR_NONE != ret) return; - if (IOTCON_RESPONSE_RESULT_OK != response_result) + if (IOTCON_RESPONSE_OK != response_result) return; ret = iotcon_response_get_representation(response, &repr); @@ -129,7 +129,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques if (IOTCON_ERROR_NONE != ret) return; - ret = iotcon_response_set_result(response, IOTCON_RESPONSE_RESULT_OK); + ret = iotcon_response_set_result(response, IOTCON_RESPONSE_OK); if (IOTCON_ERROR_NONE != ret) { iotcon_response_destroy(response); return; diff --git a/lib/include/iotcon-state.h b/lib/include/iotcon-state.h index 8e602eb..6111347 100644 --- a/lib/include/iotcon-state.h +++ b/lib/include/iotcon-state.h @@ -439,7 +439,7 @@ int iotcon_state_unset(iotcon_state_h state, const char *key); /** * @brief Gets the type of a value at the given key. * @details It gets the data type of value related the @a key in @a state. - * The data type could be one of #iotcon_types_e. + * The data type could be one of #iotcon_type_e. * * @since_tizen 3.0 * @@ -453,7 +453,7 @@ int iotcon_state_unset(iotcon_state_h state, const char *key); * @retval #IOTCON_ERROR_NO_DATA No data available */ int iotcon_state_get_type(iotcon_state_h state, const char *key, - iotcon_types_e *type); + iotcon_type_e *type); /** * @brief Specifies the type of function passed to iotcon_state_foreach() diff --git a/test/iotcon-test-basic-client.c b/test/iotcon-test-basic-client.c index 9676047..8c600e7 100644 --- a/test/iotcon-test-basic-client.c +++ b/test/iotcon-test-basic-client.c @@ -45,7 +45,7 @@ static void _on_observe(iotcon_remote_resource_h resource, iotcon_error_e err, return; } - if (IOTCON_RESPONSE_RESULT_OK != response_result) { + if (IOTCON_RESPONSE_OK != response_result) { ERR("_on_response_observe Response error(%d)", response_result); return; } @@ -98,8 +98,8 @@ static void _on_response_delete(iotcon_remote_resource_h resource, return; } - if (IOTCON_RESPONSE_RESULT_OK != response_result - && IOTCON_RESPONSE_RESULT_RESOURCE_DELETED != response_result) { + if (IOTCON_RESPONSE_OK != response_result + && IOTCON_RESPONSE_RESULT_DELETED != response_result) { ERR("_on_response_delete Response error(%d)", response_result); return; } @@ -128,8 +128,8 @@ static void _on_response_post(iotcon_remote_resource_h resource, return; } - if (IOTCON_RESPONSE_RESULT_OK != response_result - && IOTCON_RESPONSE_RESULT_RESOURCE_CREATED != response_result) { + if (IOTCON_RESPONSE_OK != response_result + && IOTCON_RESPONSE_RESOURCE_CREATED != response_result) { ERR("_on_response_post Response error(%d)", response_result); return; } @@ -206,7 +206,7 @@ static void _on_response_put(iotcon_remote_resource_h resource, iotcon_response_ return; } - if (IOTCON_RESPONSE_RESULT_OK != response_result) { + if (IOTCON_RESPONSE_OK != response_result) { ERR("_on_response_put Response error(%d)", response_result); return; } @@ -243,7 +243,7 @@ static void _on_response_get(iotcon_remote_resource_h resource, return; } - if (IOTCON_RESPONSE_RESULT_OK != response_result) { + if (IOTCON_RESPONSE_OK != response_result) { ERR("_on_response_get Response error(%d)", response_result); return; } diff --git a/test/iotcon-test-basic-server.c b/test/iotcon-test-basic-server.c index 0baf4ea..ecda6ba 100644 --- a/test/iotcon-test-basic-server.c +++ b/test/iotcon-test-basic-server.c @@ -62,7 +62,7 @@ static int _set_door_resource(door_resource_s *door) } door->ifaces = IOTCON_INTERFACE_DEFAULT; - door->properties = IOTCON_DISCOVERABLE; + door->properties = IOTCON_RESOURCE_DISCOVERABLE; ret = iotcon_observers_create(&door->observers); if (IOTCON_ERROR_NONE != ret) { @@ -225,7 +225,7 @@ static int _request_handler_get(door_resource_s *door, iotcon_request_h request) return -1; } - ret = _send_response(request, resp_repr, IOTCON_RESPONSE_RESULT_OK); + ret = _send_response(request, resp_repr, IOTCON_RESPONSE_OK); if (0 != ret) { ERR("_send_response() Fail(%d)", ret); iotcon_representation_destroy(resp_repr); @@ -286,7 +286,7 @@ static int _request_handler_put(door_resource_s *door, iotcon_request_h request) return -1; } - ret = _send_response(request, resp_repr, IOTCON_RESPONSE_RESULT_OK); + ret = _send_response(request, resp_repr, IOTCON_RESPONSE_OK); if (0 != ret) { ERR("_send_response() Fail(%d)", ret); iotcon_representation_destroy(resp_repr); @@ -354,7 +354,7 @@ static int _request_handler_post(door_resource_s *door, iotcon_request_h request } new_door_handle = _create_door_resource(DOOR_RESOURCE_URI2, door->type, - IOTCON_INTERFACE_DEFAULT, (IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE), door); + IOTCON_INTERFACE_DEFAULT, (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE), door); if (NULL == new_door_handle) { ERR("_create_door_resource() Fail"); return -1; @@ -393,7 +393,7 @@ static int _request_handler_post(door_resource_s *door, iotcon_request_h request iotcon_state_destroy(resp_state); - ret = _send_response(request, resp_repr, IOTCON_RESPONSE_RESULT_RESOURCE_CREATED); + ret = _send_response(request, resp_repr, IOTCON_RESPONSE_RESOURCE_CREATED); if (0 != ret) { ERR("_send_response() Fail(%d)", ret); iotcon_representation_destroy(resp_repr); @@ -416,7 +416,7 @@ static int _request_handler_delete(iotcon_resource_h resource, iotcon_request_h return -1; } - ret = _send_response(request, NULL, IOTCON_RESPONSE_RESULT_RESOURCE_DELETED); + ret = _send_response(request, NULL, IOTCON_RESPONSE_RESULT_DELETED); if (0 != ret) { ERR("_send_response() Fail(%d)", ret); return -1; @@ -447,7 +447,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques ret = iotcon_request_get_host_address(request, &host_address); if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_request_get_host_address() Fail(%d)", ret); - _send_response(request, NULL, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, IOTCON_RESPONSE_ERROR); return; } INFO("host_address : %s", host_address); @@ -455,7 +455,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques ret = iotcon_request_get_query(request, &query); if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_request_get_query() Fail(%d)", ret); - _send_response(request, NULL, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, IOTCON_RESPONSE_ERROR); return; } if (query) @@ -464,7 +464,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques ret = iotcon_request_get_request_type(request, &type); if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_request_get_types() Fail(%d)", ret); - _send_response(request, NULL, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, IOTCON_RESPONSE_ERROR); return; } @@ -484,7 +484,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques ret = _request_handler_delete(resource, request); if (0 != ret) { - _send_response(request, NULL, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, IOTCON_RESPONSE_ERROR); return; } @@ -561,7 +561,7 @@ int main(int argc, char **argv) /* add resource options */ my_door.ifaces |= IOTCON_INTERFACE_BATCH; - my_door.properties |= IOTCON_OBSERVABLE; + my_door.properties |= IOTCON_RESOURCE_OBSERVABLE; /* add presence */ g_timeout_add_seconds(10, _presence_timer, NULL); diff --git a/test/iotcon-test-encap-client.c b/test/iotcon-test-encap-client.c index ef9c2ce..ca4d3a8 100644 --- a/test/iotcon-test-encap-client.c +++ b/test/iotcon-test-encap-client.c @@ -45,10 +45,10 @@ static void _state_changed_cb(iotcon_remote_resource_h resource, INFO("Resource State is Changed"); switch (state) { - case IOTCON_REMOTE_RESOURCE_STATE_ALIVE: + case IOTCON_REMOTE_RESOURCE_ALIVE: INFO(" --- ALIVE"); break; - case IOTCON_REMOTE_RESOURCE_STATE_LOST_SIGNAL: + case IOTCON_REMOTE_RESOURCE_LOST_SIGNAL: INFO(" --- LOST_SIGNAL"); break; default: diff --git a/test/iotcon-test-encap-server.c b/test/iotcon-test-encap-server.c index c43237a..0a2b1f8 100644 --- a/test/iotcon-test-encap-server.c +++ b/test/iotcon-test-encap-server.c @@ -50,7 +50,7 @@ static int _set_door_resource(door_resource_s *door) return -1; } - door->properties = IOTCON_DISCOVERABLE; + door->properties = IOTCON_RESOURCE_DISCOVERABLE; return 0; } @@ -203,7 +203,7 @@ int main(int argc, char **argv) } /* add resource options */ - my_door.properties |= IOTCON_OBSERVABLE; + my_door.properties |= IOTCON_RESOURCE_OBSERVABLE; /* create new door resource */ my_door.handle = _create_door_resource(my_door.uri_path, my_door.type, diff --git a/test/iotcon-test-iface-client.c b/test/iotcon-test-iface-client.c index a14e8b1..f2a2ee9 100644 --- a/test/iotcon-test-iface-client.c +++ b/test/iotcon-test-iface-client.c @@ -184,7 +184,7 @@ static void _on_get_2nd(iotcon_remote_resource_h resource, return; } - if (IOTCON_RESPONSE_RESULT_OK == response_result) + if (IOTCON_RESPONSE_OK == response_result) _print_repr(recv_repr); else ERR("Invalid result(%d)", response_result); @@ -217,7 +217,7 @@ static void _on_response_1st(iotcon_remote_resource_h resource, return; } - if (IOTCON_RESPONSE_RESULT_OK == response_result) + if (IOTCON_RESPONSE_OK == response_result) _print_repr(recv_repr); else ERR("Invalid result(%d)", response_result); diff --git a/test/iotcon-test-iface-server.c b/test/iotcon-test-iface-server.c index 404b7b3..190e911 100644 --- a/test/iotcon-test-iface-server.c +++ b/test/iotcon-test-iface-server.c @@ -90,7 +90,7 @@ static int _set_room_resource(room_resource_s *room) } room->ifaces = IOTCON_INTERFACE_DEFAULT | IOTCON_INTERFACE_BATCH; - room->properties = IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE; + room->properties = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE; return 0; } @@ -120,7 +120,7 @@ static int _set_light_resource(light_resource_s *light) } light->ifaces = IOTCON_INTERFACE_DEFAULT; - light->properties = IOTCON_HIDDEN; + light->properties = IOTCON_RESOURCE_NO_PROPERTY; return 0; } @@ -149,7 +149,7 @@ static int _set_fan_resource(fan_resource_s *fan) } fan->ifaces = IOTCON_INTERFACE_DEFAULT; - fan->properties = IOTCON_HIDDEN; + fan->properties = IOTCON_RESOURCE_NO_PROPERTY; return 0; } @@ -296,7 +296,7 @@ static int _light_request_handler_get(light_resource_s *light, iotcon_request_h } ret = _send_response(request, repr, IOTCON_INTERFACE_DEFAULT, - IOTCON_RESPONSE_RESULT_OK); + IOTCON_RESPONSE_OK); if (0 != ret) { ERR("_send_response() Fail(%d)", ret); iotcon_representation_destroy(repr); @@ -373,7 +373,7 @@ static int _fan_request_handler_get(fan_resource_s *fan, iotcon_request_h reques } ret = _send_response(request, repr, IOTCON_INTERFACE_DEFAULT, - IOTCON_RESPONSE_RESULT_OK); + IOTCON_RESPONSE_OK); if (0 != ret) { ERR("_send_response() Fail(%d)", ret); iotcon_representation_destroy(repr); @@ -576,7 +576,7 @@ static int _room_request_handler_get(room_resource_s *room, iotcon_request_h req } } - ret = _send_response(request, repr, iface, IOTCON_RESPONSE_RESULT_OK); + ret = _send_response(request, repr, iface, IOTCON_RESPONSE_OK); if (0 != ret) { ERR("_send_response() Fail(%d)", ret); iotcon_representation_destroy(repr); @@ -601,16 +601,16 @@ static void _light_request_handler(iotcon_resource_h resource, iotcon_request_h ret = iotcon_request_get_request_type(request, &type); if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_request_get_types() Fail(%d)", ret); - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR); return; } if (IOTCON_REQUEST_GET == type) { ret = _light_request_handler_get(light, request); if (0 != ret) - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR); } else { - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_FORBIDDEN); + _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN); } } @@ -627,16 +627,16 @@ static void _fan_request_handler(iotcon_resource_h resource, iotcon_request_h re ret = iotcon_request_get_request_type(request, &type); if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_request_get_types() Fail(%d)", ret); - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR); return; } if (IOTCON_REQUEST_GET == type) { ret = _fan_request_handler_get(fan, request); if (0 != ret) - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR); } else { - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_FORBIDDEN); + _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN); } } @@ -655,7 +655,7 @@ static void _room_request_handler(iotcon_resource_h resource, iotcon_request_h r ret = iotcon_request_get_host_address(request, &host_address); if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_request_get_host_address() Fail(%d)", ret); - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR); return; } INFO("host address : %s", host_address); @@ -663,16 +663,16 @@ static void _room_request_handler(iotcon_resource_h resource, iotcon_request_h r ret = iotcon_request_get_request_type(request, &type); if (IOTCON_ERROR_NONE != ret) { ERR("iotcon_request_get_types() Fail(%d)", ret); - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR); return; } if (IOTCON_REQUEST_GET == type) { ret = _room_request_handler_get(room, request); if (0 != ret) - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR); + _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR); } else { - _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_FORBIDDEN); + _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN); } }