Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / platform / Tizen / Mediacontent / Mediacontent.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. 
15 */
16
17
18
19 #ifndef _PLATFORM_MEDIA_CONTENT_H_
20 #define _PLATFORM_MEDIA_CONTENT_H_
21
22 #include <list>
23 #include <ctime>
24 #include "API/Mediacontent/IMediacontent.h"
25 #include "API/Mediacontent/IEventFindFolder.h"
26 #include "API/Mediacontent/IEventFindMedia.h"
27 #include "API/Mediacontent/IEventUpdateMedia.h"
28
29 #include <API/Mediacontent/MediacontentImage.h>
30 #include <API/Mediacontent/MediacontentVideo.h>
31 #include <API/Mediacontent/MediacontentAudio.h>
32 #include <API/Mediacontent/MediacontentLyrics.h>
33
34
35 #include <db-util.h>
36
37 #define MEDIA_DB_PATH "/opt/dbspace/.media.db"
38 typedef struct _media_folder_s
39 {
40         char* folder_uuid;
41         char* folder_path;
42         char* folder_name;
43         int storage_type;       
44         time_t modified_date;
45 }folder_s;
46
47
48 using namespace TizenApis::Api::Mediacontent;
49
50
51 namespace TizenApis {
52 namespace Platform {
53 namespace Mediacontent {
54
55 class Mediacontent : public Api::Mediacontent::IMediacontent
56 {
57
58         public:
59         Mediacontent();
60         virtual ~Mediacontent();
61
62         protected:
63         virtual void OnRequestReceived(const IEventFindMediaPtr &ptr);
64         virtual void OnRequestReceived(const IEventFindFolderPtr &ptr);
65         virtual void OnRequestReceived(const IEventUpdateMediaPtr &ptr);
66
67         private:
68         void convertToPlatformFolder(folder_s &media_folder, MediacontentFolderPtr& newFolder);
69         void readImageFromDB(sqlite3_stmt* pStmt, MediacontentImage* newImage);
70         void readVideoFromDB(sqlite3_stmt* pStmt, MediacontentVideo* newVideo);
71         void readAudioFromDB(sqlite3_stmt* pStmt, MediacontentAudio* newAudio);
72         tm toDateTm(time_t date);
73                 
74         string makeQuerySortMode(SortModeArrayPtr attr);
75
76         private:
77         sqlite3 *hDBCt;
78         int db_connnect_count;
79
80 };
81
82
83 }
84 }
85 }
86
87 #endif /* _PLATFORM_MEDIA_CONTENT_H_ */