|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Alwaysonline manager declaration file |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __ALWAYSONLINEMANAGER_H__ |
|
21 #define __ALWAYSONLINEMANAGER_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <AlwaysOnlineManagerClient.h> |
|
26 #include <msvapi.h> |
|
27 #include <rconnmon.h> |
|
28 #include <MuiuMsvSingleOpWatcher.h> |
|
29 #include <centralrepository.h> |
|
30 #include <cenrepnotifyhandler.h> |
|
31 |
|
32 #include "AlwaysOnlineEComInterface.h" |
|
33 #include "AlwaysOnlineStatusQueryInterface.h" |
|
34 #include "AlwaysOnlineManagerDiskSpaceObserver.h" |
|
35 |
|
36 // CONSTANTS |
|
37 // MACROS |
|
38 // DATA TYPES |
|
39 // FUNCTION PROTOTYPES |
|
40 // FORWARD DECLARATIONS |
|
41 class CAlwaysOnlineManagerServer; |
|
42 class CAOCenRepControl; |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * CAlwaysOnlineManager |
|
48 * |
|
49 * This class contains the plugin related logic in always online server |
|
50 * @since s60 2.1 |
|
51 */ |
|
52 class CAlwaysOnlineManager : |
|
53 public CBase, |
|
54 public MAlwaysOnlineStatusQueryInterface, |
|
55 public MConnectionMonitorObserver, |
|
56 public MMsvSessionObserver, |
|
57 public MMsvSingleOpWatcher, |
|
58 public MCenRepNotifyHandlerCallback |
|
59 { |
|
60 public: |
|
61 |
|
62 |
|
63 /** |
|
64 * NewL(); |
|
65 * @since Series60 2.6 |
|
66 * @param CAlwaysOnlineManagerServer*, pointer to server |
|
67 * @return CAlwaysOnlineManager*, self |
|
68 */ |
|
69 static CAlwaysOnlineManager* NewL( CAlwaysOnlineManagerServer* aServer ); |
|
70 |
|
71 /** |
|
72 * Destructor |
|
73 * ~CAlwaysOnlineManager(); |
|
74 */ |
|
75 ~CAlwaysOnlineManager(); |
|
76 |
|
77 /** |
|
78 * DoStartL(); |
|
79 * @since Series60 2.6 |
|
80 */ |
|
81 void DoStartL(); |
|
82 |
|
83 /** |
|
84 * RoamingStatus() |
|
85 * @since Series60 2.6 |
|
86 * @param TInt, query id |
|
87 * @return TAny*, returned value for a query. Real type depends on |
|
88 * the query. See documentation |
|
89 */ |
|
90 TAny* QueryStatusL( TInt aQuery ); |
|
91 |
|
92 |
|
93 /** |
|
94 * HandleOfflineEventL |
|
95 * Sends event to plugins to inform them about changes between |
|
96 * offline/normal mode |
|
97 * @since Series60 2.6 |
|
98 * @param TInt event id |
|
99 */ |
|
100 void HandleOfflineEventL( TInt aEvent ); |
|
101 |
|
102 |
|
103 /** |
|
104 * From connmon |
|
105 * @since Series60 2.6 |
|
106 * @param CConnMonEventBase |
|
107 */ |
|
108 void EventL( const CConnMonEventBase &aConnMonEvent ); |
|
109 |
|
110 /** |
|
111 * HandleDiskSpaceEventL() |
|
112 * Handle event from disk space observer |
|
113 * @since Series60 2.6 |
|
114 * @param TInt, event id |
|
115 */ |
|
116 void HandleDiskSpaceEventL( TInt aEvent ); |
|
117 |
|
118 private: // From base classes |
|
119 |
|
120 /** |
|
121 * From MCenRepNotifyHandlerCallback |
|
122 * Handles the incoming notifications of key changes |
|
123 * @since Series60 3.0 |
|
124 * @param aId, Key that has changed |
|
125 * @param aNewValue, New value of the key |
|
126 */ |
|
127 void HandleNotifyInt( TUint32 aId, TInt aNewValue ); |
|
128 |
|
129 /** |
|
130 * From MCenRepNotifyHandlerCallback |
|
131 * Handles the notifier errors |
|
132 * @since Series60 3.0 |
|
133 * @param aId, Key that has changed |
|
134 * @param aNewValue, New value of the key |
|
135 */ |
|
136 void HandleNotifyError( |
|
137 TUint32 aId, |
|
138 TInt aError, |
|
139 CCenRepNotifyHandler* aHandler ); |
|
140 |
|
141 /** |
|
142 * HandleSessionEventL |
|
143 * @since Series60 2.6 |
|
144 * @param TMsvSessionEvent, session event |
|
145 * @param TAny* parameter 1 |
|
146 * @param TAny* parameter 2 |
|
147 * @param TAny* parameter 3 |
|
148 */ |
|
149 void HandleSessionEventL(TMsvSessionEvent aEvent, |
|
150 TAny* aArg1, |
|
151 TAny* /*aArg2*/, |
|
152 TAny* /*aArg3*/); |
|
153 |
|
154 public: |
|
155 |
|
156 /** |
|
157 * BroadcastClientCommandL |
|
158 * @since Series60 2.6 |
|
159 */ |
|
160 void BroadcastClientCommandL( TAlwaysOnlineServerAPICommands aCommand, TDes8& aParameter ); |
|
161 |
|
162 /** |
|
163 * OpCompleted() |
|
164 * From MMsvSingleOpWatcher |
|
165 * @since Series60 2.6 |
|
166 * @param CMsvSingleOpWatcher& opwatcher which completed |
|
167 * @param TInt, completion code |
|
168 */ |
|
169 virtual void OpCompleted( |
|
170 CMsvSingleOpWatcher& aOpWatcher, |
|
171 TInt aCompletionCode ); |
|
172 private: |
|
173 |
|
174 /** |
|
175 * C++ constructor |
|
176 * CAlwaysOnlineManager(); |
|
177 */ |
|
178 CAlwaysOnlineManager(); |
|
179 |
|
180 /** |
|
181 * ConstructL() |
|
182 * @since Series60 2.6 |
|
183 * @param CAlwaysOnlineManagerServer*, server pointer |
|
184 */ |
|
185 void ConstructL( CAlwaysOnlineManagerServer* aServer ); |
|
186 |
|
187 /** |
|
188 * LoadPluginsL(); |
|
189 * @since Series60 2.6 |
|
190 */ |
|
191 void LoadPluginsL(); |
|
192 |
|
193 /** |
|
194 * StartPluginsL(); |
|
195 * @since Series60 2.6 |
|
196 */ |
|
197 void StartPluginsL(); |
|
198 |
|
199 /** |
|
200 * Check network status and report it to plugins; |
|
201 * @since Series60 2.6 |
|
202 */ |
|
203 void CheckNetworkStatusAndSetObserverL(); |
|
204 |
|
205 /** |
|
206 * Takes action based on registration status |
|
207 * @since Series60 2.6 |
|
208 * @param TInt, status id |
|
209 */ |
|
210 void HandleRegistrationStatusL( TInt aStatus ); |
|
211 |
|
212 /** |
|
213 * Sends command to all plugins |
|
214 * @since Series60 3.2.3 |
|
215 * @param TManagerServerCommands, command for plugin |
|
216 * @param TDes8&, parameter |
|
217 */ |
|
218 void BroadcastCommandDirectL( |
|
219 TManagerServerCommands aCommand, |
|
220 TDes8& aParameter ); |
|
221 |
|
222 /** |
|
223 * |
|
224 * @since Series60 2.6 |
|
225 */ |
|
226 void InvokeCommandHandlerL( const TManagerServerCommands aCommand, |
|
227 TDes8& aParameter, |
|
228 TInt aIndex ); |
|
229 |
|
230 /** |
|
231 * Queries all the started plugins, whether they want to be shutdown or not. |
|
232 * @since Series60 3.1 |
|
233 */ |
|
234 void QuerySuicideL(); |
|
235 |
|
236 /** |
|
237 * Handles starting of plugin, which UID is inside parameter. |
|
238 * @since Series60 3.1 |
|
239 * @param aParameter, UID of plugin |
|
240 */ |
|
241 void HandleStartPluginL( const TDes8& aParameter ); |
|
242 |
|
243 /** |
|
244 * Handles stopping of plugin, which UID is inside parameter. |
|
245 * @since Series60 3.1 |
|
246 * @param aParameter, UID of plugin |
|
247 */ |
|
248 void HandleStopPluginL( const TDes8& aParameter ); |
|
249 |
|
250 /** |
|
251 * Handles stopping of plugin with given UID. |
|
252 * @since Series60 3.1 |
|
253 * @param aPlugin, UID of plugin |
|
254 */ |
|
255 void StopPluginL( const TUid& aPlugin ); |
|
256 |
|
257 /** |
|
258 * Unloads the plugin with given UID and sets it as disabled. |
|
259 * @since Series60 3.1 |
|
260 * @param aPlugin, UID of plugin |
|
261 */ |
|
262 void DisablePlugin( const TUid& aPlugin ); |
|
263 |
|
264 /** |
|
265 * Handles the final progress of an operation. |
|
266 * @since Series60 3.1 |
|
267 * @param aProgress, progress from operation |
|
268 */ |
|
269 void HandleOpCompletionL( const TDesC8& aProgress ); |
|
270 |
|
271 /** |
|
272 * Handles the parsing of final progress. |
|
273 * @since Series60 3.1 |
|
274 * @param aProgress, final progress of an operation |
|
275 * @param aUid, UID of plugin |
|
276 * @param aCommand, command executed in operation |
|
277 * @param aResult, final result of an operation |
|
278 */ |
|
279 TBool ParseProgressL( |
|
280 const TDesC8& aProgress, |
|
281 TUid& aUid, |
|
282 TInt& aCommand, |
|
283 TDes8& aResult ); |
|
284 |
|
285 //data |
|
286 private: |
|
287 TBool iOffline; |
|
288 TInt iNetworkStatus; |
|
289 TBool iPluginsLoaded; |
|
290 CArrayFixFlat<CAlwaysOnlineEComInterface*>* iPluginArray; |
|
291 CArrayFixFlat<TUid>* iDisabledPluginUidsArray; |
|
292 CAlwaysOnlineManagerServer* iServer; |
|
293 CAlwaysOnlineDiskSpaceObserver* iDiskSpaceObserver; |
|
294 RFs iRfs; |
|
295 CMsvSession* iSession; |
|
296 // Array to store the operation |
|
297 CMsvSingleOpWatcherArray* iOperations; |
|
298 TInt iLastDiskEvent; |
|
299 // Used to listen network state changes |
|
300 RConnectionMonitor iConMon; |
|
301 // Handle all the cenrep actions |
|
302 CAOCenRepControl* iCenRepControl; |
|
303 }; |
|
304 |
|
305 #endif |
|
306 //EOF |