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