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 #include "thumbagimageobserver.h" |
|
31 #include "thumbagcameraobserver.h" |
|
32 #include "thumbagaudioobserver.h" |
|
33 #include "thumbagvideoobserver.h" |
|
34 |
|
35 |
|
36 /** |
|
37 * ThumbAG daemon. |
|
38 * |
|
39 * @since S60 v5.0 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CThumbAGDaemon ): public CServer2, |
|
42 public MMdESessionObserver, |
|
43 public MMdEObjectObserver, |
|
44 public MTMShutdownObserver, |
|
45 public MMdEObjectPresentObserver |
|
46 #ifdef MDS_URI_OBSERVER |
|
47 ,public MMdEObjectObserverWithUri |
|
48 #endif |
|
49 |
|
50 { |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Two-phased constructor |
|
55 * |
|
56 * @since S60 v5.0 |
|
57 * @return New CThumbAGDaemon server. |
|
58 */ |
|
59 static CThumbAGDaemon* NewLC(); |
|
60 |
|
61 /** |
|
62 * Two-phased constructor |
|
63 * |
|
64 * @since S60 v5.0 |
|
65 * @return New CThumbAGDaemon server. |
|
66 */ |
|
67 static CThumbAGDaemon* NewL(); |
|
68 |
|
69 /** |
|
70 * Destructor |
|
71 * |
|
72 * @since S60 v5.0 |
|
73 */ |
|
74 virtual ~CThumbAGDaemon(); |
|
75 |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Creates new server session. |
|
80 * |
|
81 * @since S60 v5.0 |
|
82 * @param aVersion Version info. |
|
83 * @param aMessage Message to be passed. |
|
84 * @return New session. |
|
85 */ |
|
86 CSession2* NewSessionL( const TVersion& aVersion, |
|
87 const RMessage2& aMessage ) const; |
|
88 |
|
89 /** |
|
90 * ThreadFunctionL |
|
91 * |
|
92 * @since S60 v5.0 |
|
93 */ |
|
94 static void ThreadFunctionL(); |
|
95 |
|
96 public: |
|
97 |
|
98 // from MMdESessionObserver |
|
99 void HandleSessionOpened( CMdESession& aSession, TInt aError ); |
|
100 void HandleSessionError( CMdESession& aSession, TInt aError ); |
|
101 |
|
102 // from MMdEObjectObserver |
|
103 void HandleObjectNotification(CMdESession& aSession, |
|
104 TObserverNotificationType aType, |
|
105 const RArray<TItemId>& aObjectIdArray); |
|
106 |
|
107 #ifdef MDS_URI_OBSERVER |
|
108 void HandleUriObjectNotification(CMdESession& aSession, |
|
109 TObserverNotificationType aType, |
|
110 const RArray<TItemId>& aObjectIdArray, |
|
111 const RPointerArray<HBufC>& aObjectUriArray); |
|
112 #endif |
|
113 |
|
114 void HandleObjectPresentNotification(CMdESession& aSession, |
|
115 TBool aPresent, const RArray<TItemId>& aObjectIdArray); |
|
116 |
|
117 // from MTMShutdownObserver |
|
118 void ShutdownNotification(); |
|
119 |
|
120 protected: |
|
121 |
|
122 /** |
|
123 * AddObserversL |
|
124 * |
|
125 * @since S60 v5.0 |
|
126 */ |
|
127 void AddObserversL(); |
|
128 |
|
129 /** |
|
130 * Check if daemon needs to run |
|
131 * |
|
132 * @since S60 v5.0 |
|
133 */ |
|
134 TBool DaemonEnabledL(); |
|
135 |
|
136 private: |
|
137 |
|
138 /** |
|
139 * C++ default constructor |
|
140 * |
|
141 * @since S60 v5.0 |
|
142 * @return New CThumbAGDaemon instance. |
|
143 */ |
|
144 CThumbAGDaemon(); |
|
145 |
|
146 /** |
|
147 * Symbian 2nd phase constructor can leave. |
|
148 * |
|
149 * @since S60 v5.0 |
|
150 */ |
|
151 void ConstructL(); |
|
152 |
|
153 /** |
|
154 * Initilization helper |
|
155 * |
|
156 * @since S60 v5.2 |
|
157 */ |
|
158 void InitializeL(); |
|
159 |
|
160 /** |
|
161 * Callback for reconnect timer |
|
162 * |
|
163 * @since S60 v5.0 |
|
164 */ |
|
165 static TInt ReconnectCallBack(TAny* aAny); |
|
166 |
|
167 private: |
|
168 |
|
169 // own |
|
170 CTMShutdownObserver* iShutdownObserver; |
|
171 CTMShutdownObserver* iMDSShutdownObserver; |
|
172 CMdESession* iMdESession; |
|
173 CThumbAGProcessor* iProcessor; |
|
174 |
|
175 TBool iShutdown; |
|
176 |
|
177 // reconnect timer |
|
178 CPeriodic* iReconnect; |
|
179 |
|
180 TBool iSessionError; |
|
181 |
|
182 #ifdef _DEBUG |
|
183 TUint32 iAddCounter; |
|
184 TUint32 iDelCounter; |
|
185 #endif |
|
186 |
|
187 //observers |
|
188 CThumbAGImageObserver* iImageObserver; |
|
189 CThumbAGCameraObserver* iCameraObserver; |
|
190 CThumbAGAudioObserver* iAudioObserver; |
|
191 CThumbAGVideoObserver* iVideoObserver; |
|
192 }; |
|
193 |
|
194 #endif // THUMBAGDAEMON_H |
|