_icl_ioty_free_response_container(cb_container);
return ret;
}
- SECURE_DBG("uri:[%s], oic_conn_type:[0x%x]", uri, oic_conn_type);
+ SECURE_DBG("uri:[%s], oic_conn_type:[0x%x] To [%s:%d] ", uri, oic_conn_type, dev_addr.addr, dev_addr.port);
ret = OCDoResource(NULL, method, uri, &dev_addr, (OCPayload *)payload, oic_conn_type,
OC_HIGH_QOS, &cbdata, oic_options_ptr, options_size);
free(uri);
iotcon_response_h response,
void *user_data)
{
- FN_CALL;
+ DBG(">>>>>>>> called... resource :[%p]", resource);
+
int ret;
iotcon_representation_h repr;
iotcon_remote_resource_state_e state;
}
if (state != resource->monitoring.state) {
- DBG("call the monitoring callback...");
+ DBG("call the monitoring callback [%p]", resource->monitoring.cb);
resource->monitoring.cb(resource, state, resource->monitoring.user_data);
resource->monitoring.state = state;
DBG("call the monitoring callback done");
repr = response->repr;
break;
default:
- WARN("iotcon_remote_resource_get() Fail(%d)", err);
+ WARN("_icl_ioty_encap_get_cb() Fail(%d)", err);
repr = NULL;
}
response->repr = NULL;
if (resource->caching.cb) {
- DBG("call the caching callback...");
+ DBG("call the caching callback [%p]", resource->caching.cb);
resource->caching.cb(resource, repr, resource->caching.user_data);
DBG("call the caching callback done");
}
int icl_ioty_remote_resource_start_monitoring(iotcon_remote_resource_h resource,
iotcon_remote_resource_state_changed_cb cb, void *user_data)
{
- FN_CALL;
+ DBG(">>>>>>>> called... resource :[%p], cb :[%p]", resource, cb);
int ret;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
static void _icl_ioty_caching_observe_cb(iotcon_remote_resource_h resource,
iotcon_error_e err, int sequence_number, iotcon_response_h response, void *user_data)
{
- RET_IF(NULL == resource);
+ RET_IF(NULL == resource || NULL == response);
- _icl_ioty_encap_timeout_cb(resource);
+
+ if (resource->timer_id)
+ g_source_remove(resource->timer_id);
+
+ if (resource->caching.obs_handle) {
+ int ret;
+ iotcon_representation_h repr = response->repr;
+ resource->timer_id = g_timeout_add_seconds(resource->checking_interval, _icl_ioty_encap_timeout_cb,
+ resource);
+ DBG("resource->timer_id :[%d]", resource->timer_id);
+
+ ret = icl_representation_compare(resource->caching.repr, repr);
+ if (IC_EQUAL != ret) { /* updated */
+ if (resource->caching.repr)
+ icl_representation_destroy(resource->caching.repr);
+ resource->caching.repr = repr;
+ if (response)
+ response->repr = NULL;
+
+ if (resource->caching.cb) {
+ DBG("call the caching callback [%p]", resource->caching.cb);
+ resource->caching.cb(resource, repr, resource->caching.user_data);
+ DBG("call the caching callback done");
+ }
+ }
+ }
}
int icl_ioty_remote_resource_start_caching(iotcon_remote_resource_h resource,
iotcon_remote_resource_cached_representation_changed_cb cb, void *user_data)
{
- FN_CALL;
+ DBG(">>>>>>>> called... resource :[%p], cb :[%p]", resource, cb);
int ret;
RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);