1 /* |
|
2 * Copyright (c) 2008 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: Content Manager server's client header |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CONTENTMANAGER_H |
|
21 #define CONTENTMANAGER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 #include "cmcommon.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CCmFillRuleContainer; |
|
30 class CCmStoreRuleContainer; |
|
31 class CCmMediaServerFull; |
|
32 class CCmBaseListItem; |
|
33 class CCmActive; |
|
34 class CCmDriveInfo; |
|
35 class CCmSqlPropertyCollector; |
|
36 class RDesReadStream; |
|
37 |
|
38 /** |
|
39 * Content Manager session |
|
40 * |
|
41 * @lib cmclient.lib |
|
42 * @since S60 3.1 |
|
43 */ |
|
44 class RContentManager : public RSessionBase |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Session constructor. |
|
50 */ |
|
51 IMPORT_C RContentManager(); |
|
52 |
|
53 /** |
|
54 * Creates a connection to server. If server is not started, |
|
55 * method will start the server first and then create a new session. |
|
56 * |
|
57 * @since S60 3.1 |
|
58 * @return TInt indicating the success of the call. |
|
59 */ |
|
60 IMPORT_C TInt Connect(); |
|
61 |
|
62 /** |
|
63 * Closes connection to server |
|
64 * |
|
65 * @since S60 3.1 |
|
66 * @return TInt indicating the success of the call. |
|
67 */ |
|
68 IMPORT_C TInt Close(); |
|
69 |
|
70 /** |
|
71 * Cancels all ongoing async operations |
|
72 * |
|
73 * @since S60 3.1 |
|
74 */ |
|
75 IMPORT_C void Cancel(); |
|
76 |
|
77 /** |
|
78 * Returns the current state of the Content Manager |
|
79 * |
|
80 * @since S60 3.1 |
|
81 * @return TCmServerState state of the manager |
|
82 */ |
|
83 IMPORT_C TCmServerState ServerState() const; |
|
84 |
|
85 |
|
86 /** |
|
87 * Sets state of a service |
|
88 * |
|
89 * @since S60 3.1 |
|
90 * @param aService, defines the service |
|
91 * @param aNewState, service state to set¨ |
|
92 * @return TInt, status of the operation |
|
93 */ |
|
94 IMPORT_C TInt SetServiceState( const TCmService aService, |
|
95 const TCmServiceState aNewState ); |
|
96 |
|
97 /** |
|
98 * Gets service state |
|
99 * |
|
100 * @since S60 3.1 |
|
101 * @param aService, defining the requested service |
|
102 * @return TCmServiceState, service state |
|
103 */ |
|
104 IMPORT_C TCmServiceState ServiceState( const TCmService aService ) const; |
|
105 |
|
106 /** |
|
107 * Execute a service |
|
108 * |
|
109 * @since S60 3.1 |
|
110 * @param aService defines the service |
|
111 * @param aStatus asynchronous request status |
|
112 * @return TInt, KErrNone if successfull |
|
113 */ |
|
114 IMPORT_C TInt ExecuteService( const TCmService aService, |
|
115 TRequestStatus& aStatus ); |
|
116 |
|
117 /** |
|
118 * Sets media server information to database |
|
119 * |
|
120 * @since S60 3.1 |
|
121 * @param aServers New media server information. |
|
122 * @return TInt, status of the operation |
|
123 */ |
|
124 IMPORT_C TInt SetMediaserversL( |
|
125 RPointerArray<CCmMediaServerFull>& aServers ); |
|
126 |
|
127 /** |
|
128 * Deletes media servers from db ( servers with deleted status ) |
|
129 * |
|
130 * @since S60 3.1 |
|
131 * @return None |
|
132 */ |
|
133 IMPORT_C void DeleteDeletedMediaserversL(); |
|
134 |
|
135 /** |
|
136 * Gets media server information from database (ownership to caller) |
|
137 * |
|
138 * @since S60 3.1 |
|
139 * @return RPointerArray<CCmMediaServerFull>, |
|
140 * media server information array |
|
141 */ |
|
142 IMPORT_C RPointerArray<CCmMediaServerFull>* MediaserversL() const; |
|
143 |
|
144 /** |
|
145 * Gets current item count for a list of a service (fill or store) |
|
146 * |
|
147 * @since S60 3.1 |
|
148 * @param aService defines the service |
|
149 * @param aListName list name |
|
150 * @param aCount returns count |
|
151 * @param aSize returns size |
|
152 * @return TInt, KErrNone if successfull |
|
153 */ |
|
154 IMPORT_C TInt GetItemCountsL( const TCmService aService, |
|
155 const TDesC8& aListName, |
|
156 TInt& aCount, |
|
157 TInt64& aSize ) const; |
|
158 /** |
|
159 * Gets filled files size |
|
160 * |
|
161 * @since S60 3.1 |
|
162 * @param aSize returns size |
|
163 * @param aID id of fill rule |
|
164 */ |
|
165 IMPORT_C void GetFilledFilesSize( TInt64& aSize, const TInt aID ) const; |
|
166 |
|
167 /** |
|
168 * Gets filtered metadata items |
|
169 * |
|
170 * @since S60 3.2 |
|
171 * @param aService, defines the service |
|
172 * @param aCollector, metadata collector |
|
173 * @param aStatus, asynchronous request status |
|
174 * @return TInt, error code |
|
175 */ |
|
176 IMPORT_C TInt GetFilteredMetadataL( const TCmService aService, |
|
177 CCmSqlPropertyCollector*& aCollector, |
|
178 TRequestStatus& aStatus ); |
|
179 |
|
180 /** |
|
181 * Updating fill lists |
|
182 * |
|
183 * @since S60 3.1 |
|
184 * @param aStatus asynchronous request status |
|
185 */ |
|
186 IMPORT_C void UpdateFillListsL( TRequestStatus& aStatus ); |
|
187 |
|
188 /** |
|
189 * Deleting metadata |
|
190 * |
|
191 * @since S60 3.1 |
|
192 * @param aStatus asynchronous request status |
|
193 */ |
|
194 IMPORT_C void DeleteMetadataL( TRequestStatus& aStatus ); |
|
195 |
|
196 /** |
|
197 * Returns the app wizard execution information. |
|
198 * |
|
199 * @since S60 3.1 |
|
200 * @return TBool, ETrue if app wizard has been executed at startup |
|
201 */ |
|
202 IMPORT_C TBool AppWizardState() const; |
|
203 |
|
204 /** |
|
205 * Sets the app wizard execution information. |
|
206 * |
|
207 * @since S60 3.1 |
|
208 * @return TInt, KErrNone if successfull |
|
209 */ |
|
210 IMPORT_C TInt SetAppWizardState(); |
|
211 |
|
212 /** |
|
213 * Gets last sync time |
|
214 * |
|
215 * @since S60 3.1 |
|
216 * @return TTime, last sync time |
|
217 */ |
|
218 IMPORT_C TTime LastSyncTime() const; |
|
219 |
|
220 /** |
|
221 * Sets fill file statuses |
|
222 * |
|
223 * @param aItems, reference to item array containing statuses |
|
224 * @since S60 3.1 |
|
225 */ |
|
226 IMPORT_C void SetFillFileStatusesL( |
|
227 const RPointerArray<CCmBaseListItem>& aItems ); |
|
228 |
|
229 /** |
|
230 * Get transfer item count and time for a service |
|
231 * |
|
232 * @param aService defines the service |
|
233 * @param aItemCount, item count value |
|
234 * @param aTimeInSec, transfer time value |
|
235 * @since S60 3.1 |
|
236 */ |
|
237 IMPORT_C void GetTransferInfo( const TCmService aService, |
|
238 TInt& aItemCount, |
|
239 TInt& aTimeInSec ) const; |
|
240 |
|
241 /** |
|
242 * Sets Fill rules |
|
243 * |
|
244 * @since S60 3.1 |
|
245 * @param aFillRules, reference to fill rule container object |
|
246 */ |
|
247 IMPORT_C void SetFillRulesL( const CCmFillRuleContainer& aFillRules ); |
|
248 |
|
249 /** |
|
250 * Gets fill rules |
|
251 * |
|
252 * @since S60 3.1 |
|
253 * @return CCmFillRuleContainer, pointer to fill rule container |
|
254 * object (ownership to caller) |
|
255 */ |
|
256 IMPORT_C CCmFillRuleContainer* FillRulesL(); |
|
257 |
|
258 /** |
|
259 * Gets files of the list |
|
260 * |
|
261 * @since S60 3.1 |
|
262 * @param aListName, list name |
|
263 * @param aService, fill or store service |
|
264 * @return RPointerArray<CCmBaseListItem, pointer to fill list item |
|
265 * array (ownership to caller) |
|
266 */ |
|
267 IMPORT_C RPointerArray<CCmBaseListItem>* |
|
268 ListItemsL( const TDesC8& aListName, TCmService aService ); |
|
269 |
|
270 /** |
|
271 * Preprocesses fill list |
|
272 * |
|
273 * @since S60 3.1 |
|
274 * @param aListName fill list name |
|
275 * @return TInt, error code |
|
276 */ |
|
277 IMPORT_C TInt PreProcessFillList( const TDesC8& aListName, |
|
278 TRequestStatus& aStatus ); |
|
279 |
|
280 /** |
|
281 * Sets store rules |
|
282 * |
|
283 * @since S60 3.1 |
|
284 * @param aStoreRules reference to store rule container object |
|
285 */ |
|
286 IMPORT_C void SetStoreRulesL( |
|
287 const CCmStoreRuleContainer& aStoreRules ); |
|
288 |
|
289 /** |
|
290 * Gets store rules |
|
291 * |
|
292 * @since S60 3.1 |
|
293 * @return CCmStoreRuleContainer, pointer to store rule container object |
|
294 * (ownership to caller) |
|
295 */ |
|
296 IMPORT_C CCmStoreRuleContainer* StoreRulesL(); |
|
297 |
|
298 /** |
|
299 * Sets drives |
|
300 * @since S60 3.1 |
|
301 * @param aDrive, drive info array |
|
302 */ |
|
303 IMPORT_C void SetDrivesL( RPointerArray<CCmDriveInfo> aDrives ); |
|
304 |
|
305 /** |
|
306 * Gets drives |
|
307 * @since S60 3.1 |
|
308 * @param aDrives, drives on return |
|
309 */ |
|
310 IMPORT_C void GetDrivesL( RPointerArray<CCmDriveInfo>& aDrives ); |
|
311 |
|
312 /** |
|
313 * Returns drive selection status |
|
314 * @since S60 3.1 |
|
315 * @return TBool, ETrue if set, EFalse otherwise |
|
316 */ |
|
317 IMPORT_C TBool DriveSelectionStatus(); |
|
318 |
|
319 /** |
|
320 * Informs server that application will be shut down |
|
321 * @since S60 3.1 |
|
322 */ |
|
323 IMPORT_C void ApplicationExit(); |
|
324 |
|
325 /** |
|
326 * Informs client when server operation is complete |
|
327 * |
|
328 * @since S60 3.1 |
|
329 * @param aErr |
|
330 * @return TInt, KErrNone if successfull |
|
331 */ |
|
332 TInt OperationCompletedL( TInt aErr ); |
|
333 |
|
334 private: |
|
335 |
|
336 /** |
|
337 * Copy items from server side collector to client collector |
|
338 * @Since s60 3.1 |
|
339 * @param aStream, dataStream from server |
|
340 */ |
|
341 void CopyItemsL( RDesReadStream& aStream ); |
|
342 |
|
343 private: // data |
|
344 |
|
345 /** |
|
346 * active object |
|
347 */ |
|
348 CCmActive* iAo; // owned |
|
349 |
|
350 /** |
|
351 * target array for metadata items |
|
352 */ |
|
353 CCmSqlPropertyCollector** iTargetContainer; // not owned |
|
354 |
|
355 /** |
|
356 * client's request status |
|
357 */ |
|
358 TRequestStatus* iClientRequest; |
|
359 |
|
360 /** |
|
361 * indicator for user cancelling |
|
362 */ |
|
363 TBool iCanceled; |
|
364 |
|
365 /** |
|
366 * data buffer |
|
367 */ |
|
368 CBufFlat* iBuffer; // owned |
|
369 |
|
370 /** |
|
371 * buffer to be sent to server size |
|
372 */ |
|
373 TPtrC8 iBufferPointer; |
|
374 }; |
|
375 |
|
376 |
|
377 #endif // CONTENTMANAGER_H |
|
378 |
|
379 // End of File |
|