iotcon_query_h query,
iotcon_remote_resource_observe_cb cb,
void *user_data,
- OCDoHandle *observe_handle)
+ OCDoHandle *obs_handle)
{
int ret, options_size = 0;
char *uri = NULL;
OCMethod method;
- OCDoHandle handle;
OCDevAddr dev_addr = {0};
OCCallbackData cbdata = {0};
OCConnectivityType oic_conn_type;
return ret;
}
- ret = OCDoResource(&handle, method, uri, &dev_addr, NULL, oic_conn_type,
+ ret = OCDoResource(obs_handle, method, uri, &dev_addr, NULL, oic_conn_type,
OC_HIGH_QOS, &cbdata, oic_options_ptr, options_size);
icl_ioty_mutex_unlock();
}
free(uri);
- *observe_handle = handle;
return IOTCON_ERROR_NONE;
void *user_data)
{
int ret;
- OCDoHandle handle = NULL;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(resource->observe_handle, IOTCON_ERROR_ALREADY);
+ RETV_IF(resource->obs_handle, IOTCON_ERROR_ALREADY);
ret = _icl_ioty_remote_resource_observe(resource, observe_policy, query, cb, user_data,
- &handle);
+ &(resource->obs_handle));
if (IOTCON_ERROR_NONE != ret) {
ERR("_icl_ioty_remote_resource_observe() Fail(%d)", ret);
return ret;
}
- resource->observe_handle = IC_POINTER_TO_INT64(handle);
return IOTCON_ERROR_NONE;
}
int icl_ioty_remote_resource_observe_cancel(iotcon_remote_resource_h resource,
- int64_t observe_handle)
+ OCDoHandle obs_handle)
{
int ret;
int options_size = 0;
- OCDoHandle handle;
OCHeaderOption *oic_options_ptr = NULL;
OCHeaderOption oic_options[MAX_HEADER_OPTIONS];
oic_options_ptr = oic_options;
options_size = g_hash_table_size(resource->header_options->hash);
}
- handle = IC_INT64_TO_POINTER(observe_handle);
ret = icl_ioty_mutex_lock();
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
return ret;
}
- ret = OCCancel(handle, OC_HIGH_QOS, oic_options_ptr, options_size);
+ ret = OCCancel(obs_handle, OC_HIGH_QOS, oic_options_ptr, options_size);
icl_ioty_mutex_unlock();
if (OC_STACK_OK != ret) {
int ret;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(0 == resource->observe_handle, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == resource->obs_handle, IOTCON_ERROR_INVALID_PARAMETER);
- ret = icl_ioty_remote_resource_observe_cancel(resource, resource->observe_handle);
+ ret = icl_ioty_remote_resource_observe_cancel(resource, resource->obs_handle);
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_remote_resource_observe_cancel() Fail(%d)", ret);
return ret;
}
- resource->observe_handle = 0;
+ resource->obs_handle = NULL;
return IOTCON_ERROR_NONE;
}
}
/* CACHING */
- if (resource->caching.observe) {
+ if (resource->caching.obs_handle) {
switch (err) {
case IOTCON_ERROR_NONE:
repr = response->repr;
}
/* get */
- if (resource->caching.observe)
+ if (resource->caching.obs_handle)
return IOTCON_ERROR_NONE;
ret = icl_ioty_remote_resource_set_checking_interval(resource,
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- if (0 == resource->caching.observe && resource->timer_id) {
+ if (NULL == resource->caching.obs_handle && resource->timer_id) {
g_source_remove(resource->timer_id);
resource->timer_id = 0;
}
{
FN_CALL;
int ret;
- OCDoHandle handle = NULL;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
/* observe */
ret = _icl_ioty_remote_resource_observe(resource, IOTCON_OBSERVE_IGNORE_OUT_OF_ORDER,
- NULL, _icl_ioty_caching_observe_cb, NULL, &handle);
+ NULL, _icl_ioty_caching_observe_cb, NULL, &(resource->caching.obs_handle));
if (IOTCON_ERROR_NONE != ret) {
ERR("_icl_ioty_remote_resource_observe() Fail(%d)", ret);
return ret;
}
- resource->caching.observe = IC_POINTER_TO_INT64(handle);
/* get */
if (resource->monitoring.presence)
}
ret = icl_ioty_remote_resource_observe_cancel(resource,
- resource->caching.observe);
+ resource->caching.obs_handle);
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_remote_resource_observe_cancel() Fail(%d)", ret);
return IOTCON_ERROR_INVALID_PARAMETER;
}
- resource->caching.observe = 0;
+ resource->caching.obs_handle = NULL;
return IOTCON_ERROR_NONE;
}
iotcon_resource_destroy(resource);
return IOTCON_ERROR_IOTIVITY;
}
- resource->handle = IC_POINTER_TO_INT64(handle);
+ resource->res_handle = handle;
for (c = res_types->type_list, i = 0; c; c = c->next, i++) {
if (0 == i) /* skip a first resource type */
{
FN_CALL;
int ret;
- OCResourceHandle handle;
iotcon_resource_types_h resource_types;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
return ret;
}
- handle = IC_INT64_TO_POINTER(resource->handle);
- ret = _icl_ioty_resource_bind_type(handle, resource_type);
+ ret = _icl_ioty_resource_bind_type(resource->res_handle, resource_type);
if (IOTCON_ERROR_NONE != ret) {
ERR("_icl_ioty_resource_bind_type Fail(%d)", ret);
iotcon_resource_types_destroy(resource_types);
{
FN_CALL;
int ret;
- OCResourceHandle handle;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
return ret;
}
- handle = IC_INT64_TO_POINTER(resource->handle);
- ret = _icl_ioty_resource_bind_interface(handle, iface);
+ ret = _icl_ioty_resource_bind_interface(resource->res_handle, iface);
if (IOTCON_ERROR_NONE != ret) {
ERR("_icl_ioty_resource_bind_interface() Fail(%d)", ret);
return ret;
{
FN_CALL;
int ret;
- OCResourceHandle handle_parent, handle_child;
RETV_IF(NULL == parent, IOTCON_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == child, IOTCON_ERROR_INVALID_PARAMETER);
RETV_IF(parent == child, IOTCON_ERROR_INVALID_PARAMETER);
- handle_parent = IC_INT64_TO_POINTER(parent->handle);
- handle_child = IC_INT64_TO_POINTER(child->handle);
-
ret = icl_ioty_mutex_lock();
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
return ret;
}
- ret = OCBindResource(handle_parent, handle_child);
+ ret = OCBindResource(parent->res_handle, child->res_handle);
icl_ioty_mutex_unlock();
if (OC_STACK_OK != ret) {
{
FN_CALL;
int ret;
- OCResourceHandle handle_parent, handle_child;
RETV_IF(NULL == parent, IOTCON_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == child, IOTCON_ERROR_INVALID_PARAMETER);
- handle_parent = IC_INT64_TO_POINTER(parent->handle);
- handle_child = IC_INT64_TO_POINTER(child->handle);
-
ret = icl_ioty_mutex_lock();
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
return ret;
}
- ret = OCUnBindResource(handle_parent, handle_child);
+ ret = OCUnBindResource(parent->res_handle, child->res_handle);
icl_ioty_mutex_unlock();
if (OC_STACK_OK != ret) {
iotcon_observers_h observers_ori;
OCObservationId obs_ids[IC_OBSERVE_ID_MAX_LEN];
OCQualityOfService oc_qos;
- OCResourceHandle handle;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
oc_qos = ic_ioty_convert_qos(qos);
- handle = IC_INT64_TO_POINTER(resource->handle);
-
ret = icl_ioty_mutex_lock();
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
return ret;
}
if (payload)
- ret = OCNotifyListOfObservers(handle, obs_ids, obs_length, payload, oc_qos);
+ ret = OCNotifyListOfObservers(resource->res_handle, obs_ids, obs_length, payload, oc_qos);
else
- ret = OCNotifyAllObservers(handle, oc_qos);
+ ret = OCNotifyAllObservers(resource->res_handle, oc_qos);
icl_ioty_mutex_unlock();
if (OC_STACK_NO_OBSERVERS == ret) {
{
FN_CALL;
int ret;
- OCResourceHandle handle;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- handle = IC_INT64_TO_POINTER(resource->handle);
-
ret = icl_ioty_mutex_lock();
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
return ret;
}
- ret = OCDeleteResource(handle);
+ ret = OCDeleteResource(resource->res_handle);
icl_ioty_mutex_unlock();
if (OC_STACK_OK != ret) {
ERR("OCDeleteResource() Fail(%d)", ret);
return ic_ioty_parse_oic_error(ret);
}
- resource->handle = 0;
+ resource->res_handle = NULL;
return IOTCON_ERROR_NONE;
}
FN_CALL;
int ret, i;
GList *c;
- OCResourceHandle handle;
iotcon_lite_resource_h resource;
const char *res_iface = NULL;
icl_ioty_lite_resource_destroy(resource);
return ret;
}
- ret = OCCreateResource(&handle, res_types->type_list->data, res_iface, uri_path,
+ ret = OCCreateResource(&(resource->res_handle), res_types->type_list->data, res_iface, uri_path,
icl_ioty_ocprocess_lite_request_cb, resource, policies);
icl_ioty_mutex_unlock();
if (OC_STACK_OK != ret) {
icl_ioty_lite_resource_destroy(resource);
return IOTCON_ERROR_IOTIVITY;
}
- resource->handle = IC_POINTER_TO_INT64(handle);
for (c = res_types->type_list, i = 0; c; c = c->next, i++) {
if (0 == i) /* skip a first resource type */
continue;
- _icl_ioty_resource_bind_type(handle, c->data);
+ _icl_ioty_resource_bind_type(resource->res_handle, c->data);
}
*resource_handle = resource;
{
FN_CALL;
int ret;
- OCResourceHandle handle;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- handle = IC_INT64_TO_POINTER(resource->handle);
-
ret = icl_ioty_mutex_lock();
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
return ret;
}
- ret = OCDeleteResource(handle);
+ ret = OCDeleteResource(resource->res_handle);
icl_ioty_mutex_unlock();
if (OC_STACK_OK != ret) {
ERR("OCDeleteResource() Fail(%d)", ret);
return ic_ioty_parse_oic_error(ret);
}
- resource->handle = 0;
+ resource->res_handle = NULL;
free(resource->uri_path);
free(resource);
{
FN_CALL;
int ret;
- OCResourceHandle handle;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
- handle = IC_INT64_TO_POINTER(resource->handle);
-
ret = icl_ioty_mutex_lock();
if (IOTCON_ERROR_NONE != ret) {
ERR("icl_ioty_mutex_lock() Fail(%d)", ret);
return ret;
}
- ret = OCNotifyAllObservers(handle, IOTCON_QOS_HIGH);
+ ret = OCNotifyAllObservers(resource->res_handle, IOTCON_QOS_HIGH);
icl_ioty_mutex_unlock();
if (OC_STACK_NO_OBSERVERS == ret) {
RETV_IF(NULL == response_handle, IOTCON_ERROR_INVALID_PARAMETER);
- response.requestHandle = (unsigned int)(response_handle->oic_request_h);
- response.resourceHandle = IC_INT64_TO_POINTER(response_handle->oic_resource_h);
+ response.requestHandle = response_handle->oic_request_h;
+ response.resourceHandle = response_handle->oic_resource_h;
response.ehResult = ic_ioty_convert_response_result(response_handle->result);
if (response_handle->header_options && response_handle->header_options->hash) {