fix type casting for oic handle 43/104043/2 submit/tizen_3.0/20161212.080836
authorJooseok Park <jooseok.park@samsung.com>
Mon, 12 Dec 2016 07:13:26 +0000 (16:13 +0900)
committerJooseok Park <jooseok.park@samsung.com>
Mon, 12 Dec 2016 07:57:04 +0000 (16:57 +0900)
 - remove type casting and use original oic handle

Change-Id: Ia3fd0131bca459cedcba7906c419028b9564cb16

15 files changed:
packaging/iotcon.spec
src/ic-ioty-ocprocess.c
src/ic-ioty.c
src/ic-ioty.h
src/ic-lite-resource.h
src/ic-remote-resource-caching.c
src/ic-remote-resource-crud.c
src/ic-remote-resource.c
src/ic-remote-resource.h
src/ic-request.h
src/ic-resource.h
src/ic-response.h
src/ic-types.c
src/ic-types.h
src/ic.c

index 86a8f1e..0cf7c68 100644 (file)
@@ -1,6 +1,6 @@
 Name:       iotcon
 Summary:    Tizen IoT Connectivity
-Version:    0.3.6
+Version:    0.3.7
 Release:    0
 Group:      Network & Connectivity/Service
 License:    Apache-2.0
index 6d658b5..15659b1 100644 (file)
@@ -751,8 +751,8 @@ OCEntityHandlerResult icl_ioty_ocprocess_request_cb(OCEntityHandlerFlag flag,
        req->observation_info.action = obs_type;
        req->observation_info.observe_id = observe_id;
        req->repr = repr;
-       req->oic_request_h = IC_POINTER_TO_INT64(request->requestHandle);
-       req->oic_resource_h = IC_POINTER_TO_INT64(request->resource);
+       req->oic_request_h = request->requestHandle;
+       req->oic_resource_h = request->resource;
 
        icl_request_container_s *req_container = calloc(1, sizeof(icl_request_container_s));
        req_container->request = req;
@@ -874,8 +874,8 @@ OCEntityHandlerResult icl_ioty_ocprocess_lite_request_cb(OCEntityHandlerFlag fla
                ERR("calloc() Fail(%d)", errno);
                return OC_EH_ERROR;
        }
-       res->oic_request_h = IC_POINTER_TO_INT64(request->requestHandle);
-       res->oic_resource_h = IC_POINTER_TO_INT64(request->resource);
+       res->oic_request_h = request->requestHandle;
+       res->oic_resource_h = request->resource;
 
        switch (req_type) {
        case IOTCON_REQUEST_GET:
index 2be4ce6..897dda8 100644 (file)
@@ -854,12 +854,11 @@ static int _icl_ioty_remote_resource_observe(iotcon_remote_resource_h resource,
                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;
@@ -939,7 +938,7 @@ static int _icl_ioty_remote_resource_observe(iotcon_remote_resource_h resource,
                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();
 
@@ -951,7 +950,6 @@ static int _icl_ioty_remote_resource_observe(iotcon_remote_resource_h resource,
        }
 
        free(uri);
-       *observe_handle = handle;
 
        return IOTCON_ERROR_NONE;
 
@@ -965,28 +963,25 @@ int icl_ioty_remote_resource_observe_register(
                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];
 
@@ -1003,14 +998,13 @@ int icl_ioty_remote_resource_observe_cancel(iotcon_remote_resource_h resource,
                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) {
@@ -1027,15 +1021,15 @@ int icl_ioty_remote_resource_observe_deregister(
        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;
 }
 
@@ -1303,7 +1297,7 @@ static void _icl_ioty_encap_get_cb(iotcon_remote_resource_h resource,
        }
 
        /* CACHING */
-       if (resource->caching.observe) {
+       if (resource->caching.obs_handle) {
                switch (err) {
                case IOTCON_ERROR_NONE:
                        repr = response->repr;
@@ -1414,7 +1408,7 @@ int icl_ioty_remote_resource_start_monitoring(iotcon_remote_resource_h resource,
        }
 
        /* get */
-       if (resource->caching.observe)
+       if (resource->caching.obs_handle)
                return IOTCON_ERROR_NONE;
 
        ret = icl_ioty_remote_resource_set_checking_interval(resource,
@@ -1433,7 +1427,7 @@ int icl_ioty_remote_resource_stop_monitoring(iotcon_remote_resource_h 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;
        }
@@ -1461,7 +1455,6 @@ int icl_ioty_remote_resource_start_caching(iotcon_remote_resource_h resource,
 {
        FN_CALL;
        int ret;
-       OCDoHandle handle = NULL;
 
        RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
 
@@ -1470,12 +1463,11 @@ int icl_ioty_remote_resource_start_caching(iotcon_remote_resource_h resource,
 
        /* 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)
@@ -1503,12 +1495,12 @@ int icl_ioty_remote_resource_stop_caching(iotcon_remote_resource_h resource)
        }
 
        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;
 }
@@ -1647,7 +1639,7 @@ int icl_ioty_resource_create(const char *uri_path,
                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 */
@@ -1671,7 +1663,6 @@ int icl_ioty_resource_bind_type(iotcon_resource_h resource,
 {
        FN_CALL;
        int ret;
-       OCResourceHandle handle;
        iotcon_resource_types_h resource_types;
 
        RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
@@ -1690,8 +1681,7 @@ int icl_ioty_resource_bind_type(iotcon_resource_h resource,
                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);
@@ -1709,7 +1699,6 @@ int icl_ioty_resource_bind_interface(iotcon_resource_h resource,
 {
        FN_CALL;
        int ret;
-       OCResourceHandle handle;
 
        RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
 
@@ -1719,8 +1708,7 @@ int icl_ioty_resource_bind_interface(iotcon_resource_h resource,
                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;
@@ -1734,21 +1722,17 @@ int icl_ioty_resource_bind_child_resource(iotcon_resource_h parent,
 {
        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) {
@@ -1764,20 +1748,16 @@ int icl_ioty_resource_unbind_child_resource(iotcon_resource_h parent,
 {
        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) {
@@ -1797,7 +1777,6 @@ int icl_ioty_resource_notify(iotcon_resource_h resource, iotcon_representation_h
        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);
 
@@ -1823,17 +1802,15 @@ int icl_ioty_resource_notify(iotcon_resource_h resource, iotcon_representation_h
 
        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) {
@@ -1851,25 +1828,22 @@ int icl_ioty_resource_destroy(iotcon_resource_h 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;
 
        return IOTCON_ERROR_NONE;
 }
@@ -1886,7 +1860,6 @@ int icl_ioty_lite_resource_create(const char *uri_path,
        FN_CALL;
        int ret, i;
        GList *c;
-       OCResourceHandle handle;
        iotcon_lite_resource_h resource;
        const char *res_iface = NULL;
 
@@ -1919,7 +1892,7 @@ int icl_ioty_lite_resource_create(const char *uri_path,
                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) {
@@ -1927,12 +1900,11 @@ int icl_ioty_lite_resource_create(const char *uri_path,
                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;
@@ -1944,25 +1916,22 @@ int icl_ioty_lite_resource_destroy(iotcon_lite_resource_h 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);
 
@@ -1973,18 +1942,15 @@ int icl_ioty_lite_resource_notify(iotcon_lite_resource_h 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) {
@@ -2029,8 +1995,8 @@ int icl_ioty_response_send(iotcon_response_h response_handle)
 
        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) {
index 249085b..f8fcfa2 100644 (file)
@@ -102,7 +102,7 @@ int icl_ioty_remote_resource_delete(iotcon_remote_resource_h resource,
                iotcon_remote_resource_response_cb cb,
                void *user_data);
 int icl_ioty_remote_resource_observe_cancel(iotcon_remote_resource_h resource,
-               int64_t handle);
+               OCDoHandle obs_handle);
 int icl_ioty_remote_resource_start_monitoring(iotcon_remote_resource_h resource,
                iotcon_remote_resource_state_changed_cb cb, void *user_data);
 int icl_ioty_remote_resource_stop_monitoring(iotcon_remote_resource_h resource);
index 00b05d7..315bc26 100644 (file)
@@ -23,7 +23,7 @@
 struct icl_lite_resource {
        char *uri_path;
        iotcon_attributes_h attributes;
-       int64_t handle;
+       OCResourceHandle res_handle;
        uint8_t policies;
        iotcon_lite_resource_post_request_cb cb;
        void *cb_data;
index d54727f..e22cb77 100644 (file)
@@ -40,7 +40,7 @@ API int iotcon_remote_resource_start_caching(iotcon_remote_resource_h resource,
                ERR("The resource should be cloned.");
                return IOTCON_ERROR_INVALID_PARAMETER;
        }
-       if (resource->caching.observe) {
+       if (resource->caching.obs_handle) {
                ERR("Already Start Caching");
                return IOTCON_ERROR_ALREADY;
        }
@@ -68,7 +68,7 @@ API int iotcon_remote_resource_stop_caching(iotcon_remote_resource_h resource)
                        IOTCON_ERROR_PERMISSION_DENIED);
        RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
 
-       if (0 == resource->caching.observe) {
+       if (0 == resource->caching.obs_handle) {
                ERR("Not Cached");
                return IOTCON_ERROR_INVALID_PARAMETER;
        }
index d8dc861..0de99b8 100644 (file)
@@ -147,7 +147,7 @@ API int iotcon_remote_resource_observe_register(
                        IOTCON_ERROR_PERMISSION_DENIED);
        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);
 
        if (true == resource->is_found) {
                ERR("The resource should be cloned.");
@@ -180,7 +180,7 @@ API int iotcon_remote_resource_observe_deregister(
                return IOTCON_ERROR_INVALID_PARAMETER;
        }
 
-       if (0 == resource->observe_handle) {
+       if (NULL == resource->obs_handle) {
                ERR("It doesn't have a observe_handle");
                return IOTCON_ERROR_INVALID_PARAMETER;
        }
index d094a80..d2999cb 100644 (file)
@@ -141,7 +141,7 @@ static void _icl_remote_resource_destroy(iotcon_remote_resource_h resource)
        if (resource->monitoring.presence)
                iotcon_remote_resource_stop_monitoring(resource);
 
-       if (resource->caching.observe)
+       if (resource->caching.obs_handle)
                iotcon_remote_resource_stop_caching(resource);
 
        free(resource);
@@ -169,7 +169,7 @@ API int iotcon_remote_resource_destroy(iotcon_remote_resource_h resource)
        RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
        RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
 
-       if (resource->observe_handle)
+       if (resource->obs_handle)
                iotcon_remote_resource_observe_deregister(resource);
 
        icl_remote_resource_unref(resource);
@@ -428,7 +428,7 @@ API int iotcon_remote_resource_set_checking_interval(iotcon_remote_resource_h re
        RETV_IF(ICL_REMOTE_RESOURCE_MAX_CHECKING_INTERVAL < interval || interval <= 0,
                        IOTCON_ERROR_INVALID_PARAMETER);
 
-       if (resource->monitoring.presence || resource->caching.observe) {
+       if (resource->monitoring.presence || resource->caching.obs_handle) {
                ret = icl_ioty_remote_resource_set_checking_interval(resource, interval);
                if (IOTCON_ERROR_NONE != ret) {
                        ERR("icl_ioty_remote_resource_set_checking_interval() Fail(%d)", ret);
index 6e2cc04..fb4221a 100644 (file)
 #include "iotcon-types.h"
 #include "iotcon-remote-resource.h"
 #include "ic-options.h"
+#include <octypes.h>
 
 typedef struct icl_remote_resource_caching {
        iotcon_representation_h repr;
        iotcon_remote_resource_cached_representation_changed_cb cb;
        void *user_data;
-       int64_t observe;
+       OCDoHandle obs_handle;
 } icl_remote_resource_caching_s;
 
 typedef struct icl_remote_resource_monitoring {
@@ -50,7 +51,7 @@ struct icl_remote_resource {
        iotcon_resource_interfaces_h ifaces;
        iotcon_connectivity_type_e connectivity_type;
        int connectivity_options;
-       int64_t observe_handle;
+       OCDoHandle obs_handle;
        int checking_interval;
        unsigned int timer_id;
        icl_remote_resource_caching_s caching;
index 8b77a66..4b7fb79 100644 (file)
@@ -32,8 +32,8 @@ struct icl_resource_request {
        iotcon_query_h query;
        struct icl_observe_info observation_info;
        iotcon_representation_h repr;
-       int64_t oic_request_h;
-       int64_t oic_resource_h;
+       OCRequestHandle oic_request_h;
+       OCResourceHandle oic_resource_h;
 };
 
 #endif /* __IOTCON_INTERNAL_REQUEST_H__ */
index b6fda39..56ea383 100644 (file)
@@ -40,7 +40,7 @@ struct icl_resource {
        iotcon_resource_interfaces_h ifaces;
        iotcon_request_handler_cb cb;
        void *user_data;
-       int64_t handle;
+       OCResourceHandle res_handle;
        iotcon_observers_h observers;
        GList *children;
 };
index aae9395..29143fb 100644 (file)
@@ -31,8 +31,8 @@ struct icl_resource_response {
        char *iface;
        int result;
        iotcon_representation_h repr;
-       int64_t oic_request_h;
-       int64_t oic_resource_h;
+       OCRequestHandle oic_request_h;
+       OCResourceHandle oic_resource_h;
 };
 
 #endif /* __IOTCON_INTERNAL_RESPONSE_H__ */
index a823997..e44069b 100644 (file)
@@ -296,10 +296,10 @@ void icl_destroy_caching_container(void *data)
                return;
        }
 
-       if (cb_container->observe_handle) {
+       if (cb_container->obs_handle) {
                icl_ioty_remote_resource_observe_cancel(cb_container->resource,
-                               cb_container->observe_handle);
-               cb_container->observe_handle = 0;
+                               cb_container->obs_handle);
+               cb_container->obs_handle = NULL;
        }
 
        if (cb_container->timeout) {
index 45d5b2b..e0b4c12 100644 (file)
@@ -88,7 +88,7 @@ typedef struct {
        iotcon_remote_resource_cached_representation_changed_cb cb;
        void *user_data;
        iotcon_remote_resource_h resource;
-       int64_t observe_handle;
+       OCDoHandle obs_handle;
        int timeout;
 } icl_caching_container_s;
 
index 8cb3d32..ba62008 100644 (file)
--- a/src/ic.c
+++ b/src/ic.c
@@ -86,6 +86,7 @@ API int iotcon_initialize(const char *file_path)
 
 API int iotcon_deinitialize(void)
 {
+       FN_CALL;
        RETV_IF(false == ic_utils_check_ocf_feature(), IOTCON_ERROR_NOT_SUPPORTED);
 
        ic_utils_mutex_lock(IC_UTILS_MUTEX_INIT);