}
-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)
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;
}
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);
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__*/
...
{
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;
}
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);
...
{
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;
}
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);
}
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};
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;
}
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);
return ret;
}
- if (IOTCON_RESOURCE_SECURE & resource->properties)
+ if (IOTCON_RESOURCE_SECURE & resource->policies)
dev_addr.flags |= OC_FLAG_SECURE;
/* options */
return ret;
}
- if (IOTCON_RESOURCE_SECURE & resource->properties)
+ if (IOTCON_RESOURCE_SECURE & resource->policies)
dev_addr.flags |= OC_FLAG_SECURE;
/* representation */
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)
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);
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,
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;
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);
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);
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,
/* 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,
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);
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;
};
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)
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;
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) {
}
-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;
}
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;
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)
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);
}
-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;
}
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;
* @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 */
#ifndef __IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_H__
#define __IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_H__
+#include <stdint.h>
#include <iotcon-types.h>
/**
* @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
*
* @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
*/
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,
#ifndef __IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_H__
#define __IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_H__
+#include <stdint.h>
#include <iotcon-types.h>
/**
* 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
* @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
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);
* @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,
* @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,
* @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,
* @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,
* @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,
* @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,
/**
* @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
* @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);
/**
* @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);
* @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);
#ifndef __IOT_CONNECTIVITY_SERVER_RESOURCE_H__
#define __IOT_CONNECTIVITY_SERVER_RESOURCE_H__
+#include <stdint.h>
#include <iotcon-types.h>
/**
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)
}
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);
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) {
}
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);
* 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.
* @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
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);
* @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);
* @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);
* @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);
* @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);
* @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
* @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);
/**
* @}
}
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;
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;
return -1;
}
- door->properties = IOTCON_RESOURCE_DISCOVERABLE;
+ door->policies = IOTCON_RESOURCE_DISCOVERABLE;
ret = iotcon_observers_create(&door->observers);
if (IOTCON_ERROR_NONE != ret) {
}
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;
}
/* 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");
}
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;
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);
/* 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);
bool state;
char *uri_path;
char *type;
- int properties;
+ uint8_t policies;
iotcon_lite_resource_h handle;
} door_resource_s;
return -1;
}
- door->properties = IOTCON_RESOURCE_DISCOVERABLE;
+ door->policies = IOTCON_RESOURCE_DISCOVERABLE;
return 0;
}
}
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;
}
/* 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");
}
/* 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);
char *uri_path;
char *type;
iotcon_resource_interfaces_h ifaces;
- int properties;
+ uint8_t policies;
iotcon_resource_h handle;
} light_resource_s;
char *uri_path;
char *type;
iotcon_resource_interfaces_h ifaces;
- int properties;
+ uint8_t policies;
iotcon_resource_h handle;
} fan_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;
return -1;
}
- room->properties = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE;
+ room->policies = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE;
return 0;
}
return -1;
}
- light->properties = IOTCON_RESOURCE_NO_PROPERTY;
+ light->policies = IOTCON_RESOURCE_NO_POLICY;
return 0;
}
return -1;
}
- fan->properties = IOTCON_RESOURCE_NO_PROPERTY;
+ fan->policies = IOTCON_RESOURCE_NO_POLICY;
return 0;
}
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)
{
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);
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");
/* 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);
}
/* 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");