|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Meta data Mpx access |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMMMTPDPMETADATAMPXACCESS_H |
|
20 #define CMMMTPDPMETADATAMPXACCESS_H |
|
21 |
|
22 #include <badesca.h> |
|
23 |
|
24 #include "cmmmtpdpperflog.h" |
|
25 |
|
26 // keep here to avoid warning on urel |
|
27 _LIT( KMpxCollectionNewL, "MpxCollectionNewL" ); |
|
28 _LIT( KMpxCollectionAddL, "MpxCollectionAddL" ); |
|
29 _LIT( KMpxCollectionGetL, "MpxCollectionGetL" ); |
|
30 _LIT( KMpxCollectionSetL, "MpxCollectionSetL" ); |
|
31 _LIT( KMpxCollectionGetPlaylist, "MpxCollectionGetPlaylist" ); |
|
32 _LIT( KMpxCollectionGetReference, "MpxCollectionGetReference" ); |
|
33 _LIT( KMpxCollectionFindAllLValidate, "MpxCollectionValidate" ); |
|
34 _LIT( KMpxCollectionFindAllLBeforeAdd, "KMpxCollectionFindAllLBeforeAdd" ); |
|
35 |
|
36 // forward declacration |
|
37 class CMPXMedia; |
|
38 class CMTPObjectMetaData; |
|
39 class MMPXCollectionHelper; |
|
40 class MMTPDataProviderFramework; |
|
41 class MMTPType; |
|
42 class TMPXAttributeData; |
|
43 |
|
44 const TInt KStorageRootMaxLength = 10; |
|
45 |
|
46 typedef struct |
|
47 { |
|
48 TMTPObjectPropertyCode iPropCode; |
|
49 TMPXAttributeData iMpxAttrib; |
|
50 } TMetadataTable; |
|
51 |
|
52 /** |
|
53 * Controls access to the music MPX store database. Allows access to the |
|
54 * information about any of the music stored in any of the MPX db's on any |
|
55 * of the drives. Also supports deletions and insertions into the db. |
|
56 */ |
|
57 class CMmMtpDpMetadataMpxAccess : public CBase |
|
58 { |
|
59 public: |
|
60 |
|
61 static CMmMtpDpMetadataMpxAccess* NewL( RFs& aRfs, MMTPDataProviderFramework& aFramework ); |
|
62 |
|
63 /** |
|
64 * Destructor |
|
65 */ |
|
66 ~CMmMtpDpMetadataMpxAccess(); |
|
67 |
|
68 public: |
|
69 /** |
|
70 * Get all playlists from MPX database in the assigned store |
|
71 * @param aStoreRoot, specify in which drive playlists are stored |
|
72 * @param aPlaylists, return result array |
|
73 */ |
|
74 void GetAllPlaylistL( const TDesC& aStoreRoot, CMPXMediaArray** aPlaylists ); |
|
75 |
|
76 /** |
|
77 * Get all references of specified playlist |
|
78 * @param aPlaylist, specify of which reference should be get |
|
79 * @param aReferences, return result array which stored handles of all references |
|
80 */ |
|
81 void GetAllReferenceL( CMPXMedia* aPlaylist, CDesCArray& aReferences ); |
|
82 |
|
83 /** |
|
84 * Get an playlist name from CMPXMedia object |
|
85 * @param aPlaylist, specify the source |
|
86 * @param aPlaylistName, return result |
|
87 */ |
|
88 void GetPlaylistNameL( CMPXMedia* aPlaylist, TDes& aPlaylistName ); |
|
89 |
|
90 /** |
|
91 * Adds Songs info to Mpx DB |
|
92 * @param aFullFileName, full file name of Media file |
|
93 */ |
|
94 void AddSongL( const TDesC& aFullFileName ); |
|
95 |
|
96 /** |
|
97 * Adds Playlist to Mpx DB |
|
98 * @param aFullFileName, full file name of Playlist file |
|
99 */ |
|
100 void AddPlaylistL( const TDesC& aFullFileName ); |
|
101 |
|
102 /** |
|
103 * Set playlist to DB |
|
104 * @param aPlaylistFileName, full file name of playlist file |
|
105 * @param aRefFileArray, a array to store the full file name of media files |
|
106 */ |
|
107 void SetPlaylistL( const TDesC& aPlaylistFileName, |
|
108 CDesCArray& aRefFileArray ); |
|
109 |
|
110 void GetObjectMetadataValueL( const TUint16 aPropCode, |
|
111 MMTPType& aNewData, |
|
112 const CMTPObjectMetaData& aObjectMetaData ); |
|
113 |
|
114 /** |
|
115 * Set object property and updated object in DB according property code, |
|
116 * only for update, not for creation |
|
117 * @param aPropCode, property code of aObjectMetaData |
|
118 * @param aNewData, object property value which will be set into |
|
119 * aObjectMetaData |
|
120 * @param aObjectMetaData, owner of the property which should be |
|
121 * updated into database |
|
122 */ |
|
123 void SetObjectMetadataValueL( const TUint16 aPropCode, |
|
124 const MMTPType& aNewData, |
|
125 const CMTPObjectMetaData& aObjectMetaData ); |
|
126 |
|
127 /** |
|
128 * Set object property and updated object in DB according property code, |
|
129 * only for update, not for creation |
|
130 * @param aPropCode, property code of aObjectMetaData |
|
131 * @param aNewData, object property value which will be set into |
|
132 * aObjectMetaData |
|
133 * @param aSuid, full file name of object of which properties need to set |
|
134 */ |
|
135 void SetObjectMetadataValueL( const TUint16 aPropCode, |
|
136 const MMTPType& aNewData, |
|
137 const TDesC& aSuid ); |
|
138 |
|
139 CMPXMedia* FindWMPMediaLC( TMPXAttributeData aWMPMediaID, TBool aFlag ); |
|
140 |
|
141 /** |
|
142 * Update the Sync flag for those not synchronized, Update the Modified |
|
143 * flag for those have been modified, and delete the stale records for |
|
144 * files that have been deleted. |
|
145 */ |
|
146 void UpdateMusicCollectionL(); |
|
147 |
|
148 /** |
|
149 * Remove the file from MPX DB |
|
150 * @param aFullFileName, the file to remove |
|
151 * @param aCategory, the category of the file |
|
152 */ |
|
153 void DeleteObjectL( const TDesC& aFullFileName, TMPXGeneralCategory aCategory ); |
|
154 |
|
155 /** |
|
156 * Rename the filename onto MPX DB |
|
157 * @param aOldFileName, the old file to rename |
|
158 * @param aNewFileName, the new file name |
|
159 * @param aFormatCode, the format of object |
|
160 */ |
|
161 void RenameObjectL( const TDesC& aOldFileName, const TDesC& aNewFileName, |
|
162 TUint aFormatCode ); |
|
163 |
|
164 /** |
|
165 * Set current drive info |
|
166 * @param aStorageRoot, current drive info |
|
167 */ |
|
168 void SetStorageRootL( const TDesC& aStorageRoot ); |
|
169 |
|
170 /** |
|
171 * Get modified content |
|
172 * @param arrayCount, count of modified content |
|
173 * @param aModifiedcontent, modified files name list |
|
174 */ |
|
175 void GetModifiedContentL( TInt& arrayCount, CDesCArray& aModifiedcontent ); |
|
176 |
|
177 /** |
|
178 * if the playlsit exist in the MPX DB |
|
179 * @param aSuid, the suid of playlsit |
|
180 */ |
|
181 TBool IsExistL( const TDesC& aSuid ); |
|
182 |
|
183 private: |
|
184 CMmMtpDpMetadataMpxAccess( RFs& aFs, MMTPDataProviderFramework& aFramework ); |
|
185 |
|
186 void ConstructL(); |
|
187 |
|
188 void SetDefaultL( CMPXMedia& aMediaProp ); |
|
189 |
|
190 /** |
|
191 * Set property value into MPX object according to property code, |
|
192 * only used by member functions of this class. |
|
193 * @param aPropCode, specify property code of aMediaProp |
|
194 * @param aNewData, object property value which will be set into |
|
195 * aObjectMetaData |
|
196 * @param aObjectMetaData, owner of the property which should be |
|
197 * inserted or updated into database |
|
198 */ |
|
199 void SetMetadataValueL( const TUint16 aPropCode, |
|
200 const MMTPType& aNewData, |
|
201 CMPXMedia& aMediaProp ); |
|
202 |
|
203 TMPXAttributeData MpxAttribFromPropL( const CMPXMedia& aMedia, |
|
204 const TUint16 aPropCode ); |
|
205 |
|
206 MMPXCollectionHelper* CollectionHelperL(); |
|
207 |
|
208 private: |
|
209 // File server to allow file access |
|
210 RFs& iRfs; |
|
211 |
|
212 TBuf<KStorageRootMaxLength> iStoreRoot; |
|
213 |
|
214 MMPXCollectionHelper* iCollectionHelper; |
|
215 |
|
216 MMTPDataProviderFramework& iFramework; |
|
217 |
|
218 #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) |
|
219 CMmMtpDpPerfLog* iPerfLog; |
|
220 #endif |
|
221 |
|
222 }; |
|
223 |
|
224 #endif // CMMMTPDPMETADATAMPXACCESS_H |