|
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 * CMsgErrorWatcher declaration file |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MSGERRORWATCHER_H |
|
22 #define MSGERRORWATCHER_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 CStringResourceReader; |
|
46 class CMsgSentItemsObserver; |
|
47 class CMsgErrorCommDbObserver; |
|
48 class CMsgErrorConnectionObserver; |
|
49 class CMsgErrorDiskSpaceObserver; |
|
50 class CMsgErrorSmsDiskSpaceObserver; |
|
51 class CMsgErrorExtSmsDiskSpaceObserver; |
|
52 class CMsgErrorRoamingObserver; |
|
53 class CMsgErrorStartupObserver; |
|
54 class CMsgErrorGlobalQuery; |
|
55 class CMsgErrorDisconnectDlg; |
|
56 class CMsgCenRepObserver; |
|
57 class CMsgLogsObserver; |
|
58 class CMsgGarbageCollection; |
|
59 |
|
60 // CLASS DECLARATION |
|
61 |
|
62 /** |
|
63 * CMsgErrorWatcher |
|
64 * |
|
65 * @lib msgerrorwatcher.dll |
|
66 * @since 2.0 |
|
67 */ |
|
68 class CMsgErrorWatcher : |
|
69 public CActive, |
|
70 public MMsvSessionObserver |
|
71 { |
|
72 public: // Constructors and destructor |
|
73 |
|
74 /** |
|
75 * Two-phased constructor. |
|
76 * The parameters must be exactly these. Defined by |
|
77 * Symbian watcher framework |
|
78 * |
|
79 * @param aFs A reference to file session |
|
80 * @param aLog A reference to watcher log |
|
81 */ |
|
82 static CMsgErrorWatcher* NewL( TAny* aWatcherParams ); |
|
83 |
|
84 /** |
|
85 * Destructor. |
|
86 */ |
|
87 virtual ~CMsgErrorWatcher(); |
|
88 |
|
89 public: // New functions |
|
90 |
|
91 /** |
|
92 * Callback function for roaming observer. |
|
93 * |
|
94 * @param aRoaming ETrue if roaming, EFalse otherwise |
|
95 */ |
|
96 void HandleRoamingEventL( TBool aRoaming ); |
|
97 |
|
98 /** |
|
99 * Callback function for CommDB observer. |
|
100 */ |
|
101 void HandleCommDbEventL(); |
|
102 |
|
103 /** |
|
104 * Callback function for connection observer. |
|
105 */ |
|
106 void HandleConnectionEvent(); |
|
107 |
|
108 /** |
|
109 * Callback function for disk space observer. |
|
110 */ |
|
111 void HandleDiskSpaceEventL(); |
|
112 void HandleDiskSpaceEvent2L(); |
|
113 /** |
|
114 * Callback function for global query observer. |
|
115 */ |
|
116 void HandleGlobalQueryEventL( TInt aQueryId, TInt aStatus ); |
|
117 |
|
118 /** |
|
119 * Callback function for startup state observer (currently |
|
120 * sent items observer). |
|
121 */ |
|
122 void HandleStartupReadyL(); |
|
123 |
|
124 /** |
|
125 * HandleCenRepNotificationL |
|
126 * Handles events from central repository observer |
|
127 */ |
|
128 void HandleCenRepNotificationL(); |
|
129 |
|
130 /* |
|
131 * Hadles events from logs observer |
|
132 */ |
|
133 void ShowDeliveredNoteL( const TDesC& aRemoteParty ); |
|
134 |
|
135 /* |
|
136 * Hadles events from logs observer |
|
137 */ |
|
138 void ShowReadNoteL( const TDesC& aRemoteParty ); |
|
139 |
|
140 /* |
|
141 * Showns read or delivered note |
|
142 */ |
|
143 void ShowReadOrDeliveredNoteL( const TDesC& aRemoteParty, TInt aResourceId ); |
|
144 |
|
145 |
|
146 public: // Functions from base classes |
|
147 |
|
148 /** |
|
149 * From MMsvSessionObserver |
|
150 */ |
|
151 void HandleSessionEventL( |
|
152 TMsvSessionEvent aEvent, |
|
153 TAny* aArg1, |
|
154 TAny* aArg2, |
|
155 TAny* aArg3 ); |
|
156 |
|
157 protected: // Functions from base classes |
|
158 |
|
159 /** |
|
160 * From CActive |
|
161 */ |
|
162 void RunL(); |
|
163 |
|
164 /** |
|
165 * From CActive |
|
166 */ |
|
167 void DoCancel(); |
|
168 |
|
169 private: |
|
170 |
|
171 /** |
|
172 * By default Symbian OS constructor is private. |
|
173 */ |
|
174 void ConstructL(); |
|
175 |
|
176 /** |
|
177 * Private C++ constructor. |
|
178 * |
|
179 * @param aFs A reference to file session |
|
180 */ |
|
181 CMsgErrorWatcher( RFs& aFs ); |
|
182 |
|
183 /** |
|
184 * Start watcher. |
|
185 */ |
|
186 void StartWatcherL(); |
|
187 |
|
188 /** |
|
189 * Stop watcher. |
|
190 */ |
|
191 void StopWatcher(); |
|
192 |
|
193 /** |
|
194 * Start restart timer. Timer is used when trying to reconnect |
|
195 * to message server after watcher has been stopped due |
|
196 * to certain message server events. |
|
197 */ |
|
198 void StartRestartTimer(); |
|
199 |
|
200 /** |
|
201 * Initialise iErrorMessages array |
|
202 */ |
|
203 void InitMessageArraysL(); |
|
204 |
|
205 /** |
|
206 * Kills all observers and resets counters. |
|
207 */ |
|
208 void ResetWatcher(); |
|
209 |
|
210 /** |
|
211 * Checks whether MMS Service is already found. If not |
|
212 * gets a pointer to MMS service from MsgStore and if |
|
213 * found updates the context of MmsClientMtm. |
|
214 * |
|
215 * @return ETrue if MMS service was found, EFalse otherwise |
|
216 */ |
|
217 TBool GetMmsServiceL(); |
|
218 |
|
219 /** |
|
220 * Initiates MMS fetch by sending a request to MMS engine. |
|
221 */ |
|
222 void StartMmsFetchL(); |
|
223 |
|
224 /** |
|
225 * Initiates MMS send by sending a request to MMS engine. |
|
226 */ |
|
227 void StartMmsSendL(); |
|
228 |
|
229 /** |
|
230 * Checks whether MMS receiving mode is "Enabled in home network" |
|
231 * and "On". If so, activates roaming observer. |
|
232 */ |
|
233 void CheckMmsReceivingModeL(); |
|
234 |
|
235 /** |
|
236 * A wrapper for CMmsClient::ValidateService(). |
|
237 * |
|
238 * @return ETrue if service is valid, EFalse otherwise. |
|
239 */ |
|
240 TBool ValidateMmsServiceL(); |
|
241 |
|
242 /** |
|
243 * Shows a global query when message sending, (manual) |
|
244 * retrieving or forwarding has failed. |
|
245 */ |
|
246 void ShowErrorMessageQueryL(); |
|
247 |
|
248 /** |
|
249 * Shows a global note |
|
250 * |
|
251 * @param aNoteId The identifier of the note |
|
252 */ |
|
253 void ShowGlobalNoteL( TMsgErrorNoteIds aNoteId ); |
|
254 |
|
255 /** |
|
256 * Cancels all global notes |
|
257 */ |
|
258 void CancelNotesL(); |
|
259 |
|
260 /** |
|
261 * Finds the next message entry for which to |
|
262 * to show an error message. |
|
263 * @param aEntry OUT The possibly found message entry |
|
264 * @return Standard Symbian error code. |
|
265 * KErrNone if message was found. |
|
266 */ |
|
267 TInt GetNextErrorMsg( TMsvEntry& aEntry ); |
|
268 |
|
269 /** |
|
270 * Resolves the first text for |
|
271 * send/(manual)retrieve/forward failure |
|
272 * @param aEntry IN Valid message entry |
|
273 */ |
|
274 void ResolveErrorTextL( TMsvEntry& aEntry ); |
|
275 |
|
276 /** |
|
277 * Resolves the possible details text |
|
278 * for send/(manual)retrieve/forward failure |
|
279 * @param aEntry IN Valid message entry |
|
280 */ |
|
281 void ResolveErrorDetailsL( TMsvEntry& aEntry ); |
|
282 |
|
283 /** |
|
284 * Called when MMS reception fails due to insufficient |
|
285 * disk space. |
|
286 * |
|
287 * @param aEntry The failed entry |
|
288 */ |
|
289 void HandleDiskSpaceErrorL( TMsvEntry& aEntry ); |
|
290 |
|
291 /** |
|
292 * Called when MMS reception fails due to insufficient |
|
293 * memory. |
|
294 * |
|
295 * @param aEntry The failed entry |
|
296 */ |
|
297 void HandleMemoryErrorL( TMsvEntry& aEntry ); |
|
298 |
|
299 /** |
|
300 * Called when MMS reception fails because there is |
|
301 * another data connection open. |
|
302 * |
|
303 * @param aEntry The failed entry |
|
304 * @param aReceive, ETrue for incoming messages, EFalse for outgoing |
|
305 */ |
|
306 void HandleConnectionErrorL( TMsvEntry& aEntry, TBool aReceive ); |
|
307 |
|
308 /** |
|
309 * Called when MMS reception fails because there is no |
|
310 * access point defined. |
|
311 * |
|
312 * @param aEntry The failed entry |
|
313 */ |
|
314 void HandleNoAPErrorL( TMsvEntry& aEntry ); |
|
315 |
|
316 /** |
|
317 * Called when MMS reception fails because the current |
|
318 * access point is invalid. |
|
319 * |
|
320 * @param aEntry The failed entry |
|
321 */ |
|
322 void HandleInvalidAPErrorL( TMsvEntry& aEntry, TBool aStartObserver ); |
|
323 |
|
324 /** |
|
325 * Subfunction of HandleSessionEventL |
|
326 * Handles root events from MsgServer observer |
|
327 * |
|
328 * @param aEvent Message server event |
|
329 * @param aEntries Affected entries |
|
330 */ |
|
331 void HandleRootEventL( |
|
332 TMsvSessionEvent aEvent, |
|
333 CMsvEntrySelection* aEntries ); |
|
334 |
|
335 /** |
|
336 * Subfunction of HandleSessionEventL |
|
337 * Handles local service events from MsgServer observer |
|
338 * |
|
339 * @param aEvent Message server event |
|
340 * @param aEntries Affected entries |
|
341 */ |
|
342 void HandleLocalServiceEventL( |
|
343 TMsvSessionEvent aEvent, |
|
344 CMsvEntrySelection* aEntries ); |
|
345 |
|
346 /** |
|
347 * Subfunction of HandleSessionEventL |
|
348 * Handles inbox events from MsgServer observer |
|
349 * |
|
350 * @param aEvent Message server event |
|
351 * @param aEntries Affected entries |
|
352 */ |
|
353 void HandleInboxEventL( |
|
354 TMsvSessionEvent aEvent, |
|
355 CMsvEntrySelection* aEntries ); |
|
356 |
|
357 /** |
|
358 * Subfunction of HandleSessionEventL |
|
359 * Handles outbox events from MsgServer observer |
|
360 * |
|
361 * @param aEvent Message server event |
|
362 * @param aEntries Affected entries |
|
363 */ |
|
364 void HandleOutboxEventL( |
|
365 TMsvSessionEvent aEvent, |
|
366 CMsvEntrySelection* aEntries ); |
|
367 |
|
368 /** |
|
369 * Subfunction of HandleSessionEventL |
|
370 * Handles MMS service events from MsgServer observer |
|
371 * |
|
372 * @param aEvent Message server event |
|
373 * @param aEntries Affected entries |
|
374 */ |
|
375 void HandleMmsServiceEventL( |
|
376 TMsvSessionEvent aEvent, |
|
377 CMsvEntrySelection* aEntries ); |
|
378 |
|
379 |
|
380 /** |
|
381 * Resets TMsvEntry::iError of an entry saved in iCurrentEntry |
|
382 */ |
|
383 void ResetErrorFieldL( ); |
|
384 |
|
385 /** |
|
386 * Resets TMsvEntry::iError of an entry given as parameter |
|
387 */ |
|
388 void ResetErrorFieldL( TMsvEntry& aEntry ); |
|
389 |
|
390 private: // Data |
|
391 |
|
392 enum TMsgErrorWatcherFlags |
|
393 { |
|
394 EStartupReady = 0x0001, |
|
395 EWatcherRunning = 0x0002, |
|
396 ENoAPErrorPending = 0x0004, |
|
397 EShowRoamingNote = 0x0008, |
|
398 ERoamingNoteShown = 0x0010, |
|
399 EReceivingDisconnectDelay = 0x0020 |
|
400 }; |
|
401 |
|
402 enum TMsgRequestTypes |
|
403 { |
|
404 EMsgRequestNone = 0, |
|
405 EMsgRequestStartingUp, |
|
406 EMsgRequestFetching, |
|
407 EMsgRequestFetchingAll, |
|
408 EMsgRequestSending, |
|
409 EMsgRequestWaitingErrorNote, |
|
410 EMsgRequestWaitingDisconnection |
|
411 }; |
|
412 |
|
413 |
|
414 TMsvId iMmsServiceId; |
|
415 TMsvId iNotificationFolderId; |
|
416 CMsvSession* iSession; |
|
417 CMsvOperation* iOperation; |
|
418 CClientMtmRegistry* iClientMtmRegistry; |
|
419 CMmsClientMtm* iMmsClient; |
|
420 CMsvEntrySelection* iMmsReceiveErrorMessages; |
|
421 CMsvEntrySelection* iMmsSendErrorMessages; |
|
422 CMsvEntrySelection* iErrorMessages; |
|
423 CArrayFixFlat<TInt>* iNoteIds; |
|
424 CStringResourceReader* iResourceReader; |
|
425 TMsvId iCurrentEntryId; |
|
426 |
|
427 CMsgSentItemsObserver* iSentItemsObserver; |
|
428 CMsgErrorCommDbObserver* iCommDbObserver; |
|
429 CMsgErrorConnectionObserver* iConnectionObserver; |
|
430 CMsgErrorDiskSpaceObserver* iDiskSpaceObserver; |
|
431 CMsgErrorSmsDiskSpaceObserver* iSmsDiskSpaceObserver; |
|
432 CMsgErrorExtSmsDiskSpaceObserver* iSmsExtDiskSpaceObserver; |
|
433 CMsgErrorRoamingObserver* iRoamingObserver; |
|
434 CMsgErrorStartupObserver* iStartupObserver; |
|
435 CMsgErrorDisconnectDlg* iDisconnectDlg; |
|
436 CMsgCenRepObserver* iCenRepObserver; |
|
437 CMsgLogsObserver* iLogsObserver; |
|
438 CMsgGarbageCollection* iGarbageCollection; |
|
439 |
|
440 HBufC* iErrorMsgText; |
|
441 HBufC* iErrorMsgDetails; |
|
442 CMsgErrorGlobalQuery* iErrorQuery; |
|
443 CMsgErrorGlobalQuery* iDisconnectQuery; |
|
444 CMsvEntrySelection* iErrorMsgNotes; |
|
445 |
|
446 RFs& iFs; |
|
447 RTimer iTimer; |
|
448 |
|
449 TMsgRequestTypes iRequestType; |
|
450 TUint iWatcherFlags; |
|
451 TUint32 iMaxReceiveSize; |
|
452 TUint iDiskSpaceErrors; |
|
453 TUint iTimerRetries; |
|
454 }; |
|
455 |
|
456 #endif // MSGERRORWATCHER_H |
|
457 |
|
458 // End of File |