Modify name from resource_properties to resource_policies 09/71609/3
authorsung.goo.kim <sung.goo.kim@samsung.com>
Thu, 26 May 2016 06:48:46 +0000 (15:48 +0900)
committersung.goo.kim <sung.goo.kim@samsung.com>
Thu, 26 May 2016 23:14:44 +0000 (08:14 +0900)
Change-Id: I09cc875138f6d27d7ec4891f0b9400fef5498c4b

20 files changed:
common/ic-ioty-types.c
common/ic-ioty-types.h
doc/iotcon_doc.h
lib/icl-ioty-types.c
lib/icl-ioty.c
lib/icl-ioty.h
lib/icl-lite-resource.c
lib/icl-lite-resource.h
lib/icl-remote-resource.c
lib/icl-remote-resource.h
lib/icl-resource.c
lib/icl-resource.h
lib/include/iotcon-constant.h
lib/include/iotcon-lite-resource.h
lib/include/iotcon-remote-resource.h
lib/include/iotcon-resource.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 c2f299c956e190a94040b82fd8bbfd76e5d0ea5c..3bb6f1343e173d73247c452d455c7a4395af0939 100644 (file)
@@ -156,29 +156,29 @@ int ic_ioty_parse_oic_dev_address(OCDevAddr *dev_addr, char **host_address,
 }
 
 
-int ic_ioty_parse_oic_properties(int oic_properties)
+uint8_t ic_ioty_parse_oic_policies(uint8_t oic_policies)
 {
-       int prop = IOTCON_RESOURCE_NO_PROPERTY;
+       uint8_t policies = IOTCON_RESOURCE_NO_POLICY;
 
-       if (OC_DISCOVERABLE & oic_properties)
-               prop |= IOTCON_RESOURCE_DISCOVERABLE;
+       if (OC_DISCOVERABLE & oic_policies)
+               policies |= IOTCON_RESOURCE_DISCOVERABLE;
 
-       if (OC_OBSERVABLE & oic_properties)
-               prop |= IOTCON_RESOURCE_OBSERVABLE;
+       if (OC_OBSERVABLE & oic_policies)
+               policies |= IOTCON_RESOURCE_OBSERVABLE;
 
-       if (OC_ACTIVE & oic_properties)
-               prop |= IOTCON_RESOURCE_ACTIVE;
+       if (OC_ACTIVE & oic_policies)
+               policies |= IOTCON_RESOURCE_ACTIVE;
 
-       if (OC_SLOW & oic_properties)
-               prop |= IOTCON_RESOURCE_SLOW;
+       if (OC_SLOW & oic_policies)
+               policies |= IOTCON_RESOURCE_SLOW;
 
-       if (OC_SECURE & oic_properties)
-               prop |= IOTCON_RESOURCE_SECURE;
+       if (OC_SECURE & oic_policies)
+               policies |= IOTCON_RESOURCE_SECURE;
 
-       if (OC_EXPLICIT_DISCOVERABLE & oic_properties)
-               prop |= IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE;
+       if (OC_EXPLICIT_DISCOVERABLE & oic_policies)
+               policies |= IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE;
 
-       return prop;
+       return policies;
 }
 
 iotcon_error_e ic_ioty_parse_oic_error(OCStackResult ret)
@@ -309,28 +309,28 @@ OCQualityOfService ic_ioty_convert_qos(iotcon_qos_e qos)
        return OC_NA_QOS;
 }
 
-int ic_ioty_convert_properties(int properties)
+uint8_t ic_ioty_convert_policies(uint8_t policies)
 {
-       int prop = OC_RES_PROP_NONE;
+       uint8_t oic_policies = OC_RES_PROP_NONE;
 
-       if (IOTCON_RESOURCE_DISCOVERABLE & properties)
-               prop |= OC_DISCOVERABLE;
+       if (IOTCON_RESOURCE_DISCOVERABLE & policies)
+               oic_policies |= OC_DISCOVERABLE;
 
-       if (IOTCON_RESOURCE_OBSERVABLE & properties)
-               prop |= OC_OBSERVABLE;
+       if (IOTCON_RESOURCE_OBSERVABLE & policies)
+               oic_policies |= OC_OBSERVABLE;
 
-       if (IOTCON_RESOURCE_ACTIVE & properties)
-               prop |= OC_ACTIVE;
+       if (IOTCON_RESOURCE_ACTIVE & policies)
+               oic_policies |= OC_ACTIVE;
 
-       if (IOTCON_RESOURCE_SLOW & properties)
-               prop |= OC_SLOW;
+       if (IOTCON_RESOURCE_SLOW & policies)
+               oic_policies |= OC_SLOW;
 
-       if (IOTCON_RESOURCE_SECURE & properties)
-               prop |= OC_SECURE;
+       if (IOTCON_RESOURCE_SECURE & policies)
+               oic_policies |= OC_SECURE;
 
-       if (IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE & properties)
-               prop |= OC_EXPLICIT_DISCOVERABLE;
+       if (IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE & policies)
+               oic_policies |= OC_EXPLICIT_DISCOVERABLE;
 
-       return prop;
+       return oic_policies;
 }
 
index 6ed120a5526cd81ca439a812e5e14eb84d56b582..92d49426ec7d09281827a099ae7f1a57c5371c00 100644 (file)
@@ -24,7 +24,7 @@ iotcon_connectivity_type_e ic_ioty_parse_oic_transport(OCTransportAdapter adapte
                OCTransportFlags flag);
 iotcon_request_type_e ic_ioty_parse_oic_method(OCMethod method);
 iotcon_response_result_e ic_ioty_parse_oic_response_result(OCStackResult result);
-int ic_ioty_parse_oic_properties(int properties);
+uint8_t ic_ioty_parse_oic_policies(uint8_t policies);
 iotcon_error_e ic_ioty_parse_oic_error(OCStackResult ret);
 iotcon_presence_trigger_e ic_ioty_parse_oic_trigger(OCPresenceTrigger src);
 iotcon_observe_type_e ic_ioty_parse_oic_action(OCObserveAction oic_action);
@@ -39,6 +39,6 @@ OCEntityHandlerResult ic_ioty_convert_response_result(iotcon_response_result_e r
 OCQualityOfService ic_ioty_convert_qos(iotcon_qos_e qos);
 int ic_ioty_convert_connectivity(const char *host_address, int conn_type,
                OCDevAddr *dev_addr);
-int ic_ioty_convert_properties(int properties);
+uint8_t ic_ioty_convert_policies(uint8_t policies);
 
 #endif /*__IOT_CONNECTIVITY_COMMON_IOTIVITY_TYPES_H__*/
index dea385968359ee4b61a79a370302733086fc3b1e..17af6f9c6de9624e6629a6fc238e976ad377cd83 100644 (file)
@@ -125,7 +125,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
 ...
 {
        int ret;
-       int properties = (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE);
+       uint8_t policies = (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE);
        const char *uri_path = "/door/1";
        const char *type = "org.tizen.door";
        iotcon_resource_types_h resource_types;
@@ -155,7 +155,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
        }
 
        ret = iotcon_resource_create(uri_path, resource_types,
-                       resource_ifaces, properties, _request_handler, NULL, &resource);
+                       resource_ifaces, policies, _request_handler, NULL, &resource);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_interfaces_destroy(resource_ifaces);
                iotcon_resource_types_destroy(resource_types);
@@ -311,7 +311,7 @@ static void _request_handler(iotcon_request_h request, void *user_data)
 ...
 {
        int ret;
-       int properties = (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE);
+       uint8_t policies = (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE);
        const char *uri_path = "/door/1";
        const char *type = "org.tizen.door";
        iotcon_resource_types_h resource_types;
@@ -340,7 +340,7 @@ static void _request_handler(iotcon_request_h request, void *user_data)
        }
 
        ret = iotcon_resource_create(uri_path, resource_types,
-                       resource_ifaces, properties, _request_handler, NULL, &_door_handle);
+                       resource_ifaces, policies, _request_handler, NULL, &_door_handle);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_interfaces_destroy(resource_ifaces);
                iotcon_resource_types_destroy(resource_types);
index c4a5d70ecadaf516b0d0f4029f64475ba0b7e056..d2d8e0b311ba61360dc0e90ceeaee12de8f77cd1 100644 (file)
@@ -88,7 +88,8 @@ int icl_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
        }
 
        for (i = 0; res_payload; i++, res_payload = res_payload->next) {
-               int port, properties, conn_type;
+               int port, conn_type;
+               uint8_t policies;
                iotcon_resource_interfaces_h ifaces;
                iotcon_resource_types_h types;
                char host_addr[PATH_MAX] = {0};
@@ -138,10 +139,10 @@ int icl_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
                for (; node; node = node->next)
                        iotcon_resource_interfaces_add(ifaces, node->value);
 
-               /* Resource Properties */
-               properties = ic_ioty_parse_oic_properties(res_payload->bitmap);
+               /* Resource Policies */
+               policies = ic_ioty_parse_oic_policies(res_payload->bitmap);
                if (res_payload->secure)
-                       properties |= IOTCON_RESOURCE_SECURE;
+                       policies |= IOTCON_RESOURCE_SECURE;
 
                /* port */
                port = (res_payload->port) ? res_payload->port : dev_addr->port;
@@ -162,7 +163,7 @@ int icl_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
                }
 
                ret = iotcon_remote_resource_create(host_addr, conn_type, res_payload->uri,
-                               properties, types, ifaces, &(res_list[i]));
+                               policies, types, ifaces, &(res_list[i]));
                if (IOTCON_ERROR_NONE != ret) {
                        ERR("iotcon_remote_resource_create() Fail(%d)", ret);
                        iotcon_resource_interfaces_destroy(ifaces);
index e19dcd91ce5869f9513afb15be0a2f0ce344f1d5..cb2468e7b8f93b4ef864a441f4976d079090bf02 100644 (file)
@@ -602,7 +602,7 @@ static int _icl_ioty_remote_resource_observe(iotcon_remote_resource_h resource,
                return ret;
        }
 
-       if (IOTCON_RESOURCE_SECURE & resource->properties)
+       if (IOTCON_RESOURCE_SECURE & resource->policies)
                dev_addr.flags |= OC_FLAG_SECURE;
 
        /* options */
@@ -807,7 +807,7 @@ static int _icl_ioty_remote_resource_crud(
                return ret;
        }
 
-       if (IOTCON_RESOURCE_SECURE & resource->properties)
+       if (IOTCON_RESOURCE_SECURE & resource->policies)
                dev_addr.flags |= OC_FLAG_SECURE;
 
        /* representation */
@@ -1351,7 +1351,7 @@ static int _icl_ioty_resource_bind_interface(OCResourceHandle handle,
 int icl_ioty_resource_create(const char *uri_path,
                iotcon_resource_types_h res_types,
                iotcon_resource_interfaces_h ifaces,
-               int properties,
+               uint8_t policies,
                iotcon_request_handler_cb cb,
                void *user_data,
                iotcon_resource_h *resource_handle)
@@ -1376,18 +1376,18 @@ int icl_ioty_resource_create(const char *uri_path,
                return IOTCON_ERROR_OUT_OF_MEMORY;
        }
        resource->uri_path = strdup(uri_path);
-       resource->properties = properties;
+       resource->policies = policies;
        resource->types = icl_resource_types_ref(res_types);
        resource->ifaces = icl_resource_interfaces_ref(ifaces);
 
        resource->cb = cb;
        resource->user_data = user_data;
 
-       properties = ic_ioty_convert_properties(properties);
+       policies = ic_ioty_convert_policies(policies);
 
        ic_utils_mutex_lock(IC_UTILS_MUTEX_IOTY);
        ret = OCCreateResource(&handle, res_types->type_list->data, ifaces->iface_list->data,
-                       uri_path, icl_ioty_ocprocess_request_cb, resource, properties);
+                       uri_path, icl_ioty_ocprocess_request_cb, resource, policies);
        ic_utils_mutex_unlock(IC_UTILS_MUTEX_IOTY);
        if (OC_STACK_OK != ret) {
                ERR("OCCreateResource() Fail(%d)", ret);
@@ -1607,7 +1607,7 @@ int icl_ioty_resource_destroy(iotcon_resource_h resource)
 
 int icl_ioty_lite_resource_create(const char *uri_path,
                iotcon_resource_types_h res_types,
-               int properties,
+               uint8_t policies,
                iotcon_state_h state,
                iotcon_lite_resource_post_request_cb cb,
                void *user_data,
@@ -1633,7 +1633,7 @@ int icl_ioty_lite_resource_create(const char *uri_path,
                return IOTCON_ERROR_OUT_OF_MEMORY;
        }
        resource->uri_path = strdup(uri_path);
-       resource->properties = properties;
+       resource->policies = policies;
        resource->state = state;
        icl_state_ref(resource->state);
        resource->cb = cb;
@@ -1641,11 +1641,11 @@ int icl_ioty_lite_resource_create(const char *uri_path,
 
        res_iface = IOTCON_INTERFACE_DEFAULT;
 
-       properties = ic_ioty_convert_properties(properties);
+       policies = ic_ioty_convert_policies(policies);
 
        ic_utils_mutex_lock(IC_UTILS_MUTEX_IOTY);
        ret = OCCreateResource(&handle, res_types->type_list->data, res_iface, uri_path,
-                       icl_ioty_ocprocess_lite_request_cb, resource, properties);
+                       icl_ioty_ocprocess_lite_request_cb, resource, policies);
        ic_utils_mutex_unlock(IC_UTILS_MUTEX_IOTY);
        if (OC_STACK_OK != ret) {
                ERR("OCCreateResource() Fail(%d)", ret);
index 8876458e18b9f18b1a113ada7bea4bd045796c9c..094527ab9617666d9d860ac57a35433872f080dd 100644 (file)
@@ -111,7 +111,7 @@ int icl_ioty_stop_presence();
 int icl_ioty_resource_create(const char *uri_path,
                iotcon_resource_types_h res_types,
                iotcon_resource_interfaces_h ifaces,
-               int properties,
+               uint8_t policies,
                iotcon_request_handler_cb cb,
                void *user_data,
                iotcon_resource_h *resource_handle);
@@ -129,7 +129,7 @@ int icl_ioty_resource_destroy(iotcon_resource_h resource);
 
 int icl_ioty_lite_resource_create(const char *uri_path,
                iotcon_resource_types_h res_types,
-               int properties,
+               uint8_t policies,
                iotcon_state_h state,
                iotcon_lite_resource_post_request_cb cb,
                void *user_data,
index 211d5f03336749e279c0e28051a91365344197c9..37eb0b9cca569099c26ad33aafdddaffe052e3bd 100644 (file)
@@ -33,7 +33,7 @@
 /* The length of uri_path should be less than or equal to 36. */
 API int iotcon_lite_resource_create(const char *uri_path,
                iotcon_resource_types_h res_types,
-               int properties,
+               uint8_t policies,
                iotcon_state_h state,
                iotcon_lite_resource_post_request_cb cb,
                void *user_data,
@@ -50,7 +50,7 @@ API int iotcon_lite_resource_create(const char *uri_path,
        RETV_IF(NULL == res_types, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == resource_handle, IOTCON_ERROR_INVALID_PARAMETER);
 
-       ret = icl_ioty_lite_resource_create(uri_path, res_types, properties, state, cb,
+       ret = icl_ioty_lite_resource_create(uri_path, res_types, policies, state, cb,
                        user_data, resource_handle);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("icl_ioty_lite_resource_create() Fail(%d)", ret);
index 6b194ae1b0e6ce9bde83075d906c66c94688ea05..26b4e21ffb922bbed7fe0dca570b996fd158ed62 100644 (file)
@@ -24,7 +24,7 @@ struct icl_lite_resource {
        char *uri_path;
        iotcon_state_h state;
        int64_t handle;
-       int properties;
+       uint8_t policies;
        iotcon_lite_resource_post_request_cb cb;
        void *cb_data;
 };
index bac98b8a90baa09da863068c549c746838f61d73..f7ac7df484b146d39863d0d46b3cf1803c79fd04 100644 (file)
@@ -72,7 +72,7 @@ API int iotcon_find_resource(const char *host_address,
 API int iotcon_remote_resource_create(const char *host_address,
                iotcon_connectivity_type_e connectivity_type,
                const char *uri_path,
-               int properties,
+               uint8_t policies,
                iotcon_resource_types_h resource_types,
                iotcon_resource_interfaces_h resource_ifaces,
                iotcon_remote_resource_h *resource_handle)
@@ -98,7 +98,7 @@ API int iotcon_remote_resource_create(const char *host_address,
        resource->host_address = ic_utils_strdup(host_address);
        resource->connectivity_type = connectivity_type;
        resource->uri_path = ic_utils_strdup(uri_path);
-       resource->properties = properties;
+       resource->policies = policies;
        resource->types = icl_resource_types_ref(resource_types);
        resource->ifaces = icl_resource_interfaces_ref(resource_ifaces);
        resource->ref_count = 1;
@@ -207,7 +207,7 @@ API int iotcon_remote_resource_clone(iotcon_remote_resource_h src,
        resource->host_address = ic_utils_strdup(src->host_address);
        resource->connectivity_type = src->connectivity_type;
        resource->device_id = ic_utils_strdup(src->device_id);
-       resource->properties = src->properties;
+       resource->policies = src->policies;
        resource->ref_count = 1;
 
        if (src->header_options) {
@@ -327,14 +327,14 @@ API int iotcon_remote_resource_get_interfaces(iotcon_remote_resource_h resource,
 }
 
 
-API int iotcon_remote_resource_get_properties(iotcon_remote_resource_h resource,
-               int *properties)
+API int iotcon_remote_resource_get_policies(iotcon_remote_resource_h resource,
+               uint8_t *policies)
 {
        RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
        RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
-       RETV_IF(NULL == properties, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == policies, IOTCON_ERROR_INVALID_PARAMETER);
 
-       *properties = resource->properties;
+       *policies = resource->policies;
 
        return IOTCON_ERROR_NONE;
 }
index 1c6480b9fcc8606312ebdf690e879c190dcb4112..719baacbdba044373a76b25a2aa93a57664b58f1 100644 (file)
@@ -29,7 +29,7 @@ struct icl_remote_resource {
        char *uri_path;
        char *host_address;
        char *device_id;
-       int properties;
+       uint8_t policies;
        iotcon_options_h header_options;
        iotcon_resource_types_h types;
        iotcon_resource_interfaces_h ifaces;
index 0641507e9c270cdc27b2ab90a1d4e5ea4988102c..e95952ddc861e8427a20bf625fbe94fa8df62f62 100644 (file)
@@ -106,7 +106,7 @@ bool icl_resource_check_interface(const char *iface)
 API int iotcon_resource_create(const char *uri_path,
                iotcon_resource_types_h res_types,
                iotcon_resource_interfaces_h ifaces,
-               int properties,
+               uint8_t policies,
                iotcon_request_handler_cb cb,
                void *user_data,
                iotcon_resource_h *resource_handle)
@@ -124,7 +124,7 @@ API int iotcon_resource_create(const char *uri_path,
        RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == resource_handle, IOTCON_ERROR_INVALID_PARAMETER);
 
-       ret = icl_ioty_resource_create(uri_path, res_types, ifaces, properties, cb,
+       ret = icl_ioty_resource_create(uri_path, res_types, ifaces, policies, cb,
                        user_data, resource_handle);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("icl_ioty_resource_create() Fail(%d)", ret);
@@ -350,13 +350,13 @@ API int iotcon_resource_get_interfaces(iotcon_resource_h resource,
 }
 
 
-API int iotcon_resource_get_properties(iotcon_resource_h resource, int *properties)
+API int iotcon_resource_get_policies(iotcon_resource_h resource, uint8_t *policies)
 {
        RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
        RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
-       RETV_IF(NULL == properties, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == policies, IOTCON_ERROR_INVALID_PARAMETER);
 
-       *properties = resource->properties;
+       *policies = resource->policies;
 
        return IOTCON_ERROR_NONE;
 }
index 10181bb8c7d1e7da8a5b4003f50f0c20b7c7603c..05c4663614d01ade18ecc681389b890abdd4bbd4 100644 (file)
@@ -35,7 +35,7 @@ struct icl_notify_msg {
 
 struct icl_resource {
        char *uri_path;
-       int properties;
+       uint8_t policies;
        iotcon_resource_types_h types;
        iotcon_resource_interfaces_h ifaces;
        iotcon_request_handler_cb cb;
index 3c156a12da8e2477395a365513962b7a2b6354e7..da4bc9a95b7b536309af1d874ea43f745fdc3d61 100644 (file)
@@ -126,7 +126,7 @@ typedef enum {
  * @since_tizen 3.0
  */
 typedef enum {
-       IOTCON_RESOURCE_NO_PROPERTY = 0, /**< Indicates resource uninitialized */
+       IOTCON_RESOURCE_NO_POLICY = 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 */
index 9b697e4bf1ec024ff782946cbc13025b2956341a..d351cf178b5a61f38343316f09c7562b630966a8 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef __IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_H__
 #define __IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_H__
 
+#include <stdint.h>
 #include <iotcon-types.h>
 
 /**
@@ -170,7 +171,7 @@ typedef bool (*iotcon_lite_resource_post_request_cb)(iotcon_lite_resource_h reso
  * @details Registers a resource specified by @a uri_path, @a res_types, @a state which have
  * @a properties in IoTCon server.\n
  * When client requests some operations, it send a response to client, automatically.\n
- * The @a properties can contain multiple properties like
+ * The @a policies can contain multiple policies like
  * IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE.
  *
  * @since_tizen 3.0
@@ -183,7 +184,7 @@ typedef bool (*iotcon_lite_resource_post_request_cb)(iotcon_lite_resource_h reso
  *
  * @param[in] uri_path The URI path of the resource
  * @param[in] res_types The list of type of the resource
- * @param[in] properties The property of the resource\n Set of #iotcon_resource_policy_e
+ * @param[in] policies The policies of the resource\n Set of #iotcon_resource_policy_e
  * @param[in] state The state handle to set
  * @param[in] cb The callback function to add into callback list
  * @param[in] user_data The user data to pass to the callback function
@@ -203,7 +204,7 @@ typedef bool (*iotcon_lite_resource_post_request_cb)(iotcon_lite_resource_h reso
  */
 int iotcon_lite_resource_create(const char *uri_path,
                iotcon_resource_types_h res_types,
-               int properties,
+               uint8_t policies,
                iotcon_state_h state,
                iotcon_lite_resource_post_request_cb cb,
                void *user_data,
index 269b4134a1d8a69520135d9c54a724bca494f85c..53d86287fed98b928259749c4d8563bb8aa955ad 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef __IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_H__
 #define __IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_H__
 
+#include <stdint.h>
 #include <iotcon-types.h>
 
 /**
@@ -112,7 +113,7 @@ static void _find_light_resource()
  * To use this API, you should provide all of the details required to correctly contact and
  * observe the object.\n
  * If not, you should discover the resource object manually.\n
- * The @a properties can contain multiple properties like
+ * The @a policies can contain multiple policies like
  * IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE.\n
  *
  * @since_tizen 3.0
@@ -123,7 +124,7 @@ static void _find_light_resource()
  * @param[in] host_address The host address of the resource
  * @param[in] connectivity_type The connectivity type
  * @param[in] uri_path The URI path of the resource
- * @param[in] properties The properties of the resource\n Set of #iotcon_resource_policy_e
+ * @param[in] policies The policies of the resource\n Set of #iotcon_resource_policy_e
  * @param[in] resource_types The resource types of the resource. For example, "core.light"
  * @param[in] resource_ifaces The resource interfaces of the resource.
  * @param[out] remote_resource Generated resource handle
@@ -141,7 +142,7 @@ static void _find_light_resource()
 int iotcon_remote_resource_create(const char *host_address,
                iotcon_connectivity_type_e connectivity_type,
                const char *uri_path,
-               int properties,
+               uint8_t policies,
                iotcon_resource_types_h resource_types,
                iotcon_resource_interfaces_h resource_ifaces,
                iotcon_remote_resource_h *remote_resource);
@@ -584,7 +585,7 @@ int iotcon_remote_resource_stop_monitoring(iotcon_remote_resource_h resource);
  * @see iotcon_remote_resource_get_device_id()
  * @see iotcon_remote_resource_get_types()
  * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_get_properties()
+ * @see iotcon_remote_resource_get_policies()
  * @see iotcon_remote_resource_set_options()
  */
 int iotcon_remote_resource_get_uri_path(iotcon_remote_resource_h resource,
@@ -609,7 +610,7 @@ int iotcon_remote_resource_get_uri_path(iotcon_remote_resource_h resource,
  * @see iotcon_remote_resource_get_device_id()
  * @see iotcon_remote_resource_get_types()
  * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_get_properties()
+ * @see iotcon_remote_resource_get_policies()
  * @see iotcon_remote_resource_set_options()
  */
 int iotcon_remote_resource_get_connectivity_type(iotcon_remote_resource_h resource,
@@ -635,7 +636,7 @@ int iotcon_remote_resource_get_connectivity_type(iotcon_remote_resource_h resour
  * @see iotcon_remote_resource_get_device_id()
  * @see iotcon_remote_resource_get_types()
  * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_get_properties()
+ * @see iotcon_remote_resource_get_policies()
  * @see iotcon_remote_resource_set_options()
  */
 int iotcon_remote_resource_get_host_address(iotcon_remote_resource_h resource,
@@ -664,7 +665,7 @@ int iotcon_remote_resource_get_host_address(iotcon_remote_resource_h resource,
  * @see iotcon_remote_resource_get_connectivity_type()
  * @see iotcon_remote_resource_get_types()
  * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_get_properties()
+ * @see iotcon_remote_resource_get_policies()
  * @see iotcon_remote_resource_set_options()
  */
 int iotcon_remote_resource_get_device_id(iotcon_remote_resource_h resource,
@@ -690,7 +691,7 @@ int iotcon_remote_resource_get_device_id(iotcon_remote_resource_h resource,
  * @see iotcon_remote_resource_get_connectivity_type()
  * @see iotcon_remote_resource_get_device_id()
  * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_get_properties()
+ * @see iotcon_remote_resource_get_policies()
  * @see iotcon_remote_resource_set_options()
  */
 int iotcon_remote_resource_get_types(iotcon_remote_resource_h resource,
@@ -716,7 +717,7 @@ int iotcon_remote_resource_get_types(iotcon_remote_resource_h resource,
  * @see iotcon_remote_resource_get_connectivity_type()
  * @see iotcon_remote_resource_get_device_id()
  * @see iotcon_remote_resource_get_types()
- * @see iotcon_remote_resource_get_properties()
+ * @see iotcon_remote_resource_get_policies()
  * @see iotcon_remote_resource_set_options()
  */
 int iotcon_remote_resource_get_interfaces(iotcon_remote_resource_h resource,
@@ -725,12 +726,12 @@ int iotcon_remote_resource_get_interfaces(iotcon_remote_resource_h resource,
 /**
  * @brief Checks whether the remote resource is observable or not.
  *
- * @details The @a properties can contain multiple properties like
+ * @details The @a policies can contain multiple policies like
  * IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE.
  * @since_tizen 3.0
  *
  * @param[in] resource The handle of the resource
- * @param[out] properties The Properties of the resource\n Set of #iotcon_resource_policy_e
+ * @param[out] policies The policies of the resource\n Set of #iotcon_resource_policy_e
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #IOTCON_ERROR_NONE  Successful
@@ -745,8 +746,8 @@ int iotcon_remote_resource_get_interfaces(iotcon_remote_resource_h resource,
  * @see iotcon_remote_resource_get_interfaces()
  * @see iotcon_remote_resource_set_options()
  */
-int iotcon_remote_resource_get_properties(iotcon_remote_resource_h resource,
-               int *properties);
+int iotcon_remote_resource_get_policies(iotcon_remote_resource_h resource,
+               uint8_t *policies);
 
 
 /**
@@ -771,7 +772,7 @@ int iotcon_remote_resource_get_properties(iotcon_remote_resource_h resource,
  * @see iotcon_remote_resource_get_types()
  * @see iotcon_remote_resource_get_interfaces()
  * @see iotcon_remote_resource_set_options()
- * @see iotcon_remote_resource_get_properties()
+ * @see iotcon_remote_resource_get_policies()
  */
 int iotcon_remote_resource_get_options(iotcon_remote_resource_h resource,
                iotcon_options_h *options);
@@ -796,7 +797,7 @@ int iotcon_remote_resource_get_options(iotcon_remote_resource_h resource,
  * @see iotcon_remote_resource_get_types()
  * @see iotcon_remote_resource_get_interfaces()
  * @see iotcon_remote_resource_get_options()
- * @see iotcon_remote_resource_get_properties()
+ * @see iotcon_remote_resource_get_policies()
  */
 int iotcon_remote_resource_set_options(iotcon_remote_resource_h resource,
                iotcon_options_h options);
index bb6c172ccedc0fdaaff977812cdba0f4b0fbdd2f..f23442ea1a3814ca9fff76239b158f32a9405706 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef __IOT_CONNECTIVITY_SERVER_RESOURCE_H__
 #define __IOT_CONNECTIVITY_SERVER_RESOURCE_H__
 
+#include <stdint.h>
 #include <iotcon-types.h>
 
 /**
@@ -55,13 +56,13 @@ static void _door_request_handler(iotcon_resource_h resource, iotcon_request_h r
 static void _create_resource()
 {
        int ret;
-       int properties;
+       uint8_t policies;
        iotcon_resource_interfaces_h resource_ifaces = NULL;
        iotcon_resource_types_h resource_types = NULL;
        iotcon_resource_h resource_door = NULL;
 
        // 1. create room resource
-       properties = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE;
+       policies = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE;
 
        ret = iotcon_resource_types_create(&resource_types);
        if (IOTCON_ERROR_NONE != ret)
@@ -100,7 +101,7 @@ static void _create_resource()
        }
 
        ret = iotcon_resource_create("/room/1", resource_types, resource_ifaces,
-                       properties, _room_request_handler, NULL, &_resource_room);
+                       policies, _room_request_handler, NULL, &_resource_room);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_interfaces_destroy(resource_ifaces);
                iotcon_resource_types_destroy(resource_types);
@@ -110,7 +111,7 @@ static void _create_resource()
        iotcon_resource_types_destroy(resource_types);
 
        // 2. create door resource
-       properties = IOTCON_RESOURCE_OBSERVABLE;
+       policies = IOTCON_RESOURCE_OBSERVABLE;
 
        ret = iotcon_resource_types_create(&resource_types);
        if (IOTCON_ERROR_NONE != ret) {
@@ -142,7 +143,7 @@ static void _create_resource()
        }
 
        ret = iotcon_resource_create("/door/1", resource_types, resource_ifaces,
-                       properties, _door_request_handler, NULL, &resource_door);
+                       policies, _door_request_handler, NULL, &resource_door);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_interfaces_destroy(resource_ifaces);
                iotcon_resource_types_destroy(resource_types);
@@ -208,7 +209,7 @@ typedef void (*iotcon_request_handler_cb)(iotcon_resource_h resource,
  * add types string to it.\n
  * @a ifaces is a list of resource interfaces. Create a iotcon_resource_interfaces_h handle and
  * add interfaces string to it.\n
- * @a properties also can contain multiple properties like
+ * @a policies also can contain multiple policies like
  * IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE.\n
  * iotcon_request_handler_cb() will be called when receive CRUD request to the registered
  * resource.
@@ -224,7 +225,7 @@ typedef void (*iotcon_request_handler_cb)(iotcon_resource_h resource,
  * @param[in] uri_path The URI path of the resource
  * @param[in] res_types The list of type of the resource
  * @param[in] ifaces The list of interface of the resource
- * @param[in] properties The properties of the resource\n Set of #iotcon_resource_policy_e
+ * @param[in] policies The policies of the resource\n Set of #iotcon_resource_policy_e
  * @param[in] cb The request handler callback function
  * @param[in] user_data The user data to pass to the callback function
  * @param[out] resource_handle The handle of the resource
@@ -251,7 +252,7 @@ typedef void (*iotcon_request_handler_cb)(iotcon_resource_h resource,
 int iotcon_resource_create(const char *uri_path,
                iotcon_resource_types_h res_types,
                iotcon_resource_interfaces_h ifaces,
-               int properties,
+               uint8_t policies,
                iotcon_request_handler_cb cb,
                void *user_data,
                iotcon_resource_h *resource_handle);
@@ -493,7 +494,7 @@ int iotcon_resource_notify(iotcon_resource_h resource, iotcon_representation_h r
  * @see iotcon_resource_get_uri_path()
  * @see iotcon_resource_get_types()
  * @see iotcon_resource_get_interfaces()
- * @see iotcon_resource_get_properties()
+ * @see iotcon_resource_get_policies()
  */
 int iotcon_resource_get_child_count(iotcon_resource_h resource,
                unsigned int *count);
@@ -519,7 +520,7 @@ int iotcon_resource_get_child_count(iotcon_resource_h resource,
  * @see iotcon_resource_get_uri_path()
  * @see iotcon_resource_get_types()
  * @see iotcon_resource_get_interfaces()
- * @see iotcon_resource_get_properties()
+ * @see iotcon_resource_get_policies()
  */
 int iotcon_resource_get_nth_child(iotcon_resource_h parent, int index,
                iotcon_resource_h *child);
@@ -543,7 +544,7 @@ int iotcon_resource_get_nth_child(iotcon_resource_h parent, int index,
  * @see iotcon_resource_get_nth_child()
  * @see iotcon_resource_get_types()
  * @see iotcon_resource_get_interfaces()
- * @see iotcon_resource_get_properties()
+ * @see iotcon_resource_get_policies()
  */
 int iotcon_resource_get_uri_path(iotcon_resource_h resource, char **uri_path);
 
@@ -566,7 +567,7 @@ int iotcon_resource_get_uri_path(iotcon_resource_h resource, char **uri_path);
  * @see iotcon_resource_get_nth_child()
  * @see iotcon_resource_get_uri_path()
  * @see iotcon_resource_get_interfaces()
- * @see iotcon_resource_get_properties()
+ * @see iotcon_resource_get_policies()
  */
 int iotcon_resource_get_types(iotcon_resource_h resource, iotcon_resource_types_h *types);
 
@@ -589,20 +590,20 @@ int iotcon_resource_get_types(iotcon_resource_h resource, iotcon_resource_types_
  * @see iotcon_resource_get_nth_child()
  * @see iotcon_resource_get_uri_path()
  * @see iotcon_resource_get_types()
- * @see iotcon_resource_get_properties()
+ * @see iotcon_resource_get_policies()
  */
 int iotcon_resource_get_interfaces(iotcon_resource_h resource,
                iotcon_resource_interfaces_h *ifaces);
 
 /**
- * @brief Gets the properties in the resource.
- * @details @a properties can contain multiple properties like
+ * @brief Gets the policies in the resource.
+ * @details @a policies can contain multiple policies like
  * IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE.
  *
  * @since_tizen 3.0
  *
  * @param[in] resource The handle of the resource
- * @param[out] properties The properties of resource\n Set of #iotcon_resource_policy_e
+ * @param[out] policies The policies of resource\n Set of #iotcon_resource_policy_e
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #IOTCON_ERROR_NONE  Successful
@@ -615,7 +616,7 @@ int iotcon_resource_get_interfaces(iotcon_resource_h resource,
  * @see iotcon_resource_get_types()
  * @see iotcon_resource_get_interfaces()
  */
-int iotcon_resource_get_properties(iotcon_resource_h resource, int *properties);
+int iotcon_resource_get_policies(iotcon_resource_h resource, uint8_t *policies);
 
 /**
  * @}
index ef17bb534b01e1a2268e18fd1ea42d5f27f75fac..2410be2b36b1ff70018a22ce824e6655e775c787 100644 (file)
@@ -182,7 +182,7 @@ static void _on_response_post(iotcon_remote_resource_h resource,
        }
 
        ret = iotcon_remote_resource_create(host, connectivity_type, created_uri_path,
-                       IOTCON_RESOURCE_NO_PROPERTY, types, ifaces, &new_door_resource);
+                       IOTCON_RESOURCE_NO_POLICY, types, ifaces, &new_door_resource);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_remote_resource_create() Fail(%d)", ret);
                return;
index 3219e17e9dd2cb2e0b3afccc2c4849b3184c7246..56c67177ae69a080d25747928498bb3f9f279fd4 100644 (file)
@@ -30,7 +30,7 @@ typedef struct _door_resource_s {
        char *uri_path;
        char *type;
        iotcon_resource_interfaces_h ifaces;
-       int properties;
+       uint8_t policies;
        iotcon_resource_h handle;
        iotcon_observers_h observers;
        iotcon_representation_h repr;
@@ -77,7 +77,7 @@ static int _set_door_resource(door_resource_s *door)
                return -1;
        }
 
-       door->properties = IOTCON_RESOURCE_DISCOVERABLE;
+       door->policies = IOTCON_RESOURCE_DISCOVERABLE;
 
        ret = iotcon_observers_create(&door->observers);
        if (IOTCON_ERROR_NONE != ret) {
@@ -108,7 +108,7 @@ static void _check_door_state(door_resource_s door)
 }
 
 static iotcon_resource_h _create_door_resource(char *uri_path, char *type,
-               iotcon_resource_interfaces_h ifaces, int properties, void *user_data)
+               iotcon_resource_interfaces_h ifaces, uint8_t policies, void *user_data)
 {
        int ret;
        iotcon_resource_h handle;
@@ -128,7 +128,7 @@ static iotcon_resource_h _create_door_resource(char *uri_path, char *type,
        }
 
        /* register door resource */
-       ret = iotcon_resource_create(uri_path, resource_types, ifaces, properties,
+       ret = iotcon_resource_create(uri_path, resource_types, ifaces, policies,
                        _request_handler, user_data, &handle);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_resource_create() Fail");
@@ -372,7 +372,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,
-                       door->ifaces, IOTCON_RESOURCE_NO_PROPERTY, door);
+                       door->ifaces, IOTCON_RESOURCE_NO_POLICY, door);
        if (NULL == new_door_handle) {
                ERR("_create_door_resource() Fail");
                return -1;
@@ -586,7 +586,7 @@ int main(int argc, char **argv)
                iotcon_deinitialize();
                return -1;
        }
-       my_door.properties |= IOTCON_RESOURCE_OBSERVABLE;
+       my_door.policies |= IOTCON_RESOURCE_OBSERVABLE;
 
        /* add presence */
        g_timeout_add_seconds(10, _presence_timer, NULL);
@@ -594,7 +594,7 @@ int main(int argc, char **argv)
 
        /* create new door resource */
        my_door.handle = _create_door_resource(my_door.uri_path, my_door.type, my_door.ifaces,
-                       my_door.properties, &my_door);
+                       my_door.policies, &my_door);
        if (NULL == my_door.handle) {
                ERR("_create_door_resource() Fail");
                _free_door_resource(&my_door);
index 485cff587c37c7345ad2877f4cda04ce2b6b631c..30cdd2a5ae974ccc8ca0c4bd6958385303426b30 100644 (file)
@@ -28,7 +28,7 @@ typedef struct _door_resource_s {
        bool state;
        char *uri_path;
        char *type;
-       int properties;
+       uint8_t policies;
        iotcon_lite_resource_h handle;
 } door_resource_s;
 
@@ -49,7 +49,7 @@ static int _set_door_resource(door_resource_s *door)
                return -1;
        }
 
-       door->properties = IOTCON_RESOURCE_DISCOVERABLE;
+       door->policies = IOTCON_RESOURCE_DISCOVERABLE;
 
        return 0;
 }
@@ -136,7 +136,7 @@ static bool _door_state_changed(iotcon_lite_resource_h resource,
 }
 
 static iotcon_lite_resource_h _create_door_resource(char *uri_path, char *type,
-               int properties, void *user_data)
+               uint8_t policies, void *user_data)
 {
        int ret;
        iotcon_state_h state;
@@ -172,7 +172,7 @@ static iotcon_lite_resource_h _create_door_resource(char *uri_path, char *type,
        }
 
        /* register door resource */
-       ret = iotcon_lite_resource_create(uri_path, resource_types, properties, state,
+       ret = iotcon_lite_resource_create(uri_path, resource_types, policies, state,
                        _door_state_changed, NULL, &handle);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_lite_resource_create() Fail");
@@ -219,11 +219,11 @@ int main(int argc, char **argv)
        }
 
        /* add resource options */
-       my_door.properties |= IOTCON_RESOURCE_OBSERVABLE;
+       my_door.policies |= IOTCON_RESOURCE_OBSERVABLE;
 
        /* create new door resource */
        my_door.handle = _create_door_resource(my_door.uri_path, my_door.type,
-                       my_door.properties, &my_door);
+                       my_door.policies, &my_door);
        if (NULL == my_door.handle) {
                ERR("_create_door_resource() Fail");
                _free_door_resource(&my_door);
index 7b1c29c0b4ab9efb185fc068cbb0e0be5caf7d16..f6854f016ad8ca699157015a94fcd399d6f6c9c6 100644 (file)
@@ -33,7 +33,7 @@ typedef struct _light_resource_s {
        char *uri_path;
        char *type;
        iotcon_resource_interfaces_h ifaces;
-       int properties;
+       uint8_t policies;
        iotcon_resource_h handle;
 } light_resource_s;
 
@@ -43,7 +43,7 @@ typedef struct _fan_resource_s {
        char *uri_path;
        char *type;
        iotcon_resource_interfaces_h ifaces;
-       int properties;
+       uint8_t policies;
        iotcon_resource_h handle;
 } fan_resource_s;
 
@@ -54,7 +54,7 @@ typedef struct _room_resource_s {
        char *uri_path;
        char *type;
        iotcon_resource_interfaces_h ifaces;
-       int properties;
+       uint8_t policies;
        iotcon_resource_h handle;
        light_resource_s *child_light;
        fan_resource_s *child_fan;
@@ -120,7 +120,7 @@ static int _set_room_resource(room_resource_s *room)
                return -1;
        }
 
-       room->properties = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE;
+       room->policies = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE;
 
        return 0;
 }
@@ -169,7 +169,7 @@ static int _set_light_resource(light_resource_s *light)
                return -1;
        }
 
-       light->properties = IOTCON_RESOURCE_NO_PROPERTY;
+       light->policies = IOTCON_RESOURCE_NO_POLICY;
 
        return 0;
 }
@@ -217,7 +217,7 @@ static int _set_fan_resource(fan_resource_s *fan)
                return -1;
        }
 
-       fan->properties = IOTCON_RESOURCE_NO_PROPERTY;
+       fan->policies = IOTCON_RESOURCE_NO_POLICY;
 
        return 0;
 }
@@ -232,7 +232,7 @@ static void _free_fan_resource(fan_resource_s *fan)
 static iotcon_resource_h _create_resource(char *uri_path,
                char *type,
                iotcon_resource_interfaces_h ifaces,
-               int properties,
+               uint8_t policies,
                iotcon_request_handler_cb cb,
                void *user_data)
 {
@@ -253,7 +253,7 @@ static iotcon_resource_h _create_resource(char *uri_path,
                return NULL;
        }
 
-       ret = iotcon_resource_create(uri_path, resource_types, ifaces, properties, cb,
+       ret = iotcon_resource_create(uri_path, resource_types, ifaces, policies, cb,
                        user_data, &handle);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_response_create() Fail(%d)", ret);
@@ -797,7 +797,7 @@ int main(int argc, char **argv)
        room.child_fan = &fan;
 
        /* register room resource */
-       room.handle = _create_resource(room.uri_path, room.type, room.ifaces, room.properties,
+       room.handle = _create_resource(room.uri_path, room.type, room.ifaces, room.policies,
                        _room_request_handler, &room);
        if (NULL == room.handle) {
                ERR("_create_resource() Fail");
@@ -810,7 +810,7 @@ int main(int argc, char **argv)
 
        /* register light resource */
        light.handle = _create_resource(light.uri_path, light.type, light.ifaces,
-                       light.properties, _light_request_handler, &light);
+                       light.policies, _light_request_handler, &light);
        if (NULL == light.handle) {
                ERR("_create_resource() Fail");
                iotcon_resource_destroy(room.handle);
@@ -834,7 +834,7 @@ int main(int argc, char **argv)
        }
 
        /* register fan resource */
-       fan.handle = _create_resource(fan.uri_path, fan.type, fan.ifaces, fan.properties,
+       fan.handle = _create_resource(fan.uri_path, fan.type, fan.ifaces, fan.policies,
                        _fan_request_handler, &fan);
        if (NULL == fan.handle) {
                ERR("_create_resource() Fail");