case OC_OBSERVE_NO_OPTION:
default:
ERR("Invalid action (%d)", oic_action);
- action = IOTCON_OBSERVE_TYPE_NONE;
+ action = IOTCON_OBSERVE_NO_TYPE;
}
return action;
}
req_ctx->observe_id = request->obsInfo.obsId;
req_ctx->observe_type = _ioty_oic_action_to_ioty_action(request->obsInfo.action);
} else {
- req_ctx->observe_type = IOTCON_OBSERVE_TYPE_NONE;
+ req_ctx->observe_type = IOTCON_OBSERVE_NO_TYPE;
}
/* header options */
switch (result) {
case OC_STACK_OK:
- res = IOTCON_RESPONSE_RESULT_OK;
+ res = IOTCON_RESPONSE_OK;
break;
case OC_STACK_RESOURCE_CREATED:
- res = IOTCON_RESPONSE_RESULT_RESOURCE_CREATED;
+ res = IOTCON_RESPONSE_RESOURCE_CREATED;
break;
case OC_STACK_RESOURCE_DELETED:
- res = IOTCON_RESPONSE_RESULT_RESOURCE_DELETED;
+ res = IOTCON_RESPONSE_RESULT_DELETED;
break;
case OC_STACK_UNAUTHORIZED_REQ:
- res = IOTCON_RESPONSE_RESULT_FORBIDDEN;
+ res = IOTCON_RESPONSE_FORBIDDEN;
break;
default:
WARN("response error(%d)", result);
- res = IOTCON_RESPONSE_RESULT_ERROR;
+ res = IOTCON_RESPONSE_ERROR;
break;
}
GVariant *value, *value2;
value = g_variant_new("(iusiis)", ret_val, 0, IC_STR_NULL, IOTCON_CONNECTIVITY_ALL,
- IOTCON_PRESENCE_TRIGGER_RESOURCE_CREATED, IC_STR_NULL);
+ IOTCON_PRESENCE_RESOURCE_CREATED, IC_STR_NULL);
value2 = g_variant_ref(value);
ret = _ocprocess_response_signal(NULL, IC_DBUS_SIGNAL_PRESENCE,
switch (src) {
case OC_PRESENCE_TRIGGER_CREATE:
- *dest = IOTCON_PRESENCE_TRIGGER_RESOURCE_CREATED;
+ *dest = IOTCON_PRESENCE_RESOURCE_CREATED;
break;
case OC_PRESENCE_TRIGGER_CHANGE:
- *dest = IOTCON_PRESENCE_TRIGGER_RESOURCE_UPDATED;
+ *dest = IOTCON_PRESENCE_RESOURCE_UPDATED;
break;
case OC_PRESENCE_TRIGGER_DELETE:
- *dest = IOTCON_PRESENCE_TRIGGER_RESOURCE_DESTROYED;
+ *dest = IOTCON_PRESENCE_RESOURCE_DESTROYED;
break;
default:
ERR("Invalid trigger(%d)", src);
tizen_device_id = val->str;
if (OC_STACK_OK == resp->result)
- res = IOTCON_RESPONSE_RESULT_OK;
+ res = IOTCON_RESPONSE_OK;
else
- res = IOTCON_RESPONSE_RESULT_ERROR;
+ res = IOTCON_RESPONSE_ERROR;
tizen_info = g_variant_new("(ssi)", device_name, tizen_device_id, res);
{
int prop = OC_RES_PROP_NONE;
- if (IOTCON_DISCOVERABLE & properties)
+ if (IOTCON_RESOURCE_DISCOVERABLE & properties)
prop |= OC_DISCOVERABLE;
- if (IOTCON_OBSERVABLE & properties)
+ if (IOTCON_RESOURCE_OBSERVABLE & properties)
prop |= OC_OBSERVABLE;
- if (IOTCON_ACTIVE & properties)
+ if (IOTCON_RESOURCE_ACTIVE & properties)
prop |= OC_ACTIVE;
- if (IOTCON_SLOW & properties)
+ if (IOTCON_RESOURCE_SLOW & properties)
prop |= OC_SLOW;
- if (IOTCON_SECURE & properties)
+ if (IOTCON_RESOURCE_SECURE & properties)
prop |= OC_SECURE;
- if (IOTCON_EXPLICIT_DISCOVERABLE & properties)
+ if (IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE & properties)
prop |= OC_EXPLICIT_DISCOVERABLE;
/* TODO: Secure option is not supported yet. */
if (IOTCON_ERROR_NONE != ret)
return;
- ret = iotcon_response_set_result(response, IOTCON_RESPONSE_RESULT_OK);
+ ret = iotcon_response_set_result(response, IOTCON_RESPONSE_OK);
if (IOTCON_ERROR_NONE != ret) {
iotcon_response_destroy(response);
return;
{
int ret;
int interfaces = IOTCON_INTERFACE_DEFAULT;
- int properties = (IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE);
+ int properties = (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE);
const char *uri_path = "/door/1";
const char *type = "org.tizen.door";
iotcon_resource_types_h resource_types;
{
int ret;
int interfaces = IOTCON_INTERFACE_DEFAULT;
- int properties = (IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE);
+ int properties = (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE);
const char *uri_path = "/door/1";
const char *type = "org.tizen.door";
iotcon_resource_types_h resource_types;
return ret;
}
-static int _icl_list_create(iotcon_types_e type, iotcon_list_h *ret_list)
+static int _icl_list_create(iotcon_type_e type, iotcon_list_h *ret_list)
{
iotcon_list_h list;
return IOTCON_ERROR_NONE;
}
-API int iotcon_list_create(iotcon_types_e type, iotcon_list_h *ret_list)
+API int iotcon_list_create(iotcon_type_e type, iotcon_list_h *ret_list)
{
int ret;
iotcon_list_h list;
return ret;
}
-API int iotcon_list_get_type(iotcon_list_h list, iotcon_types_e *type)
+API int iotcon_list_get_type(iotcon_list_h list, iotcon_type_e *type)
{
RETV_IF(NULL == list, IOTCON_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == type, IOTCON_ERROR_INVALID_PARAMETER);
struct icl_resource resource = {0};
RETV_IF(NULL == lite_resource, IOTCON_ERROR_INVALID_PARAMETER);
- if (false == (IOTCON_OBSERVABLE & lite_resource->properties))
+ if (false == (IOTCON_RESOURCE_OBSERVABLE & lite_resource->properties))
return IOTCON_ERROR_NONE;
resource.handle = lite_resource->handle;
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_representation_create() Fail(%d)", ret);
_icl_lite_resource_response_send(NULL, oic_request_h, oic_resource_h,
- IOTCON_RESPONSE_RESULT_ERROR);
+ IOTCON_RESPONSE_ERROR);
return;
}
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_representation_set_uri_path() Fail(%d)", ret);
_icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h,
- IOTCON_RESPONSE_RESULT_ERROR);
+ IOTCON_RESPONSE_ERROR);
iotcon_representation_destroy(repr);
return;
}
if (FALSE == g_variant_iter_loop(repr_iter, "v", &repr_gvar)) {
ERR("Received representation is empty.");
_icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h,
- IOTCON_RESPONSE_RESULT_ERROR);
+ IOTCON_RESPONSE_ERROR);
iotcon_representation_destroy(repr);
return;
}
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_state_create() Fail(%d)", ret);
_icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h,
- IOTCON_RESPONSE_RESULT_ERROR);
+ IOTCON_RESPONSE_ERROR);
iotcon_representation_destroy(repr);
return;
}
if (IOTCON_ERROR_NONE != ret) {
ERR("_icl_lite_resource_set_state() Fail(%d)", ret);
_icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h,
- IOTCON_RESPONSE_RESULT_ERROR);
+ IOTCON_RESPONSE_ERROR);
iotcon_state_destroy(recv_state);
iotcon_representation_destroy(repr);
return;
default:
WARN("Not supported request (only GET / PUT / OBSERVE)");
ret = _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h,
- IOTCON_RESPONSE_RESULT_FORBIDDEN);
+ IOTCON_RESPONSE_FORBIDDEN);
if (IOTCON_ERROR_NONE != ret)
ERR("_icl_lite_resource_response_send() Fail(%d)", ret);
iotcon_representation_destroy(repr);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_representation_set_state() Fail(%d)", ret);
_icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h,
- IOTCON_RESPONSE_RESULT_ERROR);
+ IOTCON_RESPONSE_ERROR);
iotcon_representation_destroy(repr);
return;
}
ret = _icl_lite_resource_response_send(repr, oic_request_h, oic_resource_h,
- IOTCON_RESPONSE_RESULT_OK);
+ IOTCON_RESPONSE_OK);
if (IOTCON_ERROR_NONE != ret) {
ERR("_icl_lite_resource_response_send() Fail(%d)", ret);
iotcon_representation_destroy(repr);
RETM_IF(IOTCON_ERROR_NONE != err, "_caching_get() Fail(%d)", err);
ret = iotcon_response_get_result(resp, &result);
- if (IOTCON_ERROR_NONE != ret || IOTCON_RESPONSE_RESULT_OK != result) {
+ if (IOTCON_ERROR_NONE != ret || IOTCON_RESPONSE_OK != result) {
ERR("Invalid result (%d)", result);
return;
}
return;
}
- if (IOTCON_RESPONSE_RESULT_OK <= response_result)
- resource_state = IOTCON_REMOTE_RESOURCE_STATE_ALIVE;
+ if (IOTCON_RESPONSE_OK <= response_result)
+ resource_state = IOTCON_REMOTE_RESOURCE_ALIVE;
else
- resource_state = IOTCON_REMOTE_RESOURCE_STATE_LOST_SIGNAL;
+ resource_state = IOTCON_REMOTE_RESOURCE_LOST_SIGNAL;
if (resource_state == resource->monitoring_handle->resource_state)
return;
return;
}
- if (IOTCON_PRESENCE_TRIGGER_RESOURCE_DESTROYED != trigger)
+ if (IOTCON_PRESENCE_RESOURCE_DESTROYED != trigger)
return;
}
#include "icl-response.h"
/* the last index of iotcon_response_result_e */
-#define ICL_RESPONSE_RESULT_MAX (IOTCON_RESPONSE_RESULT_FORBIDDEN + 1)
+#define ICL_RESPONSE_RESULT_MAX (IOTCON_RESPONSE_FORBIDDEN + 1)
API int iotcon_response_create(iotcon_request_h request,
iotcon_response_h *response)
{
RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER);
- if (result < IOTCON_RESPONSE_RESULT_OK || ICL_RESPONSE_RESULT_MAX <= result) {
+ if (result < IOTCON_RESPONSE_OK || ICL_RESPONSE_RESULT_MAX <= result) {
ERR("Invalid result(%d)", result);
return IOTCON_ERROR_INVALID_PARAMETER;
}
}
API int iotcon_state_get_type(iotcon_state_h state, const char *key,
- iotcon_types_e *type)
+ iotcon_type_e *type)
{
iotcon_value_h value = NULL;
* @since_tizen 3.0
*/
typedef enum {
- IOTCON_OBSERVE_REGISTER = 0, /**< Indicates action of registering observation*/
- IOTCON_OBSERVE_DEREGISTER = 1, /**< Indicates action of unregistering observation */
- IOTCON_OBSERVE_TYPE_NONE = 2, /**< Indicates no option */
+ IOTCON_OBSERVE_NO_TYPE = 0, /**< Indicates no option */
+ IOTCON_OBSERVE_REGISTER = 1, /**< Indicates action of registering observation*/
+ IOTCON_OBSERVE_DEREGISTER = 2, /**< Indicates action of unregistering observation */
} iotcon_observe_type_e;
/**
* @since_tizen 3.0
*/
typedef enum {
- IOTCON_HIDDEN = 0, /**< Indicates resource uninitialized */
- IOTCON_DISCOVERABLE = (1 << 0), /**< Indicates resource that is allowed to be discovered */
- IOTCON_OBSERVABLE = (1 << 1), /**< Indicates resource that is allowed to be observed */
- IOTCON_ACTIVE = (1 << 2), /**< Indicates resource initialized and activated */
- IOTCON_SLOW = (1 << 3), /**< Indicates resource which takes some delay to respond */
- IOTCON_SECURE = (1 << 4), /**< Indicates secure resource */
- IOTCON_EXPLICIT_DISCOVERABLE = (1 << 5), /**< When this bit is set, the resource is allowed to be discovered only if discovery request contains an explicit querystring. */
+ IOTCON_RESOURCE_NO_PROPERTY = 0, /**< Indicates resource uninitialized */
+ IOTCON_RESOURCE_DISCOVERABLE = (1 << 0), /**< Indicates resource that is allowed to be discovered */
+ IOTCON_RESOURCE_OBSERVABLE = (1 << 1), /**< Indicates resource that is allowed to be observed */
+ IOTCON_RESOURCE_ACTIVE = (1 << 2), /**< Indicates resource initialized and activated */
+ IOTCON_RESOURCE_SLOW = (1 << 3), /**< Indicates resource which takes some delay to respond */
+ IOTCON_RESOURCE_SECURE = (1 << 4), /**< Indicates secure resource */
+ IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE = (1 << 5), /**< When this bit is set, the resource is allowed to be discovered only if discovery request contains an explicit querystring. */
} iotcon_resource_property_e;
/**
* @since_tizen 3.0
*/
typedef enum {
- IOTCON_REQUEST_NONE = 0, /**< Indicates none */
+ IOTCON_REQUEST_UNKNOWN = 0, /**< Indicates none */
IOTCON_REQUEST_GET = 1, /**< Indicates get method of request */
IOTCON_REQUEST_PUT = 2, /**< Indicates put method of request */
IOTCON_REQUEST_POST = 3, /**< Indicates post method of request */
* @since_tizen 3.0
*/
typedef enum {
- IOTCON_RESPONSE_RESULT_OK = 0, /**< Indicates result of response for success */
- IOTCON_RESPONSE_RESULT_ERROR, /**< Indicates result of response for something error */
- IOTCON_RESPONSE_RESULT_RESOURCE_CREATED, /**< Indicates result of response for resource has created */
- IOTCON_RESPONSE_RESULT_RESOURCE_DELETED, /**< Indicates result of response for resource has deleted */
- IOTCON_RESPONSE_RESULT_SLOW, /**< Indicates result of response for slow resource */
- IOTCON_RESPONSE_RESULT_FORBIDDEN, /**< Indicates result of response for accessing unauthorized resource */
+ IOTCON_RESPONSE_OK = 0, /**< Indicates result of response for success */
+ IOTCON_RESPONSE_ERROR, /**< Indicates result of response for something error */
+ IOTCON_RESPONSE_RESOURCE_CREATED, /**< Indicates result of response for resource has created */
+ IOTCON_RESPONSE_RESULT_DELETED, /**< Indicates result of response for resource has deleted */
+ IOTCON_RESPONSE_SLOW, /**< Indicates result of response for slow resource */
+ IOTCON_RESPONSE_FORBIDDEN, /**< Indicates result of response for accessing unauthorized resource */
} iotcon_response_result_e;
/**
* @since_tizen 3.0
*/
typedef enum {
- IOTCON_PRESENCE_TRIGGER_RESOURCE_CREATED, /**< Indicates for resource creation operation of server */
- IOTCON_PRESENCE_TRIGGER_RESOURCE_UPDATED, /**< Indicates for resource update operation of server */
- IOTCON_PRESENCE_TRIGGER_RESOURCE_DESTROYED, /**< Indicates for resource destruction operation of server */
+ IOTCON_PRESENCE_RESOURCE_CREATED, /**< Indicates for resource creation operation of server */
+ IOTCON_PRESENCE_RESOURCE_UPDATED, /**< Indicates for resource update operation of server */
+ IOTCON_PRESENCE_RESOURCE_DESTROYED, /**< Indicates for resource destruction operation of server */
} iotcon_presence_trigger_e;
/**
IOTCON_TYPE_NULL, /**< Indicates for representation that have null type */
IOTCON_TYPE_LIST, /**< Indicates for representation that have list type */
IOTCON_TYPE_STATE, /**< Indicates for representation that have another representation type */
-} iotcon_types_e;
+} iotcon_type_e;
/**
* @brief Enumeration for properties of device information.
* @since_tizen 3.0
*/
typedef enum {
- IOTCON_REMOTE_RESOURCE_STATE_ALIVE, /**< Indicates remote resource is alive */
- IOTCON_REMOTE_RESOURCE_STATE_LOST_SIGNAL, /**< Indicates remote resource is lost */
+ IOTCON_REMOTE_RESOURCE_ALIVE, /**< Indicates remote resource is alive */
+ IOTCON_REMOTE_RESOURCE_LOST_SIGNAL, /**< Indicates remote resource is lost */
} iotcon_remote_resource_state_e;
/**
* @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #IOTCON_ERROR_INVALID_TYPE Invalid type
*/
-int iotcon_list_create(iotcon_types_e type, iotcon_list_h *list);
+int iotcon_list_create(iotcon_type_e type, iotcon_list_h *list);
/**
* @brief Destroys a list handle.
/**
* @brief Gets the type of the list.
* @details It gets the data type of value related the @a key in @a state.
- * The data type could be one of #iotcon_types_e.
+ * The data type could be one of #iotcon_type_e.
*
* @since_tizen 3.0
*
* @retval #IOTCON_ERROR_NONE Successful
* @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter
*/
-int iotcon_list_get_type(iotcon_list_h list, iotcon_types_e *type);
+int iotcon_list_get_type(iotcon_list_h list, iotcon_type_e *type);
/**
* @brief Gets the number of elements in a list.
}
ret = iotcon_lite_resource_create("/light/1", resource_types,
- IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE, state, &resource);
+ IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE, state, &resource);
if (IOTCON_ERROR_NONE != ret) {
iotcon_state_destroy(state);
iotcon_resource_types_destroy(resource_types);
}
ret = iotcon_resource_create("/light/1", resource_types, IOTCON_INTERFACE_DEFAULT,
- IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE, _request_handler, NULL, &resource);
+ IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE, _request_handler, NULL, &resource);
if (IOTCON_ERROR_NONE != ret) {
iotcon_resource_types_destroy(resource_types);
return;
// 1. create room resource
ifaces = IOTCON_INTERFACE_DEFAULT | IOTCON_INTERFACE_LINK | IOTCON_INTERFACE_BATCH;
- properties = IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE;
+ properties = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE;
ret = iotcon_resource_types_create(&resource_types);
if (IOTCON_ERROR_NONE != ret)
// 2. create door resource
ifaces = IOTCON_INTERFACE_DEFAULT;
- properties = IOTCON_OBSERVABLE;
+ properties = IOTCON_RESOURCE_OBSERVABLE;
ret = iotcon_resource_types_create(&resource_types);
if (IOTCON_ERROR_NONE != ret) {
* @a ifaces can contain multiple interfaces like
* IOTCON_INTERFACE_LINK | IOTCON_INTERFACE_BATCH.\n
* @a properties also can contain multiple properties like
- * IOTCON_ACTIVE | IOTCON_DISCOVERABLE.\n
+ * IOTCON_RESOURCE_ACTIVE | IOTCON_RESOURCE_DISCOVERABLE.\n
* iotcon_request_handler_cb() will be called when receive CRUD request to the registered
* resource.
*
if (IOTCON_ERROR_NONE != ret)
return;
- if (IOTCON_RESPONSE_RESULT_OK != response_result)
+ if (IOTCON_RESPONSE_OK != response_result)
return;
ret = iotcon_response_get_representation(response, &repr);
if (IOTCON_ERROR_NONE != ret)
return;
- ret = iotcon_response_set_result(response, IOTCON_RESPONSE_RESULT_OK);
+ ret = iotcon_response_set_result(response, IOTCON_RESPONSE_OK);
if (IOTCON_ERROR_NONE != ret) {
iotcon_response_destroy(response);
return;
/**
* @brief Gets the type of a value at the given key.
* @details It gets the data type of value related the @a key in @a state.
- * The data type could be one of #iotcon_types_e.
+ * The data type could be one of #iotcon_type_e.
*
* @since_tizen 3.0
*
* @retval #IOTCON_ERROR_NO_DATA No data available
*/
int iotcon_state_get_type(iotcon_state_h state, const char *key,
- iotcon_types_e *type);
+ iotcon_type_e *type);
/**
* @brief Specifies the type of function passed to iotcon_state_foreach()
return;
}
- if (IOTCON_RESPONSE_RESULT_OK != response_result) {
+ if (IOTCON_RESPONSE_OK != response_result) {
ERR("_on_response_observe Response error(%d)", response_result);
return;
}
return;
}
- if (IOTCON_RESPONSE_RESULT_OK != response_result
- && IOTCON_RESPONSE_RESULT_RESOURCE_DELETED != response_result) {
+ if (IOTCON_RESPONSE_OK != response_result
+ && IOTCON_RESPONSE_RESULT_DELETED != response_result) {
ERR("_on_response_delete Response error(%d)", response_result);
return;
}
return;
}
- if (IOTCON_RESPONSE_RESULT_OK != response_result
- && IOTCON_RESPONSE_RESULT_RESOURCE_CREATED != response_result) {
+ if (IOTCON_RESPONSE_OK != response_result
+ && IOTCON_RESPONSE_RESOURCE_CREATED != response_result) {
ERR("_on_response_post Response error(%d)", response_result);
return;
}
return;
}
- if (IOTCON_RESPONSE_RESULT_OK != response_result) {
+ if (IOTCON_RESPONSE_OK != response_result) {
ERR("_on_response_put Response error(%d)", response_result);
return;
}
return;
}
- if (IOTCON_RESPONSE_RESULT_OK != response_result) {
+ if (IOTCON_RESPONSE_OK != response_result) {
ERR("_on_response_get Response error(%d)", response_result);
return;
}
}
door->ifaces = IOTCON_INTERFACE_DEFAULT;
- door->properties = IOTCON_DISCOVERABLE;
+ door->properties = IOTCON_RESOURCE_DISCOVERABLE;
ret = iotcon_observers_create(&door->observers);
if (IOTCON_ERROR_NONE != ret) {
return -1;
}
- ret = _send_response(request, resp_repr, IOTCON_RESPONSE_RESULT_OK);
+ ret = _send_response(request, resp_repr, IOTCON_RESPONSE_OK);
if (0 != ret) {
ERR("_send_response() Fail(%d)", ret);
iotcon_representation_destroy(resp_repr);
return -1;
}
- ret = _send_response(request, resp_repr, IOTCON_RESPONSE_RESULT_OK);
+ ret = _send_response(request, resp_repr, IOTCON_RESPONSE_OK);
if (0 != ret) {
ERR("_send_response() Fail(%d)", ret);
iotcon_representation_destroy(resp_repr);
}
new_door_handle = _create_door_resource(DOOR_RESOURCE_URI2, door->type,
- IOTCON_INTERFACE_DEFAULT, (IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE), door);
+ IOTCON_INTERFACE_DEFAULT, (IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE), door);
if (NULL == new_door_handle) {
ERR("_create_door_resource() Fail");
return -1;
iotcon_state_destroy(resp_state);
- ret = _send_response(request, resp_repr, IOTCON_RESPONSE_RESULT_RESOURCE_CREATED);
+ ret = _send_response(request, resp_repr, IOTCON_RESPONSE_RESOURCE_CREATED);
if (0 != ret) {
ERR("_send_response() Fail(%d)", ret);
iotcon_representation_destroy(resp_repr);
return -1;
}
- ret = _send_response(request, NULL, IOTCON_RESPONSE_RESULT_RESOURCE_DELETED);
+ ret = _send_response(request, NULL, IOTCON_RESPONSE_RESULT_DELETED);
if (0 != ret) {
ERR("_send_response() Fail(%d)", ret);
return -1;
ret = iotcon_request_get_host_address(request, &host_address);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_request_get_host_address() Fail(%d)", ret);
- _send_response(request, NULL, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
return;
}
INFO("host_address : %s", host_address);
ret = iotcon_request_get_query(request, &query);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_request_get_query() Fail(%d)", ret);
- _send_response(request, NULL, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
return;
}
if (query)
ret = iotcon_request_get_request_type(request, &type);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_request_get_types() Fail(%d)", ret);
- _send_response(request, NULL, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
return;
}
ret = _request_handler_delete(resource, request);
if (0 != ret) {
- _send_response(request, NULL, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
return;
}
/* add resource options */
my_door.ifaces |= IOTCON_INTERFACE_BATCH;
- my_door.properties |= IOTCON_OBSERVABLE;
+ my_door.properties |= IOTCON_RESOURCE_OBSERVABLE;
/* add presence */
g_timeout_add_seconds(10, _presence_timer, NULL);
INFO("Resource State is Changed");
switch (state) {
- case IOTCON_REMOTE_RESOURCE_STATE_ALIVE:
+ case IOTCON_REMOTE_RESOURCE_ALIVE:
INFO(" --- ALIVE");
break;
- case IOTCON_REMOTE_RESOURCE_STATE_LOST_SIGNAL:
+ case IOTCON_REMOTE_RESOURCE_LOST_SIGNAL:
INFO(" --- LOST_SIGNAL");
break;
default:
return -1;
}
- door->properties = IOTCON_DISCOVERABLE;
+ door->properties = IOTCON_RESOURCE_DISCOVERABLE;
return 0;
}
}
/* add resource options */
- my_door.properties |= IOTCON_OBSERVABLE;
+ my_door.properties |= IOTCON_RESOURCE_OBSERVABLE;
/* create new door resource */
my_door.handle = _create_door_resource(my_door.uri_path, my_door.type,
return;
}
- if (IOTCON_RESPONSE_RESULT_OK == response_result)
+ if (IOTCON_RESPONSE_OK == response_result)
_print_repr(recv_repr);
else
ERR("Invalid result(%d)", response_result);
return;
}
- if (IOTCON_RESPONSE_RESULT_OK == response_result)
+ if (IOTCON_RESPONSE_OK == response_result)
_print_repr(recv_repr);
else
ERR("Invalid result(%d)", response_result);
}
room->ifaces = IOTCON_INTERFACE_DEFAULT | IOTCON_INTERFACE_BATCH;
- room->properties = IOTCON_DISCOVERABLE | IOTCON_OBSERVABLE;
+ room->properties = IOTCON_RESOURCE_DISCOVERABLE | IOTCON_RESOURCE_OBSERVABLE;
return 0;
}
}
light->ifaces = IOTCON_INTERFACE_DEFAULT;
- light->properties = IOTCON_HIDDEN;
+ light->properties = IOTCON_RESOURCE_NO_PROPERTY;
return 0;
}
}
fan->ifaces = IOTCON_INTERFACE_DEFAULT;
- fan->properties = IOTCON_HIDDEN;
+ fan->properties = IOTCON_RESOURCE_NO_PROPERTY;
return 0;
}
}
ret = _send_response(request, repr, IOTCON_INTERFACE_DEFAULT,
- IOTCON_RESPONSE_RESULT_OK);
+ IOTCON_RESPONSE_OK);
if (0 != ret) {
ERR("_send_response() Fail(%d)", ret);
iotcon_representation_destroy(repr);
}
ret = _send_response(request, repr, IOTCON_INTERFACE_DEFAULT,
- IOTCON_RESPONSE_RESULT_OK);
+ IOTCON_RESPONSE_OK);
if (0 != ret) {
ERR("_send_response() Fail(%d)", ret);
iotcon_representation_destroy(repr);
}
}
- ret = _send_response(request, repr, iface, IOTCON_RESPONSE_RESULT_OK);
+ ret = _send_response(request, repr, iface, IOTCON_RESPONSE_OK);
if (0 != ret) {
ERR("_send_response() Fail(%d)", ret);
iotcon_representation_destroy(repr);
ret = iotcon_request_get_request_type(request, &type);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_request_get_types() Fail(%d)", ret);
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
return;
}
if (IOTCON_REQUEST_GET == type) {
ret = _light_request_handler_get(light, request);
if (0 != ret)
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
} else {
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_FORBIDDEN);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN);
}
}
ret = iotcon_request_get_request_type(request, &type);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_request_get_types() Fail(%d)", ret);
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
return;
}
if (IOTCON_REQUEST_GET == type) {
ret = _fan_request_handler_get(fan, request);
if (0 != ret)
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
} else {
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_FORBIDDEN);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN);
}
}
ret = iotcon_request_get_host_address(request, &host_address);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_request_get_host_address() Fail(%d)", ret);
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
return;
}
INFO("host address : %s", host_address);
ret = iotcon_request_get_request_type(request, &type);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_request_get_types() Fail(%d)", ret);
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
return;
}
if (IOTCON_REQUEST_GET == type) {
ret = _room_request_handler_get(room, request);
if (0 != ret)
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_ERROR);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
} else {
- _send_response(request, NULL, iface, IOTCON_RESPONSE_RESULT_FORBIDDEN);
+ _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN);
}
}