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 executable header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMSERVER_H |
|
21 #define CMSERVER_H |
|
22 |
|
23 // Includes |
|
24 #include <mdesession.h> |
|
25 #include "upnpavdeviceobserver.h" |
|
26 #include <f32file.h> |
|
27 |
|
28 #include "cmmmobserver.h" |
|
29 #include "cmserviceobserver.h" |
|
30 |
|
31 // Forward declarations |
|
32 class MUPnPAVController; |
|
33 class CCmMediaServerFull; |
|
34 class CCmDriveInfo; |
|
35 class CCmFillListItem; |
|
36 class CCmSqlPropertyCollector; |
|
37 class CCmDmMain; |
|
38 class MCmFmManager; |
|
39 class MCmSmManager; |
|
40 class CCmMmMain; |
|
41 class MCmMdhClient; |
|
42 class MCmSettings; |
|
43 class CCmScheduler; |
|
44 class CCmFillRuleContainer; |
|
45 class CCmSqlPropertyContainer; |
|
46 |
|
47 |
|
48 // CLASS DECLARATION |
|
49 |
|
50 /** |
|
51 * Content Manager server Core class |
|
52 * |
|
53 * @since S60 3.1 |
|
54 */ |
|
55 NONSHARABLE_CLASS ( CCmServer ) : public CPolicyServer, |
|
56 public MCmServiceObserver, |
|
57 public MUPnPAVDeviceObserver, |
|
58 public MCmMmObserver, |
|
59 public MMdESessionObserver |
|
60 { |
|
61 |
|
62 public: |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 */ |
|
67 static CCmServer* NewLC(); |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 virtual ~CCmServer(); |
|
73 |
|
74 public: |
|
75 |
|
76 /** |
|
77 * Decrements server sessions |
|
78 * @Since S60 3.1 |
|
79 */ |
|
80 void DecrementSessions(); |
|
81 |
|
82 /** |
|
83 * Server state |
|
84 * @Since S60 3.1 |
|
85 * @return TCmServerState, server state |
|
86 */ |
|
87 TCmServerState ServerState() const; |
|
88 |
|
89 /** |
|
90 * Sets asynchronous message |
|
91 * @Since S60 3.1 |
|
92 * @param aMessage, asynchronous message |
|
93 */ |
|
94 void SetCurrentAsyncMsg( const RMessage2& aMessage ); |
|
95 |
|
96 /** |
|
97 * Executes service |
|
98 * @Since S60 3.1 |
|
99 * @param aService, service to be executed |
|
100 */ |
|
101 void ExecuteServiceL( TCmService aService ); |
|
102 |
|
103 /** |
|
104 * Executes service |
|
105 * @Since S60 3.1 |
|
106 * @param aService, service to be executed |
|
107 * @param aOptParam1, optional parameter 1 |
|
108 * @param aOptParam2, optional parameter 2 |
|
109 */ |
|
110 void ExecuteServiceL( TCmService aService, |
|
111 TInt aOptParam1, |
|
112 TAny* aOptParam2 ); |
|
113 |
|
114 /** |
|
115 * Sets service state |
|
116 * @Since S60 3.1 |
|
117 * @param aService, Service |
|
118 * @param aState, service state |
|
119 */ |
|
120 void SetServiceStateL( TCmService aService, TCmServiceState aState ); |
|
121 |
|
122 /** |
|
123 * Cancels current service |
|
124 * @Since S60 3.1 |
|
125 */ |
|
126 void CancelServiceL(); |
|
127 |
|
128 /** |
|
129 * Returns propertycontainer |
|
130 * @since S60 3.1 |
|
131 * @return CCmSqlPropertyContainer, property container |
|
132 */ |
|
133 CCmSqlPropertyContainer* PropertyContainer() const; |
|
134 |
|
135 /** |
|
136 * Returns propertycollector |
|
137 * @since S60 3.2 |
|
138 * @return CCmSqlPropertyCollector, property containers |
|
139 */ |
|
140 CCmSqlPropertyCollector* PropertyCollector() const; |
|
141 |
|
142 /** |
|
143 * Returns mediaserver array |
|
144 * @Since S60 3.1 |
|
145 * @return RPointerArray<CCmMediaServerFull>, server array |
|
146 */ |
|
147 RPointerArray<CCmMediaServerFull>& MediaServerArray(); |
|
148 |
|
149 /** |
|
150 * Returns fill rule container |
|
151 * @Since S60 3.1 |
|
152 * @return CCmFillRuleContainer, fill rule container |
|
153 */ |
|
154 CCmFillRuleContainer* FillRuleContainerL() const; |
|
155 |
|
156 /** |
|
157 * Drive status |
|
158 * @since S60 3.1 |
|
159 * @return TBool, ETrue if set, EFalse otherwise |
|
160 */ |
|
161 TBool DriveSelectionStatus(); |
|
162 |
|
163 /** |
|
164 * Sets drive status |
|
165 * @since S60 3.1 |
|
166 * @param aDriveSelectionStatus, Drive status |
|
167 */ |
|
168 void SetDriveSelectionStatus( const TBool aDriveSelectionStatus ); |
|
169 |
|
170 /** |
|
171 * Set async observer flag |
|
172 * @since S60 3.1 |
|
173 * @param aState, ETrue if application initiated |
|
174 * EFalse if scheduler initiated |
|
175 */ |
|
176 void SetAsyncRequestStateL( TBool aState ); |
|
177 |
|
178 protected: |
|
179 |
|
180 // From base class MCmAVDeviceObserver |
|
181 |
|
182 /** |
|
183 * From MCmAVDeviceObserver |
|
184 * See base class definition |
|
185 */ |
|
186 void UPnPDeviceDiscovered(const CUpnpAVDevice& aDevice); |
|
187 |
|
188 /** |
|
189 * From MCmAVDeviceObserver |
|
190 * See base class definition |
|
191 */ |
|
192 void UPnPDeviceDisappeared(const CUpnpAVDevice& aDevice); |
|
193 |
|
194 /** |
|
195 * From MCmAVDeviceObserver |
|
196 * See base class definition |
|
197 */ |
|
198 void WLANConnectionLost(); |
|
199 |
|
200 // From base class MCmMmObserver |
|
201 |
|
202 /** |
|
203 * From MCmMmObserver |
|
204 * See base class definition |
|
205 */ |
|
206 void DeleteCompleteL( TInt aErr ); |
|
207 |
|
208 /** |
|
209 * From MCmMmObserver |
|
210 * See base class definition |
|
211 */ |
|
212 void ShrinkCompleteL( TInt aErr ); |
|
213 |
|
214 // From base class MMdESessionObserver |
|
215 |
|
216 /** |
|
217 * From MMdESessionObserver |
|
218 * See base class definition |
|
219 */ |
|
220 void HandleSessionOpened(CMdESession& aSession, TInt aError); |
|
221 |
|
222 /** |
|
223 * From MMdESessionObserver |
|
224 * See base class definition |
|
225 */ |
|
226 void HandleSessionError(CMdESession& aSession, TInt aError); |
|
227 |
|
228 // From base class CPolicyServer |
|
229 |
|
230 /** |
|
231 * From CPolicyServer |
|
232 * See base class definition |
|
233 */ |
|
234 CSession2* NewSessionL( const TVersion& aVersion, |
|
235 const RMessage2& aMessage ) const; |
|
236 |
|
237 private: |
|
238 /** |
|
239 * Creates SQL about files to be deleted |
|
240 * |
|
241 * @since S60 5.1 |
|
242 * @param aItems, item list |
|
243 * @param aDrives, drivinfo |
|
244 * @param aFilesToDelete, Sql clause array |
|
245 */ |
|
246 void CreateFileDeleteSQLL( RPointerArray<CCmFillListItem>& aItems, |
|
247 RPointerArray<CCmDriveInfo>& aDrives, |
|
248 CDesCArrayFlat* aFilesToDelete ); |
|
249 private: |
|
250 |
|
251 /** |
|
252 * C++ default constructor. |
|
253 */ |
|
254 CCmServer(); |
|
255 |
|
256 /** |
|
257 * By default Symbian 2nd phase constructor is private. |
|
258 */ |
|
259 void ConstructL(); |
|
260 |
|
261 /** |
|
262 * Creates AV controller and starts discovery timer |
|
263 * @since S60 3.1 |
|
264 */ |
|
265 void CreateAvcAndTimerL(); |
|
266 |
|
267 /** |
|
268 * Checks if server is not ready |
|
269 * @since S60 3.1 |
|
270 */ |
|
271 void LeaveIfNotReadyL(); |
|
272 |
|
273 /** |
|
274 * Deletes next fill rule |
|
275 * @since S60 3.1 |
|
276 */ |
|
277 void DeleteUnselectedFillFilesL(); |
|
278 |
|
279 /** |
|
280 * Starts store process |
|
281 * @since S60 3.1 |
|
282 */ |
|
283 void ExecuteStoreL(); |
|
284 |
|
285 /** |
|
286 * Starts fill process |
|
287 * @since S60 3.1 |
|
288 */ |
|
289 void ExecuteFillL(); |
|
290 |
|
291 /** |
|
292 * Gets status by group id |
|
293 * @since S60 3.1 |
|
294 * @param aListId, list id |
|
295 * @param aStatus, list item status |
|
296 * @return TInt, error code |
|
297 */ |
|
298 TInt GetStatusByGroupId( TUint aListId, TCmListItemStatus& aStatus ); |
|
299 |
|
300 /** |
|
301 * Checks server and adds it to db |
|
302 * @since S60 3.1 |
|
303 * @param aDevice, media server |
|
304 */ |
|
305 void CheckServerL( const CUpnpAVDevice& aDevice ); |
|
306 |
|
307 /** |
|
308 * Deletes filled files |
|
309 * @Since S60 3.1 |
|
310 */ |
|
311 void DeleteFilledFilesL(); |
|
312 |
|
313 /** |
|
314 * Device discovery timer |
|
315 * @Since S60 3.1 |
|
316 * @param TAny, caller class pointer |
|
317 * @return TInt, returns always 0 |
|
318 */ |
|
319 static TInt SearchTimerCompletedL( TAny* aNy ); |
|
320 |
|
321 /** |
|
322 * Called when service is executed |
|
323 * @Since S60 3.1 |
|
324 * @param TCmService, completed service |
|
325 * @param TInt, error code |
|
326 */ |
|
327 void ServiceExecuted( TCmService aService, TInt aErrCode ); |
|
328 |
|
329 /** |
|
330 * Updates fill list priorities |
|
331 * @Since S60 3.1 |
|
332 */ |
|
333 void UpdateFillPriorities(); |
|
334 |
|
335 /** |
|
336 * Append drive letter |
|
337 * @since S60 3.1 |
|
338 * @param aFs, file server |
|
339 * @param aDriveNumber, drive number |
|
340 */ |
|
341 HBufC* ResolveAndAppendRootPathL( RFs& aFs, const TInt aDriveNumber ); |
|
342 |
|
343 /** |
|
344 * Updates drive quota when files are deleted |
|
345 * @since S60 3.1 |
|
346 * @param aDrives, drive info |
|
347 * @param aItem, deleted item |
|
348 */ |
|
349 void UpdateDriveQuota( RPointerArray<CCmDriveInfo>& aDrives, |
|
350 CCmFillListItem& aItem ); |
|
351 |
|
352 /** |
|
353 * Starts service when timer elapses |
|
354 * @Since S60 3.1 |
|
355 * @return TInt, returns always 0 |
|
356 */ |
|
357 TInt DoSearchTimerCompletedL(); |
|
358 |
|
359 /** |
|
360 * Deletes property container |
|
361 * @Since S60 3.1 |
|
362 */ |
|
363 void DeletePropertyContainer(); |
|
364 |
|
365 /** |
|
366 * Deletes items from database by FillListId |
|
367 * @Since S60 3.1 |
|
368 */ |
|
369 void DeleteItemsByFillListId( TInt aFillListId ); |
|
370 |
|
371 /** |
|
372 * Sort function that arranges pointers by id |
|
373 * @since S60 5.1 |
|
374 * @param aItem1, item to be sorted |
|
375 * @param aItem2, item to be sorted |
|
376 */ |
|
377 static TInt CompareById( const CCmFillListItem& aItem1, |
|
378 const CCmFillListItem& aItem2 ); |
|
379 |
|
380 private: |
|
381 |
|
382 /** |
|
383 * AV controller |
|
384 */ |
|
385 MUPnPAVController* iAvController; // owned |
|
386 /** |
|
387 * Database manager |
|
388 */ |
|
389 CCmDmMain* iDbManager; // owned |
|
390 /** |
|
391 * Fill manager |
|
392 */ |
|
393 MCmFmManager* iFillManager; // owned |
|
394 /** |
|
395 * Store manager |
|
396 */ |
|
397 MCmSmManager* iStoreManager; // owned |
|
398 /** |
|
399 * Memory manager |
|
400 */ |
|
401 CCmMmMain* iMemoryManager; // owned |
|
402 /** |
|
403 * Metadata harvester |
|
404 */ |
|
405 MCmMdhClient* iMdhClient; // owned |
|
406 /** |
|
407 * Settings engine |
|
408 */ |
|
409 MCmSettings* iSettings; // owned |
|
410 /** |
|
411 * Scheduler |
|
412 */ |
|
413 CCmScheduler* iScheduler; // owned |
|
414 /** |
|
415 * Server state |
|
416 */ |
|
417 TCmServerState iServerState; |
|
418 /** |
|
419 * Current asyncronous message holder |
|
420 */ |
|
421 RMessage2 iCurrentAsyncMsg; |
|
422 /** |
|
423 * Device discovery timer |
|
424 */ |
|
425 CPeriodic* iDeviceDiscoveryTimer; // owned |
|
426 /** |
|
427 * Fill rule container |
|
428 */ |
|
429 CCmFillRuleContainer* iFillRuleContainer; // owned |
|
430 /** |
|
431 * Item container |
|
432 */ |
|
433 CCmSqlPropertyContainer* iPropertyContainer; // owned |
|
434 /** |
|
435 * Mediaserver array |
|
436 */ |
|
437 RPointerArray<CCmMediaServerFull> iMediaServers; // owned |
|
438 /** |
|
439 * Session counter |
|
440 */ |
|
441 TInt* iSessionCount; |
|
442 /** |
|
443 * Fill rule index |
|
444 */ |
|
445 TInt iFillRuleIndex; |
|
446 /** |
|
447 * Indicator for delete process |
|
448 */ |
|
449 TBool iDeletingDeletedItems; |
|
450 /** |
|
451 * Asynchronous request status |
|
452 */ |
|
453 TBool iAsyncRequestOn; |
|
454 /** |
|
455 * Store execution indicator |
|
456 */ |
|
457 TBool iExecuteStoreAfterDelete; |
|
458 /** |
|
459 * Memory manager status |
|
460 */ |
|
461 TBool iMmState; |
|
462 /** |
|
463 * MDE session |
|
464 */ |
|
465 CMdESession* iSession; // owned |
|
466 /** |
|
467 * Fill list collector |
|
468 */ |
|
469 CCmSqlPropertyCollector* iPropertyCollector; // not owned |
|
470 /** |
|
471 * status flag for drive setting |
|
472 */ |
|
473 TBool iDriveSelectionStatus; |
|
474 }; |
|
475 |
|
476 #endif // CMSERVER_H |
|
477 |
|
478 // End of File |
|