#ifndef _MEDIA_SVC_H_
#define _MEDIA_SVC_H_
-#include "media-svc-types.h"
-#include "media-svc-error.h"
+#include <media-util.h>
+#include <stdbool.h>
+#include <sqlite3.h>
#ifdef __cplusplus
extern "C" {
#endif
-/**
- @defgroup MEDIA_SVC Media Information Service
- @{
- * @file media-svc.h
- * @brief This file defines API's for media service.
- * @version 1.0
- */
-
-/**
- @defgroup MEDIA_SVC_API Media Database API
- @{
-
- @par
- manage the service database.
- */
-
-
-/**
- * media_svc_connect:
- * Connect to the media database. This is the function that an user who wants to get a handle to access the media database.
- *
- * @param handle [out] Handle to access database.
- * @return This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
- * Please refer 'media-info-error.h' to know the exact meaning of the error.
- * @see media_svc_disconnect
- * @pre None
- * @post call media_svc_disconnect to disconnect media database.
- * @remark The database name is "/opt/usr/dbspace/.media.db".
- * @par example
- * @code
-
-#include <media-info.h>
-
-void connect_media_db()
-{
- int ret = MEDIA_INFO_ERROR_NONE;
- MediaSvcHandle* my_handle = NULL;
-
- // connect to the media database
- ret = media_svc_connect(&my_handle);
-
- if (ret < 0)
- {
- printf("Fatal error to connect DB\n");
- return;
- }
-
- return;
-}
-
- * @endcode
- */
-int media_svc_connect(MediaSvcHandle **handle);
-
-
-/**
- * media_svc_disconnect:
- * Disconnect to the media database. This is the function that an user who wants to disconnect the media database.
- *
- * @param handle [in] Handle to access database.
- * @return This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
- * Please refer 'media-info-error.h' to know the exact meaning of the error.
- * @see media_svc_connect
- * @pre call media_svc_connect to connect media database.
- * @post None
- * @remark The database name is "/opt/usr/dbspace/.media.db".
- * @par example
- * @code
-
-#include <media-info.h>
-
-void disconnect_media_db()
-{
- int ret = MEDIA_INFO_ERROR_NONE;
- MediaSvcHandle* my_handle = NULL;
-
- // connect to the media database
- ret = media_svc_connect(&my_handle);
-
- if (ret < 0)
- {
- printf("Fatal error to connect DB\n");
- return;
- }
-
- //
- // Do something using my_handle
- //
-
-
- ret = media_svc_disconnect(my_handle);
- if (ret < 0)
- {
- printf("Fatal error to disconnect DB\n");
- }
-
- return;
-}
-
- * @endcode
- */
-int media_svc_disconnect(MediaSvcHandle *handle);
-
-
-/**
- * media_svc_create_table:
- * Create table of media database and set Index and Triggers.
- *
- * @param handle [in] Handle to access database.
- * @return This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
- * Please refer 'media-info-error.h' to know the exact meaning of the error.
- * @see None
- * @pre call media_svc_connect to connect media database.
- * @post call media_svc_disconnect to disconnect media database.
- * @remark The database name is "/opt/usr/dbspace/.media.db".
- * @par example
- * @code
-
-#include <media-info.h>
-
-void create_media_db_table()
-{
- int ret = MEDIA_INFO_ERROR_NONE;
- MediaSvcHandle* my_handle = NULL;
-
- // connect to the media database
- ret = media_svc_connect(&my_handle);
-
- if (ret < 0)
- {
- printf("Fatal error to connect DB\n");
- return;
- }
-
- ret = media_svc_create_table(my_handle);
- if (ret < 0)
- {
- printf("Fatal error to create DB table\n");
- }
-
- ret = media_svc_disconnect(my_handle);
- if (ret < 0)
- {
- printf("Fatal error to disconnect DB\n");
- }
-
- return;
-}
-
- * @endcode
- */
-
-int media_svc_create_table(MediaSvcHandle *handle);
-
-int media_svc_check_item_exist_by_path(MediaSvcHandle *handle, const char *path);
-
-int media_svc_insert_folder(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, const char *path);
-
-int media_svc_insert_item_begin(MediaSvcHandle *handle, int data_cnt);
-
-int media_svc_insert_item_end(MediaSvcHandle *handle);
-
-int media_svc_insert_item_bulk(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, const char *path, const char *mime_type, media_svc_media_type_e media_type);
-
-int media_svc_insert_item_immediately(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, const char *path, const char *mime_type, media_svc_media_type_e media_type);
-
-int media_svc_move_item_begin(MediaSvcHandle *handle, int data_cnt);
-
-int media_svc_move_item_end(MediaSvcHandle *handle);
-
-int media_svc_move_item(MediaSvcHandle *handle, media_svc_storage_type_e src_storage, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path);
-
-int media_svc_set_item_validity_begin(MediaSvcHandle *handle, int data_cnt);
-
-int media_svc_set_item_validity_end(MediaSvcHandle *handle);
-
-int media_svc_set_item_validity(MediaSvcHandle *handle, const char *path, int validity);
-
-int media_svc_delete_item_by_path(MediaSvcHandle *handle, const char *path);
-
-int media_svc_delete_all_items_in_storage(MediaSvcHandle *handle, media_svc_storage_type_e storage_type);
-
-int media_svc_delete_invalid_items_in_storage(MediaSvcHandle *handle, media_svc_storage_type_e storage_type);
-
-int media_svc_delete_invalid_items_in_folder(MediaSvcHandle *handle, const char *folder_path);
-
-int media_svc_set_all_storage_items_validity(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, int validity);
-
-int media_svc_set_folder_items_validity(MediaSvcHandle *handle, const char *folder_path, int validity, int recursive);
-
-int media_svc_refresh_item(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, const char *path, media_svc_media_type_e media_type);
-
-int media_svc_rename_folder(MediaSvcHandle *handle, const char *src_path, const char *dst_path);
-
-int media_svc_request_update_db(const char *db_query);
-
-int media_svc_get_storage_type(const char *path, media_svc_storage_type_e *storage_type);
-
-int media_svc_get_mime_type(const char *path, char *mimetype);
-
-int media_svc_get_media_type(const char *path, const char *mime_type, media_svc_media_type_e *media_type);
-
-/** @} */
-
-/**
- @}
- */
+int media_svc_get_user_version(sqlite3 *handle, int *user_version);
+int media_svc_create_table(uid_t uid);
+int media_svc_check_item_exist_by_path(sqlite3 *handle, const char *storage_id, const char *path);
+int media_svc_get_modified_time(sqlite3 *handle, const char *storage_id, const char *path, int *modified_time);
+int media_svc_insert_folder(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_insert_item_begin(bool with_noti, int from_pid);
+int media_svc_insert_item_end(uid_t uid);
+int media_svc_insert_item_bulk(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_insert_item_immediately(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_move_item(sqlite3 *handle,
+ const char *src_path,
+ const char *dest_path,
+ const char *media_id,
+ int media_type,
+ const char *mime_type,
+ uid_t uid);
+
+int media_svc_set_item_validity(const char *path, int validity, uid_t uid);
+int media_svc_delete_item_by_path(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
+int media_svc_refresh_item(sqlite3 *handle, bool is_direct, const char *storage_id, ms_user_storage_type_e storage_type, const char *path, uid_t uid);
+int media_svc_send_dir_update_noti(const char *dir_path, const char *folder_id, media_item_update_type_e update_type, int pid);
+int media_svc_check_db_upgrade(sqlite3 *handle, int user_version, uid_t uid);
+int media_svc_publish_noti(media_item_update_type_e update_type, const char *path, media_type_e media_type, const char *uuid, const char *mime_type);
+int media_svc_get_pinyin(const char *src_str, char **pinyin_str);
+int media_svc_check_pinyin_support(bool *support);
+int media_svc_update_item_meta(sqlite3 *handle, uid_t uid);
+
+int media_svc_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity);
+int media_svc_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, ms_user_storage_type_e storage_type, uid_t uid);
+int media_svc_update_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid);
+int media_svc_set_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid);
+int media_svc_get_storage_id(sqlite3 *handle, const char *path, char *storage_id, uid_t uid);
+int media_svc_set_folder_validity(const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid);
+
+int media_svc_check_folder_exist_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path);
+
+int media_svc_append_query(const char *query, uid_t uid);
+int media_svc_send_query(uid_t uid);
+
+int media_svc_get_media_type(const char *path, int *mediatype);
+int media_svc_create_thumbnail(const char *file_path, int media_type, uid_t uid, char **thumbnail_path);
#ifdef __cplusplus
}