|
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: |
|
15 * CMsgErrorWatcher declaration file |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MSGERRORWATCHERPRIVATE_H |
|
22 #define MSGERRORWATCHERPRIVATE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <f32file.h> |
|
26 #include <msvstd.h> |
|
27 #include <msvapi.h> |
|
28 #include <systemwarninglevels.hrh> // Critical level |
|
29 #include <mmsconst.h> // KMmsDiskSafetyMargin |
|
30 |
|
31 #include "MsgErrorWatcher.hrh" |
|
32 |
|
33 const TUint KCriticalDiskLevel = KDRIVECCRITICALTHRESHOLD; |
|
34 const TUint KCriticalLevel = KCriticalDiskLevel + KMmsDiskSafetyMargin; |
|
35 const TUint32 KDefaultTriggerLevel = 300 * 1024; // 100 kilobytes |
|
36 const TUint KTriggerMargin = 20 * 1024; // 20 kilobytes |
|
37 |
|
38 // FUNCTION PROTOTYPES |
|
39 GLREF_C void Panic( TInt aPanic ); |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 class CWatcherLog; |
|
43 class CMmsClientMtm; |
|
44 class CClientMtmRegistry; |
|
45 class MsgErrorWatcher; |
|
46 class CMsgErrorCommDbObserver; |
|
47 class CMsgErrorDiskSpaceObserver; |
|
48 class CMsgErrorSmsDiskSpaceObserver; |
|
49 class CMsgErrorExtSmsDiskSpaceObserver; |
|
50 class CMsgErrorRoamingObserver; |
|
51 class CMsgErrorStartupObserver; |
|
52 class CMsgErrorDisconnectDlg; |
|
53 class CMsgCenRepObserver; |
|
54 |
|
55 |
|
56 // CLASS DECLARATION |
|
57 |
|
58 /** |
|
59 * CMsgErrorWatcherPrivate |
|
60 */ |
|
61 class CMsgErrorWatcherPrivate :public CActive, public MMsvSessionObserver |
|
62 { |
|
63 public: // Constructors and destructor |
|
64 /** |
|
65 * Default constructor. |
|
66 */ |
|
67 CMsgErrorWatcherPrivate(MsgErrorWatcher* msgErrorWatcher); |
|
68 |
|
69 /** |
|
70 * Destructor |
|
71 */ |
|
72 virtual ~CMsgErrorWatcherPrivate(); |
|
73 |
|
74 public: // New functions |
|
75 |
|
76 /** |
|
77 * Callback function for roaming observer. |
|
78 * |
|
79 * @param aRoaming ETrue if roaming, EFalse otherwise |
|
80 */ |
|
81 void HandleRoamingEventL( TBool aRoaming ); |
|
82 |
|
83 /** |
|
84 * Callback function for CommDB observer. |
|
85 */ |
|
86 void HandleCommDbEventL(); |
|
87 |
|
88 /** |
|
89 * Callback function for connection observer. |
|
90 */ |
|
91 // void HandleConnectionEvent(); |
|
92 |
|
93 /** |
|
94 * Callback function for disk space observer. |
|
95 */ |
|
96 void HandleDiskSpaceEventL(); |
|
97 void HandleDiskSpaceEvent2L(); |
|
98 |
|
99 /** |
|
100 * Callback function for startup state observer (currently |
|
101 * sent items observer). |
|
102 */ |
|
103 void HandleStartupReadyL(); |
|
104 |
|
105 /** |
|
106 * HandleCenRepNotificationL |
|
107 * Handles events from central repository observer |
|
108 */ |
|
109 void HandleCenRepNotificationL(); |
|
110 |
|
111 |
|
112 public: // Functions from base classes |
|
113 |
|
114 /** |
|
115 * From MMsvSessionObserver |
|
116 */ |
|
117 void HandleSessionEventL( |
|
118 TMsvSessionEvent aEvent, |
|
119 TAny* aArg1, |
|
120 TAny* aArg2, |
|
121 TAny* aArg3 ); |
|
122 |
|
123 protected: // Functions from base classes |
|
124 |
|
125 /** |
|
126 * From CActive |
|
127 */ |
|
128 void RunL(); |
|
129 |
|
130 /** |
|
131 * From CActive |
|
132 */ |
|
133 void DoCancel(); |
|
134 |
|
135 private: |
|
136 |
|
137 |
|
138 /** |
|
139 * Initializes the MsgStoreHandler class. |
|
140 */ |
|
141 void InitL(); |
|
142 |
|
143 /** |
|
144 * Start watcher. |
|
145 */ |
|
146 void StartWatcherL(); |
|
147 |
|
148 /** |
|
149 * Stop watcher. |
|
150 */ |
|
151 void StopWatcher(); |
|
152 |
|
153 /** |
|
154 * Start restart timer. Timer is used when trying to reconnect |
|
155 * to message server after watcher has been stopped due |
|
156 * to certain message server events. |
|
157 */ |
|
158 void StartRestartTimer(); |
|
159 |
|
160 /** |
|
161 * Kills all observers and resets counters. |
|
162 */ |
|
163 void ResetWatcher(); |
|
164 |
|
165 /** |
|
166 * Checks whether MMS Service is already found. If not |
|
167 * gets a pointer to MMS service from MsgStore and if |
|
168 * found updates the context of MmsClientMtm. |
|
169 * |
|
170 * @return ETrue if MMS service was found, EFalse otherwise |
|
171 */ |
|
172 TBool GetMmsServiceL(); |
|
173 |
|
174 /** |
|
175 * Initiates MMS fetch by sending a request to MMS engine. |
|
176 */ |
|
177 void StartMmsFetchL(); |
|
178 |
|
179 /** |
|
180 * Initiates MMS send by sending a request to MMS engine. |
|
181 */ |
|
182 void StartMmsSendL(); |
|
183 |
|
184 /** |
|
185 * Checks whether MMS receiving mode is "Enabled in home network" |
|
186 * and "On". If so, activates roaming observer. |
|
187 */ |
|
188 void CheckMmsReceivingModeL(); |
|
189 |
|
190 /** |
|
191 * A wrapper for CMmsClient::ValidateService(). |
|
192 * |
|
193 * @return ETrue if service is valid, EFalse otherwise. |
|
194 */ |
|
195 TBool ValidateMmsServiceL(); |
|
196 |
|
197 /** |
|
198 * Called when MMS reception fails due to insufficient |
|
199 * disk space. |
|
200 * |
|
201 * @param aEntry The failed entry |
|
202 */ |
|
203 void HandleDiskSpaceErrorL( TMsvEntry& aEntry ); |
|
204 |
|
205 /** |
|
206 * Called when MMS reception fails due to insufficient |
|
207 * memory. |
|
208 * |
|
209 * @param aEntry The failed entry |
|
210 */ |
|
211 void HandleMemoryErrorL( TMsvEntry& aEntry ); |
|
212 |
|
213 /** |
|
214 * Called when MMS reception fails because there is |
|
215 * another data connection open. |
|
216 * |
|
217 * @param aEntry The failed entry |
|
218 * @param aReceive, ETrue for incoming messages, EFalse for outgoing |
|
219 */ |
|
220 //void HandleConnectionErrorL( TMsvEntry& aEntry, TBool aReceive ); |
|
221 |
|
222 /** |
|
223 * Called when MMS reception fails because there is no |
|
224 * access point defined. |
|
225 * |
|
226 * @param aEntry The failed entry |
|
227 */ |
|
228 void HandleNoAPErrorL( TMsvEntry& aEntry ); |
|
229 |
|
230 /** |
|
231 * Called when MMS reception fails because the current |
|
232 * access point is invalid. |
|
233 * |
|
234 * @param aEntry The failed entry |
|
235 */ |
|
236 void HandleInvalidAPErrorL( TMsvEntry& aEntry, TBool aStartObserver ); |
|
237 |
|
238 /** |
|
239 * Subfunction of HandleSessionEventL |
|
240 * Handles root events from MsgServer observer |
|
241 * |
|
242 * @param aEvent Message server event |
|
243 * @param aEntries Affected entries |
|
244 */ |
|
245 void HandleRootEventL( |
|
246 TMsvSessionEvent aEvent, |
|
247 CMsvEntrySelection* aEntries ); |
|
248 |
|
249 /** |
|
250 * Subfunction of HandleSessionEventL |
|
251 * Handles local service events from MsgServer observer |
|
252 * |
|
253 * @param aEvent Message server event |
|
254 * @param aEntries Affected entries |
|
255 */ |
|
256 void HandleLocalServiceEventL( |
|
257 TMsvSessionEvent aEvent, |
|
258 CMsvEntrySelection* aEntries ); |
|
259 |
|
260 /** |
|
261 * Subfunction of HandleSessionEventL |
|
262 * Handles inbox events from MsgServer observer |
|
263 * |
|
264 * @param aEvent Message server event |
|
265 * @param aEntries Affected entries |
|
266 */ |
|
267 void HandleInboxEventL( |
|
268 TMsvSessionEvent aEvent, |
|
269 CMsvEntrySelection* aEntries ); |
|
270 |
|
271 /** |
|
272 * Subfunction of HandleSessionEventL |
|
273 * Handles outbox events from MsgServer observer |
|
274 * |
|
275 * @param aEvent Message server event |
|
276 * @param aEntries Affected entries |
|
277 */ |
|
278 void HandleOutboxEventL( |
|
279 TMsvSessionEvent aEvent, |
|
280 CMsvEntrySelection* aEntries ); |
|
281 |
|
282 /** |
|
283 * Subfunction of HandleSessionEventL |
|
284 * Handles MMS service events from MsgServer observer |
|
285 * |
|
286 * @param aEvent Message server event |
|
287 * @param aEntries Affected entries |
|
288 */ |
|
289 void HandleMmsServiceEventL( |
|
290 TMsvSessionEvent aEvent, |
|
291 CMsvEntrySelection* aEntries ); |
|
292 |
|
293 |
|
294 /** |
|
295 * Resets TMsvEntry::iError of an entry saved in iCurrentEntry |
|
296 */ |
|
297 void ResetErrorFieldL( ); |
|
298 |
|
299 /** |
|
300 * Resets TMsvEntry::iError of an entry given as parameter |
|
301 */ |
|
302 void ResetErrorFieldL( TMsvEntry& aEntry ); |
|
303 |
|
304 private: // Data |
|
305 |
|
306 enum TMsgErrorWatcherFlags |
|
307 { |
|
308 EStartupReady = 0x0001, |
|
309 EWatcherRunning = 0x0002, |
|
310 ENoAPErrorPending = 0x0004, |
|
311 EShowRoamingNote = 0x0008, |
|
312 ERoamingNoteShown = 0x0010, |
|
313 EReceivingDisconnectDelay = 0x0020 |
|
314 }; |
|
315 |
|
316 enum TMsgRequestTypes |
|
317 { |
|
318 EMsgRequestNone = 0, |
|
319 EMsgRequestStartingUp, |
|
320 EMsgRequestFetching, |
|
321 EMsgRequestFetchingAll, |
|
322 EMsgRequestSending, |
|
323 EMsgRequestWaitingErrorNote, |
|
324 EMsgRequestWaitingDisconnection |
|
325 }; |
|
326 |
|
327 /** |
|
328 * Pointer to MsgErrorWatcher |
|
329 * Doesn't own |
|
330 */ |
|
331 MsgErrorWatcher* q_ptr; |
|
332 |
|
333 /** |
|
334 * MMSservice id |
|
335 */ |
|
336 TMsvId iMmsServiceId; |
|
337 |
|
338 /** |
|
339 * Notification folder id |
|
340 */ |
|
341 TMsvId iNotificationFolderId; |
|
342 |
|
343 /** |
|
344 * Msv session |
|
345 * Own |
|
346 */ |
|
347 CMsvSession* iSession; |
|
348 |
|
349 /** |
|
350 * Msv operation |
|
351 * Own |
|
352 */ |
|
353 CMsvOperation* iOperation; |
|
354 |
|
355 /** |
|
356 * Mtmregitsry client |
|
357 * Own |
|
358 */ |
|
359 CClientMtmRegistry* iClientMtmRegistry; |
|
360 |
|
361 /** |
|
362 * Mmsclient |
|
363 * Own |
|
364 */ |
|
365 CMmsClientMtm* iMmsClient; |
|
366 |
|
367 /** |
|
368 * Pointer to mms receive error messages |
|
369 * Own |
|
370 */ |
|
371 CMsvEntrySelection* iMmsReceiveErrorMessages; |
|
372 |
|
373 /** |
|
374 * Pointer to mms receive error messages |
|
375 * Own |
|
376 */ |
|
377 CMsvEntrySelection* iMmsSendErrorMessages; |
|
378 |
|
379 /** |
|
380 * Current entry id |
|
381 */ |
|
382 TMsvId iCurrentEntryId; |
|
383 |
|
384 /** |
|
385 * Pointers to error observers |
|
386 * CommDb observer |
|
387 * Own |
|
388 */ |
|
389 CMsgErrorCommDbObserver* iCommDbObserver; |
|
390 |
|
391 /** |
|
392 * Pointer to diskspace observer |
|
393 * Own |
|
394 */ |
|
395 CMsgErrorDiskSpaceObserver* iDiskSpaceObserver; |
|
396 /** |
|
397 * Pointer to sms diskspace observer |
|
398 * Own |
|
399 */ |
|
400 CMsgErrorSmsDiskSpaceObserver* iSmsDiskSpaceObserver; |
|
401 /** |
|
402 * Pointer to extension sms diskspace observer |
|
403 * Own |
|
404 */ |
|
405 CMsgErrorExtSmsDiskSpaceObserver* iSmsExtDiskSpaceObserver; |
|
406 /** |
|
407 * Pointer to roaming observer |
|
408 * Own |
|
409 */ |
|
410 CMsgErrorRoamingObserver* iRoamingObserver; |
|
411 /** |
|
412 * Pointer to startup observer |
|
413 * Own |
|
414 */ |
|
415 CMsgErrorStartupObserver* iStartupObserver; |
|
416 /** |
|
417 * Pointer to cenerep observer |
|
418 * Own |
|
419 */ |
|
420 CMsgCenRepObserver* iCenRepObserver; |
|
421 |
|
422 /** |
|
423 * File session |
|
424 */ |
|
425 RFs iFs; |
|
426 |
|
427 /** |
|
428 * Timer |
|
429 */ |
|
430 RTimer iTimer; |
|
431 |
|
432 TMsgRequestTypes iRequestType; |
|
433 TUint iWatcherFlags; |
|
434 TUint32 iMaxReceiveSize; |
|
435 TUint iDiskSpaceErrors; |
|
436 TUint iTimerRetries; |
|
437 }; |
|
438 |
|
439 #endif // MSGERRORWATCHERPRIVATE_H |
|
440 |
|
441 // End of File |