Rename API (iotcon_state_set_xxx -> iotcon_state_add_xxx)
authorsung.goo.kim <sung.goo.kim@samsung.com>
Fri, 20 Nov 2015 02:37:58 +0000 (11:37 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Fri, 20 Nov 2015 06:13:51 +0000 (15:13 +0900)
Change-Id: If39d3efab3786e834aac2389c759c076f258689a

doc/iotcon_doc.h
lib/icl-state.c
lib/include/iotcon-lite-resource.h
lib/include/iotcon-representation.h
lib/include/iotcon-state.h
test/iotcon-test-basic-client.c
test/iotcon-test-basic-server.c
test/iotcon-test-encap-server.c
test/iotcon-test-iface-server.c

index 984a993..53795e2 100644 (file)
@@ -90,7 +90,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
                        return;
                }
 
-               ret = iotcon_state_set_bool(resp_repr, "opened", true);
+               ret = iotcon_state_add_bool(resp_repr, "opened", true);
                if (IOTCON_ERROR_NONE != ret) {
                        iotcon_state_destroy(state);
                        iotcon_representation_destroy(resp_repr);
index fce11e7..3c71993 100644 (file)
@@ -144,7 +144,7 @@ API int iotcon_state_get_int(iotcon_state_h state, const char *key, int *val)
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_set_int(iotcon_state_h state, const char *key, int val)
+API int iotcon_state_add_int(iotcon_state_h state, const char *key, int val)
 {
        iotcon_value_h value;
 
@@ -162,7 +162,7 @@ API int iotcon_state_set_int(iotcon_state_h state, const char *key, int val)
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_unset(iotcon_state_h state, const char *key)
+API int iotcon_state_remove(iotcon_state_h state, const char *key)
 {
        int ret;
 
@@ -202,7 +202,7 @@ API int iotcon_state_get_bool(iotcon_state_h state, const char *key, bool *val)
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_set_bool(iotcon_state_h state, const char *key, bool val)
+API int iotcon_state_add_bool(iotcon_state_h state, const char *key, bool val)
 {
        iotcon_value_h value = NULL;
 
@@ -246,7 +246,7 @@ API int iotcon_state_get_double(iotcon_state_h state, const char *key, double *v
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_set_double(iotcon_state_h state, const char *key, double val)
+API int iotcon_state_add_double(iotcon_state_h state, const char *key, double val)
 {
        iotcon_value_h value = NULL;
 
@@ -290,7 +290,7 @@ API int iotcon_state_get_str(iotcon_state_h state, const char *key, char **val)
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_set_str(iotcon_state_h state, const char *key, char *val)
+API int iotcon_state_add_str(iotcon_state_h state, const char *key, char *val)
 {
        iotcon_value_h value = NULL;
 
@@ -329,7 +329,7 @@ API int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_nul
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_set_null(iotcon_state_h state, const char *key)
+API int iotcon_state_add_null(iotcon_state_h state, const char *key)
 {
        iotcon_value_h value = NULL;
 
@@ -373,7 +373,7 @@ API int iotcon_state_get_list(iotcon_state_h state, const char *key, iotcon_list
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_set_list(iotcon_state_h state, const char *key, iotcon_list_h list)
+API int iotcon_state_add_list(iotcon_state_h state, const char *key, iotcon_list_h list)
 {
        iotcon_value_h value = NULL;
 
@@ -419,7 +419,7 @@ API int iotcon_state_get_state(iotcon_state_h src, const char *key, iotcon_state
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_set_state(iotcon_state_h state, const char *key, iotcon_state_h val)
+API int iotcon_state_add_state(iotcon_state_h state, const char *key, iotcon_state_h val)
 {
        iotcon_value_h value = NULL;
 
index 199002e..42743ac 100644 (file)
@@ -66,14 +66,14 @@ static void _create_light_resource()
                return;
        }
 
-       ret = iotcon_state_set_bool(state, "power", true);
+       ret = iotcon_state_add_bool(state, "power", true);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_state_destroy(state);
                iotcon_resource_types_destroy(resource_types);
                return;
        }
 
-       ret = iotcon_state_set_int(state, "brightness", 75);
+       ret = iotcon_state_add_int(state, "brightness", 75);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_state_destroy(state);
                iotcon_resource_types_destroy(resource_types);
@@ -108,7 +108,7 @@ static void _update_brightness(int brightness)
        if (IOTCON_ERROR_NONE != ret)
                return;
 
-       ret = iotcon_state_set_int(state_clone, "brightness", brightness);
+       ret = iotcon_state_add_int(state_clone, "brightness", brightness);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_state_destroy(state_clone);
                return;
index 6897169..db83bc7 100644 (file)
                return;
        }
 
-       ret = iotcon_state_set_str(resp_repr, "type", "lamp");
+       ret = iotcon_state_add_str(resp_repr, "type", "lamp");
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(types);
                iotcon_representation_destroy(resp_repr);
                return;
        }
 
-       ret = iotcon_state_set_str(resp_repr, "where", "desk");
+       ret = iotcon_state_add_str(resp_repr, "where", "desk");
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(types);
                iotcon_representation_destroy(resp_repr);
                return;
        }
 
-       ret = iotcon_state_set_double(resp_repr, "default_bright", 200.0);
+       ret = iotcon_state_add_double(resp_repr, "default_bright", 200.0);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(types);
                iotcon_representation_destroy(resp_repr);
                return;
        }
 
-       ret = iotcon_state_set_str(resp_repr, "unit", "lux");
+       ret = iotcon_state_add_str(resp_repr, "unit", "lux");
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(types);
                iotcon_representation_destroy(resp_repr);
                return;
        }
 
-       ret = iotcon_state_set_bool(resp_repr, "bright_step", true);
+       ret = iotcon_state_add_bool(resp_repr, "bright_step", true);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(types);
                iotcon_representation_destroy(resp_repr);
                return;
        }
 
-       ret = iotcon_state_set_list(resp_repr, "bright_step_list", bright_step_list);
+       ret = iotcon_state_add_list(resp_repr, "bright_step_list", bright_step_list);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_list_destroy(bright_step_list);
                iotcon_resource_types_destroy(types);
index 6111347..61e9961 100644 (file)
@@ -72,7 +72,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
                        return;
                }
 
-               ret = iotcon_state_set_bool(state, "power", true);
+               ret = iotcon_state_add_bool(state, "power", true);
                if (IOTCON_ERROR_NONE != ret) {
                        iotcon_state_destroy(state);
                        iotcon_representation_destroy(representation);
@@ -181,7 +181,7 @@ void iotcon_state_destroy(iotcon_state_h state);
 int iotcon_state_clone(iotcon_state_h state, iotcon_state_h *state_clone);
 
 /**
- * @brief Sets a new key and integer value into the representation.
+ * @brief Adds a new key and integer value into the representation.
  * @details If @a key is already exists, current value will be replaced with new @a val.
  *
  * @since_tizen 3.0
@@ -195,10 +195,10 @@ int iotcon_state_clone(iotcon_state_h state, iotcon_state_h *state_clone);
  * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  */
-int iotcon_state_set_int(iotcon_state_h state, const char *key, int val);
+int iotcon_state_add_int(iotcon_state_h state, const char *key, int val);
 
 /**
- * @brief Sets a new key and boolean value into the representation.
+ * @brief Adds a new key and boolean value into the representation.
  * @details If @a key is already exists, current value will be replaced with new @a val.
  *
  * @since_tizen 3.0
@@ -212,10 +212,10 @@ int iotcon_state_set_int(iotcon_state_h state, const char *key, int val);
  * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  */
-int iotcon_state_set_bool(iotcon_state_h state, const char *key, bool val);
+int iotcon_state_add_bool(iotcon_state_h state, const char *key, bool val);
 
 /**
- * @brief Sets a new key and double value into the representation.
+ * @brief Adds a new key and double value into the representation.
  * @details If @a key is already exists, current value will be replaced with new @a val.
  *
  * @since_tizen 3.0
@@ -229,10 +229,10 @@ int iotcon_state_set_bool(iotcon_state_h state, const char *key, bool val);
  * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  */
-int iotcon_state_set_double(iotcon_state_h state, const char *key, double val);
+int iotcon_state_add_double(iotcon_state_h state, const char *key, double val);
 
 /**
- * @brief Sets a new key and string value into the representation.
+ * @brief Adds a new key and string value into the representation.
  * @details If @a key is already exists, current value will be replaced with new @a val.
  *
  * @since_tizen 3.0
@@ -246,10 +246,10 @@ int iotcon_state_set_double(iotcon_state_h state, const char *key, double val);
  * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  */
-int iotcon_state_set_str(iotcon_state_h state, const char *key, char *val);
+int iotcon_state_add_str(iotcon_state_h state, const char *key, char *val);
 
 /**
- * @brief Sets a new key and list value into the representation.
+ * @brief Adds a new key and list value into the representation.
  * @details If @a key is already exists, current list will be replaced with new @a list.
  *
  * @since_tizen 3.0
@@ -263,10 +263,10 @@ int iotcon_state_set_str(iotcon_state_h state, const char *key, char *val);
  * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  */
-int iotcon_state_set_list(iotcon_state_h state, const char *key, iotcon_list_h list);
+int iotcon_state_add_list(iotcon_state_h state, const char *key, iotcon_list_h list);
 
 /**
- * @brief Sets a new key and state value into the representation.
+ * @brief Adds a new key and state value into the representation.
  * @details If @a key is already exists, current state will be replaced with new @a src.
  *
  * @since_tizen 3.0
@@ -280,10 +280,10 @@ int iotcon_state_set_list(iotcon_state_h state, const char *key, iotcon_list_h l
  * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  */
-int iotcon_state_set_state(iotcon_state_h dest, const char *key, iotcon_state_h src);
+int iotcon_state_add_state(iotcon_state_h dest, const char *key, iotcon_state_h src);
 
 /**
- * @brief Sets a new key with NULL value into the representation.
+ * @brief Adds a new key with NULL value into the representation.
  * @details If @a key is already exists, current value will be replaced with NULL
  *
  * @since_tizen 3.0
@@ -296,7 +296,7 @@ int iotcon_state_set_state(iotcon_state_h dest, const char *key, iotcon_state_h
  * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  */
-int iotcon_state_set_null(iotcon_state_h state, const char *key);
+int iotcon_state_add_null(iotcon_state_h state, const char *key);
 
 /**
  * @brief Gets the integer value from the given key.
@@ -422,7 +422,7 @@ int iotcon_state_get_state(iotcon_state_h src, const char *key, iotcon_state_h *
 int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_null);
 
 /**
- * @brief Unsets the key and its associated value from the state.
+ * @brief Removes the key and its associated value from the state.
  *
  * @since_tizen 3.0
  *
@@ -434,7 +434,7 @@ int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_null);
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_NO_DATA  No data available
  */
-int iotcon_state_unset(iotcon_state_h state, const char *key);
+int iotcon_state_remove(iotcon_state_h state, const char *key);
 
 /**
  * @brief Gets the type of a value at the given key.
index 8c600e7..62ef31c 100644 (file)
@@ -284,9 +284,9 @@ static void _on_response_get(iotcon_remote_resource_h resource,
                return;
        }
 
-       ret = iotcon_state_set_bool(send_state, "opened", !opened);
+       ret = iotcon_state_add_bool(send_state, "opened", !opened);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_bool() Fail(%d)", ret);
+               ERR("iotcon_state_add_bool() Fail(%d)", ret);
                iotcon_state_destroy(send_state);
                iotcon_representation_destroy(send_repr);
                return;
index ecda6ba..69f5e05 100644 (file)
@@ -192,9 +192,9 @@ static iotcon_representation_h _get_door_representation(door_resource_s *door)
                return NULL;
        }
 
-       ret = iotcon_state_set_bool(state, "opened", door->state);
+       ret = iotcon_state_add_bool(state, "opened", door->state);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_bool() Fail(%d)", ret);
+               ERR("iotcon_state_add_bool() Fail(%d)", ret);
                iotcon_state_destroy(state);
                iotcon_representation_destroy(repr);
                return NULL;
@@ -375,9 +375,9 @@ static int _request_handler_post(door_resource_s *door, iotcon_request_h request
                return -1;
        }
 
-       ret = iotcon_state_set_str(resp_state, "createduripath", DOOR_RESOURCE_URI2);
+       ret = iotcon_state_add_str(resp_state, "createduripath", DOOR_RESOURCE_URI2);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_str() Fail(%d)", ret);
+               ERR("iotcon_state_add_str() Fail(%d)", ret);
                iotcon_state_destroy(resp_state);
                iotcon_representation_destroy(resp_repr);
                return -1;
index 0a2b1f8..d53bbf2 100644 (file)
@@ -98,9 +98,9 @@ static gboolean _door_state_changer(gpointer user_data)
                return G_SOURCE_CONTINUE;
        }
 
-       ret = iotcon_state_set_bool(send_state, "opened", door->state);
+       ret = iotcon_state_add_bool(send_state, "opened", door->state);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_bool() Fail(%d)", ret);
+               ERR("iotcon_state_add_bool() Fail(%d)", ret);
                iotcon_state_destroy(send_state);
                return G_SOURCE_CONTINUE;
        }
@@ -147,9 +147,9 @@ static iotcon_lite_resource_h _create_door_resource(char *uri_path, char *type,
                return NULL;
        }
 
-       ret = iotcon_state_set_bool(state, "opened", false);
+       ret = iotcon_state_add_bool(state, "opened", false);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_bool() Fail(%d)", ret);
+               ERR("iotcon_state_add_bool() Fail(%d)", ret);
                iotcon_state_destroy(state);
                iotcon_resource_types_destroy(resource_types);
                return NULL;
index 190e911..1ecec08 100644 (file)
@@ -260,9 +260,9 @@ static iotcon_representation_h _get_light_representation(light_resource_s *light
                return NULL;
        }
 
-       ret = iotcon_state_set_int(state, "brightness", light->brightness);
+       ret = iotcon_state_add_int(state, "brightness", light->brightness);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_int() Fail(%d)", ret);
+               ERR("iotcon_state_add_int() Fail(%d)", ret);
                iotcon_state_destroy(state);
                iotcon_representation_destroy(repr);
                return NULL;
@@ -337,9 +337,9 @@ static iotcon_representation_h _get_fan_representation(fan_resource_s *fan)
                return NULL;
        }
 
-       ret = iotcon_state_set_bool(state, "state", fan->state);
+       ret = iotcon_state_add_bool(state, "state", fan->state);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_bool() Fail(%d)", ret);
+               ERR("iotcon_state_add_bool() Fail(%d)", ret);
                iotcon_state_destroy(state);
                iotcon_representation_destroy(repr);
                return NULL;
@@ -414,18 +414,18 @@ static iotcon_representation_h _get_room_representation(room_resource_s *room)
                return NULL;
        }
 
-       ret = iotcon_state_set_str(state, "name", room->name);
+       ret = iotcon_state_add_str(state, "name", room->name);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_str() Fail(%d)", ret);
+               ERR("iotcon_state_add_str() Fail(%d)", ret);
                iotcon_state_destroy(state);
                iotcon_representation_destroy(repr);
                return NULL;
        }
 
        /* set null */
-       ret = iotcon_state_set_null(state, "null value");
+       ret = iotcon_state_add_null(state, "null value");
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_null() Fail(%d)", ret);
+               ERR("iotcon_state_add_null() Fail(%d)", ret);
                iotcon_state_destroy(state);
                iotcon_representation_destroy(repr);
                return NULL;
@@ -484,9 +484,9 @@ static iotcon_representation_h _get_room_representation(room_resource_s *room)
                return NULL;
        }
 
-       ret = iotcon_state_set_list(state, "today_temp", today_temp);
+       ret = iotcon_state_add_list(state, "today_temp", today_temp);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_state_set_list() Fail(%d)", ret);
+               ERR("iotcon_state_add_list() Fail(%d)", ret);
                iotcon_list_destroy(today_temp);
                iotcon_state_destroy(state);
                iotcon_representation_destroy(repr);