Operate all functions of 2.4 APIs 03/46303/1 accepted/tizen/mobile/20150819.072523 accepted/tizen/tv/20150819.072540 accepted/tizen/wearable/20150819.072546 submit/tizen/20150819.054011
authorYongjin Kim <youth.kim@samsung.com>
Wed, 19 Aug 2015 05:14:53 +0000 (14:14 +0900)
committerYongjin Kim <youth.kim@samsung.com>
Wed, 19 Aug 2015 05:14:53 +0000 (14:14 +0900)
Change-Id: Ibdf743724bbeecb71bafcf8a828fa7676fd62226
Signed-off-by: Yongjin Kim <youth.kim@samsung.com>
client/sal_service_storage.c
client/sal_service_task.c
client/sal_service_task_internal.h
client/sal_storage_provider.h
packaging/service-adaptor.spec

index 9207dc6..a6676dc 100644 (file)
@@ -342,7 +342,17 @@ API int service_storage_get_file_list(service_plugin_h plugin,
        RETV_IF(NULL == dir_path, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == callback, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       return SERVICE_ADAPTOR_ERROR_NONE;
+       service_storage_cloud_file_h file = NULL;
+       service_storage_cloud_file_create(plugin, &file);
+       service_storage_cloud_file_set_operation(file, SERVICE_STORAGE_CLOUD_GET_FILE_LIST_URI);
+       service_storage_cloud_file_set_cloud_path(file, dir_path);
+
+       service_task_h service_task = (service_task_h) g_malloc0(sizeof(service_task_s));
+       service_task->cloud_file = file;
+       service_task->storage_file_list_callback = callback;
+       service_task->user_data = user_data;
+
+       return service_task_start(service_task);
 }
 
 API int service_storage_remove(service_plugin_h plugin,
@@ -354,7 +364,17 @@ API int service_storage_remove(service_plugin_h plugin,
        RETV_IF(NULL == remove_path, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == callback, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       return SERVICE_ADAPTOR_ERROR_NONE;
+       service_storage_cloud_file_h file = NULL;
+       service_storage_cloud_file_create(plugin, &file);
+       service_storage_cloud_file_set_operation(file, SERVICE_STORAGE_CLOUD_REMOVE_FILE_URI);
+       service_storage_cloud_file_set_cloud_path(file, remove_path);
+
+       service_task_h service_task = (service_task_h) g_malloc0(sizeof(service_task_s));
+       service_task->cloud_file = file;
+       service_task->storage_result_callback = callback;
+       service_task->user_data = user_data;
+
+       return service_task_start(service_task);
 }
 
 API int service_storage_create_upload_task(service_plugin_h plugin,
@@ -509,6 +529,8 @@ API int service_storage_file_list_clone(service_storage_file_list_h src_list,
        RETV_IF(NULL == src_list, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == dst_list, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
+       *dst_list = src_list;
+
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
@@ -525,6 +547,9 @@ API int service_storage_file_list_get_length(service_storage_file_list_h list,
        RETV_IF(NULL == list, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == length, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
+       service_storage_cloud_file_h file = (service_storage_cloud_file_h) list;
+       *length = file->size;
+
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
@@ -535,6 +560,9 @@ API int service_storage_file_list_foreach_file(service_storage_file_list_h list,
        RETV_IF(NULL == list, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == callback, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
+       service_storage_cloud_file_h file = (service_storage_cloud_file_h) list;
+       callback((service_storage_file_h) file, user_data);
+
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
@@ -544,6 +572,8 @@ API int service_storage_file_clone(service_storage_file_h src_file,
        RETV_IF(NULL == src_file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == dst_file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
+       *dst_file = src_file;
+
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
@@ -560,6 +590,9 @@ API int service_storage_file_is_dir(service_storage_file_h file,
        RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == is_dir, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
+       service_storage_cloud_file_h cloud_file = (service_storage_cloud_file_h) file;
+       *is_dir = cloud_file->is_dir;
+
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
@@ -569,6 +602,9 @@ API int service_storage_file_get_size(service_storage_file_h file,
        RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == size, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
+       service_storage_cloud_file_h cloud_file = (service_storage_cloud_file_h) file;
+       *size = cloud_file->size;
+
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
@@ -578,6 +614,9 @@ API int service_storage_file_get_logical_path(service_storage_file_h file,
        RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == path, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
+       service_storage_cloud_file_h cloud_file = (service_storage_cloud_file_h) file;
+       *path = strdup(cloud_file->cloud_path);
+
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
@@ -587,5 +626,8 @@ API int service_storage_file_get_physical_path(service_storage_file_h file,
        RETV_IF(NULL == file, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == path, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
+       service_storage_cloud_file_h cloud_file = (service_storage_cloud_file_h) file;
+       *path = strdup(cloud_file->cloud_path);
+
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
index 1c2510b..ddc9ebc 100644 (file)
@@ -74,6 +74,18 @@ static void _service_task_async_func(gpointer data, gpointer user_data)
        {
                task->storage_state_callback(SERVICE_STORAGE_TASK_COMPLETED, task->user_data);
        }
+       if (NULL != task->storage_result_callback)
+       {
+               task->storage_result_callback(SERVICE_ADAPTOR_ERROR_NONE, task->user_data);
+       }
+       if (NULL != task->storage_file_list_callback)
+       {
+               service_storage_cloud_file_h file_list = (service_storage_cloud_file_h) g_malloc0(sizeof(service_storage_cloud_file_s));
+               file_list->is_dir = false;
+               file_list->cloud_path = "/sample.txt";
+               file_list->size = 1;
+               task->storage_file_list_callback(SERVICE_ADAPTOR_ERROR_NONE, (service_storage_cloud_file_h) file_list, task->user_data);
+       }
 }
 
 //******************************************************************************
index bb5e387..981fbef 100644 (file)
@@ -45,6 +45,8 @@ typedef struct _service_task_s
        // temp
        service_storage_task_progress_cb storage_progress_callback;
        service_storage_task_state_cb storage_state_callback;
+       service_storage_result_cb storage_result_callback;
+       service_storage_file_list_cb storage_file_list_callback;
        void *user_data;
 } service_task_s;
 
index 3053fce..bf61e06 100644 (file)
@@ -53,6 +53,9 @@ typedef struct _storage_provider_s
 {
        // Cloud
        service_adaptor_error_e (*cloud_remove_file)(const char *cloud_path);
+       service_adaptor_error_e (*cloud_download_file)(const char *cloud_path, const char *local_path);
+       service_adaptor_error_e (*cloud_upload_file)(const char *local_path, const char *cloud_path);
+       service_adaptor_error_e (*cloud_download_file_thumbnail)(const char *cloud_path, const char *local_path);
 
        // Posix
 } storage_provider_s;
index 7e3e81a..80510ed 100644 (file)
@@ -1,6 +1,6 @@
 Name:       service-adaptor
 Summary:    Service Adaptor Framework for Convergence
-Version:    1.1.2
+Version:    1.1.3
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0