tizen 2.3 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Content / ContentHelper.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef __TIZEN_CONTENT_HELPER_H__
19 #define __TIZEN_CONTENT_HELPER_H__
20
21 #include <glib.h>
22 #include <vector>
23 #include <media_content.h>
24 //#include <IFilter.h>
25 //#include <SortMode.h>
26
27 #include "Content.h"
28 #include "ContentDirectory.h"
29 #include "ImageContent.h"
30 #include "VideoContent.h"
31 #include "AudioContent.h"
32
33 namespace DeviceAPI {
34 namespace Content {
35
36 namespace {
37 const guint G_IDLE_FAILED = 0;
38 }
39
40 class JSPlaylistItem;
41
42 class ContentHelper
43 {
44 public:
45     virtual ~ContentHelper();
46     static bool Connect();
47     static bool DisConnect();
48
49     static int getCallbackCompleted(void *data);
50     static int getCallbackCanceled(void *data);
51
52     static gboolean getDirectoryWork(void* data);
53     static bool getDirectoryCallback(media_folder_h folder, void *user_data);
54
55     static gboolean findWork(void* data);
56     static bool findCallback(media_info_h info, void *user_data);
57
58     static gboolean scanFileWork(void* data);
59
60     static bool update(ContentPtr content);
61
62     static gboolean updateBatchWork(void* content);
63
64     static void changeCallbackWork(
65             media_content_error_e error,
66             int pid,
67             media_content_db_update_item_type_e update_item,
68             media_content_db_update_type_e update_type,
69             media_content_type_e media_type,
70             char *uuid,
71             char *path,
72             char *mime_type,
73             void *user_data);
74
75 private:
76     ContentHelper();
77
78     static int get_utc_offset();
79     static bool loadContent(media_info_h info, void* user_data);
80     static bool updateContentToPlatform(ContentPtr content);
81     static void loadContentFromPlatform(media_info_h info, ContentPtr content);
82     static ImageContentPtr loadImageContentFromPlatform(media_info_h info,
83             ImageContentPtr image);
84     static VideoContentPtr loadVideoContentFromPlatform(media_info_h info,
85             VideoContentPtr video);
86     static AudioContentPtr loadAudioContentFromPlatform(media_info_h info,
87             AudioContentPtr audio);
88
89     friend class Playlist;
90     friend class JSPlaylistItem;
91 };
92
93 } // Content
94 } // DeviceAPI
95
96 #endif // __TIZEN_CONTENT_DIRECTORY_H__