4 * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __SERVICE_STORAGE_H__
21 #define __SERVICE_STORAGE_H__
24 #define API __attribute__ ((visibility("default")))
32 #include "sal_service_adaptor.h"
33 #include "sal_service_task.h"
35 #define SERVICE_STORAGE_CLOUD_REMOVE_FILE_URI "http://tizen.org/service-adaptor/storage/cloud/remove_file"
36 #define SERVICE_STORAGE_CLOUD_DOWNLOAD_FILE_URI "http://tizen.org/service-adaptor/storage/cloud/download_file"
37 #define SERVICE_STORAGE_CLOUD_UPLOAD_FILE_URI "http://tizen.org/service-adaptor/storage/cloud/upload_file"
38 #define SERVICE_STORAGE_CLOUD_DOWNLOAD_FILE_THUMBNAIL_URI "http://tizen.org/service-adaptor/storage/cloud/download_file_thumbnail"
39 #define SERVICE_STORAGE_CLOUD_GET_FILE_LIST_URI "http://tizen.org/service-adaptor/storage/cloud/get_file_list"
41 typedef struct _service_storage_cloud_file_s *service_storage_cloud_file_h;
43 typedef bool (*service_storage_cloud_file_cb)(int result, service_storage_cloud_file_h file, void *user_data);
45 /*==================================================================================================
47 ==================================================================================================*/
49 int service_storage_cloud_file_create(service_plugin_h plugin, service_storage_cloud_file_h *file);
50 int service_storage_cloud_file_clone(service_storage_cloud_file_h src_file, service_storage_cloud_file_h *dst_file);
52 int service_storage_cloud_file_destroy(service_storage_cloud_file_h file);
53 int service_storage_cloud_file_set_callback(service_storage_cloud_file_h file, service_storage_cloud_file_cb callback, void *user_data);
54 int service_storage_cloud_file_unset_callback(service_storage_cloud_file_h file);
55 int service_storage_cloud_file_set_cloud_path(service_storage_cloud_file_h file, const char *cloud_path);
56 int service_storage_cloud_file_get_cloud_path(service_storage_cloud_file_h file, char **cloud_path);
57 int service_storage_cloud_file_set_local_path(service_storage_cloud_file_h file, const char *local_path);
58 int service_storage_cloud_file_get_local_path(service_storage_cloud_file_h file, char **local_path);
59 int service_storage_cloud_file_set_size(service_storage_cloud_file_h file, unsigned long long size);
60 int service_storage_cloud_file_get_size(service_storage_cloud_file_h file, unsigned long long *size);
61 int service_storage_cloud_file_set_operation(service_storage_cloud_file_h file, const char *operation);
62 int service_storage_cloud_file_get_operation(service_storage_cloud_file_h file, char **operation);
63 int service_storage_cloud_file_is_directory(service_storage_cloud_file_h file, bool *is_dir);
64 int service_storage_cloud_file_foreach_file(service_storage_cloud_file_h file, service_storage_cloud_file_cb callback, void *user_data);
65 int service_storage_cloud_file_create_task(service_storage_cloud_file_h file, service_task_h *task);
66 int service_storage_cloud_file_destroy_task(service_task_h task);
71 * @brief The handle of async task for storage service
72 * @see #service_storage_create_download_task()
73 * @see #service_storage_create_upload_task()
75 typedef struct _service_storage_task_s *service_storage_task_h;
78 * @brief The handle of file or directory in storage
79 * @see #service_storage_file_clone()
80 * @see #service_storage_file_destroy()
82 typedef struct _service_storage_file_s *service_storage_file_h;
85 * @brief The list handle of file or directory in storage
86 * @see #service_storage_file_list_clone()
87 * @see #service_storage_file_list_destroy()
89 typedef struct _service_storage_file_list_s *service_storage_file_list_h;
92 * @brief Type of storage task
96 SERVICE_STORAGE_TASK_IN_PROGRESS = 1, /**< The task is progressing */
97 SERVICE_STORAGE_TASK_COMPLETED = 2, /**< The task was completed */
98 SERVICE_STORAGE_TASK_CANCELED = 3, /**< The task was canceled */
99 SERVICE_STORAGE_TASK_FAILED = 4, /**< The task was failed */
100 } service_storage_task_state_e;
103 * @brief Callback for changing state of storage task
105 * @param[in] state The state of storage task
106 * @param[in] user_data The user data passed from #service_storage_set_task_state_changed_cb()
108 * @see #service_storage_unset_task_state_changed_cb()
109 * @pre #service_storage_set_task_state_changed_cb() will invoke this callback.
111 typedef void (*service_storage_task_state_cb)(service_storage_task_state_e state,
115 * @brief Callback for progress of storage task
117 * @param[in] progress The progressed amount of storage task
118 * @param[in] total The total amount of storage task
119 * @param[in] user_data The user data passed from #service_storage_set_task_progress_cb()
121 * @see #service_storage_unset_task_progress_cb()
122 * @pre #service_storage_set_task_progress_cb() will invoke this callback.
124 typedef void (*service_storage_task_progress_cb)(unsigned long long progress,
125 unsigned long long total,
129 * @brief Callback for getting async storage operation result
131 * @param[in] result Result code for storage async operation (see #service_adaptor_error_e)
132 * @param[in] user_data Passed data from request function
133 * @remarks If the @a result value is #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
134 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_NONE Successful
135 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_NO_DATA There is no files
136 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_TIMED_OUT Timed out
137 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
138 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
139 * @see #service_adaptor_error_e
140 * @see service_storage_remove()
142 * @pre #service_storage_remove() will invoke this callback.
144 typedef void (*service_storage_result_cb)(int result,
149 * @brief Callback for getting file list API
151 * @param[in] result Result code for #service_storage_get_file_list() (see #service_adaptor_error_e)
152 * @param[in] list The handle of file list
153 * @param[in] user_data Passed data from #service_storage_get_file_list()
154 * @remarks If the @a result value is #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
155 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_NONE Successful
156 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_NO_DATA There is no files
157 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_TIMED_OUT Timed out
158 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
159 * @remarks The @a result values #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
160 * @see #service_adaptor_error_e
161 * @see #service_storage_file_list_h
163 * @pre #service_storage_get_file_list() will invoke this callback.
165 typedef void (*service_storage_file_list_cb)(int result,
166 service_storage_file_list_h list,
170 * @brief Callback for service_storage_file_list_foreach_file API
172 * @param[in] file The handle of file
173 * @param[in] user_data Passed data from #service_storage_file_list_foreach_file()
174 * @see #service_storage_file_h
175 * @return @c true to continue with the next iteration of the loop,
176 * otherwise @c false to break out of the loop
177 * @pre #service_storage_file_list_foreach_file() will invoke this callback.
179 typedef bool (*service_storage_file_cb)(service_storage_file_h file,
183 * @brief Gets file list from storage, asynchronously.
186 * @privilege %http://tizen.org/privilege/internet
188 * @param[in] plugin The handle for use Plugin APIs
189 * @param[in] dir_path The dir path (Physical path)
190 * @param[in] callback The callback for getting file list
191 * @param[in] user_data The user data to be passed to the callback function
192 * @remarks For the @a dir_path, "/" means root path.
193 * @remarks Reference details for <b>"Logical path"</b> and <b>"Physical path"</b> at @ref SERVICE_ADAPTOR_STORAGE_MODULE_OVERVIEW page
194 * @see service_plugin_start()
195 * @see service_storage_file_list_cb()
196 * @see service_adaptor_get_last_result()
197 * @see service_adaptor_get_last_error_message()
198 * @return 0 on success, otherwise a negative error value
199 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
200 * @retval #SERVICE_ADAPTOR_ERROR_PERMISSION_DENIED Permission denied
201 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_STATE The handle's state is invalid
202 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
203 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
204 * @retval #SERVICE_ADAPTOR_ERROR_NOT_SUPPORTED Not supported API in this plugin
205 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
206 * @pre API prerequires #service_plugin_start()
207 * @post #service_storage_file_list_cb() will be invoked
209 int service_storage_get_file_list(service_plugin_h plugin,
210 const char *dir_path,
211 service_storage_file_list_cb callback,
215 * @brief Removes file or directory in storage
218 * @privilege %http://tizen.org/privilege/internet
220 * @param[in] plugin The handle for use Plugin APIs
221 * @param[in] remove_path The target file or directory for remove (Physical path)
222 * @param[in] callback The callback for getting result this operation
223 * @param[in] user_data The user data to be passed to the callback function
224 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
225 * @remarks Reference details for <b>"Logical path"</b> and <b>"Physical path"</b> at @ref SERVICE_ADAPTOR_STORAGE_MODULE_OVERVIEW page
226 * @see service_plugin_start()
227 * @see service_storage_result_cb()
228 * @see service_adaptor_get_last_result()
229 * @see service_adaptor_get_last_error_message()
230 * @return 0 on success, otherwise a negative error value
231 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
232 * @retval #SERVICE_ADAPTOR_ERROR_PERMISSION_DENIED Permission denied
233 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_STATE The handle's state is invalid
234 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
235 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
236 * @retval #SERVICE_ADAPTOR_ERROR_NOT_SUPPORTED Not supported API in this plugin
237 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
238 * @pre API prerequires #service_plugin_start()
239 * @post #service_storage_result_cb() will be invoked
241 int service_storage_remove(service_plugin_h plugin,
242 const char *remove_path,
243 service_storage_result_cb callback,
247 * @brief Creates storage task for upload file to storage
250 * @privilege %http://tizen.org/privilege/internet
252 * @param[in] plugin The handle for use Plugin APIs
253 * @param[in] file_path The upload file path in local (Logical path)
254 * @param[in] upload_path The upload target path in storage (Physical path)
255 * @param[out] task The handle of download task
256 * @remarks @a task must be released memory using service_storage_destroy_task() when the task no longer run
257 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
258 * @remarks Reference details for <b>"Logical path"</b> and <b>"Physical path"</b> at @ref SERVICE_ADAPTOR_STORAGE_MODULE_OVERVIEW page
259 * @remarks http://tizen.org/privilege/mediastorage is needed if @a file_path is relevant to media storage.
260 * @remarks http://tizen.org/privilege/externalstorage is needed if @a file_path is relevant to external storage.
261 * @see service_plugin_start()
262 * @see service_storage_destroy_task()
263 * @see service_adaptor_get_last_result()
264 * @see service_adaptor_get_last_error_message()
265 * @return 0 on success, otherwise a negative error value
266 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
267 * @retval #SERVICE_ADAPTOR_ERROR_PERMISSION_DENIED Permission denied
268 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_STATE The handle's state is invalid
269 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
270 * @retval #SERVICE_ADAPTOR_ERROR_NO_DATA There is no files
271 * @retval #SERVICE_ADAPTOR_ERROR_TIMED_OUT Timed out
272 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
273 * @retval #SERVICE_ADAPTOR_ERROR_NOT_SUPPORTED Not supported API in this plugin
274 * @retval #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
275 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
276 * @pre API prerequires #service_plugin_start()
278 int service_storage_create_upload_task(service_plugin_h plugin,
279 const char *file_path,
280 const char *upload_path,
281 service_storage_task_h *task);
284 * @brief Creates storage task for download file from storage
287 * @privilege %http://tizen.org/privilege/internet
289 * @param[in] plugin The handle for use Plugin APIs
290 * @param[in] storage_path The source file path in storage (Physical path)
291 * @param[in] download_path The download path in local (Logical path)
292 * @param[out] task The handle of download task
293 * @remarks @a task must be released memory using service_storage_destroy_task() when the task no longer run
294 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
295 * @remarks Reference details for <b>"Logical path"</b> and <b>"Physical path"</b> at @ref SERVICE_ADAPTOR_STORAGE_MODULE_OVERVIEW page
296 * @remarks http://tizen.org/privilege/mediastorage is needed if @a download_path is relevant to media storage.
297 * @remarks http://tizen.org/privilege/externalstorage is needed if @a download_path is relevant to external storage.
298 * @see service_plugin_start()
299 * @see service_storage_destroy_task()
300 * @see service_adaptor_get_last_result()
301 * @see service_adaptor_get_last_error_message()
302 * @return 0 on success, otherwise a negative error value
303 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
304 * @retval #SERVICE_ADAPTOR_ERROR_PERMISSION_DENIED Permission denied
305 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_STATE The handle's state is invalid
306 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
307 * @retval #SERVICE_ADAPTOR_ERROR_NO_DATA There is no files
308 * @retval #SERVICE_ADAPTOR_ERROR_TIMED_OUT Timed out
309 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
310 * @retval #SERVICE_ADAPTOR_ERROR_NOT_SUPPORTED Not supported API in this plugin
311 * @retval #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
312 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
313 * @pre API prerequires #service_plugin_start()
315 int service_storage_create_download_task(service_plugin_h plugin,
316 const char *storage_path,
317 const char *download_path,
318 service_storage_task_h *task);
321 * @brief Creates storage task for download thumbnail from storage
324 * @privilege %http://tizen.org/privilege/internet
326 * @param[in] plugin The handle for use Plugin APIs
327 * @param[in] storage_path The source file path in storage (Physical path)
328 * @param[in] download_path The download path in local (Logical path)
329 * @param[in] thumbnail_size The size <b>level</b> of thumbnail, the level is defined service plugin SPEC
330 * @param[out] task The handle of download task
331 * @remarks If @a thumbnail_size is <b>0</b>, gets default size thumbnail, the default size must be defined plugin SPEC
332 * @remarks If @a thumbnail_size is <b>-1</b>, gets minimum size thumbnail be supported plugin
333 * @remarks If @a thumbnail_size is <b>-2</b>, gets maximum size thumbnail be supported plugin
334 * @remarks @a task must be released memory using service_storage_destroy_task() when the task no longer run
335 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
336 * @remarks Reference details for <b>"Logical path"</b> and <b>"Physical path"</b> at @ref SERVICE_ADAPTOR_STORAGE_MODULE_OVERVIEW page
337 * @remarks http://tizen.org/privilege/mediastorage is needed if @a download_path is relevant to media storage.
338 * @remarks http://tizen.org/privilege/externalstorage is needed if @a download_path is relevant to external storage.
339 * @see service_plugin_start()
340 * @see service_adaptor_get_last_result()
341 * @see service_adaptor_get_last_error_message()
342 * @return 0 on success, otherwise a negative error value
343 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
344 * @retval #SERVICE_ADAPTOR_ERROR_PERMISSION_DENIED Permission denied
345 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_STATE The handle's state is invalid
346 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
347 * @retval #SERVICE_ADAPTOR_ERROR_NO_DATA There is no thumbnail data
348 * @retval #SERVICE_ADAPTOR_ERROR_TIMED_OUT Timed out
349 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
350 * @retval #SERVICE_ADAPTOR_ERROR_NOT_SUPPORTED Not supported API in this plugin
351 * @retval #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
352 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
353 * @pre API prerequires #service_plugin_start()
355 int service_storage_create_download_thumbnail_task (service_plugin_h plugin,
356 const char *storage_path,
357 const char *download_path,
359 service_storage_task_h *task);
362 * @brief Destroys storage task
365 * @param[in] task The handle of storage task
366 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
367 * @see service_storage_create_download_task()
368 * @see service_storage_create_upload_task()
369 * @see service_adaptor_get_last_result()
370 * @see service_adaptor_get_last_error_message()
371 * @return 0 on success, otherwise a negative error value
372 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
373 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
374 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
375 * @retval #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
376 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
378 int service_storage_destroy_task(service_storage_task_h task);
381 * @brief Starts storage task, asynchronously.
384 * @param[in] task The handle of storage task
385 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
386 * @see service_storage_create_upload_task()
387 * @see service_storage_create_download_task()
388 * @see service_storage_create_download_thumbnail_task()
389 * @see service_adaptor_get_last_result()
390 * @see service_adaptor_get_last_error_message()
391 * @return 0 on success, otherwise a negative error value
392 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
393 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
394 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
395 * @retval #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
396 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
398 int service_storage_start_task(service_storage_task_h task);
401 * @brief Cancels storage task, asynchronously.
404 * @param[in] task The handle of storage task
405 * @remarks @a task must be released memory using service_storage_destroy_task() when the task no longer run
406 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
407 * @see service_storage_start_task()
408 * @see service_adaptor_get_last_result()
409 * @see service_adaptor_get_last_error_message()
410 * @return 0 on success, otherwise a negative error value
411 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
412 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
413 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
414 * @retval #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
415 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
417 int service_storage_cancel_task(service_storage_task_h task);
420 * @brief Sets a callback function to be invoked when progress of the task running.
423 * @param[in] task The handle of storage task
424 * @param[in] callback The callback function to register
425 * @param[in] user_data The user data to be passed to the callback function
426 * @remarks This function must be called before starting task (see #service_storage_start_task())
427 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
428 * @see service_storage_start_task()
429 * @see service_adaptor_get_last_result()
430 * @see service_adaptor_get_last_error_message()
431 * @return 0 on success, otherwise a negative error value
432 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
433 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
434 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
435 * @retval #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
436 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
437 * @post #service_storage_task_progress_cb() will be invoked
439 int service_storage_set_task_progress_cb(service_storage_task_h task,
440 service_storage_task_progress_cb callback,
444 * @brief Unsets the progress callback function.
447 * @param[in] task The handle of storage task
448 * @remarks This function must be called before starting task (see #service_storage_start_task())
449 * @see service_storage_start_task()
450 * @see service_storage_set_task_progress_cb()
451 * @return 0 on success, otherwise a negative error value
452 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
453 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
455 int service_storage_unset_task_progress_cb(service_storage_task_h task);
459 * @brief Sets a callback function to be invoked when change of the task running state.
462 * @param[in] task The handle of storage task
463 * @param[in] callback The callback function to register
464 * @param[in] user_data The user data to be passed to the callback function
465 * @remarks This function must be called before starting task (see #service_storage_start_task())
466 * @remarks If the function returns #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED, error code and error message can be obtained using #service_adaptor_get_last_result() and #service_adaptor_get_last_error_message() method. Error codes and messages are described in Service Plugin.
467 * @see service_storage_start_task()
468 * @see service_adaptor_get_last_result()
469 * @see service_adaptor_get_last_error_message()
470 * @return 0 on success, otherwise a negative error value
471 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
472 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
473 * @retval #SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE IPC failed with Service Adaptor Daemon
474 * @retval #SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED Failed in Plugin internal
475 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
476 * @post #service_storage_task_state_cb() will be invoked
478 int service_storage_set_task_state_changed_cb(service_storage_task_h task,
479 service_storage_task_state_cb callback,
483 * @brief Unsets the state changed callback function.
486 * @param[in] task The handle of storage task
487 * @remarks This function must be called before starting task (see #service_storage_start_task())
488 * @see service_storage_start_task()
489 * @see service_storage_set_task_progress_cb()
490 * @return 0 on success, otherwise a negative error value
491 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
492 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
494 int service_storage_unset_task_state_changed_cb(service_storage_task_h task);
497 * @brief Clones the file list handle
500 * @param[in] src_list The source handle
501 * @param[out] dst_list The destination handle
502 * @remarks @a file must be released memory using service_storage_file_list_destroy() when you no longer needs this handle
503 * @see service_storage_file_list_h
504 * @see service_storage_file_list_destroy()
505 * @return 0 on success, otherwise a negative error value
506 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
507 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
509 int service_storage_file_list_clone(service_storage_file_list_h src_list,
510 service_storage_file_list_h *dst_list);
513 * @brief Destroys the file list handle
516 * @param[in] list The file list handle
517 * @remarks It must be used for cloned file list handle
518 * @see service_storage_file_list_h
519 * @see service_storage_file_list_clone()
520 * @return 0 on success, otherwise a negative error value
521 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
522 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
524 int service_storage_file_list_destroy(service_storage_file_list_h list);
527 * @brief Gets length of the file list handle
530 * @param[in] list The file list handle
531 * @param[out] length The length of the file list handle
532 * @return 0 on success, otherwise a negative error value
533 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
534 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
536 int service_storage_file_list_get_length(service_storage_file_list_h list,
540 * @brief Foreach All of the file from file list
543 * @param[in] list The file list handle
544 * @param[in] callback The callback for foreach file
545 * @param[in] user_data Passed data to callback
546 * @see #service_storage_file_cb
547 * @return 0 on success, otherwise a negative error value
548 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
549 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
550 * @retval #SERVICE_ADAPTOR_ERROR_NO_DATA There is no files
552 int service_storage_file_list_foreach_file(service_storage_file_list_h list,
553 service_storage_file_cb callback,
557 * @brief Clones the file handle
560 * @param[in] src_file The source handle
561 * @param[out] dst_file The destination handle
562 * @remarks @a file must be released memory using service_storage_file_destroy() when you no longer needs this handle
563 * @see #service_storage_file_h
564 * @see #service_storage_file_destroy()
565 * @return 0 on success, otherwise a negative error value
566 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
567 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
569 int service_storage_file_clone(service_storage_file_h src_file,
570 service_storage_file_h *dst_file);
573 * @brief Destroys the file handle
574 * @details This function must be used for cloned file handle.
577 * @param[in] file The handle of file or directory in storage
578 * @see service_storage_file_h
579 * @see service_storage_file_clone()
580 * @return 0 on success, otherwise a negative error value
581 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
582 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
584 int service_storage_file_destroy(service_storage_file_h file);
587 * @brief Gets whether directory or file for file handle
590 * @param[in] file The handle of file or directory in storage
591 * @param[out] is_dir true on directory, false on file
592 * @see service_storage_file_h
593 * @return 0 on success, otherwise a negative error value
594 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
595 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
597 int service_storage_file_is_dir(service_storage_file_h file,
601 * @brief Gets size of handle
604 * @param[in] file The handle of file or directory in storage
605 * @param[out] size The size of file (byte)
606 * @see service_storage_file_h
607 * @return 0 on success, otherwise a negative error value
608 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
609 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
611 int service_storage_file_get_size(service_storage_file_h file,
612 unsigned long long *size);
615 * @brief Gets logical path from file handle
618 * @param[in] file The handle of file or directory in storage
619 * @param[out] path The logical path of file
620 * @remarks @a path must be released using free()
621 * @remarks Reference details for <b>"Logical path"</b> and <b>"Physical path"</b> at @ref SERVICE_ADAPTOR_STORAGE_MODULE_OVERVIEW page
622 * @see #service_storage_file_h
623 * @return 0 on success, otherwise a negative error value
624 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
625 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
626 * @retval #SERVICE_ADAPTOR_ERROR_NO_DATA There is no data
628 int service_storage_file_get_logical_path(service_storage_file_h file,
632 * @brief Gets physical path from file handle
635 * @param[in] file The handle of file or directory in storage
636 * @param[out] path The physical path of file
637 * @remarks @a path must be released using free()
638 * @remarks Reference details for <b>"Logical path"</b> and <b>"Physical path"</b> at @ref SERVICE_ADAPTOR_STORAGE_MODULE_OVERVIEW page
639 * @see #service_storage_file_h
640 * @return 0 on success, otherwise a negative error value
641 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
642 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
643 * @retval #SERVICE_ADAPTOR_ERROR_NO_DATA There is no data
645 int service_storage_file_get_physical_path(service_storage_file_h file,
652 #endif /* __SERVICE_STORAGE_H__ */