|
1 /* |
|
2 * Copyright (c) 2006-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 "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: Thumbnail Auto Generate Daemon |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef THUMBAGDAEMON_H |
|
20 #define THUMBAGDAEMON_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <w32std.h> |
|
24 |
|
25 #include <mdesession.h> |
|
26 |
|
27 #include "thumbagprocessor.h" |
|
28 #include "tmshutdownobserver.h" |
|
29 #include "thumbnaillog.h" |
|
30 |
|
31 |
|
32 /** |
|
33 * ThumbAG daemon. |
|
34 * |
|
35 * @since S60 v5.0 |
|
36 */ |
|
37 NONSHARABLE_CLASS( CThumbAGDaemon ): public CServer2, |
|
38 public MMdESessionObserver, |
|
39 public MMdEObjectObserver, |
|
40 public MTMShutdownObserver, |
|
41 public MMdEObjectPresentObserver |
|
42 |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Two-phased constructor |
|
48 * |
|
49 * @since S60 v5.0 |
|
50 * @return New CThumbAGDaemon server. |
|
51 */ |
|
52 static CThumbAGDaemon* NewLC(); |
|
53 |
|
54 /** |
|
55 * Two-phased constructor |
|
56 * |
|
57 * @since S60 v5.0 |
|
58 * @return New CThumbAGDaemon server. |
|
59 */ |
|
60 static CThumbAGDaemon* NewL(); |
|
61 |
|
62 /** |
|
63 * Destructor |
|
64 * |
|
65 * @since S60 v5.0 |
|
66 */ |
|
67 virtual ~CThumbAGDaemon(); |
|
68 |
|
69 public: |
|
70 |
|
71 /** |
|
72 * Creates new server session. |
|
73 * |
|
74 * @since S60 v5.0 |
|
75 * @param aVersion Version info. |
|
76 * @param aMessage Message to be passed. |
|
77 * @return New session. |
|
78 */ |
|
79 CSession2* NewSessionL( const TVersion& aVersion, |
|
80 const RMessage2& aMessage ) const; |
|
81 |
|
82 /** |
|
83 * ThreadFunctionL |
|
84 * |
|
85 * @since S60 v5.0 |
|
86 */ |
|
87 static void ThreadFunctionL(); |
|
88 |
|
89 public: |
|
90 |
|
91 // from MMdESessionObserver |
|
92 void HandleSessionOpened( CMdESession& aSession, TInt aError ); |
|
93 void HandleSessionError( CMdESession& aSession, TInt aError ); |
|
94 |
|
95 // from MMdEObjectObserver |
|
96 void HandleObjectNotification(CMdESession& aSession, |
|
97 TObserverNotificationType aType, |
|
98 const RArray<TItemId>& aObjectIdArray); |
|
99 |
|
100 void HandleObjectPresentNotification(CMdESession& aSession, |
|
101 TBool aPresent, const RArray<TItemId>& aObjectIdArray); |
|
102 |
|
103 // from MTMShutdownObserver |
|
104 void ShutdownNotification(); |
|
105 |
|
106 protected: |
|
107 |
|
108 /** |
|
109 * AddObserversL |
|
110 * |
|
111 * @since S60 v5.0 |
|
112 */ |
|
113 void AddObserversL(); |
|
114 |
|
115 /** |
|
116 * Check if daemon needs to run |
|
117 * |
|
118 * @since S60 v5.0 |
|
119 */ |
|
120 TBool DaemonEnabledL(); |
|
121 |
|
122 private: |
|
123 |
|
124 /** |
|
125 * C++ default constructor |
|
126 * |
|
127 * @since S60 v5.0 |
|
128 * @return New CThumbAGDaemon instance. |
|
129 */ |
|
130 CThumbAGDaemon(); |
|
131 |
|
132 /** |
|
133 * Symbian 2nd phase constructor can leave. |
|
134 * |
|
135 * @since S60 v5.0 |
|
136 */ |
|
137 void ConstructL(); |
|
138 |
|
139 private: |
|
140 |
|
141 // own |
|
142 CTMShutdownObserver* iShutdownObserver; |
|
143 CTMShutdownObserver* iMDSShutdownObserver; |
|
144 CMdESession* iMdESession; |
|
145 CThumbAGProcessor* iProcessor; |
|
146 |
|
147 TBool iShutdown; |
|
148 |
|
149 #ifdef _DEBUG |
|
150 TUint32 iAddCounter; |
|
151 TUint32 iModCounter; |
|
152 TUint32 iDelCounter; |
|
153 #endif |
|
154 }; |
|
155 |
|
156 #endif // THUMBAGDAEMON_H |