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: Main class in the Store manager component |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CMSMMAIN_H |
|
20 #define C_CMSMMAIN_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include "cmsmfileprocessingobserver.h" |
|
24 #include "cmsmtransferobserver.h" |
|
25 #include "cmmmobserver.h" |
|
26 #include "cmcommon.h" |
|
27 #include "cmstoremanager.h" |
|
28 |
|
29 // Forward declarations |
|
30 class MUPnPAVController; |
|
31 class MCmServiceObserver; |
|
32 class CCmSmTransferEngine; |
|
33 class CCmSmFileMngr; |
|
34 class CCmDmMain; |
|
35 class CCmStoreListItem; |
|
36 class CCmSqlPropertyContainer; |
|
37 class CCmMmMain; |
|
38 class CUpnpAVDeviceList; |
|
39 |
|
40 |
|
41 /** |
|
42 * CCmSmMain class definition |
|
43 * |
|
44 * @lib cmstoremanager.lib |
|
45 * |
|
46 * @since S60 v5.1 |
|
47 */ |
|
48 class CCmSmMain : public CActive, |
|
49 public MCmSmManager, |
|
50 public MCmSmFileProcessingObserver, |
|
51 public MCmSmTransferObserver, |
|
52 public MCmMmObserver |
|
53 { |
|
54 |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * Creates new CCmSmMain class and opens connection to database. |
|
60 * |
|
61 * @since S60 5.1 |
|
62 * @param aObserver, observer pointer |
|
63 * @param aSession, Mde session |
|
64 * @param aDBManager, database manager |
|
65 * @param aMemManager, memory manager |
|
66 * @return pointer to CCmSmMain class |
|
67 */ |
|
68 static CCmSmMain* NewL( |
|
69 MCmServiceObserver* aObserver, CMdESession& aSession, |
|
70 CCmDmMain* aDBManager, CCmMmMain* aMemManager ); |
|
71 |
|
72 /** |
|
73 * Two-phased constructor. |
|
74 * Creates new CCmSmMain class and opens connection to database and |
|
75 * leaves the instance in the cleanup stack. |
|
76 * |
|
77 * @since S60 5.1 |
|
78 * @param aObserver, observer pointer |
|
79 * @param aSession, Mde session |
|
80 * @param aDBManager, database manager |
|
81 * @param aMemManager, memory manager |
|
82 * @return pointer to CCmSmMain class |
|
83 */ |
|
84 static CCmSmMain* NewLC( |
|
85 MCmServiceObserver* aObserver, CMdESession& aSession, |
|
86 CCmDmMain* aDBManager, CCmMmMain* aMemManager ); |
|
87 |
|
88 /** |
|
89 * Destructor. |
|
90 */ |
|
91 virtual ~CCmSmMain(); |
|
92 |
|
93 public: |
|
94 |
|
95 /** |
|
96 * Starts store service |
|
97 * |
|
98 * @since S60 5.1 |
|
99 * @param None |
|
100 * @return None |
|
101 */ |
|
102 void StartStoreL(); |
|
103 |
|
104 /** |
|
105 * Cancels store service |
|
106 * |
|
107 * @since S60 5.1 |
|
108 * @param None |
|
109 * @return None |
|
110 */ |
|
111 void CancelOperation(); |
|
112 |
|
113 /** |
|
114 * Starts store list processing |
|
115 * |
|
116 * @since S60 5.1 |
|
117 * @param None |
|
118 * @return None |
|
119 */ |
|
120 void PreProcessLists(); |
|
121 |
|
122 /** |
|
123 * Provides album list |
|
124 * |
|
125 * @since S60 5.1 |
|
126 * @param aMedia, media type |
|
127 * @param aArray, list of values |
|
128 * @return None |
|
129 */ |
|
130 void GetColItemsL( TCmMediaType aMedia, |
|
131 CDesCArray& aArray ); |
|
132 |
|
133 /** |
|
134 * Provides metadata column item list |
|
135 * |
|
136 * @since S60 5.1 |
|
137 * @param aMedia, media type |
|
138 * @param aPropertys, list of values |
|
139 * @return None |
|
140 */ |
|
141 void GetColItemsL( TCmMediaType aMedia, |
|
142 CCmSqlPropertyContainer& aPropertys ); |
|
143 |
|
144 /** |
|
145 * Sets av controller |
|
146 * |
|
147 * @since S60 5.1 |
|
148 * @param aAVController, av controller pointer |
|
149 * @return None |
|
150 */ |
|
151 void SetAvController( MUPnPAVController* aAVController ); |
|
152 |
|
153 // From base class MCmSmManager |
|
154 |
|
155 /** |
|
156 * From MCmSmManager |
|
157 * See base class definition |
|
158 */ |
|
159 void Close(); |
|
160 |
|
161 // From base class MCmSmFileProcessingObserver |
|
162 |
|
163 /** |
|
164 * From MCmSmFileProcessingObserver |
|
165 * See base class definition |
|
166 */ |
|
167 void FileProcessingStatus( TCmSmFileProcessingStatus aStatus ); |
|
168 |
|
169 // From base class MCmSmTransferObserver |
|
170 |
|
171 /** |
|
172 * From MCmSmTransferObserver |
|
173 * See base class definition |
|
174 */ |
|
175 void TransferStatus( TCmSmTransferStatus aStatus ); |
|
176 |
|
177 // From base class MCmMmObserver |
|
178 |
|
179 /** |
|
180 * From MCmMmObserver |
|
181 * See base class definition |
|
182 */ |
|
183 void DeleteCompleteL( TInt aErr ); |
|
184 |
|
185 /** |
|
186 * From MCmMmObserver |
|
187 * See base class definition |
|
188 */ |
|
189 void ShrinkCompleteL( TInt aErr ); |
|
190 |
|
191 protected: |
|
192 |
|
193 // From base class CActive |
|
194 |
|
195 /** |
|
196 * From CActive |
|
197 * See base class definition |
|
198 */ |
|
199 void RunL(); |
|
200 |
|
201 /** |
|
202 * From CActive |
|
203 * See base class definition |
|
204 */ |
|
205 void DoCancel(); |
|
206 |
|
207 /** |
|
208 * From CActive |
|
209 * See base class definition |
|
210 */ |
|
211 TInt RunError( TInt aError ); |
|
212 |
|
213 private: |
|
214 |
|
215 /** |
|
216 * Managing files after storing |
|
217 * |
|
218 * @since S60 5.1 |
|
219 * @param None |
|
220 * @return None |
|
221 */ |
|
222 void ManageFileL(); |
|
223 |
|
224 #ifdef _DEBUG |
|
225 /** |
|
226 * Logs server Uuids |
|
227 * |
|
228 * @since S60 5.1 |
|
229 * @param None |
|
230 * @return None |
|
231 */ |
|
232 void LogServers(); |
|
233 #endif |
|
234 |
|
235 /** |
|
236 * Publish progress info |
|
237 * |
|
238 * @since S60 5.1 |
|
239 * @param aProgress |
|
240 * @return None |
|
241 */ |
|
242 void SendProgressInfo( TInt aProgress ); |
|
243 |
|
244 /** |
|
245 * Changes state |
|
246 * |
|
247 * @since S60 5.1 |
|
248 * @param aStatus, defined id for the completing |
|
249 * @return None |
|
250 */ |
|
251 void ChangeState( TCmSmMainSequencer aStatus ); |
|
252 |
|
253 /** |
|
254 * Starts clf refresh timer |
|
255 * |
|
256 * @since S60 5.1 |
|
257 * @param None |
|
258 * @return None |
|
259 */ |
|
260 void StartMdETimerL(); |
|
261 |
|
262 /** |
|
263 * Cancels mde refresh timer |
|
264 * |
|
265 * @since S60 5.1 |
|
266 * @param None |
|
267 * @return None |
|
268 */ |
|
269 void CancelMdETimer(); |
|
270 |
|
271 /** |
|
272 * Call back for clf refresh timer |
|
273 * |
|
274 * @since S60 5.1 |
|
275 * @param aPtr, this |
|
276 * @return None |
|
277 */ |
|
278 static TInt CheckItems( TAny* aPtr ); |
|
279 |
|
280 /** |
|
281 * Starts clf refresh if no services ongoing |
|
282 * |
|
283 * @since S60 5.1 |
|
284 * @param None |
|
285 * @return KErrNone |
|
286 */ |
|
287 TInt CheckItemsChanged( ); |
|
288 |
|
289 /** |
|
290 * Delete devices |
|
291 * |
|
292 * @since S60 5.1 |
|
293 * @param None |
|
294 * @return None |
|
295 */ |
|
296 void DeleteDevices(); |
|
297 |
|
298 /** |
|
299 * Performs the first phase of two phase construction. |
|
300 * |
|
301 * @since S60 5.1 |
|
302 * @param aObserver, service observer |
|
303 * @param aDBManager, database manager |
|
304 * @param aMemManager, memory manager |
|
305 */ |
|
306 CCmSmMain( MCmServiceObserver* aObserver, CCmDmMain* aDBManager, |
|
307 CCmMmMain* aMemManager ); |
|
308 |
|
309 /** |
|
310 * Performs the second phase construction. |
|
311 */ |
|
312 void ConstructL( CMdESession& aSession, CCmDmMain* aDBManager ); |
|
313 |
|
314 |
|
315 private: |
|
316 |
|
317 /** |
|
318 * Service observer |
|
319 */ |
|
320 MCmServiceObserver* iObserver; // not owned |
|
321 |
|
322 /** |
|
323 * Database manager |
|
324 */ |
|
325 CCmMmMain* iMemManager; // not owned |
|
326 |
|
327 /** |
|
328 * Memory manager |
|
329 */ |
|
330 CCmDmMain* iDbManager; // not owned |
|
331 |
|
332 /** |
|
333 * Upnp operation manager |
|
334 */ |
|
335 CCmSmTransferEngine* iCmSmTransferEngine; // owned |
|
336 |
|
337 /** |
|
338 * File manager |
|
339 */ |
|
340 CCmSmFileMngr* iCmSmFileMngr; // owned |
|
341 |
|
342 /** |
|
343 * Checks if clf state has changed |
|
344 */ |
|
345 CPeriodic* iPeriodic; // owned |
|
346 |
|
347 /** |
|
348 * Array of found devices |
|
349 */ |
|
350 CUpnpAVDeviceList* iDevices; // owned |
|
351 |
|
352 /** |
|
353 * Fill progress info |
|
354 */ |
|
355 TCmProgressInfo iProgressInfo; |
|
356 |
|
357 /** |
|
358 * Logged storing time values |
|
359 */ |
|
360 TTime iStoreStarted; |
|
361 |
|
362 /** |
|
363 * Index to device array |
|
364 */ |
|
365 TInt iDeviceIndex; |
|
366 |
|
367 /** |
|
368 * List of store file items |
|
369 */ |
|
370 RPointerArray<CCmStoreListItem> iItems; // owned |
|
371 |
|
372 /** |
|
373 * List of store item ids |
|
374 */ |
|
375 RArray<TInt>iItemIds; // owned |
|
376 |
|
377 /** |
|
378 * Id of the current mediaserver |
|
379 */ |
|
380 TInt64 iId; |
|
381 |
|
382 /** |
|
383 * Service |
|
384 */ |
|
385 TCmService iService; |
|
386 |
|
387 /** |
|
388 * Flag defining if cancel is on |
|
389 */ |
|
390 TBool iCancelOnGoing; |
|
391 |
|
392 }; |
|
393 |
|
394 #endif // C_CMSMMAIN_H |
|