author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 00:13:15 +0300 | |
changeset 72 | 6f657153cbc5 |
parent 31 | ebfee66fde93 |
permissions | -rw-r--r-- |
31 | 1 |
/* |
2 |
* Copyright (c) 2004-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: base class for mms operations |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <msventry.h> |
|
23 |
#include <logcli.h> |
|
24 |
#include <logview.h> |
|
25 |
// socket error when switching to offline mode |
|
26 |
#include <es_sock.h> |
|
27 |
// Internet error when switching to offline mode |
|
28 |
#include <inet6err.h> |
|
29 |
#include <CoreApplicationUIsSDKCRKeys.h> |
|
30 |
#include <e32property.h> // PubSub |
|
31 |
#include <connect/sbdefs.h> |
|
32 |
#include <apgcli.h> // RApaLsSession |
|
33 |
#include <fileprotectionresolver.h> |
|
34 |
#include <mmsvattachmentmanager.h> |
|
35 |
||
36 |
#include "mmsbaseoperation.h" |
|
37 |
#include "mmsservercommon.h" |
|
38 |
#include "mmserrors.h" |
|
39 |
#include "mmssettings.h" |
|
40 |
#include "mmsserverentry.h" |
|
41 |
#include "mmssession.h" |
|
42 |
#include "mmsheaders.h" |
|
43 |
#include "mmsdecode.h" |
|
44 |
#include "mmsencode.h" |
|
45 |
#include "mmsscheduledentry.h" |
|
46 |
#include "mmslog.h" |
|
47 |
#include "mmsconninit.h" |
|
48 |
#include "MmsServerDebugLogging.h" |
|
49 |
#include "MmsPhoneClient.H" |
|
50 |
#include "mmscodecdatasupplier.h" |
|
51 |
#include "mmscodecdatasink.h" |
|
52 |
#include "mmsregisteredapplications.h" |
|
53 |
||
54 |
// EXTERNAL DATA STRUCTURES |
|
55 |
||
56 |
// EXTERNAL FUNCTION PROTOTYPES |
|
57 |
||
58 |
// CONSTANTS |
|
59 |
const TInt KMmsBackupWait = 300000000; // wait for 5min, no more |
|
60 |
const TInt KMmsServerReadyWait = 5000000; // wait for 5 sec for server ready after backup end |
|
61 |
||
62 |
// MACROS |
|
63 |
||
64 |
// LOCAL CONSTANTS AND MACROS |
|
65 |
||
66 |
// MODULE DATA STRUCTURES |
|
67 |
||
68 |
// LOCAL FUNCTION PROTOTYPES |
|
69 |
||
70 |
// FORWARD DECLARATIONS |
|
71 |
||
72 |
// ============================= LOCAL FUNCTIONS =============================== |
|
73 |
||
74 |
||
75 |
// ============================ MEMBER FUNCTIONS =============================== |
|
76 |
||
77 |
// ----------------------------------------------------------------------------- |
|
78 |
// CMmsBaseOperation::CMmsBaseOperation |
|
79 |
// C++ default constructor can NOT contain any code, that |
|
80 |
// might leave. |
|
81 |
// ----------------------------------------------------------------------------- |
|
82 |
// |
|
83 |
CMmsBaseOperation::CMmsBaseOperation( RFs& aFs ):CMsgActive( KMmsActiveObjectPriority ), |
|
84 |
iFs( aFs ) |
|
85 |
{ |
|
86 |
// As this class is derived from CBase, all uninitialized variables are set to 0. |
|
87 |
} |
|
88 |
||
89 |
// ----------------------------------------------------------------------------- |
|
90 |
// CMmsBaseOperation::ConstructL |
|
91 |
// Symbian 2nd phase constructor can leave. |
|
92 |
// ----------------------------------------------------------------------------- |
|
93 |
// |
|
94 |
void CMmsBaseOperation::ConstructL( CMmsSettings* aMmsSettings ) |
|
95 |
{ |
|
96 |
// Default critical state |
|
97 |
// If nothing is stored, operations just fall through, and there is no error |
|
98 |
iCriticalState = EMmsOperationEncodingPDU; |
|
99 |
iMmsSettings = aMmsSettings; |
|
100 |
||
101 |
// connect to socket to keep connection open as long as we need it |
|
102 |
TInt error = KErrNone; |
|
103 |
error = iSocketServ.Connect(); |
|
104 |
#ifndef _NO_MMSS_LOGGING_ |
|
105 |
if ( error != KErrNone ) |
|
106 |
{ |
|
107 |
TMmsLogger::Log( _L("BaseOperation: Connect Socket server returned error %d"), error ); |
|
108 |
} |
|
109 |
#endif |
|
110 |
User::LeaveIfError( error ); |
|
111 |
error = iConnection.Open( iSocketServ ); |
|
112 |
#ifndef _NO_MMSS_LOGGING_ |
|
113 |
if ( error != KErrNone ) |
|
114 |
{ |
|
115 |
TMmsLogger::Log( _L("BaseOperation: RConnection::Open returned error %d"), error ); |
|
116 |
} |
|
117 |
#endif |
|
118 |
User::LeaveIfError( error ); |
|
119 |
iFailed = new( ELeave ) CMsvEntrySelection; |
|
120 |
iSuccessful = new( ELeave ) CMsvEntrySelection; |
|
121 |
iResponse = CMmsHeaders::NewL( iMmsSettings->MmsVersion() ); |
|
122 |
iEncoder = CMmsEncode::NewL( iFs ); |
|
123 |
iDecoder = CMmsDecode::NewL( iFs ); |
|
124 |
// expand size is arbitrary. It is not used, we |
|
125 |
// always allocate the amount we need |
|
126 |
iEncodeBuffer = CBufFlat::NewL( 0x100 ); |
|
72
6f657153cbc5
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
127 |
// coverity[size_error][buffer_alloc] |
31 | 128 |
iMmsSession = CMmsSession::NewL( KMmsActiveObjectPriority, iSocketServ, iConnection ); |
129 |
iRemoteParties = new ( ELeave )CDesCArrayFlat( KMmsArrayAllocationNumber ); |
|
130 |
// observe backup/restore event ends |
|
131 |
iBackupStart = EFalse; |
|
132 |
iBackupEnd = EFalse; |
|
133 |
} |
|
134 |
||
135 |
// ----------------------------------------------------------------------------- |
|
136 |
// CMmsBaseOperation::NewL |
|
137 |
// Two-phased constructor. |
|
138 |
// ----------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
CMmsBaseOperation* CMmsBaseOperation::NewL( RFs& aFs, CMmsSettings* aMmsSettings ) |
|
141 |
{ |
|
142 |
CMmsBaseOperation* self = new( ELeave ) CMmsBaseOperation( aFs ); |
|
143 |
||
144 |
CleanupStack::PushL( self ); |
|
145 |
self->ConstructL( aMmsSettings ); |
|
146 |
CleanupStack::Pop( self ); |
|
147 |
||
148 |
return self; |
|
149 |
} |
|
150 |
||
151 |
||
152 |
// Destructor |
|
153 |
CMmsBaseOperation::~CMmsBaseOperation() |
|
154 |
{ |
|
155 |
// derived class must cancel. |
|
156 |
Cancel(); // framework requirement |
|
157 |
// iSelection, iServerEntry, and iMmsSettings |
|
158 |
// are not deleted, because they belong to caller |
|
159 |
||
160 |
// start of ROAMING CHECK handling |
|
161 |
delete iPhone; |
|
162 |
// end ROAMING CHECK handling |
|
163 |
if ( iRemoteParties ) |
|
164 |
{ |
|
165 |
iRemoteParties->Reset(); |
|
166 |
} |
|
167 |
delete iRemoteParties; |
|
168 |
delete iEncodeBuffer; |
|
169 |
delete iFailed; |
|
170 |
delete iSuccessful; |
|
171 |
delete iEntryWrapper; |
|
172 |
delete iUri; |
|
173 |
delete iResponse; |
|
174 |
delete iEncoder; |
|
175 |
delete iDecoder; |
|
176 |
delete iMmsLog; |
|
177 |
delete iLogEvent; |
|
178 |
delete iLogViewEvent; |
|
179 |
delete iLogClient; |
|
180 |
delete iMmsSession; |
|
181 |
||
182 |
// connection initiator should be NULL already... |
|
183 |
delete iConnectionInitiator; |
|
184 |
delete iIAPArray; |
|
185 |
iConnection.Close(); |
|
186 |
iSocketServ.Close(); |
|
187 |
||
188 |
} |
|
189 |
||
190 |
// --------------------------------------------------------- |
|
191 |
// CMmsBaseOperation::NetworkOperationsAllowed() |
|
192 |
// |
|
193 |
// --------------------------------------------------------- |
|
194 |
// |
|
195 |
TBool CMmsBaseOperation::NetworkOperationsAllowed() |
|
196 |
{ |
|
197 |
TBool networkAllowed = ETrue; // optimist |
|
198 |
// If there is no such key, we will continue normally. |
|
199 |
// This means that in a system where online/offline mode switching |
|
200 |
// is not supported, we behave as we were always online |
|
201 |
||
202 |
CRepository* repository = NULL; |
|
203 |
TInt error = KErrNone; |
|
204 |
TInt value = ECoreAppUIsNetworkConnectionAllowed; |
|
205 |
TRAP( error, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) ); |
|
206 |
if( error == KErrNone ) |
|
207 |
{ |
|
208 |
repository->Get( KCoreAppUIsNetworkConnectionAllowed, value ); |
|
209 |
delete repository; |
|
210 |
repository = NULL; |
|
211 |
if ( value == ECoreAppUIsNetworkConnectionNotAllowed ) |
|
212 |
{ |
|
213 |
networkAllowed = EFalse; |
|
214 |
} |
|
215 |
} |
|
216 |
||
217 |
return networkAllowed; |
|
218 |
} |
|
219 |
||
220 |
// --------------------------------------------------------- |
|
221 |
// CMmsBaseOperation::AllocateTID |
|
222 |
// |
|
223 |
// --------------------------------------------------------- |
|
224 |
// |
|
225 |
TInt64 CMmsBaseOperation::AllocateTID() |
|
226 |
{ |
|
227 |
TTime currentTime; |
|
228 |
currentTime.UniversalTime(); |
|
229 |
return currentTime.Int64(); |
|
230 |
} |
|
231 |
||
232 |
// --------------------------------------------------------- |
|
233 |
// CMmsBaseOperation::StartL |
|
234 |
// |
|
235 |
// --------------------------------------------------------- |
|
236 |
// |
|
237 |
void CMmsBaseOperation::StartL( |
|
238 |
CMsvEntrySelection& aSelection, |
|
239 |
CMsvServerEntry& aServerEntry, |
|
240 |
TMsvId aService, |
|
241 |
TRequestStatus& aStatus ) |
|
242 |
{ |
|
243 |
||
244 |
#ifndef _NO_MMSS_LOGGING_ |
|
245 |
TMmsLogger::Log( _L("BaseOperation starting")); |
|
246 |
#endif |
|
247 |
||
248 |
InitializeL( aSelection, aServerEntry, aService ); |
|
249 |
||
250 |
if ( iCurrentMessageNo < 1 ) |
|
251 |
{ |
|
252 |
// nothing to send. Give up immediately |
|
253 |
aStatus = KRequestPending; |
|
254 |
TRequestStatus* status = &aStatus; |
|
255 |
User::RequestComplete( status, KErrNotFound ); |
|
256 |
return; |
|
257 |
} |
|
258 |
||
259 |
// The first thing to do is to encode the first message. |
|
260 |
// We don't start connecting before we have something to send |
|
261 |
// We want to minimize the connection time in order to minimize |
|
262 |
// the probability of the connection being broken. |
|
263 |
||
264 |
// In the connect routine we must check that the connection |
|
265 |
// exists, and open it if it doesn't |
|
266 |
||
267 |
// the last call in derived class StartL before SetActive() must be Queue. |
|
268 |
// This will store the caller's status and set it to "request pending" state |
|
269 |
Queue( aStatus ); |
|
270 |
FallThrough(); |
|
271 |
} |
|
272 |
||
273 |
// --------------------------------------------------------- |
|
274 |
// CMmsBaseOperation::ContainsClosedContent |
|
275 |
// |
|
276 |
// --------------------------------------------------------- |
|
277 |
// |
|
278 |
TInt CMmsBaseOperation::CheckClosedContentL( CMsvServerEntry& aServerEntry, RFs& aFs ) |
|
279 |
{ |
|
280 |
RApaLsSession apaLsSession; |
|
281 |
TInt err = apaLsSession.Connect(); |
|
282 |
||
283 |
if ( err != KErrNone ) |
|
284 |
{ |
|
285 |
return err; |
|
286 |
} |
|
287 |
CleanupClosePushL( apaLsSession ); |
|
288 |
||
289 |
CFileProtectionResolver* fileProt = CFileProtectionResolver::NewLC( aFs ); |
|
290 |
||
291 |
TDataRecognitionResult* dataType = new( ELeave )TDataRecognitionResult; |
|
292 |
CleanupStack::PushL( dataType ); |
|
293 |
||
294 |
CMsvStore* store = aServerEntry.ReadStoreL(); |
|
295 |
CleanupStack::PushL( store ); |
|
296 |
||
297 |
MMsvAttachmentManager& attachMan = store->AttachmentManagerL(); |
|
298 |
||
299 |
TInt attaCount = attachMan.AttachmentCount(); |
|
300 |
||
301 |
TInt i = 0; |
|
302 |
// we check all attachments, but if we find even one forbidden type, we give up. |
|
303 |
for ( i = 0; i < attaCount && err == KErrNone; i++ ) |
|
304 |
{ |
|
305 |
CMsvAttachment* attaInfo = attachMan.GetAttachmentInfoL( i ); |
|
306 |
RFile file; |
|
307 |
err = file.Open( aFs, attaInfo->FilePath(), EFileRead|EFileShareReadersOnly ); |
|
308 |
delete attaInfo; |
|
309 |
attaInfo = NULL; |
|
310 |
||
311 |
if ( err == KErrNone ) |
|
312 |
{ |
|
313 |
// We continue only if we managed to open the file successfully |
|
314 |
CleanupClosePushL( file ); |
|
315 |
||
316 |
err = apaLsSession.RecognizeData( file, *dataType ); |
|
317 |
#ifndef _NO_MMSS_LOGGING_ |
|
318 |
if ( err != KErrNone ) |
|
319 |
{ |
|
320 |
TMmsLogger::Log(_L("- Error in recognization of data type"), err ); |
|
321 |
// We assume that the file cannot be closed content, if its type |
|
322 |
// is not recognized |
|
323 |
err = KErrNotSupported; |
|
324 |
} |
|
325 |
else |
|
326 |
{ |
|
327 |
HBufC16* buf16 = HBufC16::NewLC( KMaxFileName ); |
|
328 |
TPtrC dummy; |
|
329 |
TPtr ptr = buf16->Des(); |
|
330 |
file.Name( ptr ); |
|
331 |
// we cannot log indefinitely long strings. |
|
332 |
// We get this long strings only if the message is corrupted. |
|
333 |
dummy.Set( ptr.Left( KMmsMaxLogStringLength ) ); |
|
334 |
TMmsLogger::Log( _L("- filename: %S"), &dummy ); |
|
335 |
CleanupStack::PopAndDestroy( buf16 ); |
|
336 |
||
337 |
TBuf<KMaxDataTypeLength> buffer; |
|
338 |
buffer.Copy( dataType->iDataType.Des8() ); |
|
339 |
TMmsLogger::Log(_L("- Data type recognizer result: %S"), &buffer ); |
|
340 |
if ( dataType->iConfidence == CApaDataRecognizerType::ECertain ) |
|
341 |
{ |
|
342 |
TMmsLogger::Log(_L("- Confidence level: Certain")); |
|
343 |
} |
|
344 |
else if ( dataType->iConfidence == CApaDataRecognizerType::EProbable ) |
|
345 |
{ |
|
346 |
TMmsLogger::Log(_L("- Confidence level: Probable")); |
|
347 |
} |
|
348 |
else if ( dataType->iConfidence == CApaDataRecognizerType::EPossible ) |
|
349 |
{ |
|
350 |
TMmsLogger::Log(_L("- Confidence level: Possible")); |
|
351 |
} |
|
352 |
else if ( dataType->iConfidence == CApaDataRecognizerType::EUnlikely ) |
|
353 |
{ |
|
354 |
TMmsLogger::Log(_L("- Confidence level: Unlikely")); |
|
355 |
} |
|
356 |
else if ( dataType->iConfidence == CApaDataRecognizerType::ENotRecognized ) |
|
357 |
{ |
|
358 |
TMmsLogger::Log(_L("- Confidence level: Not recognized")); |
|
359 |
} |
|
360 |
else |
|
361 |
{ |
|
362 |
TMmsLogger::Log(_L("- Unknown confidence level")); |
|
363 |
} |
|
364 |
} |
|
365 |
#endif |
|
366 |
// We Must set limit to "possible". The recognition is rather uncertain |
|
367 |
if ( err == KErrNone && dataType->iConfidence >= CApaDataRecognizerType::EPossible ) |
|
368 |
{ |
|
369 |
TInt pos = 0; |
|
370 |
file.Seek( ESeekStart, pos ); // rewind just in case |
|
371 |
TInt prot = fileProt->ProtectionStatusL( file, dataType->iDataType ); |
|
372 |
if ( ( prot & ( EFileProtForwardLocked | EFileProtClosedContent ) ) && |
|
373 |
!( prot & EFileProtSuperDistributable ) ) |
|
374 |
{ |
|
375 |
err = KMmsErrorProtectedContent; |
|
376 |
} |
|
377 |
} |
|
378 |
CleanupStack::PopAndDestroy( &file ); //close file |
|
379 |
} |
|
380 |
#ifndef _NO_MMSS_LOGGING_ |
|
381 |
else |
|
382 |
{ |
|
383 |
TMmsLogger::Log(_L("- Error in opening file for recognization of data type"), err ); |
|
384 |
} |
|
385 |
#endif |
|
386 |
} |
|
387 |
||
388 |
CleanupStack::PopAndDestroy( store ); |
|
389 |
CleanupStack::PopAndDestroy( dataType ); |
|
390 |
CleanupStack::PopAndDestroy( fileProt ); |
|
391 |
||
392 |
CleanupStack::PopAndDestroy( &apaLsSession ); // close apaSession |
|
393 |
||
394 |
if ( err == KErrNotSupported ) |
|
395 |
{ |
|
396 |
// the content type was not recognized, we must assume it is not closed content |
|
397 |
err = KErrNone; |
|
398 |
} |
|
399 |
||
400 |
return err; |
|
401 |
} |
|
402 |
||
403 |
// --------------------------------------------------------- |
|
404 |
// CMmsBaseOperation::HandleBackupOperationEventL |
|
405 |
// |
|
406 |
// --------------------------------------------------------- |
|
407 |
// |
|
408 |
void CMmsBaseOperation::HandleBackupOperationEventL( |
|
409 |
const TBackupOperationAttributes& aBackupOperationAttributes ) |
|
410 |
{ |
|
411 |
switch ( aBackupOperationAttributes.iOperation ) |
|
412 |
{ |
|
413 |
case EStart: |
|
414 |
iBackupStart = ETrue; |
|
415 |
iBackupEnd = EFalse; |
|
416 |
#ifndef _NO_MMSS_LOGGING_ |
|
417 |
TMmsLogger::Log(_L("Backup/Restore Start")); |
|
418 |
#endif |
|
419 |
break; |
|
420 |
case EEnd: |
|
421 |
case EAbort: |
|
422 |
iBackupStart = EFalse; |
|
423 |
if ( iHaveTimer ) |
|
424 |
{ |
|
425 |
iTimer.Cancel(); |
|
426 |
// Set this to true only if we cancel timer because of backup end |
|
427 |
iBackupEnd = ETrue; |
|
428 |
// do not do it twice |
|
429 |
iDoNotWaitForBackupEnd = ETrue; |
|
430 |
iMustWait = ETrue; |
|
431 |
} |
|
432 |
#ifndef _NO_MMSS_LOGGING_ |
|
433 |
if ( aBackupOperationAttributes.iOperation == EEnd ) |
|
434 |
{ |
|
435 |
TMmsLogger::Log(_L("Backup/Restore End")); |
|
436 |
} |
|
437 |
else // if not end, then it was abort |
|
438 |
{ |
|
439 |
TMmsLogger::Log(_L("Backup/Restore Abort")); |
|
440 |
} |
|
441 |
#endif |
|
442 |
break; |
|
443 |
default: |
|
444 |
break; |
|
445 |
} |
|
446 |
} |
|
447 |
||
448 |
// --------------------------------------------------------- |
|
449 |
// CMmsBaseOperation::RunL |
|
450 |
// |
|
451 |
// --------------------------------------------------------- |
|
452 |
// |
|
453 |
void CMmsBaseOperation::RunL() |
|
454 |
{ |
|
455 |
// DoRunL() takes the AO through the states, queuing another |
|
456 |
// asynch step as required. |
|
457 |
// if DoRunL() detects the end of the cycle it returns |
|
458 |
// without queuing another cycle. |
|
459 |
||
460 |
// If Run() would exit without queuing another cycle it reports |
|
461 |
// completion to the client. |
|
462 |
// In CMsgActive this is true if the asynch step or DoRunL fails, |
|
463 |
// or the state cycle is complete |
|
464 |
// However, we must keep our cycle going in spite of error. |
|
465 |
// If any step reports an error, we must cleanup the current |
|
466 |
// operation, and continue to the next entry in the selection. |
|
467 |
// Only if we lose the connection, we complete the whole loop. |
|
468 |
||
469 |
// If we have completed ourselves, the error is already in iError. |
|
470 |
// However, if an asynchronous operation completed us, the error |
|
471 |
// comes back to us in iStatus. |
|
472 |
// As we always complete ourselves by returning iError as the |
|
473 |
// status, we get back either our original iError, or a new |
|
474 |
// error value set by an asynchronous operation. |
|
475 |
#ifndef _NO_MMSS_LOGGING_ |
|
476 |
TMmsLogger::Log( _L("BaseOperation RunL status %d, error %d"), |
|
477 |
iStatus.Int(), iError ); |
|
478 |
#endif |
|
479 |
TInt status=iStatus.Int(); |
|
480 |
||
481 |
if ( iBackupEnd && ( status == KErrCancel || status == KErrTimedOut ) ) |
|
482 |
{ |
|
483 |
// timer cancelled because of backup end - continue as if no error |
|
484 |
status = KErrNone; |
|
485 |
} |
|
486 |
||
487 |
// wait for 5 seconds after backup end |
|
488 |
if ( iMustWait ) |
|
489 |
{ |
|
490 |
// Timer is never active if iMustWait == ETrue, |
|
491 |
// Actually it is not possible to check if iTimer is active. |
|
492 |
// We must rely on iMustWait. |
|
493 |
// iMustWait is set true only when the timer was just cancelled |
|
494 |
// because of backup end, and we must wait a few seconds before continuing. |
|
495 |
iMustWait = EFalse; |
|
496 |
iTimer.After( iStatus, KMmsServerReadyWait ); |
|
497 |
SetActive(); |
|
498 |
return; |
|
499 |
} |
|
500 |
||
501 |
// when we come here after wait, the timer can go. |
|
502 |
if ( iHaveTimer ) |
|
503 |
{ |
|
504 |
iTimer.Cancel(); |
|
505 |
iTimer.Close(); |
|
506 |
iHaveTimer = EFalse; |
|
507 |
iDoNotWaitForBackupEnd = ETrue; |
|
508 |
iBackupEnd = EFalse; |
|
509 |
} |
|
510 |
||
511 |
if ( status <= (TInt) KMsvMediaUnavailable && |
|
512 |
status >= (TInt) KMsvIndexRestore && |
|
513 |
!iDoNotWaitForBackupEnd ) |
|
514 |
{ |
|
515 |
#ifndef _NO_MMSS_LOGGING_ |
|
516 |
TMmsLogger::Log( _L("- must wait for backup end ") ); |
|
517 |
#endif |
|
518 |
iState = EMmsOperationWaitingForBackupEnd; |
|
519 |
// This will take us back to RunL |
|
520 |
WaitForBackupEnd(); |
|
521 |
// iError has been set when the media unavailable error has occurred. |
|
522 |
if ( iError == status ) |
|
523 |
{ |
|
524 |
iError = KErrNone; |
|
525 |
} |
|
526 |
return; |
|
527 |
} |
|
528 |
||
529 |
if ( iState == EMmsOperationCheckingRoaming ) |
|
530 |
{ |
|
531 |
// the status is the result of the roaming query |
|
532 |
iRegistrationStatus = status; |
|
533 |
delete iPhone; |
|
534 |
iPhone = NULL; |
|
535 |
if ( status > 0 ) |
|
536 |
{ |
|
537 |
// If the status is a successful registration state result, |
|
538 |
// it must not be set into iError |
|
539 |
// However, if something has gone wrong, the error should |
|
540 |
// be propagated. |
|
541 |
status = 0; |
|
542 |
} |
|
543 |
} |
|
544 |
||
545 |
// Don't override old error. |
|
546 |
// Connection state returns index of successful connection in status, |
|
547 |
// it must be handled separately. |
|
548 |
// And if logging fails, the error is not stored. |
|
549 |
// Logging is done on "best effort" basis |
|
550 |
if ( iError == KErrNone && |
|
551 |
iState != EMmsOperationConnectingToIAP && |
|
552 |
iState != EMmsOperationLogging) |
|
553 |
{ |
|
554 |
iError = status; |
|
555 |
} |
|
556 |
||
557 |
// The connection may go wrong, which means there's no use continuing now. |
|
558 |
// On the other hand, if one operation fails, the next one may be all right. |
|
559 |
// We don't exit in the middle of the loop without deciding |
|
560 |
// what cleanup work must be done. |
|
561 |
// Only cancel can exit. |
|
562 |
if ( status != KErrCancel ) |
|
563 |
{ |
|
564 |
// iError contains the possible error from previous step. |
|
565 |
// It may be needed to decide what to do with current message |
|
566 |
// in next step. |
|
567 |
TRAPD( error,DoRunL() ); // continue operations, may re-queue |
|
568 |
// must not requeue in error situations |
|
569 |
// If we want to continue the loop in spite of error, |
|
570 |
// we must not leave, but return the error in iError. |
|
571 |
// Symbian code may leave, so we must trap the leaves here, |
|
572 |
// as we want to keep the loop going unless something |
|
573 |
// is really fatally wrong (we are completely out of memory, |
|
574 |
// or the system has crashed) |
|
575 |
#ifndef _NO_MMSS_LOGGING_ |
|
576 |
if ( error != KErrNone ) |
|
577 |
{ |
|
578 |
TMmsLogger::Log(_L("BaseOperatin DoRunL left with error %d"), |
|
579 |
error ); |
|
580 |
if ( IsActive() ) |
|
581 |
{ |
|
582 |
TMmsLogger::Log(_L("- still active!")); |
|
583 |
} |
|
584 |
} |
|
585 |
#endif |
|
586 |
__ASSERT_DEBUG( error==KErrNone || !IsActive(), User::Invariant() ); |
|
587 |
if ( IsActive() ) // requeued |
|
588 |
{ |
|
589 |
return; |
|
590 |
} |
|
591 |
status=error; |
|
592 |
if ( error == KErrNone ) |
|
593 |
{ |
|
594 |
// If DoRunL did not leave, possible error is in iError |
|
595 |
status = iError; |
|
596 |
} |
|
597 |
} |
|
598 |
||
599 |
Complete( status ); |
|
600 |
} |
|
601 |
||
602 |
// --------------------------------------------------------- |
|
603 |
// CMmsBaseOperation::DoRunL |
|
604 |
// |
|
605 |
// --------------------------------------------------------- |
|
606 |
// |
|
607 |
void CMmsBaseOperation::DoRunL() |
|
608 |
{ |
|
609 |
||
610 |
// This routine takes the state machine through the states |
|
611 |
// until an error is encountered or the cycle completes. |
|
612 |
||
613 |
if ( iState != EMmsOperationFinalizing ) |
|
614 |
{ |
|
615 |
SelectNextState(); |
|
616 |
// If appropriate, ChangeState makes us active again |
|
617 |
ChangeStateL(); |
|
618 |
} |
|
619 |
else |
|
620 |
{ |
|
621 |
iState = EMmsOperationIdle; |
|
622 |
iStatus = iError; |
|
623 |
// If we return from DoRunL without becoming active again, |
|
624 |
// RunL completes. |
|
625 |
} |
|
626 |
} |
|
627 |
||
628 |
// --------------------------------------------------------- |
|
629 |
// CMmsBaseOperation::DoComplete |
|
630 |
// |
|
631 |
// --------------------------------------------------------- |
|
632 |
// |
|
633 |
void CMmsBaseOperation::DoComplete( TInt& aError ) |
|
634 |
{ |
|
635 |
||
636 |
#ifndef _NO_MMSS_LOGGING_ |
|
637 |
TMmsLogger::Log( _L("BaseOperation DoComplete")); |
|
638 |
#endif |
|
639 |
// We should get here if we are cancelled, or if |
|
640 |
// the cycle has completed (with or without error) |
|
641 |
||
642 |
// Only final cleanup can be done here, nothing asychronous is allowed |
|
643 |
||
644 |
UnSetSendMask( *iFailed, aError ); |
|
645 |
||
646 |
} |
|
647 |
||
648 |
// --------------------------------------------------------- |
|
649 |
// CMmsBaseOperation::DoCancel |
|
650 |
// |
|
651 |
// --------------------------------------------------------- |
|
652 |
// |
|
653 |
void CMmsBaseOperation::DoCancel() |
|
654 |
{ |
|
655 |
#ifndef _NO_MMSS_LOGGING_ |
|
656 |
TMmsLogger::Log( _L("BaseOperation DoCancel")); |
|
657 |
#endif |
|
658 |
// cancel anything that is still active |
|
659 |
||
660 |
if ( iPhone ) |
|
661 |
{ |
|
662 |
iPhone->Cancel(); |
|
663 |
} |
|
664 |
if ( iDecoder ) |
|
665 |
{ |
|
666 |
iDecoder->Cancel(); |
|
667 |
} |
|
668 |
if ( iEncoder ) |
|
669 |
{ |
|
670 |
iEncoder->Cancel(); |
|
671 |
} |
|
672 |
if ( iConnectionInitiator ) |
|
673 |
{ |
|
674 |
iConnectionInitiator->Cancel(); |
|
675 |
} |
|
676 |
if ( iMmsSession ) |
|
677 |
{ |
|
678 |
iMmsSession->Cancel(); |
|
679 |
} |
|
680 |
if ( iHaveTimer ) |
|
681 |
{ |
|
682 |
iTimer.Cancel(); |
|
683 |
iTimer.Close(); |
|
684 |
iHaveTimer = EFalse; |
|
685 |
} |
|
686 |
||
687 |
CMsgActive::DoCancel(); |
|
688 |
if ( iError == KErrNone ) |
|
689 |
{ |
|
690 |
iError = KErrCancel; |
|
691 |
} |
|
692 |
||
693 |
} |
|
694 |
||
695 |
// --------------------------------------------------------- |
|
696 |
// CMmsBaseOperation::SelectNextState |
|
697 |
// |
|
698 |
// --------------------------------------------------------- |
|
699 |
// |
|
700 |
void CMmsBaseOperation::SelectNextState() |
|
701 |
{ |
|
702 |
||
703 |
// If appropriate, the functions called within the switch statement |
|
704 |
// will make us active again. If all is done, the asynchronous request |
|
705 |
// will complete |
|
706 |
||
707 |
// iCritical state determines the state where the operation must be |
|
708 |
// continued if progress is interrupted by an error caused by backup/restore. |
|
709 |
// The critical state changes when enough information has been saved so |
|
710 |
// that backtracking is no longer needed. The critical state is always a |
|
711 |
// stat where information is read from disk or stored to disk, because |
|
712 |
// disk operations may fail because of backup/restore. |
|
713 |
// Continuation is usually possible only after backup, not after restore, |
|
714 |
// but because available events do not specify which operation is in progress, |
|
715 |
// every situation must be handled as if it would be possible to continue |
|
716 |
// as soon as disk files can be accessed again. |
|
717 |
||
718 |
switch ( iState ) |
|
719 |
{ |
|
720 |
case EMmsOperationIdle: |
|
721 |
iState = EMmsOperationCheckingRoaming; |
|
722 |
break; |
|
723 |
case EMmsOperationCheckingRoaming: |
|
724 |
// check what we got from the roaming query and adjust any |
|
725 |
// roaming state dependent modes needed by the operation |
|
726 |
GetRoamingState(); |
|
727 |
iState = EMmsOperationEncodingPDU; |
|
728 |
break; |
|
729 |
case EMmsOperationEncodingPDU: |
|
730 |
if ( iConnected ) |
|
731 |
{ |
|
732 |
iState = EMmsOperationSubmittingTransaction; |
|
733 |
} |
|
734 |
else |
|
735 |
{ |
|
736 |
iState = EMmsOperationConnectingToIAP; |
|
737 |
} |
|
738 |
iCriticalState = EMmsOperationCreatingEntry; |
|
739 |
break; |
|
740 |
case EMmsOperationConnectingToIAP: |
|
741 |
CheckConnectionState(); |
|
742 |
if ( iConnected ) |
|
743 |
{ |
|
744 |
iState = EMmsOperationInitializingSession; |
|
745 |
} |
|
746 |
else |
|
747 |
{ |
|
748 |
// if could not connect, give up |
|
749 |
iState = EMmsOperationUpdatingEntryStatus; |
|
750 |
} |
|
751 |
break; |
|
752 |
case EMmsOperationInitializingSession: |
|
753 |
iState = EMmsOperationSubmittingTransaction; |
|
754 |
break; |
|
755 |
case EMmsOperationSubmittingTransaction: |
|
756 |
iState = EMmsOperationCreatingEntry; |
|
757 |
iCriticalState = EMmsOperationCreatingEntry; |
|
758 |
break; |
|
759 |
case EMmsOperationCreatingEntry: |
|
760 |
iState = EMmsOperationDecodingResponse; |
|
761 |
break; |
|
762 |
case EMmsOperationDecodingResponse: |
|
763 |
iState = EMmsOperationStoringResponseData; |
|
764 |
iCriticalState = EMmsOperationStoringResponseData; |
|
765 |
break; |
|
766 |
case EMmsOperationStoringResponseData: |
|
767 |
iState = EMmsOperationEncodingAck; |
|
768 |
iCriticalState = EMmsOperationUpdatingEntryStatus; |
|
769 |
break; |
|
770 |
case EMmsOperationEncodingAck: |
|
771 |
iState = EMmsOperationSendingAck; |
|
772 |
break; |
|
773 |
case EMmsOperationSendingAck: |
|
774 |
iState = EMmsOperationUpdatingEntryStatus; |
|
775 |
break; |
|
776 |
case EMmsOperationUpdatingEntryStatus: |
|
777 |
iState = EMmsOperationLogging; |
|
778 |
iCriticalState = EMmsOperationMovingEntry; |
|
779 |
break; |
|
780 |
case EMmsOperationLogging: |
|
781 |
iState = EMmsOperationMovingEntry; |
|
782 |
break; |
|
783 |
case EMmsOperationMovingEntry: |
|
784 |
iCurrentMessageNo--; |
|
785 |
if ( iCurrentMessageNo > 0 ) |
|
786 |
{ |
|
787 |
iState = EMmsOperationEncodingPDU; |
|
788 |
iCriticalState = EMmsOperationEncodingPDU; |
|
789 |
} |
|
790 |
else |
|
791 |
{ |
|
792 |
iState = EMmsOperationFinalizing; |
|
793 |
iCriticalState = EMmsOperationFinalizing; |
|
794 |
} |
|
795 |
break; |
|
796 |
case EMmsOperationFinalizing: |
|
797 |
// no more states |
|
798 |
break; |
|
799 |
case EMmsOperationWaitingForBackupEnd: |
|
800 |
// return to failure point |
|
801 |
iState = iCriticalState; |
|
802 |
break; |
|
803 |
default: |
|
804 |
// If we are in an illegal state, we don't change it. |
|
805 |
// The only way we can end here is if someone overwrites |
|
806 |
// our stack, and in that case things are so terribly wrong |
|
807 |
// that there is nothing to be done |
|
808 |
// Change state will terminate the loop. |
|
809 |
#ifndef _NO_MMSS_LOGGING_ |
|
810 |
TMmsLogger::Log( _L("BaseOperation in illegal state %d "), iState ); |
|
811 |
#endif |
|
812 |
break; |
|
813 |
} |
|
814 |
} |
|
815 |
||
816 |
// --------------------------------------------------------- |
|
817 |
// CMmsBaseOperation::ChangeStateL |
|
818 |
// |
|
819 |
// --------------------------------------------------------- |
|
820 |
// |
|
821 |
void CMmsBaseOperation::ChangeStateL() |
|
822 |
{ |
|
823 |
switch ( iState ) |
|
824 |
{ |
|
825 |
case EMmsOperationCheckingRoaming: |
|
826 |
RoamingCheck(); |
|
827 |
break; |
|
828 |
case EMmsOperationEncodingPDU: |
|
829 |
EncodePDUL(); |
|
830 |
break; |
|
831 |
case EMmsOperationConnectingToIAP: |
|
832 |
ConnectToIAPL(); |
|
833 |
break; |
|
834 |
case EMmsOperationInitializingSession: |
|
835 |
InitializeSessionL(); |
|
836 |
break; |
|
837 |
case EMmsOperationSubmittingTransaction: |
|
838 |
SubmitTransactionL(); |
|
839 |
break; |
|
840 |
case EMmsOperationCreatingEntry: |
|
841 |
CreateEntryL(); |
|
842 |
break; |
|
843 |
case EMmsOperationDecodingResponse: |
|
844 |
DecodeResponseL(); |
|
845 |
break; |
|
846 |
case EMmsOperationStoringResponseData: |
|
847 |
StoreResponseL(); |
|
848 |
break; |
|
849 |
case EMmsOperationEncodingAck: |
|
850 |
EncodeAckL(); |
|
851 |
break; |
|
852 |
case EMmsOperationSendingAck: |
|
853 |
SendAckL(); |
|
854 |
break; |
|
855 |
case EMmsOperationUpdatingEntryStatus: |
|
856 |
UpdateEntryStatusL(); |
|
857 |
break; |
|
858 |
case EMmsOperationLogging: |
|
859 |
LogL(); |
|
860 |
break; |
|
861 |
case EMmsOperationMovingEntry: |
|
862 |
MoveEntryL(); |
|
863 |
break; |
|
864 |
case EMmsOperationFinalizing: |
|
865 |
FinalizeL(); |
|
866 |
break; |
|
867 |
case EMmsOperationWaitingForBackupEnd: |
|
868 |
WaitForBackupEnd(); |
|
869 |
break; |
|
870 |
case EMmsOperationIdle: |
|
871 |
// We should not become idle again. This is startup state |
|
872 |
break; |
|
873 |
default: |
|
874 |
// Totally messed up. Someone overwrote the stack. |
|
875 |
// If we return without becoming active again, the |
|
876 |
// cycle completes. |
|
877 |
#ifndef _NO_MMSS_LOGGING_ |
|
878 |
TMmsLogger::Log( _L("BaseOperation in illegal state %d "), iState ); |
|
879 |
#endif |
|
880 |
iError = KErrUnknown; |
|
881 |
iStatus = iError; |
|
882 |
break; |
|
883 |
} |
|
884 |
} |
|
885 |
||
886 |
||
887 |
// --------------------------------------------------------- |
|
888 |
// CMmsBaseOperation::FallThrough |
|
889 |
// |
|
890 |
// --------------------------------------------------------- |
|
891 |
// |
|
892 |
void CMmsBaseOperation::FallThrough() |
|
893 |
{ |
|
894 |
TRequestStatus* status = &iStatus; |
|
895 |
iStatus = KRequestPending; |
|
896 |
SetActive(); |
|
897 |
User::RequestComplete( status, iError ); |
|
898 |
} |
|
899 |
||
900 |
||
901 |
// --------------------------------------------------------- |
|
902 |
// CMmsBaseOperation::InitializeL |
|
903 |
// |
|
904 |
// --------------------------------------------------------- |
|
905 |
// |
|
906 |
void CMmsBaseOperation::InitializeL( |
|
907 |
CMsvEntrySelection& aSelection, |
|
908 |
CMsvServerEntry& aServerEntry, |
|
909 |
TMsvId aService ) |
|
910 |
{ |
|
911 |
||
912 |
#ifndef _NO_MMSS_LOGGING_ |
|
913 |
TMmsLogger::Log( _L("BaseOperation Initialize")); |
|
914 |
#endif |
|
915 |
||
916 |
iSelection = &aSelection; |
|
917 |
iServerEntry = &aServerEntry; |
|
918 |
iService = aService; |
|
919 |
||
920 |
iDoNotWaitForBackupEnd = EFalse; |
|
921 |
iCriticalState = EMmsOperationEncodingPDU; |
|
922 |
||
923 |
delete iEntryWrapper; |
|
924 |
iEntryWrapper = NULL; |
|
925 |
iEntryWrapper = CMmsServerEntry::NewL( |
|
926 |
iFs, |
|
927 |
aServerEntry, |
|
928 |
iService ); |
|
929 |
||
930 |
iFailed->Reset(); |
|
931 |
iSuccessful->Reset(); |
|
932 |
iResponse->Reset(); |
|
933 |
||
934 |
iCurrentMessageNo = iSelection->Count(); |
|
935 |
iError = KErrNone; |
|
936 |
||
937 |
// clean these in case the class is reused |
|
938 |
delete iUri; |
|
939 |
iUri = NULL; |
|
940 |
delete iIAPArray; |
|
941 |
iIAPArray = NULL; |
|
942 |
iConnectionIndex = 0; |
|
943 |
iRegistrationStatus = 0; // hope for the best |
|
944 |
||
945 |
// Initialize everything into the failed list. |
|
946 |
// Very pessimistic indeed. |
|
947 |
||
948 |
if ( iCurrentMessageNo > 0 ) |
|
949 |
{ |
|
950 |
iFailed->AppendL( iSelection->Back( 0 ), iCurrentMessageNo ); |
|
951 |
iSuccessful->SetReserveL( iCurrentMessageNo ); |
|
952 |
} |
|
953 |
||
954 |
SetSendMask( *iFailed ); |
|
955 |
||
956 |
// |
|
957 |
// NOTE: receive operation must override this setting to 'iLocalModeIn' |
|
958 |
// |
|
959 |
if ( iMmsSettings->LocalMode() ) |
|
960 |
{ |
|
961 |
iFs.SetSessionPath( iMmsSettings->LocalModeOut() ); |
|
962 |
} |
|
963 |
} |
|
964 |
||
965 |
// --------------------------------------------------------- |
|
966 |
// CMmsBaseOperation::EncodePDUL |
|
967 |
// |
|
968 |
// --------------------------------------------------------- |
|
969 |
// |
|
970 |
void CMmsBaseOperation::EncodePDUL() |
|
971 |
{ |
|
972 |
// This state is quite variable. |
|
973 |
// Each operation will need to know what to encode, |
|
974 |
// no common implementation available. |
|
975 |
#ifndef _NO_MMSS_LOGGING_ |
|
976 |
TMmsLogger::Log( _L("BaseOperation EncodePDUL - FallThrough")); |
|
977 |
#endif |
|
978 |
||
979 |
// this always starts a new round. iError should be cleared. |
|
980 |
FallThrough(); |
|
981 |
||
982 |
} |
|
983 |
||
984 |
// --------------------------------------------------------- |
|
985 |
// CMmsBaseOperation::ConnectToIAPL |
|
986 |
// |
|
987 |
// --------------------------------------------------------- |
|
988 |
// |
|
989 |
void CMmsBaseOperation::ConnectToIAPL() |
|
990 |
{ |
|
991 |
||
992 |
#ifndef _NO_MMSS_LOGGING_ |
|
993 |
TMmsLogger::Log( _L("BaseOperation Connect to IAP")); |
|
994 |
#endif |
|
995 |
||
996 |
if ( iError != KErrNone ) |
|
997 |
{ |
|
998 |
FallThrough(); |
|
999 |
return; |
|
1000 |
} |
|
1001 |
||
1002 |
// This operation should be identical for all derived classes. |
|
1003 |
TRequestStatus* status = &iStatus; |
|
1004 |
||
1005 |
// clean URI in case the class is used more than once |
|
1006 |
// Just at the last minute we check if network operations are allowed |
|
1007 |
if ( !NetworkOperationsAllowed() ) |
|
1008 |
{ |
|
1009 |
#ifdef __WINS__ |
|
1010 |
iStatus = KRequestPending; |
|
1011 |
SetActive(); |
|
1012 |
User::RequestComplete( status, KMmsErrorOfflineMode ); |
|
1013 |
return; |
|
1014 |
#else |
|
1015 |
// if offline is on and global mode is on in HW, normal offline behaviour. |
|
1016 |
// if offline is on and local mode is on in HW, continue. |
|
1017 |
// The purpose of this is to allow fetching precreated messages even if |
|
1018 |
// network operations were not allowed during the first boot. |
|
1019 |
if ( !iMmsSettings->LocalMode() ) |
|
1020 |
{ |
|
1021 |
iStatus = KRequestPending; |
|
1022 |
SetActive(); |
|
1023 |
User::RequestComplete( status, KMmsErrorOfflineMode ); |
|
1024 |
return; |
|
1025 |
} |
|
1026 |
#endif |
|
1027 |
} |
|
1028 |
||
1029 |
// Use WAP AP from Comms database table. |
|
1030 |
// This contains the home page URI, and is linked to the actual IAP. |
|
1031 |
TInt count = iMmsSettings->AccessPointCount(); |
|
1032 |
if( !iMmsSettings->LocalMode() ) |
|
1033 |
{ |
|
1034 |
if ( count < 1 ) |
|
1035 |
{ |
|
1036 |
User::Leave( KMmsErrorNoWAPAccessPoint ); |
|
1037 |
} |
|
1038 |
iIAPArray = new (ELeave) CArrayFixFlat<TUint32>( count ); |
|
1039 |
for( TInt index = 0; index < count; index++ ) |
|
1040 |
{ |
|
1041 |
iIAPArray->AppendL( iMmsSettings->AccessPoint( index ) ); |
|
1042 |
} |
|
1043 |
||
1044 |
iConnectionInitiator = CMmsConnectionInitiator::NewL(); |
|
1045 |
// CMmsConnInit sets our status to "KRequestPending" |
|
1046 |
iConnectionInitiator->ConnectL( |
|
1047 |
iConnection, |
|
1048 |
*iIAPArray, |
|
1049 |
iStatus ); |
|
1050 |
||
1051 |
SetActive(); |
|
1052 |
} |
|
1053 |
else |
|
1054 |
{ |
|
1055 |
// local mode has no real wap access point |
|
1056 |
iStatus = KRequestPending; |
|
1057 |
SetActive(); |
|
1058 |
// we return status 1 (as if we got connection to most |
|
1059 |
// preferred access point) |
|
1060 |
User::RequestComplete( status, 1 ); |
|
1061 |
} |
|
1062 |
} |
|
1063 |
||
1064 |
// --------------------------------------------------------- |
|
1065 |
// CMmsBaseOperation::InitializeSessionL |
|
1066 |
// |
|
1067 |
// --------------------------------------------------------- |
|
1068 |
// |
|
1069 |
void CMmsBaseOperation::InitializeSessionL() |
|
1070 |
{ |
|
1071 |
||
1072 |
#ifndef _NO_MMSS_LOGGING_ |
|
1073 |
TMmsLogger::Log( _L("BaseOperation InitializeSession")); |
|
1074 |
#endif |
|
1075 |
||
1076 |
if ( iError != KErrNone || iMmsSettings->LocalMode() ) |
|
1077 |
{ |
|
1078 |
FallThrough(); |
|
1079 |
return; |
|
1080 |
} |
|
1081 |
||
1082 |
// When we are supporting only HTTP, there is no separate session connection stage. |
|
1083 |
// Session initialization only sets necessary headers. (User agent and UAProf) |
|
1084 |
delete iUri; |
|
1085 |
iUri = NULL; |
|
1086 |
TUint32 iap = 0; |
|
1087 |
TBool proxyUsed = EFalse; |
|
1088 |
HBufC8* proxyAddress = NULL; |
|
1089 |
HBufC* uri = NULL; |
|
1090 |
||
1091 |
// We are not supposed to be here, if we haven't succeeded |
|
1092 |
// in making connection to one of specified access points |
|
1093 |
CMmsConnectionInitiator::GetParametersL( |
|
1094 |
iIAPArray->At( iConnectionIndex - 1 ), |
|
1095 |
iap, |
|
1096 |
uri, |
|
1097 |
proxyUsed, |
|
1098 |
proxyAddress |
|
1099 |
); |
|
1100 |
||
1101 |
// We must remember the uri, it will be used later. |
|
1102 |
iUri = uri; |
|
1103 |
uri = NULL; |
|
1104 |
||
1105 |
CleanupStack::PushL( proxyAddress ); |
|
1106 |
||
1107 |
iMmsSession->OpenL( |
|
1108 |
( !proxyAddress )?TPtrC8():proxyAddress->Des(), |
|
1109 |
proxyUsed, |
|
1110 |
iMmsSettings->MaximumReceiveSize(), |
|
1111 |
iMmsSettings->MaximumSendSize(), |
|
1112 |
iStatus ); |
|
1113 |
||
1114 |
CleanupStack::PopAndDestroy( proxyAddress ); |
|
1115 |
SetActive(); |
|
1116 |
||
1117 |
} |
|
1118 |
||
1119 |
// --------------------------------------------------------- |
|
1120 |
// CMmsBaseOperation::SubmitTransactionL |
|
1121 |
// |
|
1122 |
// --------------------------------------------------------- |
|
1123 |
// |
|
1124 |
void CMmsBaseOperation::SubmitTransactionL() |
|
1125 |
{ |
|
1126 |
// Standard transaction is sending a PDU to MMSC in global mode |
|
1127 |
// Local mode will need an override if supported (send and fetch only) |
|
1128 |
// Fetch will need an override, because it uses HTTP GET |
|
1129 |
// and not HTTP POST like other operations. |
|
1130 |
||
1131 |
#ifndef _NO_MMSS_LOGGING_ |
|
1132 |
TMmsLogger::Log( _L("BaseOperation SubmitTransaction")); |
|
1133 |
#endif |
|
1134 |
||
1135 |
if ( !iConnected ) |
|
1136 |
{ |
|
1137 |
if ( iError == KErrNone ) |
|
1138 |
{ |
|
1139 |
iError = KErrCouldNotConnect; |
|
1140 |
} |
|
1141 |
} |
|
1142 |
||
1143 |
// This check is needed only when running tests in local mode |
|
1144 |
// if length of URI is 0, Symbian code will panic |
|
1145 |
if ( !iUri ) |
|
1146 |
{ |
|
1147 |
iError = KMmsErrorNoURI1; |
|
1148 |
} |
|
1149 |
else if ( iUri->Des().Length() == 0 ) |
|
1150 |
{ |
|
1151 |
iError = KMmsErrorNoURI1; |
|
1152 |
} |
|
1153 |
else |
|
1154 |
{ |
|
1155 |
// keep LINT happy |
|
1156 |
} |
|
1157 |
||
1158 |
if ( iError != KErrNone ) |
|
1159 |
{ |
|
1160 |
FallThrough(); |
|
1161 |
return; |
|
1162 |
} |
|
1163 |
||
1164 |
// Set entry |
|
1165 |
TInt error = iServerEntry->SetEntry( iSelection->At( iCurrentMessageNo - 1 ) ); |
|
1166 |
||
1167 |
// |
|
1168 |
// Last minute check to make sure entry has not been deleted or suspended |
|
1169 |
// |
|
1170 |
if( error == KErrNone ) |
|
1171 |
{ |
|
1172 |
TMsvEntry entry = iServerEntry->Entry(); |
|
1173 |
if( entry.SendingState() == KMsvSendStateSuspended || entry.Deleted() ) |
|
1174 |
{ |
|
1175 |
// The message has disappeared and we cannot do anything with it. |
|
1176 |
#ifndef _NO_MMSS_LOGGING_ |
|
1177 |
if ( entry.SendingState() == KMsvSendStateSuspended ) |
|
1178 |
{ |
|
1179 |
TMmsLogger::Log( _L("- message in suspended") ); |
|
1180 |
} |
|
1181 |
if ( entry.Deleted() ) |
|
1182 |
{ |
|
1183 |
TMmsLogger::Log( _L("- message deleted") ); |
|
1184 |
} |
|
1185 |
TMmsLogger::Log( _L("-> finished with this entry") ); |
|
1186 |
#endif |
|
1187 |
// delete entry from the list |
|
1188 |
iFailed->Delete( iCurrentMessageNo - 1 ); |
|
1189 |
||
1190 |
// |
|
1191 |
// Set error and fall through |
|
1192 |
// |
|
1193 |
iError = KErrNotFound; |
|
1194 |
FallThrough(); |
|
1195 |
return; |
|
1196 |
} |
|
1197 |
} |
|
1198 |
||
1199 |
// |
|
1200 |
// Update the sending state of our trigger |
|
1201 |
// |
|
1202 |
if( error == KErrNone ) |
|
1203 |
{ |
|
1204 |
TMsvEntry entry = iServerEntry->Entry(); |
|
1205 |
entry.SetConnected( ETrue ); |
|
1206 |
entry.SetSendingState( KMsvSendStateSending ); |
|
1207 |
// if this fails, our sending state is wrong, but so what... |
|
1208 |
iServerEntry->ChangeEntry( entry ); |
|
1209 |
} |
|
1210 |
iServerEntry->SetEntry( KMsvNullIndexEntryId ); |
|
1211 |
||
1212 |
// |
|
1213 |
// Send |
|
1214 |
// |
|
1215 |
iMmsSession->SendMessageL( iUri->Des(), |
|
1216 |
*iEncodeBuffer, |
|
1217 |
*iEncoder, |
|
1218 |
*iDecoder, |
|
1219 |
iStatus ); |
|
1220 |
SetActive(); |
|
1221 |
} |
|
1222 |
||
1223 |
// --------------------------------------------------------- |
|
1224 |
// CMmsBaseOperation::CreateEntryL |
|
1225 |
// |
|
1226 |
// --------------------------------------------------------- |
|
1227 |
// |
|
1228 |
void CMmsBaseOperation::CreateEntryL() |
|
1229 |
{ |
|
1230 |
#ifndef _NO_MMSS_LOGGING_ |
|
1231 |
TMmsLogger::Log( _L("BaseOperation CreateEntry - FallThrough")); |
|
1232 |
#endif |
|
1233 |
// When sending messages or command PDUs (forward) there is no entry to create. |
|
1234 |
// These fall through, only receive message and view MMBox have incoming data. |
|
1235 |
FallThrough(); |
|
1236 |
} |
|
1237 |
||
1238 |
// --------------------------------------------------------- |
|
1239 |
// CMmsBaseOperation::DecodeResponseL |
|
1240 |
// |
|
1241 |
// --------------------------------------------------------- |
|
1242 |
// |
|
1243 |
void CMmsBaseOperation::DecodeResponseL() |
|
1244 |
{ |
|
1245 |
// Default action is to decode response into headers. |
|
1246 |
// The result will be analyzed in StoreResponse function |
|
1247 |
// There some data may be updated to original entry or just |
|
1248 |
// error code will be set. |
|
1249 |
||
1250 |
#ifndef _NO_MMSS_LOGGING_ |
|
1251 |
TMmsLogger::Log( _L("BaseOperation DecodeResponse")); |
|
1252 |
#endif |
|
1253 |
||
1254 |
iResponse->Reset(); |
|
1255 |
if ( !( iError != KErrNone || iEncodeBuffer->Size() == 0 ) ) |
|
1256 |
{ |
|
1257 |
// we have got a response - try to decode it |
|
1258 |
TRAP( iError, |
|
1259 |
{ |
|
1260 |
// We don't need an actual entry here. |
|
1261 |
iEntryWrapper->SetCurrentEntry( KMsvNullIndexEntryId ); |
|
1262 |
iDecoder->DecodeHeadersL( |
|
1263 |
*iEntryWrapper, |
|
1264 |
*iResponse, |
|
1265 |
*iEncodeBuffer ); |
|
1266 |
}); |
|
1267 |
// Response status is mandatory in most responses, but not in quite all. |
|
1268 |
// Some operations may need an override. |
|
1269 |
if ( iResponse->ResponseStatus() != 0 ) |
|
1270 |
{ |
|
1271 |
MapResponseStatus( *iResponse ); |
|
1272 |
} |
|
1273 |
} |
|
1274 |
FallThrough(); |
|
1275 |
} |
|
1276 |
||
1277 |
// --------------------------------------------------------- |
|
1278 |
// CMmsBaseOperation::StoreResponseL |
|
1279 |
// |
|
1280 |
// --------------------------------------------------------- |
|
1281 |
// |
|
1282 |
void CMmsBaseOperation::StoreResponseL() |
|
1283 |
{ |
|
1284 |
#ifndef _NO_MMSS_LOGGING_ |
|
1285 |
TMmsLogger::Log( _L("BaseOperation StoreResponse - FallThrough")); |
|
1286 |
#endif |
|
1287 |
// Here the response from MMSC is stored. |
|
1288 |
// When receiving message, the results have already been stored while decoding. |
|
1289 |
// Here the message would become visible. |
|
1290 |
// However, if there is an error, the error text is saved here for all messages. |
|
1291 |
// Other information may also be saved to the trigger entry (for example message id). |
|
1292 |
// When a message is forwarded, the relevant information is stored in the notification. |
|
1293 |
||
1294 |
FallThrough(); |
|
1295 |
} |
|
1296 |
||
1297 |
// --------------------------------------------------------- |
|
1298 |
// CMmsBaseOperation::EncodeAckL |
|
1299 |
// |
|
1300 |
// --------------------------------------------------------- |
|
1301 |
// |
|
1302 |
void CMmsBaseOperation::EncodeAckL() |
|
1303 |
{ |
|
1304 |
#ifndef _NO_MMSS_LOGGING_ |
|
1305 |
TMmsLogger::Log( _L("BaseOperation EncodeAck - FallThrough")); |
|
1306 |
#endif |
|
1307 |
// Only receive message has ack, others fall through |
|
1308 |
FallThrough(); |
|
1309 |
} |
|
1310 |
||
1311 |
// --------------------------------------------------------- |
|
1312 |
// CMmsBaseOperation::SendAckL |
|
1313 |
// |
|
1314 |
// --------------------------------------------------------- |
|
1315 |
// |
|
1316 |
void CMmsBaseOperation::SendAckL() |
|
1317 |
{ |
|
1318 |
#ifndef _NO_MMSS_LOGGING_ |
|
1319 |
TMmsLogger::Log( _L("BaseOperation SendAck - FallThrough")); |
|
1320 |
#endif |
|
1321 |
// Only receive message sends ack, others fall through |
|
1322 |
FallThrough(); |
|
1323 |
} |
|
1324 |
||
1325 |
// --------------------------------------------------------- |
|
1326 |
// CMmsBaseOperation::UpdateEntryStatusL |
|
1327 |
// |
|
1328 |
// --------------------------------------------------------- |
|
1329 |
// |
|
1330 |
void CMmsBaseOperation::UpdateEntryStatusL() |
|
1331 |
{ |
|
1332 |
#ifndef _NO_MMSS_LOGGING_ |
|
1333 |
TMmsLogger::Log( _L("BaseOperation UpdateEntryStatus - FallThrough")); |
|
1334 |
#endif |
|
1335 |
// This will update the status of the trigger as successful |
|
1336 |
// or unsuccessful |
|
1337 |
FallThrough(); |
|
1338 |
} |
|
1339 |
||
1340 |
// --------------------------------------------------------- |
|
1341 |
// CMmsBaseOperation::MoveEntryL |
|
1342 |
// |
|
1343 |
// --------------------------------------------------------- |
|
1344 |
// |
|
1345 |
void CMmsBaseOperation::MoveEntryL() |
|
1346 |
{ |
|
1347 |
#ifndef _NO_MMSS_LOGGING_ |
|
1348 |
TMmsLogger::Log( _L("BaseOperation MoveEntry - FallThrough")); |
|
1349 |
#endif |
|
1350 |
// This will need an override |
|
1351 |
// Send message moves entry to sent folder |
|
1352 |
// Receive message checks the fate of a notification. |
|
1353 |
FallThrough(); |
|
1354 |
} |
|
1355 |
||
1356 |
// --------------------------------------------------------- |
|
1357 |
// CMmsBaseOperation::LogL |
|
1358 |
// |
|
1359 |
// --------------------------------------------------------- |
|
1360 |
// |
|
1361 |
void CMmsBaseOperation::LogL() |
|
1362 |
{ |
|
1363 |
#ifndef _NO_MMSS_LOGGING_ |
|
1364 |
TMmsLogger::Log( _L("BaseOperation Log - FallThrough")); |
|
1365 |
#endif |
|
1366 |
// This will need an override - all operations do not log |
|
1367 |
FallThrough(); |
|
1368 |
} |
|
1369 |
||
1370 |
// --------------------------------------------------------- |
|
1371 |
// CMmsBaseOperation::FinalizeL |
|
1372 |
// |
|
1373 |
// --------------------------------------------------------- |
|
1374 |
// |
|
1375 |
void CMmsBaseOperation::FinalizeL() |
|
1376 |
{ |
|
1377 |
#ifndef _NO_MMSS_LOGGING_ |
|
1378 |
TMmsLogger::Log( _L("BaseOperation Finalize")); |
|
1379 |
#endif |
|
1380 |
FallThrough(); |
|
1381 |
} |
|
1382 |
||
1383 |
// --------------------------------------------------------- |
|
1384 |
// CMmsBaseOperation::WaitForBackupEnd |
|
1385 |
// |
|
1386 |
// --------------------------------------------------------- |
|
1387 |
// |
|
1388 |
void CMmsBaseOperation::WaitForBackupEnd() |
|
1389 |
{ |
|
1390 |
LOG( _L("BaseOperation WaitForBackupEnd")); |
|
1391 |
TInt error = KErrNone; |
|
1392 |
TInt value = 0; |
|
1393 |
error = RProperty::Get( KUidSystemCategory, conn::KUidBackupRestoreKey, value ); |
|
1394 |
||
1395 |
if( value != conn::ENoBackup && error == KErrNone ) |
|
1396 |
{ |
|
1397 |
// We are not going to wait forever: using a timer |
|
1398 |
LOG( _L(" - backup running ") ); |
|
1399 |
error = iTimer.CreateLocal(); |
|
1400 |
if( error == KErrNone ) |
|
1401 |
{ |
|
1402 |
iHaveTimer = ETrue; |
|
1403 |
// The timer cannot be active as it was just created. |
|
1404 |
// It makes no sense to check. |
|
1405 |
// And besides it is impossible to check if RTimer is active. |
|
1406 |
iTimer.After( iStatus, KMmsBackupWait ); |
|
1407 |
SetActive(); |
|
1408 |
return; |
|
1409 |
} |
|
1410 |
} |
|
1411 |
#ifndef _NO_MMSS_LOGGING_ |
|
1412 |
else |
|
1413 |
{ |
|
1414 |
LOG( _L(" - backup not running ") ); |
|
1415 |
} |
|
1416 |
#endif |
|
1417 |
||
1418 |
// No backup - media gone for other reason |
|
1419 |
iDoNotWaitForBackupEnd = ETrue; |
|
1420 |
FallThrough(); |
|
1421 |
} |
|
1422 |
||
1423 |
// --------------------------------------------------------- |
|
1424 |
// CMmsBaseOperation::SetSendMask |
|
1425 |
// |
|
1426 |
// --------------------------------------------------------- |
|
1427 |
// |
|
1428 |
void CMmsBaseOperation::SetSendMask( const CMsvEntrySelection& aSelection ) |
|
1429 |
{ |
|
1430 |
TInt index = aSelection.Count(); |
|
1431 |
TInt error = KErrNone; |
|
1432 |
while ( index-- ) |
|
1433 |
{ |
|
1434 |
error = ( iServerEntry->SetEntry( aSelection[index] ) ); |
|
1435 |
if ( error == KErrNone ) |
|
1436 |
{ |
|
1437 |
TMsvEntry tEntry = iServerEntry->Entry(); |
|
1438 |
// State is set to "sending" as late as possible to allow cancelling |
|
1439 |
// until the last possible moment |
|
1440 |
// Error in an entry is set to KErrNone to allow the error |
|
1441 |
// to be updated in case we fail halfway through a selection, and want to |
|
1442 |
// set error to unhandled entries. |
|
1443 |
tEntry.iError = KErrNone; |
|
1444 |
iServerEntry->ChangeEntry( tEntry ); |
|
1445 |
} |
|
1446 |
} |
|
1447 |
// Release the entry |
|
1448 |
iServerEntry->SetEntry( KMsvNullIndexEntryId ); |
|
1449 |
||
1450 |
} |
|
1451 |
||
1452 |
// --------------------------------------------------------- |
|
1453 |
// CMmsBaseOperation::UnSetSendMask |
|
1454 |
// |
|
1455 |
// --------------------------------------------------------- |
|
1456 |
// |
|
1457 |
void CMmsBaseOperation::UnSetSendMask( CMsvEntrySelection& aSelection, TInt aError ) |
|
1458 |
{ |
|
1459 |
TInt index = aSelection.Count(); |
|
1460 |
||
1461 |
// If we have a connection error because switching to offline mode |
|
1462 |
// has interrupted our sending operation, we suspend our failed messges |
|
1463 |
if ( !NetworkOperationsAllowed() ) |
|
1464 |
{ |
|
1465 |
aError = KMmsErrorOfflineMode; |
|
1466 |
} |
|
1467 |
||
1468 |
while ( index-- ) |
|
1469 |
{ |
|
1470 |
UnSetSendMask( aSelection[index], aError ); |
|
1471 |
// When the entry is in no list, it will not be touched by UpDateEntriesL |
|
1472 |
// function in CMmsServerMtm. |
|
1473 |
// When we switch back to "online" mode, these enries will automatically |
|
1474 |
// be rescheluded. |
|
1475 |
if ( aError == KMmsErrorOfflineMode ) |
|
1476 |
{ |
|
1477 |
aSelection.Delete( index ); |
|
1478 |
} |
|
1479 |
} |
|
1480 |
// Release the entry |
|
1481 |
iServerEntry->SetEntry( KMsvNullIndexEntryId ); |
|
1482 |
} |
|
1483 |
||
1484 |
// --------------------------------------------------------- |
|
1485 |
// CMmsBaseOperation::UnSetSendMask |
|
1486 |
// |
|
1487 |
// --------------------------------------------------------- |
|
1488 |
// |
|
1489 |
void CMmsBaseOperation::UnSetSendMask( const TMsvId aId, TInt aError ) |
|
1490 |
{ |
|
1491 |
if ( ( iServerEntry->SetEntry( aId ) ) != KErrNone ) |
|
1492 |
{ |
|
1493 |
return; // no can do |
|
1494 |
} |
|
1495 |
TInt error = KErrNone; |
|
1496 |
||
1497 |
TMsvEntry tEntry = iServerEntry->Entry(); |
|
1498 |
tEntry.SetConnected( EFalse ); |
|
1499 |
tEntry.SetFailed( EFalse ); // optimistic |
|
1500 |
if ( tEntry.iError == KErrNone ) |
|
1501 |
{ |
|
1502 |
tEntry.iError = aError; |
|
1503 |
} |
|
1504 |
||
1505 |
if ( aError == KMmsErrorOfflineMode ) |
|
1506 |
{ |
|
1507 |
// special case: we did not necessarily fail, but we are not allowed to send now |
|
1508 |
// Set entry to "suspended" state, but do not update recipient so that this does |
|
1509 |
// not count as a send or receive attempt |
|
1510 |
tEntry.iError = aError; |
|
1511 |
// value for KMmsOffLineStae defined in mmsservercommon.h |
|
1512 |
tEntry.SetSendingState( KMmsOffLineState ); |
|
1513 |
||
1514 |
// if the notification is in inbox or in mmbox folder, its operation flags have to be marked |
|
1515 |
// that the operation has finished due to offline mode. |
|
1516 |
// In addition if notification in mmbox folder has a duplicate, |
|
1517 |
// the duplicate has to be marked as well. |
|
1518 |
TMsvId mmboxFolder = iMmsSettings->MMBoxFolder(); |
|
1519 |
if ( tEntry.Parent() == mmboxFolder ) |
|
1520 |
{ |
|
1521 |
#ifndef _NO_MMSS_LOGGING_ |
|
1522 |
TMmsLogger::Log( _L(" - CMmsBaseOperation:: duplicates has to be searched") ); |
|
1523 |
#endif |
|
1524 |
TInt err = KErrNone; |
|
1525 |
TRAP ( err, MarkDuplicateL( EMmsNotificationOperationFailed, *iServerEntry ) ); |
|
1526 |
#ifndef _NO_MMSS_LOGGING_ |
|
1527 |
TMmsLogger::Log( _L("Trap failed: error %d "), err ); |
|
1528 |
#endif |
|
1529 |
} |
|
1530 |
// Mark original notification |
|
1531 |
if ( tEntry.Parent() == mmboxFolder || |
|
1532 |
tEntry.Parent() == KMsvGlobalInBoxIndexEntryIdValue ) |
|
1533 |
{ |
|
1534 |
MarkNotificationOperationFailed( tEntry ); |
|
1535 |
tEntry.SetReadOnly( ETrue ); |
|
1536 |
} |
|
1537 |
} |
|
1538 |
else |
|
1539 |
{ |
|
1540 |
// we must also update the recipient information |
|
1541 |
// in case it was not set already. |
|
1542 |
||
1543 |
// We trap all leaves. |
|
1544 |
// If we cannot update recipient because we are in very low memory situation, |
|
1545 |
// that cannot be helped. |
|
1546 |
// DoCancel and DoComplete cannot leave. |
|
1547 |
||
1548 |
CMmsScheduledEntry* mmsScheduledEntry = NULL; |
|
1549 |
TRAP( error, |
|
1550 |
{ |
|
1551 |
mmsScheduledEntry = CMmsScheduledEntry::NewL( tEntry ); |
|
1552 |
CleanupStack::PushL( mmsScheduledEntry ); |
|
1553 |
CMsvStore * store = NULL; |
|
1554 |
store = iServerEntry->EditStoreL(); |
|
1555 |
CleanupStack::PushL( store ); |
|
1556 |
mmsScheduledEntry->RestoreL( *store ); |
|
1557 |
// if status is still NotYetSent, recipient has not been updated yet |
|
1558 |
if ( mmsScheduledEntry->MmsRecipient().Status() == CMsvRecipient::ENotYetSent ) |
|
1559 |
{ |
|
1560 |
UpdateRecipient( tEntry.iError, *mmsScheduledEntry ); |
|
1561 |
} |
|
1562 |
mmsScheduledEntry->StoreL( *store ); |
|
1563 |
store->CommitL(); |
|
1564 |
CleanupStack::PopAndDestroy( store ); |
|
1565 |
CleanupStack::PopAndDestroy( mmsScheduledEntry ); |
|
1566 |
};) |
|
1567 |
mmsScheduledEntry = NULL; |
|
1568 |
||
1569 |
// Don't override previous error |
|
1570 |
// We may have entries that have failed for different reasons |
|
1571 |
if ( tEntry.iError != KErrNone ) |
|
1572 |
{ |
|
1573 |
tEntry.SetFailed( ETrue ); |
|
1574 |
} |
|
1575 |
} |
|
1576 |
error = iServerEntry->ChangeEntry( tEntry ); |
|
1577 |
} |
|
1578 |
||
1579 |
// --------------------------------------------------------- |
|
1580 |
// CMmsBaseOperation::UpdateRecipient |
|
1581 |
// |
|
1582 |
// --------------------------------------------------------- |
|
1583 |
// |
|
1584 |
void CMmsBaseOperation::UpdateRecipient( TInt aError, CMmsScheduledEntry& aMmsScheduledEntry ) |
|
1585 |
{ |
|
1586 |
aMmsScheduledEntry.MmsRecipient().Time().UniversalTime(); |
|
1587 |
aMmsScheduledEntry.MmsRecipient().SetError( aError ); |
|
1588 |
if ( aError == KErrNone ) |
|
1589 |
{ |
|
1590 |
aMmsScheduledEntry.MmsRecipient().SetStatus( CMsvRecipient::ESentSuccessfully ); |
|
1591 |
} |
|
1592 |
else |
|
1593 |
{ |
|
1594 |
aMmsScheduledEntry.MmsRecipient().SetStatus( CMsvRecipient::EFailedToSend ); |
|
1595 |
} |
|
1596 |
} |
|
1597 |
||
1598 |
// --------------------------------------------------------- |
|
1599 |
// CMmsBaseOperation::MapResponseStatus |
|
1600 |
// |
|
1601 |
// --------------------------------------------------------- |
|
1602 |
// |
|
1603 |
void CMmsBaseOperation::MapResponseStatus( CMmsHeaders& aResponse ) |
|
1604 |
{ |
|
1605 |
#ifndef _NO_MMSS_LOGGING_ |
|
1606 |
TMmsLogger::Log( _L("BaseOperation MapResponseStatus")); |
|
1607 |
#endif |
|
1608 |
// response status was initialize to 0 |
|
1609 |
// KMmsStatusOk = 128 |
|
1610 |
||
1611 |
// This is common respose status mapping. Retrieve status is different, |
|
1612 |
// MMBox view confirmation uses this mapping. |
|
1613 |
||
1614 |
switch ( aResponse.ResponseStatus() ) |
|
1615 |
{ |
|
1616 |
case KMmsStatusOk: |
|
1617 |
// No error, don't change iError |
|
1618 |
break; |
|
1619 |
case KMmsErrorPermanentSendingAddressUnresolved: |
|
1620 |
case KMmsErrorSendingAddressUnresolved: |
|
1621 |
iError = KMmsErrorStatusMessageAddressUnresolved; |
|
1622 |
break; |
|
1623 |
case KMmsErrorTransientSendingAddressUnresolved: |
|
1624 |
iError = KMmsErrorStatusTransientAddressUnresolved; |
|
1625 |
break; |
|
1626 |
case KMmsErrorPermanentMessageNotFound: |
|
1627 |
case KMmsErrorMessageNotFound: |
|
1628 |
iError = KMmsErrorStatusMessageNotFound; |
|
1629 |
break; |
|
1630 |
case KMmsErrorTransientMessageNotFound: |
|
1631 |
iError = KMmsErrorStatusTransientMessageNotFound; |
|
1632 |
break; |
|
1633 |
case KMmsErrorTransientNetworkProblem: |
|
1634 |
case KMmsErrorNetworkProblem: |
|
1635 |
iError = KMmsErrorStatusNetworkProblem; |
|
1636 |
break; |
|
1637 |
case KMmsErrorPermanentServiceDenied: |
|
1638 |
case KMmsErrorServiceDenied: |
|
1639 |
iError = KMmsErrorStatusServiceDenied; |
|
1640 |
break; |
|
1641 |
case KMmsErrorPermanentMessageFormatCorrupt: |
|
1642 |
case KMmsErrorMessageFormatCorrupt: |
|
1643 |
iError = KMmsErrorStatusMessageFormatCorrupt; |
|
1644 |
break; |
|
1645 |
case KMmsErrorPermanentContentNotAccepted: |
|
1646 |
case KMmsErrorNoContentAccepted: |
|
1647 |
iError = KMmsErrorStatusContentNotAccepted; |
|
1648 |
break; |
|
1649 |
case KMmsErrorPermanentReplyChargingLimitationsNotMet: |
|
1650 |
iError = KMmsErrorStatusReplyChargingLimitationsNotMet; |
|
1651 |
break; |
|
1652 |
case KMmsErrorPermanentReplyChargingRequestNotAccepted: |
|
1653 |
iError = KMmsErrorStatusReplyChargingRequestNotAccepted; |
|
1654 |
break; |
|
1655 |
case KMmsErrorPermanentReplyChargingForwardingDenied: |
|
1656 |
iError = KMmsErrorStatusReplyChargingForwardingDenied; |
|
1657 |
break; |
|
1658 |
case KMmsErrorPermanentReplyChargingNotSupported: |
|
1659 |
iError = KMmsErrorStatusReplyChargingNotSupported; |
|
1660 |
break; |
|
1661 |
case KMmsErrorTransientFailure: |
|
1662 |
iError = KMmsErrorStatusTransientFailure; |
|
1663 |
break; |
|
1664 |
case KMmsErrorUnspecified: |
|
1665 |
iError = KMmsErrorStatusUnspecified; |
|
1666 |
break; |
|
1667 |
case KMmsErrorPermanentFailure: |
|
1668 |
iError = KMmsErrorStatusPermanentFailure; |
|
1669 |
break; |
|
1670 |
case KMmsErrorUnsupportedMessage: |
|
1671 |
iError = KMmsErrorStatusUnsupportedMessage; |
|
1672 |
break; |
|
1673 |
default: |
|
1674 |
// No known status, but did not leave either |
|
1675 |
if ( iError == KErrNone ) |
|
1676 |
{ |
|
1677 |
if ( ( iResponse->ResponseStatus() & KMmsErrorRangeMask ) == KMmsErrorTransient ) |
|
1678 |
{ |
|
1679 |
iError = KMmsErrorStatusTransientFailure; |
|
1680 |
} |
|
1681 |
else |
|
1682 |
{ |
|
1683 |
iError = KMmsErrorStatusPermanentFailure; |
|
1684 |
} |
|
1685 |
} |
|
1686 |
break; |
|
1687 |
} |
|
1688 |
} |
|
1689 |
||
1690 |
// --------------------------------------------------------- |
|
1691 |
// CMmsBaseOperation::InitializeLoggingL |
|
1692 |
// |
|
1693 |
// --------------------------------------------------------- |
|
1694 |
// |
|
1695 |
void CMmsBaseOperation::InitializeLoggingL() |
|
1696 |
{ |
|
1697 |
#ifndef _NO_MMSS_LOGGING_ |
|
1698 |
TMmsLogger::Log( _L("BaseOperation InitializeLogging")); |
|
1699 |
#endif |
|
1700 |
if ( !iLogClient ) |
|
1701 |
{ |
|
1702 |
iLogClient = CLogClient::NewL( iFs ); |
|
1703 |
} |
|
1704 |
if ( !iLogViewEvent ) |
|
1705 |
{ |
|
1706 |
iLogViewEvent = CLogViewEvent::NewL( *iLogClient ); |
|
1707 |
} |
|
1708 |
if ( !iMmsLog ) |
|
1709 |
{ |
|
1710 |
iMmsLog = CMmsLog::NewL( *iLogClient, *iLogViewEvent, iFs ); |
|
1711 |
} |
|
1712 |
if ( !iLogEvent ) |
|
1713 |
{ |
|
1714 |
iLogEvent = CLogEvent::NewL(); |
|
1715 |
} |
|
1716 |
} |
|
1717 |
||
1718 |
||
1719 |
// --------------------------------------------------------- |
|
1720 |
// CMmsBaseOperation::CheckConnectionState |
|
1721 |
// |
|
1722 |
// --------------------------------------------------------- |
|
1723 |
// |
|
1724 |
void CMmsBaseOperation::CheckConnectionState() |
|
1725 |
{ |
|
1726 |
TInt status=iStatus.Int(); |
|
1727 |
// these can go now. |
|
1728 |
delete iConnectionInitiator; |
|
1729 |
iConnectionInitiator = NULL; |
|
1730 |
if ( status > 0 ) |
|
1731 |
{ |
|
1732 |
iConnectionIndex = status; |
|
1733 |
// We say we are connected when we have the connection to IAP. |
|
1734 |
// When protocol is HTTP there is no separate session opening step. |
|
1735 |
iConnected = ETrue; |
|
1736 |
} |
|
1737 |
else |
|
1738 |
{ |
|
1739 |
iError = status; |
|
1740 |
if ( status == KErrGeneral ) |
|
1741 |
{ |
|
1742 |
iError = KErrCouldNotConnect; |
|
1743 |
} |
|
1744 |
} |
|
1745 |
} |
|
1746 |
// --------------------------------------------------------- |
|
1747 |
// CMmsBaseOperation::FindDuplicateNotificationL |
|
1748 |
// |
|
1749 |
// --------------------------------------------------------- |
|
1750 |
// |
|
1751 |
TInt CMmsBaseOperation::FindDuplicateNotificationL( |
|
1752 |
TMsvId aParent, CMmsHeaders& aHeaders, TMsvId& aDuplicate ) |
|
1753 |
{ |
|
1754 |
#ifndef _NO_MMSS_LOGGING_ |
|
1755 |
TMmsLogger::Log( _L(" CMmsBaseOperation::FindDuplicateNotificationL") ); |
|
1756 |
#endif |
|
1757 |
||
1758 |
TInt error = KErrNone; |
|
1759 |
aDuplicate = KMsvNullIndexEntryId; |
|
1760 |
if ( aParent == KMsvNullIndexEntryId ) |
|
1761 |
{ |
|
1762 |
return KErrNotSupported; |
|
1763 |
} |
|
1764 |
||
1765 |
CMsvServerEntry* workingEntry = NULL; |
|
1766 |
TRAP( error, workingEntry = iServerEntry->NewEntryL( aParent ) ); |
|
1767 |
CleanupStack::PushL( workingEntry ); |
|
1768 |
||
1769 |
if ( error != KErrNone ) |
|
1770 |
{ |
|
1771 |
CleanupStack::PopAndDestroy( workingEntry ); // workingEntry |
|
1772 |
return error; |
|
1773 |
} |
|
1774 |
||
1775 |
CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
1776 |
CleanupStack::PushL( selection ); |
|
1777 |
||
1778 |
error = workingEntry->GetChildrenWithMtm( KUidMsgMMSNotification, *selection ); |
|
1779 |
||
1780 |
TInt count = selection->Count(); |
|
1781 |
if ( count == 0 ) |
|
1782 |
{ |
|
1783 |
error = KErrNotSupported; |
|
1784 |
} |
|
1785 |
||
1786 |
if ( error != KErrNone ) |
|
1787 |
{ |
|
1788 |
CleanupStack::PopAndDestroy( selection ); |
|
1789 |
CleanupStack::PopAndDestroy( workingEntry ); |
|
1790 |
return error; |
|
1791 |
} |
|
1792 |
||
1793 |
CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iMmsSettings->MmsVersion() ); |
|
1794 |
CleanupStack::PushL( mmsHeaders ); |
|
1795 |
||
1796 |
for ( TInt i = count; i > 0 && ( aDuplicate == KMsvNullIndexEntryId ); i-- ) |
|
1797 |
{ |
|
1798 |
if ( workingEntry->SetEntry( selection->At( i - 1 ) ) == KErrNone ) |
|
1799 |
{ |
|
1800 |
CMsvStore* store = workingEntry->ReadStoreL(); |
|
1801 |
CleanupStack::PushL( store ); |
|
1802 |
mmsHeaders->RestoreL( *store ); |
|
1803 |
CleanupStack::PopAndDestroy( store ); |
|
1804 |
||
1805 |
// content location must match |
|
1806 |
if ( mmsHeaders->ContentLocation().Compare( aHeaders.ContentLocation() ) == 0 ) |
|
1807 |
{ |
|
1808 |
// Identical. This probably means that we have not sent a response yet, |
|
1809 |
// and MMSC has sent us a new notification. |
|
1810 |
||
1811 |
#ifndef _NO_MMSS_LOGGING_ |
|
1812 |
TMmsLogger::Log( _L("- content locations match") ); |
|
1813 |
#endif |
|
1814 |
aDuplicate = workingEntry->Entry().Id(); |
|
1815 |
} |
|
1816 |
} |
|
1817 |
} |
|
1818 |
||
1819 |
CleanupStack::PopAndDestroy( mmsHeaders ); |
|
1820 |
CleanupStack::PopAndDestroy( selection ); |
|
1821 |
CleanupStack::PopAndDestroy( workingEntry ); |
|
1822 |
||
1823 |
return error; |
|
1824 |
} |
|
1825 |
||
1826 |
// --------------------------------------------------------- |
|
1827 |
// CMmsBaseOperation::FreeNotification |
|
1828 |
// |
|
1829 |
// --------------------------------------------------------- |
|
1830 |
// |
|
1831 |
TBool CMmsBaseOperation::FreeNotification( TMsvEntry aEntry, const TUint32 aOperation ) |
|
1832 |
{ |
|
1833 |
if ( aEntry.iMtmData2 & KMmsNewOperationForbidden || |
|
1834 |
( aEntry.iMtmData2 & KMmsOperationFinished && |
|
1835 |
!( aEntry.iMtmData2 & KMmsOperationResult ) && |
|
1836 |
!( aEntry.iMtmData2 & KMmsStoredInMMBox ) && |
|
1837 |
( aOperation == KMmsOperationFetch || aOperation == KMmsOperationForward ))) |
|
1838 |
{ |
|
1839 |
return EFalse; |
|
1840 |
} |
|
1841 |
||
1842 |
return ETrue; |
|
1843 |
} |
|
1844 |
||
1845 |
// --------------------------------------------------------- |
|
1846 |
// CMmsBaseOperation::MarkNotificationOperationFailed |
|
1847 |
// |
|
1848 |
// --------------------------------------------------------- |
|
1849 |
// |
|
1850 |
void CMmsBaseOperation::MarkNotificationOperationFailed( TMsvEntry& aEntry ) |
|
1851 |
{ |
|
1852 |
aEntry.iMtmData2 |= KMmsOperationFinished; // finished |
|
1853 |
aEntry.iMtmData2 |= KMmsOperationResult; // failed |
|
1854 |
aEntry.iMtmData2 &= ~KMmsOperationOngoing; // operation not active |
|
1855 |
aEntry.iMtmData2 &= ~KMmsNewOperationForbidden; // new operation allowed |
|
1856 |
} |
|
1857 |
||
1858 |
// --------------------------------------------------------- |
|
1859 |
// CMmsBaseOperation::MarkNotificationDeletedFromMmbox |
|
1860 |
// |
|
1861 |
// --------------------------------------------------------- |
|
1862 |
// |
|
1863 |
void CMmsBaseOperation::MarkNotificationDeletedFromMmbox( TMsvEntry& aEntry ) |
|
1864 |
{ |
|
1865 |
aEntry.iMtmData2 &= ~KMmsStoredInMMBox; // not in mmbox |
|
1866 |
aEntry.iMtmData2 &= ~KMmsOperationOngoing; // operation not active |
|
1867 |
aEntry.iMtmData2 |= KMmsOperationFinished; // finished |
|
1868 |
aEntry.iMtmData2 &= ~KMmsOperationResult; // successfully |
|
1869 |
aEntry.iMtmData2 &= ~KMmsNewOperationForbidden; // new operation allowed |
|
1870 |
} |
|
1871 |
||
1872 |
// --------------------------------------------------------- |
|
1873 |
// CMmsBaseOperation::MarkDuplicateL |
|
1874 |
// |
|
1875 |
// --------------------------------------------------------- |
|
1876 |
// |
|
1877 |
void CMmsBaseOperation::MarkDuplicateL( TInt aState, CMsvServerEntry& aServerEntry ) |
|
1878 |
{ |
|
1879 |
// iServerEntry must point to the original notification |
|
1880 |
// We can put default version here as the headers will be restored immediately anyway |
|
1881 |
// This is a static function and does not have access to iMmsSettings where the actual |
|
1882 |
// version is. |
|
1883 |
// Restoring the headers reads the correct version for the message in question |
|
1884 |
// Headers are used here only to clear the duplicate id from the headers. |
|
1885 |
// Other headers are not changed. |
|
1886 |
CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( KMmsDefaultVersion ); |
|
1887 |
CleanupStack::PushL( mmsHeaders ); |
|
1888 |
CMsvStore* store = aServerEntry.ReadStoreL(); |
|
1889 |
CleanupStack::PushL( store ); |
|
1890 |
mmsHeaders->RestoreL( *store ); |
|
1891 |
CleanupStack::PopAndDestroy( store ); |
|
1892 |
store = NULL; |
|
1893 |
||
1894 |
TMsvId duplicate = mmsHeaders->RelatedEntry(); |
|
1895 |
if ( duplicate != KMsvNullIndexEntryId ) |
|
1896 |
{ |
|
1897 |
// Clear related entry from the original notification |
|
1898 |
store = aServerEntry.EditStoreL(); |
|
1899 |
CleanupStack::PushL( store ); |
|
1900 |
mmsHeaders->SetRelatedEntry( KMsvNullIndexEntryId ); |
|
1901 |
mmsHeaders->StoreL( *store ); |
|
1902 |
store->CommitL(); |
|
1903 |
CleanupStack::PopAndDestroy( store ); |
|
1904 |
store = NULL; |
|
1905 |
#ifndef _NO_MMSS_LOGGING_ |
|
1906 |
TMmsLogger::Log( _L( "- related entry cleared" ) ); |
|
1907 |
#endif |
|
1908 |
||
1909 |
// Leaves if entry cannot be accessed. |
|
1910 |
// We are inside a trap already... |
|
1911 |
CMsvServerEntry* duplicateEntry = aServerEntry.NewEntryL( duplicate ); |
|
1912 |
CleanupStack::PushL( duplicateEntry ); |
|
1913 |
// Mark duplicate |
|
1914 |
TMsvEntry dupEntry = duplicateEntry->Entry(); |
|
1915 |
switch( aState ) |
|
1916 |
{ |
|
1917 |
case EMmsNotificationOperationFailed: |
|
1918 |
MarkNotificationOperationFailed( dupEntry ); |
|
1919 |
#ifndef _NO_MMSS_LOGGING_ |
|
1920 |
TMmsLogger::Log( _L( "- duplicate marked failed" ) ); |
|
1921 |
#endif |
|
1922 |
break; |
|
1923 |
case EMmsDeletedFromMmbox: |
|
1924 |
MarkNotificationDeletedFromMmbox( dupEntry ); |
|
1925 |
#ifndef _NO_MMSS_LOGGING_ |
|
1926 |
TMmsLogger::Log( _L( "- duplicate marked deleted" ) ); |
|
1927 |
#endif |
|
1928 |
break; |
|
1929 |
default: |
|
1930 |
break; |
|
1931 |
} |
|
1932 |
duplicateEntry->ChangeEntry( dupEntry ); |
|
1933 |
CleanupStack::PopAndDestroy( duplicateEntry ); |
|
1934 |
||
1935 |
} |
|
1936 |
CleanupStack::PopAndDestroy( mmsHeaders ); |
|
1937 |
} |
|
1938 |
||
1939 |
// --------------------------------------------------------- |
|
1940 |
// CMmsBaseOperation::MarkNotificationOperationReserved |
|
1941 |
// --------------------------------------------------------- |
|
1942 |
// |
|
1943 |
void CMmsBaseOperation::MarkNotificationOperationReserved( TMsvEntry& aEntry, |
|
1944 |
const TUint32 aOperation ) |
|
1945 |
{ |
|
1946 |
aEntry.iMtmData2 &= ~KMmsOperationIdentifier; // clear possible old operation |
|
1947 |
aEntry.iMtmData2 |= KMmsNewOperationForbidden; // forbidden |
|
1948 |
aEntry.iMtmData2 |= KMmsOperationOngoing; // operation is active |
|
1949 |
aEntry.iMtmData2 |= aOperation; // operation |
|
1950 |
aEntry.iMtmData2 &= ~KMmsOperationFinished; // not finished |
|
1951 |
aEntry.iMtmData2 &= ~KMmsOperationResult; // not failed |
|
1952 |
} |
|
1953 |
||
1954 |
// --------------------------------------------------------- |
|
1955 |
// |
|
1956 |
// --------------------------------------------------------- |
|
1957 |
// |
|
1958 |
TBool CMmsBaseOperation::RegisteredL( const TDesC& aApplicationId ) |
|
1959 |
{ |
|
1960 |
TBool registered = EFalse; |
|
1961 |
// check if application id is registered |
|
1962 |
CMmsRegisteredApplications* regAppId = CMmsRegisteredApplications::NewL(); |
|
1963 |
CleanupStack::PushL( regAppId ); |
|
1964 |
regAppId->LoadRegisteredApplicationsL(); |
|
1965 |
registered = regAppId->RegisteredL( aApplicationId ); |
|
1966 |
CleanupStack::PopAndDestroy( regAppId ); |
|
1967 |
return registered; |
|
1968 |
} |
|
1969 |
||
1970 |
// --------------------------------------------------------- |
|
1971 |
// CMmsBaseOperation::CommonLogEventInitializationL |
|
1972 |
// |
|
1973 |
// --------------------------------------------------------- |
|
1974 |
// |
|
1975 |
void CMmsBaseOperation::CommonLogEventInitializationL( |
|
1976 |
CMmsHeaders& aMmsHeaders, |
|
1977 |
TMsvEntry& aEntry ) |
|
1978 |
{ |
|
1979 |
if ( !iLogEvent || !iLogClient ) |
|
1980 |
{ |
|
1981 |
// something wrong with log - cannot do logging |
|
1982 |
User::Leave( KErrGeneral ); |
|
1983 |
} |
|
1984 |
||
1985 |
iLogEvent->SetEventType( KLogMmsEventTypeUid ); |
|
1986 |
iLogClient->GetString( iLogString, R_LOG_DIR_OUT ); |
|
1987 |
iLogEvent->SetDirection( iLogString ); |
|
1988 |
iLogEvent->SetDurationType( KLogDurationNone ); |
|
1989 |
||
1990 |
iLogEvent->SetSubject( aEntry.iDescription ); |
|
1991 |
iLogEvent->SetLink( aEntry.Id() ); |
|
1992 |
||
1993 |
iRemoteParties->Reset(); |
|
1994 |
iNumberOfRemoteParties = 0; |
|
1995 |
||
1996 |
// Get some fields into log entry |
|
1997 |
TTime now; |
|
1998 |
// the dates in log must be in universal time, not local time |
|
1999 |
now.UniversalTime(); |
|
2000 |
iLogEvent->SetTime( now ); |
|
2001 |
// We only log if the sending has been successful. |
|
2002 |
// We don't generate a log entry if iError not equal to KErrNone |
|
2003 |
// Therefore the status is always "pending" |
|
2004 |
iLogClient->GetString( iLogString, R_LOG_DEL_PENDING ); |
|
2005 |
iLogEvent->SetStatus( iLogString ); |
|
2006 |
||
2007 |
// Generate remote party list (pure addresses only) |
|
2008 |
TInt i; |
|
2009 |
TPtrC dummy; |
|
2010 |
// To list |
|
2011 |
for (i = 0; i < aMmsHeaders.ToRecipients().MdcaCount(); i++) |
|
2012 |
{ |
|
2013 |
dummy.Set( TMmsGenUtils::PureAddress( aMmsHeaders.ToRecipients().MdcaPoint( i ) ) ); |
|
2014 |
if ( iMmsSettings->LogEmailRecipients() || |
|
2015 |
( dummy.Locate( '@' ) == KErrNotFound ) ) |
|
2016 |
{ |
|
2017 |
iRemoteParties->AppendL( dummy ); |
|
2018 |
iNumberOfRemoteParties++; |
|
2019 |
} |
|
2020 |
} |
|
2021 |
// Cc list |
|
2022 |
for (i = 0; i < aMmsHeaders.CcRecipients().MdcaCount(); i++) |
|
2023 |
{ |
|
2024 |
dummy.Set( TMmsGenUtils::PureAddress( aMmsHeaders.CcRecipients().MdcaPoint( i ) ) ); |
|
2025 |
if ( iMmsSettings->LogEmailRecipients() || |
|
2026 |
( dummy.Locate( '@' ) == KErrNotFound ) ) |
|
2027 |
{ |
|
2028 |
iRemoteParties->AppendL( dummy ); |
|
2029 |
iNumberOfRemoteParties++; |
|
2030 |
} |
|
2031 |
} |
|
2032 |
// Bcc list |
|
2033 |
for (i = 0; i < aMmsHeaders.BccRecipients().MdcaCount(); i++) |
|
2034 |
{ |
|
2035 |
dummy.Set( TMmsGenUtils::PureAddress( aMmsHeaders.BccRecipients().MdcaPoint( i ) ) ); |
|
2036 |
if ( iMmsSettings->LogEmailRecipients() || |
|
2037 |
( dummy.Locate( '@' ) == KErrNotFound ) ) |
|
2038 |
{ |
|
2039 |
iRemoteParties->AppendL( dummy ); |
|
2040 |
iNumberOfRemoteParties++; |
|
2041 |
} |
|
2042 |
} |
|
2043 |
} |
|
2044 |
||
2045 |
// start of ROAMING CHECK handling |
|
2046 |
// --------------------------------------------------------- |
|
2047 |
// CMmsBaseOperation::RoamingCheck |
|
2048 |
// |
|
2049 |
// --------------------------------------------------------- |
|
2050 |
// |
|
2051 |
void CMmsBaseOperation::RoamingCheck() |
|
2052 |
{ |
|
2053 |
// base operation does nothing |
|
2054 |
// This is just a placeholder |
|
2055 |
FallThrough(); |
|
2056 |
} |
|
2057 |
||
2058 |
// --------------------------------------------------------- |
|
2059 |
// CMmsBaseOperation::GetRoamingState |
|
2060 |
// |
|
2061 |
// --------------------------------------------------------- |
|
2062 |
// |
|
2063 |
void CMmsBaseOperation::GetRoamingState() |
|
2064 |
{ |
|
2065 |
// Nothing needs to be done here |
|
2066 |
} |
|
2067 |
||
2068 |
||
2069 |
||
2070 |
#ifndef _NO_MMSS_LOGGING_ |
|
2071 |
// --------------------------------------------------------- |
|
2072 |
// CMmsBaseOperation::LogDateL |
|
2073 |
// |
|
2074 |
// --------------------------------------------------------- |
|
2075 |
void CMmsBaseOperation::LogDateL( const TTime& aDate ) |
|
2076 |
{ |
|
2077 |
TBuf<KMmsDateBufferLength> dateString; |
|
2078 |
aDate.FormatL(dateString,(_L("%*E%*D%X%*N%Y %1 %2 '%3"))); |
|
2079 |
TMmsLogger::Log( _L(" - date %S"), &dateString ); |
|
2080 |
aDate.FormatL(dateString,(_L("%-B%:0%J%:1%T%:2%S%:3%+B"))); |
|
2081 |
TMmsLogger::Log( _L(" - time %S"), &dateString ); |
|
2082 |
} |
|
2083 |
||
2084 |
// --------------------------------------------------------- |
|
2085 |
// CMmsBaseOperation::LogNetworkFormatDateL |
|
2086 |
// |
|
2087 |
// --------------------------------------------------------- |
|
2088 |
void CMmsBaseOperation::LogNetworkFormatDateL( const TInt64& aDateInSeconds ) |
|
2089 |
{ |
|
2090 |
TBuf<KMmsDateBufferLength> dateString; |
|
2091 |
TMmsLogger::Log( _L(" - %d seconds from 1.1.1970 (UTC)"), aDateInSeconds ); |
|
2092 |
TTime time = TTime( KMmsYear1970String ) + |
|
2093 |
TTimeIntervalMicroSeconds( aDateInSeconds * KMmsMillion ); |
|
2094 |
time.FormatL(dateString,(_L("%*E%*D%X%*N%Y %1 %2 '%3"))); |
|
2095 |
TMmsLogger::Log( _L(" - date %S"), &dateString ); |
|
2096 |
time.FormatL(dateString,(_L("%-B%:0%J%:1%T%:2%S%:3%+B"))); |
|
2097 |
TMmsLogger::Log( _L(" - time %S"), &dateString ); |
|
2098 |
} |
|
2099 |
||
2100 |
#else |
|
2101 |
// --------------------------------------------------------- |
|
2102 |
// CMmsBaseOperation::LogDateL |
|
2103 |
// |
|
2104 |
// --------------------------------------------------------- |
|
2105 |
void CMmsBaseOperation::LogDateL( const TTime& ) |
|
2106 |
{ |
|
2107 |
} |
|
2108 |
||
2109 |
// --------------------------------------------------------- |
|
2110 |
// CMmsBaseOperation::LogNetworkFormatDateL |
|
2111 |
// |
|
2112 |
// --------------------------------------------------------- |
|
2113 |
void CMmsBaseOperation::LogNetworkFormatDateL( const TInt64& ) |
|
2114 |
{ |
|
2115 |
} |
|
2116 |
#endif |
|
2117 |
||
2118 |
||
2119 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
2120 |
||
2121 |
// End of File |