|
1 /* |
|
2 * Copyright (c) 2010 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: MDE object queuemanager for indexing scheduling |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MDEOBJECTQUEUEMANAGER_H_ |
|
20 #define MDEOBJECTQUEUEMANAGER_H_ |
|
21 #include <e32def.h> |
|
22 #include <mdccommon.h> |
|
23 #include "mediaobjecthandler.h" |
|
24 |
|
25 class CMdeObjectQueueManager : public CActive |
|
26 { |
|
27 public: |
|
28 /* |
|
29 * Construction |
|
30 * @param MMediaObjectHandler* callback to media object handler dont own |
|
31 * @return instance of object queue manager |
|
32 */ |
|
33 static CMdeObjectQueueManager* NewL(MMediaObjectHandler* ); //For callback |
|
34 /* |
|
35 * Construction |
|
36 * @param MMediaObjectHandler* callback to media object handler dont own |
|
37 * @return instance of object queue manager |
|
38 */ |
|
39 static CMdeObjectQueueManager* NewLC(MMediaObjectHandler* ); |
|
40 /* |
|
41 * Destructor |
|
42 */ |
|
43 virtual ~CMdeObjectQueueManager(); |
|
44 public: |
|
45 /* |
|
46 * AddMedItemtoQueueL |
|
47 * @param TItemId aObjId item id to be added to queue |
|
48 * @param TCPixActionType aActionType CPIX action on item |
|
49 */ |
|
50 void AddMdeItemToQueueL( TItemId aObjId, TCPixActionType aActionType); |
|
51 //From CActive |
|
52 void RunL(); |
|
53 void DoCancel(); |
|
54 TInt RunError(); |
|
55 private: |
|
56 /* |
|
57 * OverWriteOrAddToQueueL add or update item to queue |
|
58 * @param TItemId aObjId itemd id |
|
59 * @param TCPixActionType aActionType action cpix |
|
60 */ |
|
61 void OverWriteOrAddToQueueL( TItemId aObjId, TCPixActionType aActionType); |
|
62 /* |
|
63 * First phase Constructor |
|
64 * @parm MMediaObjectHandler* media object handler callback |
|
65 */ |
|
66 CMdeObjectQueueManager(MMediaObjectHandler* ); |
|
67 /* |
|
68 * Second phase constructor |
|
69 */ |
|
70 void ConstructL(); |
|
71 private: |
|
72 enum TState |
|
73 { |
|
74 EStateNone = 0, |
|
75 EStateWaiting |
|
76 }; |
|
77 struct TMdeActionRecord |
|
78 { |
|
79 TItemId iObjectId; |
|
80 TCPixActionType iAction; |
|
81 TInt iRetryCount; |
|
82 TMdeActionRecord() |
|
83 { |
|
84 iRetryCount = 0; |
|
85 } |
|
86 }; |
|
87 private: |
|
88 // Queue of documents to be indexed |
|
89 RArray<TMdeActionRecord> iJobQueue; |
|
90 // State machine's state |
|
91 TState iState; |
|
92 // Timer which is used to delay indexing messages |
|
93 RTimer iTimer; //Timer for self activation of AO |
|
94 MMediaObjectHandler* iMdeObjectHandler; //media object handler |
|
95 }; |
|
96 |
|
97 #endif /* MDEOBJECTQUEUEMANAGER_H_ */ |