Remove presence API - not working, maybe it'll be deprecated 55/142155/1
authorJin Yoon <jinny.yoon@samsung.com>
Thu, 3 Aug 2017 01:55:39 +0000 (10:55 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Thu, 3 Aug 2017 01:55:39 +0000 (10:55 +0900)
Change-Id: I09a4b159c887640a41f99dffcb7164ee4e72303a

src/connectivity.c

index dac745b..3919316 100644 (file)
@@ -45,7 +45,6 @@ struct _connectivity_resource_s {
        char *device_name;
        char *type;
        char *uri_path;
-       iotcon_presence_h presence;
        iotcon_remote_resource_h resource;
        connectivity_observe_resource_cb_s *cb_info;
 };
@@ -93,42 +92,6 @@ static void _observe_cb(iotcon_remote_resource_h resource, iotcon_error_e err, i
        resource_info->cb_info->cb(resource_info, (void *)(int) opened, resource_info->cb_info->user_data);
 }
 
-static void _presence_cb(iotcon_presence_h presence, iotcon_error_e err,
-               iotcon_presence_response_h response, void *user_data)
-{
-       int ret = -1;
-       char *host_address = NULL;
-       char *resource_type = NULL;
-       iotcon_presence_result_e result;
-       iotcon_presence_trigger_e trigger;
-       iotcon_connectivity_type_e connectivity_type;
-
-       ret_if(IOTCON_ERROR_NONE != err);
-
-       ret = iotcon_presence_response_get_result(response, &result);
-       ret_if(IOTCON_ERROR_NONE != ret);
-
-       _I("Presence callback's result : %d", result);
-
-       if (IOTCON_PRESENCE_OK == result) {
-               ret = iotcon_presence_response_get_trigger(response, &trigger);
-               ret_if(IOTCON_ERROR_NONE != ret);
-               _I("trigger : %d", trigger);
-       }
-
-       ret = iotcon_presence_response_get_host_address(response, &host_address);
-       ret_if(IOTCON_ERROR_NONE != ret);
-
-       ret = iotcon_presence_response_get_connectivity_type(response, &connectivity_type);
-       ret_if(IOTCON_ERROR_NONE != ret);
-
-       ret = iotcon_presence_response_get_resource_type(response, &resource_type);
-       ret_if(IOTCON_ERROR_NONE != ret);
-
-       _I("Host address : %s", host_address);
-       _I("Resource type : %s", resource_type);
-}
-
 /* return values : -1 error, 0 not exist, 1 exist */
 static int _exist_device_id_in_list(iotcon_remote_resource_h resource)
 {
@@ -287,9 +250,6 @@ static void _free_resource_info(connectivity_resource_s *info)
 {
        ret_if(!info);
 
-       if (info->presence)
-               iotcon_remove_presence_cb(info->presence);
-
        if (info->resource)
                iotcon_remote_resource_destroy(info->resource);
 
@@ -317,40 +277,6 @@ static void _free_resource_info_list(void)
        }
 }
 
-
-static int _register_presence(iotcon_remote_resource_h resource, connectivity_resource_s *info)
-{
-       int ret = -1;
-       char *resource_host = NULL;
-       iotcon_connectivity_type_e connectivity_type;
-
-       ret = iotcon_remote_resource_get_host_address(resource, &resource_host);
-       retv_if(IOTCON_ERROR_NONE != ret, -1);
-
-       ret = iotcon_remote_resource_get_connectivity_type(resource, &connectivity_type);
-       retv_if(IOTCON_ERROR_NONE != ret, -1);
-
-       /* FIXME : We need to remove presence_cb when not needed */
-       ret = iotcon_add_presence_cb(resource_host,
-                       connectivity_type,
-                       info->type,
-                       _presence_cb,
-                       NULL,
-                       &info->presence);
-       retv_if(IOTCON_ERROR_NONE != ret, -1);
-
-       return 0;
-}
-
-#if 0
-static void _unregister_presence(connectivity_resource_s *info)
-{
-       ret_if(!info);
-       iotcon_remove_presence_cb(info->presence);
-       info->presence = NULL;
-}
-#endif
-
 static int _register_observe(connectivity_resource_s *info)
 {
        int ret = -1;
@@ -397,11 +323,6 @@ static bool _found_resource_cb(iotcon_remote_resource_h resource, iotcon_error_e
        ret = _retrieve_resource_info(resource, info);
        goto_if(-1 == ret, error);
 
-       /* FIXME : We have to develop these routines more for meaningful usecases */
-       /* We can think several scenarios like intentionally closing servers. */
-       ret = _register_presence(resource, info);
-       goto_if(-1 == ret, error);
-
        if (-1 == _register_observe(info)) {
                _E("Cannot observe [%s:%s:%s:%s]", info->device_id, info->host_address, info->device_name, info->uri_path);
        }