|
1 /* |
|
2 * Copyright (c) 2007-2007 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 the License "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: This Class provides the core functionality to |
|
15 * Media Management SAPI Interafce |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __CMGSERVICE_H |
|
22 #define __CMGSERVICE_H |
|
23 #include <e32base.h> |
|
24 #include <clfcontentlisting.hrh> |
|
25 |
|
26 #include "mgservice.hrh" |
|
27 |
|
28 class CPostFilter; |
|
29 class MCLFSortingStyle; |
|
30 class MMgOperationObserver; |
|
31 class CLiwGenericParamList; |
|
32 class MCLFContentListingEngine; |
|
33 class MCLFItemListModel; |
|
34 class CClfOperationObserver; |
|
35 class MThumbnailObserver; |
|
36 class CThumbnailGeneration; |
|
37 |
|
38 _LIT8( KMgAscending, "Ascending" ); |
|
39 const TInt KNegDefaultVal = -1; |
|
40 /** |
|
41 * This Class is used to contain all the request |
|
42 * parameters of the client |
|
43 * |
|
44 * @since Series60 v3.2 |
|
45 */ |
|
46 class TMgServiceRequest |
|
47 { |
|
48 |
|
49 public: |
|
50 /** |
|
51 * Constructor |
|
52 * @since Series60 v3.2 |
|
53 * @param void |
|
54 * @return void |
|
55 */ |
|
56 TMgServiceRequest():iFileType( KNullDesC8 ), |
|
57 iFilterField( KNullDesC8 ), |
|
58 iStartVal( KNullDesC ), |
|
59 iEndVal( KNullDesC ), |
|
60 iSortField( KNullDesC8 ), |
|
61 iOrder( KMgAscending ), |
|
62 iTransactionID( 0 ) |
|
63 { |
|
64 |
|
65 } |
|
66 |
|
67 public: |
|
68 |
|
69 TPtrC8 iFileType; |
|
70 TPtrC8 iFilterField; |
|
71 TPtrC iStartVal; |
|
72 TPtrC iEndVal; |
|
73 TPtrC8 iSortField; |
|
74 TPtrC8 iOrder; |
|
75 TUint iTransactionID; |
|
76 |
|
77 |
|
78 }; |
|
79 |
|
80 // CLASS DECLARATION |
|
81 |
|
82 /** |
|
83 * This Class provides the core functionality of |
|
84 * Media Management SAPI |
|
85 * |
|
86 * @since Series60 v3.2 |
|
87 */ |
|
88 class CMgService : public CBase |
|
89 { |
|
90 |
|
91 public: |
|
92 |
|
93 /** |
|
94 * Returns the instance of CMgService. |
|
95 * @since Series60 v3.2 |
|
96 * @param void |
|
97 * @return CMgService* return the instance of CMgService class |
|
98 */ |
|
99 IMPORT_C static CMgService* NewL(); |
|
100 |
|
101 /** |
|
102 * Destructor. |
|
103 */ |
|
104 virtual ~CMgService(); |
|
105 |
|
106 |
|
107 /** |
|
108 * This function extract all media item matches with the given arguments |
|
109 * Leave with System wide error code if the operation did not |
|
110 * succeed. |
|
111 * @since Series60 v3.2 |
|
112 * @param aFileType It specifies the required media type |
|
113 * @param aFilterField It specifies the Filter criteria |
|
114 * @param aStartVal It specifies the start value for filter criteria |
|
115 * @param aEndVal It specifies the end value for filter criteria |
|
116 * @param aSortField It specifies the field for sorting the result |
|
117 * @param aOrder It specifies the sorting order Ascending/Descending |
|
118 * @param aServiceObserver It specifies Callback for Asynchronous request |
|
119 */ |
|
120 IMPORT_C void GetListL( const TMgServiceRequest& aInParameters, |
|
121 MMgOperationObserver* aServiceObserver ); |
|
122 |
|
123 |
|
124 |
|
125 /** |
|
126 * Cancel the pending asynchronous request |
|
127 * @since Series60 v3.2 |
|
128 * @param aTransactionID Transaction Id |
|
129 * @return TInt |
|
130 */ |
|
131 IMPORT_C TInt CancelL( TUint aTransactionID ); |
|
132 |
|
133 /** |
|
134 * It will clear the filter metadata field ,registered callback |
|
135 * and sorting fields |
|
136 * @since Series60 v3.2 |
|
137 * @param void |
|
138 * @return void |
|
139 */ |
|
140 void Clear(); |
|
141 |
|
142 |
|
143 /** |
|
144 * It will return the state of service class |
|
145 * @since Series60 v3.2 |
|
146 * @param void |
|
147 * @return State(EMgFree/EMgBusy) which indicates the availability of class |
|
148 * for another request |
|
149 */ |
|
150 IMPORT_C const TMgState& State() const; |
|
151 |
|
152 /** |
|
153 * This function generates thumbnail for image/video files |
|
154 * Leave with System wide error code if the operation did not |
|
155 * succeed. |
|
156 * @since |
|
157 * @param aObs It specifies callback for Asynchronous request |
|
158 * @param aUrl It specifies the URI of media file |
|
159 * @param aTransactionID It is transactionId for Asynchronous request |
|
160 * @param aHeight It specifies the required height for thumbnail |
|
161 * @param aWidth It specifies the required width for thumbnail |
|
162 */ |
|
163 IMPORT_C void GetThumbnailL(MThumbnailObserver* aThumbnailObserver, TDesC& aUrl, TInt32 aTransactionID, |
|
164 TInt aHeight = KNegDefaultVal, TInt aWidth = KNegDefaultVal); |
|
165 |
|
166 private: |
|
167 |
|
168 /** |
|
169 * It will set the metadata field on which the result |
|
170 * should be sorted |
|
171 * Leave with KErrNotSupported if aSortField is not valid. |
|
172 * @since Series60 v3.2 |
|
173 * @param aSortField metadata field for sort the result |
|
174 * @param aOrder specify the order of sorting Ascending(0)/Descending(1) |
|
175 * @param aMediaTypes specify the media type for which this sorting |
|
176 * should performed |
|
177 */ |
|
178 void SetSortingFieldL( const TDesC8& aSortField , |
|
179 const TDesC8& aOrder , |
|
180 const RArray<TInt>& aMediaTypes, |
|
181 MCLFItemListModel* alistModel ); |
|
182 |
|
183 /** |
|
184 * It will set the metadata field and values on which the result |
|
185 * should be filtered. |
|
186 * Leave with KErrNotSupported/KErrArgument |
|
187 * if aSortField or aStartVal/aEndVal is not valid . |
|
188 * @since Series60 v3.2 |
|
189 * @param aFilterField filter criteria |
|
190 * @param aStartVal Start value of the filter criteria |
|
191 * @param aEndVal End Value of the filter criteria |
|
192 * @param aMediaTypes specify the media type for which this |
|
193 * filtering should be performed |
|
194 */ |
|
195 void SetFilterMetaDataL( const TDesC8& aFilterField, |
|
196 const TDesC& aStartVal, |
|
197 const TDesC& aEndVal, |
|
198 const RArray<TInt>& aMediaTypes, |
|
199 MCLFItemListModel* alistModel ); |
|
200 |
|
201 /** |
|
202 * Two-phased constructor |
|
203 * @since Series60 v3.2 |
|
204 * @param void |
|
205 * @return void |
|
206 */ |
|
207 void ConstructL(); |
|
208 |
|
209 /** |
|
210 * Constructor |
|
211 * @since Series60 v3.2 |
|
212 * @param void |
|
213 * @return void |
|
214 */ |
|
215 CMgService(); |
|
216 |
|
217 /** |
|
218 * It will convert the aFiletype string into equivalent mediatype ID |
|
219 * which is recognized by underlying framework.(i.e CLF) |
|
220 * Leave with KErrNotSupported If that media type is not supported. |
|
221 * @since Series60 v3.2 |
|
222 * @param aFileType Required filetype(e.g image/music) in string format |
|
223 * @param aMediaType contains the ID of given file type |
|
224 * |
|
225 */ |
|
226 static void SetMediaTypeL (const TDesC8& aFileType, |
|
227 RArray<TInt>& aMediaType); |
|
228 |
|
229 /** |
|
230 * This function will pass the request to CLF for |
|
231 * required media type |
|
232 * @since Series60 v3.2 |
|
233 * @param aFileType It specifies the required media type |
|
234 * @param aFilterField It specifies the Filter criteria |
|
235 * @param aStartVal It specifies the start value for filter criteria |
|
236 * @param aEndVal It specifies the end value for filter criteria |
|
237 * @param aSortField It specifies the field for sorting the result |
|
238 * @param aOrder It specifies the sorting order Ascending/Descending |
|
239 * @return System wide error code if the operation did not |
|
240 * succeed. |
|
241 */ |
|
242 void SendRequestToClfL( const TDesC8& aFileType, |
|
243 const TDesC8& aFilterField, |
|
244 const TDesC& aStartVal, |
|
245 const TDesC& aEndVal, |
|
246 const TDesC8& aSortField, |
|
247 const TDesC8& aOrder, |
|
248 MCLFItemListModel* listModel ); |
|
249 |
|
250 /** |
|
251 * This function will check whether metadata is supported for |
|
252 * requested mediafiles or not,If it is supported |
|
253 * then convert it into equivalent metadata ID |
|
254 * @since Series60 v3.2 |
|
255 * @param aFilterData Input filter data in string format |
|
256 * @param aFilterMetaData Equivalent metadata Id filled by the function |
|
257 * @param aFilterDataType Datatype of the given aFilterData |
|
258 * @return void |
|
259 */ |
|
260 static void GetMetaDataIdAndType( const TDesC8& aFilterData, |
|
261 TCLFDefaultFieldId& aFilterMetaData, |
|
262 TCLFItemDataType& aFilterDataType , |
|
263 const RArray<TInt> &aMediaTypes ); |
|
264 |
|
265 /** |
|
266 * Cancel the pending asynchronous request for Thumbnail Generation |
|
267 * @since Series60 v3.2 |
|
268 * @param aTransactionID Transaction Id |
|
269 * @return TInt |
|
270 */ |
|
271 TInt CancelThumbnailReq( TUint aTransactionID ); |
|
272 |
|
273 |
|
274 |
|
275 private: |
|
276 |
|
277 /** |
|
278 * indicates whether service class is busy or free to accept another request. |
|
279 */ |
|
280 TMgState iState; |
|
281 |
|
282 /** |
|
283 * stores the instance of the engine of CLF Framework |
|
284 */ |
|
285 MCLFContentListingEngine* iEngine; |
|
286 |
|
287 |
|
288 /** |
|
289 * store the instance of CPostfilter which filters the result |
|
290 * as per the set filter criteria |
|
291 */ |
|
292 CPostFilter* iFilter; |
|
293 |
|
294 /** |
|
295 * store the instance of sorting style which sorts the result |
|
296 * as per the set sort criteria |
|
297 */ |
|
298 MCLFSortingStyle* iSortingStyle; |
|
299 |
|
300 /** |
|
301 * store the instance of class which observes CLF event |
|
302 */ |
|
303 CClfOperationObserver* iClfObserver; |
|
304 |
|
305 /** |
|
306 * stores the Cuurent TransactionID |
|
307 */ |
|
308 TUint iTransactionID; |
|
309 |
|
310 /** |
|
311 * stors the instance of iTumbnailGeneration |
|
312 */ |
|
313 CThumbnailGeneration* iTumbnailGeneration; |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 }; |
|
319 |
|
320 #endif __CMGSERVICE_H |