|
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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 /* Changed by Vaibhav - 13Aug07 for Removing CodeScanner Warnings - High/medium */ |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32math.h> |
|
22 #include "BCSmsUtilitiesTest.h" |
|
23 #include <gsmunmspacemobmsg.h> |
|
24 #include <S32file.h> |
|
25 #include <e32cons.h> |
|
26 #include <txtrich.h> |
|
27 |
|
28 #include <gsmuelem.h> |
|
29 #define KTimeStampSize 32 |
|
30 _LIT(KTestNativeChar, "SmsGsmUtilities"); |
|
31 _LIT8(KTestNativeChar8, "SmsGsmUtilities"); |
|
32 _LIT8(KTestInfo8, "ABCDEFGH"); |
|
33 _LIT8(KTestCommandData8, "CommandData"); |
|
34 _LIT(KTestBuffer1, "ABCDEFGHIJKLMNOPQRSTUVWX"); |
|
35 |
|
36 // ============================= LOCAL FUNCTIONS =============================== |
|
37 // ----------------------------------------------------------------------------- |
|
38 // Create_Console |
|
39 // Creates a new Console Window |
|
40 // ----------------------------------------------------------------------------- |
|
41 LOCAL_C CConsoleBase* Create_ConsoleL(const TDesC& title) |
|
42 { |
|
43 CConsoleBase* console; |
|
44 |
|
45 console = Console::NewL(title,TSize( KConsFullScreen, KConsFullScreen)); |
|
46 CleanupStack::PushL( console ); |
|
47 return console; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // Print |
|
52 // Prints the result onto screen |
|
53 // ----------------------------------------------------------------------------- |
|
54 LOCAL_C void Print(CConsoleBase* base, TInt result, const TDesC& text) |
|
55 { |
|
56 base->Printf(text); |
|
57 if( result == KErrNone) |
|
58 { |
|
59 base->Printf(_L(" passed\n")); |
|
60 } |
|
61 else |
|
62 { |
|
63 base->Printf(_L("::Error code %d\n"), result); |
|
64 } |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // Remove_Console |
|
69 // Deletes a new Console Window |
|
70 // ----------------------------------------------------------------------------- |
|
71 LOCAL_C void Remove_Console(CConsoleBase* base) |
|
72 { |
|
73 //base->Getch(); |
|
74 CleanupStack::PopAndDestroy(base); |
|
75 } |
|
76 |
|
77 void Check(TInt aValue, TInt aExpected ) |
|
78 { |
|
79 if(aValue != aExpected) |
|
80 { |
|
81 RDebug::Print(_L("*** Expected value: %d, got: %d\r\n"), aExpected, aValue); |
|
82 __ASSERT_ALWAYS(aValue != aExpected, User::Panic(_L("Active object Error"), 1)); |
|
83 } |
|
84 } |
|
85 |
|
86 // ============================ MEMBER FUNCTIONS =============================== |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CBCSmsUtilitiesTest::Case |
|
90 // Returns a test case by number. |
|
91 // |
|
92 // This function contains an array of all available test cases |
|
93 // i.e pair of case name and test function. If case specified by parameter |
|
94 // aCaseNumber is found from array, then that item is returned. |
|
95 // |
|
96 // The reason for this rather complicated function is to specify all the |
|
97 // test cases only in one place. It is not necessary to understand how |
|
98 // function pointers to class member functions works when adding new test |
|
99 // cases. See function body for instructions how to add new test case. |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 const TCaseInfo CBCSmsUtilitiesTest::Case ( |
|
103 const TInt aCaseNumber ) const |
|
104 { |
|
105 |
|
106 |
|
107 static TCaseInfoInternal const KCases[] = |
|
108 { |
|
109 // To add new test cases, add new items to this array |
|
110 ENTRY( "CSmsAlphabetConverter", CBCSmsUtilitiesTest::TestSmsAlphabetConverterL ), |
|
111 ENTRY( "CSmsBuffer", CBCSmsUtilitiesTest::TestSmsBufferL ), |
|
112 ENTRY( "CSmsCommand", CBCSmsUtilitiesTest::TestSmsCommandL ), |
|
113 ENTRY( "CSmsDeliver", CBCSmsUtilitiesTest::TestSmsDeliverL ), |
|
114 ENTRY( "CSmsDeliverReport", CBCSmsUtilitiesTest::TestSmsDeliverReportL ), |
|
115 ENTRY( "CSmsEditorBuffer", CBCSmsUtilitiesTest::TestSmsEditorBufferL ), |
|
116 ENTRY( "CSmsInformationElement", CBCSmsUtilitiesTest::TestSmsInformationElementL ), |
|
117 ENTRY( "CSmsMessage", CBCSmsUtilitiesTest::TestSmsMessageL ), |
|
118 ENTRY( "CSmsPDU", CBCSmsUtilitiesTest::TestSmsPDUL ), |
|
119 ENTRY( "CSmsStatusReport", CBCSmsUtilitiesTest::TestSmsStatusReportL ), |
|
120 ENTRY( "CSmsSubmit", CBCSmsUtilitiesTest::TestSmsSubmitL ), |
|
121 ENTRY( "CSmsSubmitReport", CBCSmsUtilitiesTest::TestSmsSubmitReportL ), |
|
122 ENTRY( "CSmsUserData", CBCSmsUtilitiesTest::TestSmsUserDataL ), |
|
123 }; |
|
124 |
|
125 // Verify that case number is valid |
|
126 if( (TUint) aCaseNumber >= sizeof( KCases ) / |
|
127 sizeof( TCaseInfoInternal ) ) |
|
128 { |
|
129 // Invalid case, construct empty object |
|
130 TCaseInfo null( (const TText*) L"" ); |
|
131 null.iMethod = NULL; |
|
132 null.iIsOOMTest = EFalse; |
|
133 null.iFirstMemoryAllocation = 0; |
|
134 null.iLastMemoryAllocation = 0; |
|
135 return null; |
|
136 } |
|
137 |
|
138 // Construct TCaseInfo object and return it |
|
139 TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName ); |
|
140 tmp.iMethod = KCases[ aCaseNumber ].iMethod; |
|
141 tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest; |
|
142 tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation; |
|
143 tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation; |
|
144 return tmp; |
|
145 |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // TestGetAlphabet |
|
150 // Gets the coding scheme alphabet |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 LOCAL_C TInt TestGetAlphabet( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
154 { |
|
155 aLog->Log(_L("---------------------------------------------")); |
|
156 aLog->Log(_L("Calling Alphabet()")); |
|
157 TInt result = KErrNone; |
|
158 |
|
159 //inline TSmsDataCodingScheme::TSmsAlphabet CSmsAlphabetConverter::Alphabet() const |
|
160 TSmsDataCodingScheme::TSmsAlphabet alphabet = aAlphabetConv.Alphabet(); |
|
161 |
|
162 if( alphabet == TSmsDataCodingScheme::ESmsAlphabet8Bit ) |
|
163 { |
|
164 aLog->Log(_L("Alphabet() Completed")); |
|
165 aLog->Log(_L("Alphabet fetched")); |
|
166 aLog->Log(_L("Get alphabet == PASS")); |
|
167 } |
|
168 else |
|
169 { |
|
170 result = KErrGeneral; |
|
171 aLog->Log(_L("Get alphabet == FAIL")); |
|
172 } |
|
173 |
|
174 return result; |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // TestConvertFromNative |
|
179 // Converts from the native character set to |
|
180 // unpacked user data elements of the desired character set. |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 LOCAL_C TInt TestConvertFromNative( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
184 { |
|
185 aLog->Log(_L("---------------------------------------------")); |
|
186 aLog->Log(_L("Calling ConvertFromNativeL()")); |
|
187 |
|
188 TBufC<24> nativeChar(KTestNativeChar); |
|
189 TBufC8<24> UDElements(KTestNativeChar8); |
|
190 //IMPORT_C TPtrC8 ConvertFromNativeL(const TDesC& aNativeCharacters); |
|
191 TPtrC8 convChar; |
|
192 TRAPD( result, convChar.Set(aAlphabetConv.ConvertFromNativeL(nativeChar))) ; |
|
193 |
|
194 TPtrC8 UDElementsPtr(UDElements); |
|
195 if(convChar.Compare(UDElementsPtr)) |
|
196 { |
|
197 result = KErrGeneral; |
|
198 aLog->Log(_L("Convert from native == FAIL")); |
|
199 } |
|
200 else |
|
201 { |
|
202 aLog->Log(_L("ConvertFromNativeL() Completed")); |
|
203 aLog->Log(_L("Conversion successfully performoded")); |
|
204 aLog->Log(_L("Convert from native == PASS")); |
|
205 } |
|
206 |
|
207 return result; |
|
208 } |
|
209 |
|
210 LOCAL_C TInt TestConvertFromNative2L( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
211 { |
|
212 aLog->Log(_L("---------------------------------------------")); |
|
213 aLog->Log(_L("Calling ConvertFromNative2L()")); |
|
214 |
|
215 TBufC<24> nativeChar(KTestNativeChar); |
|
216 TBufC8<24> UDElements(KTestNativeChar8); |
|
217 |
|
218 TInt numUnconvertibleChars; |
|
219 TInt numDowngradedChars; |
|
220 TPtrC8 convChar; |
|
221 TRAPD( result, convChar.Set(aAlphabetConv.ConvertFromNativeL(nativeChar,ESmsEncodingNone,numUnconvertibleChars,numDowngradedChars ))) ; |
|
222 |
|
223 TPtrC8 UDElementsPtr(UDElements); |
|
224 if(convChar.Compare(UDElementsPtr)) |
|
225 { |
|
226 result = KErrGeneral; |
|
227 aLog->Log(_L("Convert from native2 == FAIL")); |
|
228 } |
|
229 else |
|
230 { |
|
231 aLog->Log(_L("ConvertFromNative2L() Completed")); |
|
232 aLog->Log(_L("Conversion successfully performoded")); |
|
233 aLog->Log(_L("Convert from native2 == PASS")); |
|
234 } |
|
235 |
|
236 return result; |
|
237 } |
|
238 // ----------------------------------------------------------------------------- |
|
239 // TestConvertToNative |
|
240 // Converts the user data elements of the specified character set to |
|
241 // the native character set. |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 LOCAL_C TInt TestConvertToNative( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
245 { |
|
246 aLog->Log(_L("---------------------------------------------")); |
|
247 aLog->Log(_L("Calling ConvertToNativeL()")); |
|
248 |
|
249 TBufC<24> nativeChar(KTestNativeChar); |
|
250 TBufC8<24> UDElements(KTestNativeChar8); |
|
251 //IMPORT_C TPtrC ConvertToNativeL(const TDesC8& aUDElements); |
|
252 TPtrC convChar; |
|
253 TRAPD( result, convChar.Set(aAlphabetConv.ConvertToNativeL(UDElements))); |
|
254 |
|
255 TBufC<24> nativeCharPtr(nativeChar); |
|
256 if(convChar.Compare(nativeCharPtr)) |
|
257 { |
|
258 result = KErrGeneral; |
|
259 aLog->Log(_L("Convert To native == FAIL")); |
|
260 } |
|
261 else |
|
262 { |
|
263 aLog->Log(_L("ConvertToNativeL() Completed")); |
|
264 aLog->Log(_L("Conversion successfully performoded")); |
|
265 aLog->Log(_L("Convert To native == PASS")); |
|
266 } |
|
267 |
|
268 return result; |
|
269 } |
|
270 |
|
271 LOCAL_C TInt TestConvertToNative2L( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
272 { |
|
273 aLog->Log(_L("---------------------------------------------")); |
|
274 aLog->Log(_L("Calling ConvertToNative2L()")); |
|
275 |
|
276 TBufC<24> nativeChar(KTestNativeChar); |
|
277 TBufC8<24> UDElements(KTestNativeChar8); |
|
278 |
|
279 TPtrC convChar; |
|
280 TRAPD( result, convChar.Set(aAlphabetConv.ConvertToNativeL(UDElements,ESmsEncodingNone ))); |
|
281 |
|
282 TBufC<24> nativeCharPtr(nativeChar); |
|
283 if(convChar.Compare(nativeCharPtr)) |
|
284 { |
|
285 result = KErrGeneral; |
|
286 aLog->Log(_L("Convert To native2 == FAIL")); |
|
287 } |
|
288 else |
|
289 { |
|
290 aLog->Log(_L("ConvertToNative2L() Completed")); |
|
291 aLog->Log(_L("Conversion successfully performoded")); |
|
292 aLog->Log(_L("Convert To native2 == PASS")); |
|
293 } |
|
294 |
|
295 return result; |
|
296 } |
|
297 // ----------------------------------------------------------------------------- |
|
298 // TestResetUnconvertedNativeCharacters |
|
299 // Resets the unconverted native character buffer |
|
300 // ----------------------------------------------------------------------------- |
|
301 // |
|
302 LOCAL_C TInt TestResetUnconvertedNativeCharacters( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
303 { |
|
304 aLog->Log(_L("---------------------------------------------")); |
|
305 aLog->Log(_L("Calling ResetUnconvertedNativeCharacters()")); |
|
306 |
|
307 TInt result = KErrNone; |
|
308 |
|
309 //inline void ResetUnconvertedNativeCharacters(); |
|
310 aAlphabetConv.ResetUnconvertedNativeCharacters(); |
|
311 |
|
312 aLog->Log(_L("ResetUnconvertedNativeCharacters() Completed")); |
|
313 aLog->Log(_L("Reset performed successfully")); |
|
314 aLog->Log(_L("Reset unconverted native characters == PASS")); |
|
315 |
|
316 return result; |
|
317 } |
|
318 |
|
319 // ----------------------------------------------------------------------------- |
|
320 // TestResetUnconvertedUDElements |
|
321 // Resets the unconverted user data elements buffer |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 LOCAL_C TInt TestResetUnconvertedUDElements( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
325 { |
|
326 aLog->Log(_L("---------------------------------------------")); |
|
327 aLog->Log(_L("Calling ResetUnconvertedUDElements()")); |
|
328 TInt result = KErrNone; |
|
329 |
|
330 //inline void ResetUnconvertedUDElements(); |
|
331 aAlphabetConv.ResetUnconvertedUDElements(); |
|
332 |
|
333 aLog->Log(_L("ResetUnconvertedUDElements() Completed")); |
|
334 aLog->Log(_L("Reset performed successfully")); |
|
335 aLog->Log(_L("Reset unconverted UD Elements == PASS")); |
|
336 |
|
337 return result; |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // TestUnconvertedNativeCharacters |
|
342 // Gets the unconverted native characters |
|
343 // ----------------------------------------------------------------------------- |
|
344 // |
|
345 LOCAL_C TInt TestUnconvertedNativeCharacters( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
346 { |
|
347 aLog->Log(_L("---------------------------------------------")); |
|
348 aLog->Log(_L("Calling UnconvertedNativeCharacters()")); |
|
349 TInt result = KErrNone; |
|
350 |
|
351 //inline TPtrC UnconvertedNativeCharacters(); |
|
352 TPtrC nativeCharPtr( aAlphabetConv.UnconvertedNativeCharacters() ); |
|
353 |
|
354 aLog->Log(_L("UnconvertedNativeCharacters() Completed")); |
|
355 if(nativeCharPtr != KNullDesC ) |
|
356 aLog->Log(_L("Result data:Characters: %s"), nativeCharPtr.Ptr()); |
|
357 else |
|
358 aLog->Log(_L("Result data:Characters: NULL ")); |
|
359 aLog->Log(_L("Get unconverted native characters == PASS")); |
|
360 |
|
361 return result; |
|
362 } |
|
363 |
|
364 // ----------------------------------------------------------------------------- |
|
365 // TestUnconvertedUDElements |
|
366 // Gets the unconverted user data elements |
|
367 // ----------------------------------------------------------------------------- |
|
368 // |
|
369 LOCAL_C TInt TestUnconvertedUDElements( CStifLogger* aLog, CSmsAlphabetConverter& aAlphabetConv) |
|
370 { |
|
371 aLog->Log(_L("---------------------------------------------")); |
|
372 aLog->Log(_L("Calling UnconvertedUDElements()")); |
|
373 TInt result = KErrNone; |
|
374 |
|
375 //inline TPtrC8 UnconvertedUDElements(); |
|
376 TPtrC8 UDElementsPtr( aAlphabetConv.UnconvertedUDElements()); |
|
377 |
|
378 aLog->Log(_L("UnconvertedUDElements() Completed")); |
|
379 if( UDElementsPtr!= KNullDesC8 ) |
|
380 aLog->Log(_L("Result data:Characters: %s"), UDElementsPtr.Ptr()); |
|
381 else |
|
382 aLog->Log(_L("Result data:Characters: NULL")); |
|
383 aLog->Log(_L("Get unconverted UD Elements == PASS")); |
|
384 |
|
385 return result; |
|
386 } |
|
387 |
|
388 // ----------------------------------------------------------------------------- |
|
389 // TestDelete |
|
390 // Deletes data from the buffer |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 LOCAL_C TInt TestDelete( CStifLogger* aLog, CSmsBuffer& aBuffer) |
|
394 { |
|
395 aLog->Log(_L("---------------------------------------------")); |
|
396 aLog->Log(_L("Calling DeleteL()")); |
|
397 |
|
398 TInt position = 2; |
|
399 TInt length = 2; |
|
400 //IMPORT_C void DeleteL(TInt aPos,TInt aLength); |
|
401 TRAPD( result, aBuffer.DeleteL( position, length)); |
|
402 |
|
403 if( result == KErrNone ) |
|
404 { |
|
405 aLog->Log(_L("DeleteL() Completed")); |
|
406 aLog->Log(_L("Data successfully deleted")); |
|
407 aLog->Log(_L("Delete == PASS")); |
|
408 } |
|
409 else |
|
410 aLog->Log(_L("Delete == FAIL")); |
|
411 |
|
412 return result; |
|
413 } |
|
414 |
|
415 // ----------------------------------------------------------------------------- |
|
416 // TestReset |
|
417 // Resets the buffer |
|
418 // ----------------------------------------------------------------------------- |
|
419 // |
|
420 LOCAL_C TInt TestReset( CStifLogger* aLog, CSmsBuffer& aBuffer) |
|
421 { |
|
422 aLog->Log(_L("---------------------------------------------")); |
|
423 aLog->Log(_L("Calling Reset()")); |
|
424 TInt result = KErrNone; |
|
425 |
|
426 //IMPORT_C void Reset(); |
|
427 aBuffer.Reset(); |
|
428 |
|
429 aLog->Log(_L("Reset() Completed")); |
|
430 aLog->Log(_L("Data successfully reseted")); |
|
431 aLog->Log(_L("Reset == PASS")); |
|
432 return result; |
|
433 } |
|
434 |
|
435 // ----------------------------------------------------------------------------- |
|
436 // TestExtract |
|
437 // Extracts buffer data to a descriptor |
|
438 // ----------------------------------------------------------------------------- |
|
439 // |
|
440 LOCAL_C TInt TestExtract( CStifLogger* aLog, CSmsBuffer& aBuffer) |
|
441 { |
|
442 aLog->Log(_L("---------------------------------------------")); |
|
443 aLog->Log(_L("Calling Extract()")); |
|
444 TInt result = KErrNone; |
|
445 |
|
446 TBuf<24> buffer; |
|
447 TInt position = 2; |
|
448 TInt length = 6; |
|
449 //IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const; |
|
450 aBuffer.Extract(buffer, position, length); |
|
451 |
|
452 aLog->Log(_L("Extract() Completed")); |
|
453 aLog->Log(_L("Data successfully extracted")); |
|
454 aLog->Log(_L("Extract == PASS")); |
|
455 return result; |
|
456 } |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // TestInsert |
|
460 // Inserts data into the buffer |
|
461 // ----------------------------------------------------------------------------- |
|
462 // |
|
463 LOCAL_C TInt TestInsert( CStifLogger* aLog, CSmsBuffer& aBuffer) |
|
464 { |
|
465 aLog->Log(_L("---------------------------------------------")); |
|
466 aLog->Log(_L("Calling InsertL()")); |
|
467 |
|
468 TBufC<24> buffer(KTestBuffer1); |
|
469 TInt position = 0; |
|
470 //IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf); |
|
471 TRAPD( result, aBuffer.InsertL(position, buffer)); |
|
472 |
|
473 if( result == KErrNone ) |
|
474 { |
|
475 aLog->Log(_L("InsertL() Completed")); |
|
476 aLog->Log(_L("Data successfully Inserted")); |
|
477 aLog->Log(_L("InsertL == PASS")); |
|
478 } |
|
479 else |
|
480 aLog->Log(_L("InsertL == FAIL")); |
|
481 |
|
482 return result; |
|
483 } |
|
484 |
|
485 // ----------------------------------------------------------------------------- |
|
486 // TestGetLength |
|
487 // Gets the amount of space currently used in the buffer. |
|
488 // ----------------------------------------------------------------------------- |
|
489 // |
|
490 LOCAL_C TInt TestGetLength( CStifLogger* aLog, CSmsBuffer& aBuffer) |
|
491 { |
|
492 aLog->Log(_L("---------------------------------------------")); |
|
493 aLog->Log(_L("Calling Length()")); |
|
494 TInt result = KErrNone; |
|
495 |
|
496 //IMPORT_C TInt Length() const; |
|
497 TInt length = aBuffer.Length(); |
|
498 |
|
499 if(length == 22) |
|
500 { |
|
501 aLog->Log(_L("Length() Completed")); |
|
502 aLog->Log(_L("Result data: Length: %d"), length); |
|
503 aLog->Log(_L("Length == PASS")); |
|
504 } |
|
505 else |
|
506 { |
|
507 result = KErrGeneral; |
|
508 aLog->Log(_L("Length == FAIL")); |
|
509 } |
|
510 |
|
511 return result; |
|
512 } |
|
513 |
|
514 // ----------------------------------------------------------------------------- |
|
515 // TestExternalize |
|
516 // Externalises the object. |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 LOCAL_C TInt TestExternalizeL( CStifLogger* aLog, CSmsBuffer& aBuffer) |
|
520 { |
|
521 aLog->Log(_L("---------------------------------------------")); |
|
522 aLog->Log(_L("Calling ExternalizeL()")); |
|
523 |
|
524 RFs session; |
|
525 User::LeaveIfError(session.Connect()); |
|
526 TBufC<64> storename = _L("C:\\SMSGSMUtilities_CSmsBuffer"); |
|
527 RFileWriteStream write; |
|
528 |
|
529 write.Create(session, storename, EFileWrite); |
|
530 TInt err = write.Open(session, storename, EFileWrite); |
|
531 |
|
532 //IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
533 TRAPD( result, aBuffer.ExternalizeL( write )); |
|
534 |
|
535 write.CommitL(); |
|
536 write.Close(); |
|
537 |
|
538 session.Close(); |
|
539 if( result == KErrNone ) |
|
540 { |
|
541 aLog->Log(_L("ExternalizeL() Completed")); |
|
542 aLog->Log(_L("Buffer successfully externalized")); |
|
543 aLog->Log(_L("ExternalizeL == PASS")); |
|
544 } |
|
545 else |
|
546 aLog->Log(_L("ExternalizeL == FAIL")); |
|
547 |
|
548 return result; |
|
549 } |
|
550 |
|
551 // ----------------------------------------------------------------------------- |
|
552 // TestInternalize |
|
553 // Internalises the object. |
|
554 // ----------------------------------------------------------------------------- |
|
555 // |
|
556 LOCAL_C TInt TestInternalizeL( CStifLogger* aLog, CSmsBuffer& aBuffer) |
|
557 { |
|
558 aLog->Log(_L("---------------------------------------------")); |
|
559 aLog->Log(_L("Calling InternalizeL()")); |
|
560 |
|
561 RFs session; |
|
562 User::LeaveIfError(session.Connect()); |
|
563 TBufC<64> storename = _L("C:\\SMSGSMUtilities_CSmsBuffer"); |
|
564 RFileReadStream read; |
|
565 |
|
566 TInt erro = read.Open(session, storename, EFileRead); |
|
567 |
|
568 //IMPORT_C void InternalizeL(RReadStream &aStream) |
|
569 TRAPD( result, aBuffer.InternalizeL( read )); |
|
570 |
|
571 read.Close(); |
|
572 |
|
573 //now delete the store |
|
574 TInt err = session.Delete(storename); |
|
575 if(err != KErrNone) |
|
576 { |
|
577 RDebug::Print(_L("Error %d deleting \"%S\" file.\n"), err, &storename); |
|
578 } |
|
579 |
|
580 session.Close(); |
|
581 if( result == KErrNone ) |
|
582 { |
|
583 aLog->Log(_L("InternalizeL() Completed")); |
|
584 aLog->Log(_L("Buffer successfully internalized")); |
|
585 aLog->Log(_L("InternalizeL == PASS")); |
|
586 } |
|
587 else |
|
588 aLog->Log(_L("InternalizeL == FAIL")); |
|
589 |
|
590 return result; |
|
591 } |
|
592 |
|
593 // ----------------------------------------------------------------------------- |
|
594 // TestAddInformationElement |
|
595 // Adds an Information Element. |
|
596 // ----------------------------------------------------------------------------- |
|
597 // |
|
598 LOCAL_C TInt TestAddInformationElement( CStifLogger* aLog, CSmsCommand& aCommand) |
|
599 { |
|
600 aLog->Log(_L("---------------------------------------------")); |
|
601 aLog->Log(_L("Calling AddInformationElementL()")); |
|
602 |
|
603 CSmsInformationElement::TSmsInformationElementIdentifier identifier = CSmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference; |
|
604 TBufC8<24> information(KTestInfo8); |
|
605 //IMPORT_C void AddInformationElementL(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier, TDesC8& aData); |
|
606 TRAPD( result, aCommand.AddInformationElementL( identifier, information)); |
|
607 |
|
608 if( result ==KErrNone ) |
|
609 { |
|
610 aLog->Log(_L("AddInformationElementL() completed")); |
|
611 aLog->Log(_L("Information element successfully added")); |
|
612 aLog->Log(_L("Add information element == PASS")); |
|
613 } |
|
614 else |
|
615 aLog->Log(_L("Add information element == FAIL")); |
|
616 |
|
617 return result; |
|
618 } |
|
619 |
|
620 // ----------------------------------------------------------------------------- |
|
621 // TestRemoveInformationElement |
|
622 // Removes an Information Element |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 LOCAL_C TInt TestRemoveInformationElement( CStifLogger* aLog, CSmsCommand& aCommand) |
|
626 { |
|
627 aLog->Log(_L("---------------------------------------------")); |
|
628 aLog->Log(_L("Calling RemoveInformationElement()")); |
|
629 TInt result = KErrNone; |
|
630 |
|
631 TInt index = 0; |
|
632 //IMPORT_C void RemoveInformationElement(TInt aIndex); |
|
633 aCommand.RemoveInformationElement( index ); |
|
634 |
|
635 aLog->Log(_L("RemoveInformationElement() completed")); |
|
636 aLog->Log(_L("Information element successfully removed")); |
|
637 aLog->Log(_L("Remove information element == PASS")); |
|
638 return result; |
|
639 } |
|
640 |
|
641 // ----------------------------------------------------------------------------- |
|
642 // TestMaxCommandDataLength |
|
643 // Gets the Maximum Data Length of the Command |
|
644 // ----------------------------------------------------------------------------- |
|
645 // |
|
646 LOCAL_C TInt TestMaxCommandDataLength( CStifLogger* aLog, CSmsCommand& aCommand) |
|
647 { |
|
648 aLog->Log(_L("---------------------------------------------")); |
|
649 aLog->Log(_L("Calling MaxCommandDataLength()")); |
|
650 TInt result = KErrNone; |
|
651 |
|
652 //IMPORT_C TInt MaxCommandDataLength() const; |
|
653 TInt maxLength = aCommand.MaxCommandDataLength(); |
|
654 |
|
655 aLog->Log(_L("MaxCommandDataLength() completed")); |
|
656 aLog->Log(_L("Result data:Max length: %d"),maxLength); |
|
657 aLog->Log(_L("Get max command data length == PASS")); |
|
658 return result; |
|
659 } |
|
660 |
|
661 // ----------------------------------------------------------------------------- |
|
662 // TestGetCommandData |
|
663 // Gets the Command Data |
|
664 // ----------------------------------------------------------------------------- |
|
665 // |
|
666 LOCAL_C TInt TestGetCommandData( CStifLogger* aLog, CSmsCommand& aCommand) |
|
667 { |
|
668 aLog->Log(_L("---------------------------------------------")); |
|
669 aLog->Log(_L("Calling CommandData()")); |
|
670 TInt result = KErrNone; |
|
671 |
|
672 //IMPORT_C TPtrC8 CommandData() const; |
|
673 TPtrC8 commandPtr = aCommand.CommandData(); |
|
674 |
|
675 if( commandPtr == KTestCommandData8) |
|
676 { |
|
677 aLog->Log(_L("CommandData() completed")); |
|
678 aLog->Log(_L("Result data:Command data: %s"), commandPtr.Ptr()); |
|
679 aLog->Log(_L("Get command data == PASS")); |
|
680 } |
|
681 else |
|
682 { |
|
683 result = KErrGeneral; |
|
684 aLog->Log(_L("Get command data == FAIL")); |
|
685 } |
|
686 return result; |
|
687 } |
|
688 |
|
689 // ----------------------------------------------------------------------------- |
|
690 // TestGetCommandType |
|
691 // Gets the Command Type |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 LOCAL_C TInt TestGetCommandType( CStifLogger* aLog, CSmsCommand& aCommand) |
|
695 { |
|
696 aLog->Log(_L("---------------------------------------------")); |
|
697 aLog->Log(_L("Calling CommandType()")); |
|
698 TInt result = KErrNone; |
|
699 |
|
700 //IMPORT_C TInt CommandType() const; |
|
701 TInt commandType = aCommand.CommandType(); |
|
702 |
|
703 if( commandType == TSmsCommandType::ESmsCommandTypeEnableStatusReportRequest) |
|
704 { |
|
705 aLog->Log(_L("CommandType() completed")); |
|
706 aLog->Log(_L("Result data:Command Type: %d"), commandType); |
|
707 aLog->Log(_L("Get command Type == PASS")); |
|
708 } |
|
709 else |
|
710 { |
|
711 result = KErrGeneral; |
|
712 aLog->Log(_L("Get command Type == FAIL")); |
|
713 } |
|
714 |
|
715 return result; |
|
716 } |
|
717 |
|
718 // ----------------------------------------------------------------------------- |
|
719 // TestSetCommandType |
|
720 // Sets the Command Type |
|
721 // ----------------------------------------------------------------------------- |
|
722 // |
|
723 LOCAL_C TInt TestSetCommandType( CStifLogger* aLog, CSmsCommand& aCommand) |
|
724 { |
|
725 aLog->Log(_L("---------------------------------------------")); |
|
726 aLog->Log(_L("Calling SetCommandType()")); |
|
727 TInt result = KErrNone; |
|
728 |
|
729 TSmsCommandType::TSmsCommandTypeValue commandType = TSmsCommandType::ESmsCommandTypeEnableStatusReportRequest; |
|
730 //IMPORT_C void SetCommandType(TSmsCommandType::TSmsCommandTypeValue aCommandType); |
|
731 aCommand.SetCommandType( commandType ); |
|
732 |
|
733 aLog->Log(_L("SetCommandType() completed")); |
|
734 aLog->Log(_L("Command type successfully stored")); |
|
735 aLog->Log(_L("Set command Type == PASS")); |
|
736 return result; |
|
737 } |
|
738 |
|
739 |
|
740 //---------------------------------------------------------------------------- |
|
741 // TestInformationElement |
|
742 // Gets an Information Element |
|
743 // ----------------------------------------------------------------------------- |
|
744 // |
|
745 LOCAL_C TInt TestInformationElement( CStifLogger* aLog, CSmsCommand& aCommand) |
|
746 { |
|
747 aLog->Log(_L("---------------------------------------------")); |
|
748 aLog->Log(_L("Calling InformationElement()")); |
|
749 TInt result = KErrNone; |
|
750 |
|
751 TInt index = 0; |
|
752 //IMPORT_C CSmsInformationElement& InformationElement(TInt aIndex) const; |
|
753 CSmsInformationElement& element = aCommand.InformationElement(index); |
|
754 |
|
755 aLog->Log(_L("InformationElement() completed")); |
|
756 aLog->Log(_L("Information element successfully fetched")); |
|
757 aLog->Log(_L("Get information element == PASS")); |
|
758 |
|
759 return result; |
|
760 } |
|
761 |
|
762 // ----------------------------------------------------------------------------- |
|
763 // TestInformationElementIndex |
|
764 // Gets index of a specified Information Element. |
|
765 // ----------------------------------------------------------------------------- |
|
766 // |
|
767 LOCAL_C TInt TestInformationElementIndex( CStifLogger* aLog, CSmsCommand& aCommand) |
|
768 { |
|
769 aLog->Log(_L("---------------------------------------------")); |
|
770 aLog->Log(_L("Calling InformationElementIndex()")); |
|
771 TInt result = KErrNone; |
|
772 |
|
773 CSmsInformationElement::TSmsInformationElementIdentifier identifier = CSmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference;; |
|
774 TInt index; |
|
775 //IMPORT_C TBool InformationElementIndex(CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier, |
|
776 // TInt& aIndex) const; |
|
777 TInt length = aCommand.InformationElementIndex(identifier, index); |
|
778 |
|
779 aLog->Log(_L("InformationElementIndex() completed")); |
|
780 aLog->Log(_L("Information element index successfully fetched")); |
|
781 aLog->Log(_L("Get information element index == PASS")); |
|
782 return result; |
|
783 } |
|
784 |
|
785 // ----------------------------------------------------------------------------- |
|
786 // TestGetMessageNumber |
|
787 // Gets the Message Number |
|
788 // ----------------------------------------------------------------------------- |
|
789 // |
|
790 LOCAL_C TInt TestGetMessageNumber( CStifLogger* aLog, CSmsCommand& aCommand) |
|
791 { |
|
792 aLog->Log(_L("---------------------------------------------")); |
|
793 aLog->Log(_L("Calling MessageNumber()")); |
|
794 TInt result = KErrNone; |
|
795 |
|
796 //IMPORT_C TInt MessageNumber() const; |
|
797 TInt number = aCommand.MessageNumber(); |
|
798 |
|
799 if( number == 1 ) |
|
800 { |
|
801 aLog->Log(_L("MessageNumber() completed")); |
|
802 aLog->Log(_L("Result data:Message number: %d"),number); |
|
803 aLog->Log(_L("Get message number == PASS")); |
|
804 } |
|
805 else |
|
806 { |
|
807 result = KErrGeneral; |
|
808 aLog->Log(_L("Get message number == FAIL")); |
|
809 } |
|
810 |
|
811 return result; |
|
812 } |
|
813 |
|
814 // ----------------------------------------------------------------------------- |
|
815 // TestSetMessageNumber |
|
816 // Sets the Message Number |
|
817 // ----------------------------------------------------------------------------- |
|
818 // |
|
819 LOCAL_C TInt TestSetMessageNumber( CStifLogger* aLog, CSmsCommand& aCommand) |
|
820 { |
|
821 aLog->Log(_L("---------------------------------------------")); |
|
822 aLog->Log(_L("Calling SetMessageNumber()")); |
|
823 TInt result = KErrNone; |
|
824 |
|
825 TInt number = 1; |
|
826 //IMPORT_C void SetMessageNumber(TInt aMessageNumber); |
|
827 aCommand.SetMessageNumber(number); |
|
828 |
|
829 aLog->Log(_L("SetMessageNumber() completed")); |
|
830 aLog->Log(_L("Message number successfully stored")); |
|
831 aLog->Log(_L("Set Message Number == PASS")); |
|
832 |
|
833 return result; |
|
834 } |
|
835 |
|
836 // ----------------------------------------------------------------------------- |
|
837 // TestGetMessageReference |
|
838 // Gets the Message Reference |
|
839 // ----------------------------------------------------------------------------- |
|
840 // |
|
841 LOCAL_C TInt TestGetMessageReference( CStifLogger* aLog, CSmsCommand& aCommand) |
|
842 { |
|
843 aLog->Log(_L("---------------------------------------------")); |
|
844 aLog->Log(_L("Calling MessageReference()")); |
|
845 TInt result = KErrNone; |
|
846 |
|
847 //IMPORT_C TInt MessageReference() const; |
|
848 TInt getRef = aCommand.MessageReference(); |
|
849 |
|
850 if( getRef == 1 ) |
|
851 { |
|
852 aLog->Log(_L("MessageReference() Completed")); |
|
853 aLog->Log(_L("result data:Message reference: %d"), getRef); |
|
854 aLog->Log(_L("Get Message Reference == PASS")); |
|
855 } |
|
856 else |
|
857 { |
|
858 result = KErrGeneral; |
|
859 aLog->Log(_L("Get Message Reference == FAIL")); |
|
860 } |
|
861 |
|
862 return result; |
|
863 } |
|
864 |
|
865 // ----------------------------------------------------------------------------- |
|
866 // TestSetMessageReference |
|
867 // Sets the Message Reference |
|
868 // ----------------------------------------------------------------------------- |
|
869 // |
|
870 LOCAL_C TInt TestSetMessageReference( CStifLogger* aLog, CSmsCommand& aCommand) |
|
871 { |
|
872 aLog->Log(_L("---------------------------------------------")); |
|
873 aLog->Log(_L("Calling SetMessageReference()")); |
|
874 TInt result = KErrNone; |
|
875 |
|
876 TInt setRef = 1; |
|
877 //IMPORT_C void SetMessageReference(TInt aMessageReference); |
|
878 aCommand.SetMessageReference(setRef); |
|
879 |
|
880 aLog->Log(_L("SetMessageReference() Completed")); |
|
881 aLog->Log(_L("Message reference successfully stored")); |
|
882 aLog->Log(_L("Set Message Reference == PASS")); |
|
883 |
|
884 return result; |
|
885 } |
|
886 |
|
887 // ----------------------------------------------------------------------------- |
|
888 // TestNumInformationElements |
|
889 // Gets the number of Information Elements in the User Data |
|
890 // ----------------------------------------------------------------------------- |
|
891 // |
|
892 LOCAL_C TInt TestNumInformationElements( CStifLogger* aLog, CSmsCommand& aCommand) |
|
893 { |
|
894 aLog->Log(_L("---------------------------------------------")); |
|
895 aLog->Log(_L("Calling NumInformationElements()")); |
|
896 TInt result = KErrNone; |
|
897 |
|
898 //IMPORT_C TInt NumInformationElements() const; |
|
899 TInt numElements = aCommand.NumInformationElements(); |
|
900 |
|
901 aLog->Log(_L("NumInformationElements() Completed")); |
|
902 aLog->Log(_L("result data: Number of elements: %d"), numElements); |
|
903 aLog->Log(_L("Get Number Of Information Elements == PASS")); |
|
904 |
|
905 return result; |
|
906 } |
|
907 |
|
908 |
|
909 // ----------------------------------------------------------------------------- |
|
910 // TestGetStatusReportRequest |
|
911 // Gets Status Report Request flag |
|
912 // ----------------------------------------------------------------------------- |
|
913 // |
|
914 LOCAL_C TInt TestGetStatusReportRequest( CStifLogger* aLog, CSmsCommand& aCommand) |
|
915 { |
|
916 aLog->Log(_L("---------------------------------------------")); |
|
917 aLog->Log(_L("Calling StatusReportRequest()")); |
|
918 TInt result = KErrNone; |
|
919 |
|
920 //IMPORT_C TBool StatusReportRequest() const; |
|
921 TBool reportReq = aCommand.StatusReportRequest(); |
|
922 |
|
923 if( reportReq ) |
|
924 { |
|
925 aLog->Log(_L("SetStatusReportRequest() completed")); |
|
926 aLog->Log(_L("Status report request flag successfully fetched")); |
|
927 aLog->Log(_L("Get status report request == PASS")); |
|
928 } |
|
929 else |
|
930 { |
|
931 result = KErrGeneral; |
|
932 aLog->Log(_L("Get status report request == FAIL")); |
|
933 } |
|
934 |
|
935 return result; |
|
936 } |
|
937 |
|
938 // ----------------------------------------------------------------------------- |
|
939 // TestSetStatusReportRequest |
|
940 // Externalises the object. |
|
941 // ----------------------------------------------------------------------------- |
|
942 // |
|
943 LOCAL_C TInt TestSetStatusReportRequest( CStifLogger* aLog, CSmsCommand& aCommand) |
|
944 { |
|
945 aLog->Log(_L("---------------------------------------------")); |
|
946 aLog->Log(_L("Calling SetStatusReportRequest()")); |
|
947 TInt result = KErrNone; |
|
948 |
|
949 TBool reportReq = ETrue; |
|
950 //IMPORT_C void SetStatusReportRequest(TBool aRequest); |
|
951 aCommand.SetStatusReportRequest(reportReq); |
|
952 |
|
953 aLog->Log(_L("SetStatusReportRequest() completed")); |
|
954 aLog->Log(_L("Status report request flag successfully stored")); |
|
955 aLog->Log(_L("Set status report request == PASS")); |
|
956 |
|
957 return result; |
|
958 } |
|
959 |
|
960 // ----------------------------------------------------------------------------- |
|
961 // TestSetCommandData |
|
962 // Sets the Command Data |
|
963 // ----------------------------------------------------------------------------- |
|
964 // |
|
965 LOCAL_C TInt TestSetCommandData( CStifLogger* aLog, CSmsCommand& aCommand) |
|
966 { |
|
967 aLog->Log(_L("---------------------------------------------")); |
|
968 aLog->Log(_L("Calling SetCommandDataL()")); |
|
969 |
|
970 TBufC8<24> commandData(KTestCommandData8); |
|
971 //IMPORT_C void SetCommandDataL(const TDesC8& aData); |
|
972 TRAPD( result, aCommand.SetCommandDataL(commandData)); |
|
973 |
|
974 if( result == KErrNone ) |
|
975 { |
|
976 aLog->Log(_L("SetCommandDataL() completed")); |
|
977 aLog->Log(_L("Command data successfully stored")); |
|
978 aLog->Log(_L("Set command data == PASS")); |
|
979 } |
|
980 else |
|
981 aLog->Log(_L("Set command data == FAIL")); |
|
982 |
|
983 return result; |
|
984 } |
|
985 // ----------------------------------------------------------------------------- |
|
986 // TestSmsCommandDuplicateL |
|
987 // Creates a copy of the object |
|
988 // ----------------------------------------------------------------------------- |
|
989 // |
|
990 LOCAL_C TInt TestSmsCommandDuplicateL( CStifLogger* aLog, CSmsCommand& aCommand) |
|
991 { |
|
992 aLog->Log(_L("---------------------------------------------")); |
|
993 aLog->Log(_L("Calling SmsCommandDuplicateL()")); |
|
994 |
|
995 TInt result = KErrNone; |
|
996 |
|
997 CSmsCommand* dupObj = aCommand.DuplicateL(); |
|
998 |
|
999 if( dupObj ) |
|
1000 { |
|
1001 aLog->Log(_L("TestSmsCommandDuplicateL() completed")); |
|
1002 aLog->Log(_L("Object successfully created")); |
|
1003 aLog->Log(_L("SmsCommandDuplicateL == PASS")); |
|
1004 |
|
1005 } |
|
1006 else |
|
1007 { |
|
1008 result = KErrGeneral; |
|
1009 aLog->Log(_L("SmsCommandDuplicateL == FAIL")); |
|
1010 } |
|
1011 return result; |
|
1012 } |
|
1013 |
|
1014 // ----------------------------------------------------------------------------- |
|
1015 // TestSetMoreMessagesToSend |
|
1016 // |
|
1017 // ----------------------------------------------------------------------------- |
|
1018 LOCAL_C TInt TestSetMoreMessagesToSend( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1019 { |
|
1020 aLog->Log(_L("---------------------------------------------")); |
|
1021 aLog->Log(_L("Calling SetMoreMessagesToSend()")); |
|
1022 TInt result = KErrNone; |
|
1023 |
|
1024 //void SetMoreMessagesToSend(TBool aMore); |
|
1025 aDeliver.SetMoreMessagesToSend(EFalse); |
|
1026 |
|
1027 aLog->Log(_L("SetMoreMessagesToSend() Completed")); |
|
1028 aLog->Log(_L("More messages to send - flag successfully stored")); |
|
1029 aLog->Log(_L("Set more messages to send == PASS")); |
|
1030 |
|
1031 return result; |
|
1032 } |
|
1033 |
|
1034 // ----------------------------------------------------------------------------- |
|
1035 // TestGetMoreMessagesToSend |
|
1036 // |
|
1037 // ----------------------------------------------------------------------------- |
|
1038 LOCAL_C TInt TestGetMoreMessagesToSend( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1039 { |
|
1040 aLog->Log(_L("---------------------------------------------")); |
|
1041 aLog->Log(_L("Calling MoreMessagesToSend()")); |
|
1042 TInt result = KErrNone; |
|
1043 |
|
1044 //TBool MoreMessagesToSend() const; |
|
1045 TBool msgs = aDeliver.MoreMessagesToSend(); |
|
1046 |
|
1047 if( msgs == EFalse) |
|
1048 { |
|
1049 aLog->Log(_L("MoreMessagesToSend() Completed")); |
|
1050 aLog->Log(_L("Result Data:More messages to send flag: %d"), msgs); |
|
1051 aLog->Log(_L("Get more messages to send == PASS")); |
|
1052 } |
|
1053 else |
|
1054 { |
|
1055 result =KErrGeneral; |
|
1056 aLog->Log(_L("Get more messages to send == PASS")); |
|
1057 } |
|
1058 |
|
1059 return result; |
|
1060 } |
|
1061 |
|
1062 // ----------------------------------------------------------------------------- |
|
1063 // TestSetReplyPath |
|
1064 // Sets Reply Path flag |
|
1065 // ----------------------------------------------------------------------------- |
|
1066 LOCAL_C TInt TestSetReplyPath( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1067 { |
|
1068 aLog->Log(_L("---------------------------------------------")); |
|
1069 aLog->Log(_L("Calling SetReplyPath()")); |
|
1070 TInt result = KErrNone; |
|
1071 |
|
1072 //void SetReplyPath(TBool aReplyPath); |
|
1073 aDeliver.SetReplyPath(EFalse); |
|
1074 |
|
1075 aLog->Log(_L("SetReplyPath() completed")); |
|
1076 aLog->Log(_L("Reply path - flag successfully stored")); |
|
1077 aLog->Log(_L("Set reply path == PASS")); |
|
1078 |
|
1079 return result; |
|
1080 } |
|
1081 |
|
1082 // ----------------------------------------------------------------------------- |
|
1083 // TestGetReplyPath |
|
1084 // Gets Reply Path flag |
|
1085 // If a Reply Path exists, the recipient of the SMS can reply using the same |
|
1086 // service center address |
|
1087 // ----------------------------------------------------------------------------- |
|
1088 LOCAL_C TInt TestGetReplyPath( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1089 { |
|
1090 aLog->Log(_L("---------------------------------------------")); |
|
1091 aLog->Log(_L("Calling ReplyPath()")); |
|
1092 TInt result = KErrNone; |
|
1093 |
|
1094 //TBool ReplyPath() const; |
|
1095 TBool path = aDeliver.ReplyPath(); |
|
1096 |
|
1097 if(path == EFalse) |
|
1098 { |
|
1099 aLog->Log(_L("ReplyPath() Completed")); |
|
1100 aLog->Log(_L("Result data:Reply path flag: %d "), path); |
|
1101 aLog->Log(_L("Get reply path == PASS")); |
|
1102 } |
|
1103 else |
|
1104 { |
|
1105 result = KErrGeneral; |
|
1106 aLog->Log(_L("Get reply path == FAIL")); |
|
1107 } |
|
1108 |
|
1109 return result; |
|
1110 } |
|
1111 |
|
1112 // ----------------------------------------------------------------------------- |
|
1113 // TestSetStatusReportIndication |
|
1114 // ----------------------------------------------------------------------------- |
|
1115 LOCAL_C TInt TestSetStatusReportIndication( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1116 { |
|
1117 aLog->Log(_L("---------------------------------------------")); |
|
1118 aLog->Log(_L("Calling SetStatusReportIndication()")); |
|
1119 TInt result = KErrNone; |
|
1120 |
|
1121 //void SetStatusReportIndication(TBool aIndication); |
|
1122 aDeliver.SetStatusReportIndication(ETrue); |
|
1123 |
|
1124 aLog->Log(_L("SetStatusReportIndication() Completed")); |
|
1125 aLog->Log(_L("Status report flag successfully stored")); |
|
1126 aLog->Log(_L("Set status report indication == PASS")); |
|
1127 |
|
1128 return result; |
|
1129 } |
|
1130 |
|
1131 // ----------------------------------------------------------------------------- |
|
1132 // TestGetStatusReportIndication |
|
1133 // ----------------------------------------------------------------------------- |
|
1134 LOCAL_C TInt TestGetStatusReportIndication( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1135 { |
|
1136 aLog->Log(_L("---------------------------------------------")); |
|
1137 aLog->Log(_L("Calling StatusReportIndication()")); |
|
1138 TInt result = KErrNone; |
|
1139 |
|
1140 //TBool StatusReportIndication() const; |
|
1141 TBool indication = aDeliver.StatusReportIndication(); |
|
1142 |
|
1143 if( indication ) |
|
1144 { |
|
1145 aLog->Log(_L("StatusReportIndication() Completed")); |
|
1146 aLog->Log(_L("Result data:Status report flag: %d "), indication); |
|
1147 aLog->Log(_L("Get status report indication == PASS")); |
|
1148 } |
|
1149 else |
|
1150 { |
|
1151 result = KErrGeneral; |
|
1152 aLog->Log(_L("Get status report indication == FAIL")); |
|
1153 } |
|
1154 |
|
1155 return result; |
|
1156 } |
|
1157 |
|
1158 // ----------------------------------------------------------------------------- |
|
1159 // TestSetServiceCenterTimeStamp |
|
1160 // ----------------------------------------------------------------------------- |
|
1161 LOCAL_C TInt TestSetServiceCenterTimeStamp( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1162 { |
|
1163 aLog->Log(_L("---------------------------------------------")); |
|
1164 aLog->Log(_L("Calling SetServiceCenterTimeStamp()")); |
|
1165 TInt result = KErrNone; |
|
1166 |
|
1167 const TTime time(TDateTime(2006,EJanuary,01,12,0,0,0)); |
|
1168 //void SetServiceCenterTimeStamp(const TTime& aTime,TInt aNumQuarterHours=0) |
|
1169 aDeliver.SetServiceCenterTimeStamp(time); |
|
1170 |
|
1171 aLog->Log(_L("SetServiceCenterTimeStamp() Completed")); |
|
1172 aLog->Log(_L("Time stamp successfully stored")); |
|
1173 aLog->Log(_L("Set service center time stamp == PASS")); |
|
1174 |
|
1175 return result; |
|
1176 } |
|
1177 |
|
1178 // ----------------------------------------------------------------------------- |
|
1179 // TestGetServiceCenterTimeStamp |
|
1180 // ----------------------------------------------------------------------------- |
|
1181 LOCAL_C TInt TestGetServiceCenterTimeStampL( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1182 { |
|
1183 aLog->Log(_L("---------------------------------------------")); |
|
1184 aLog->Log(_L("Calling ServiceCenterTimeStamp()")); |
|
1185 TInt result = KErrNone; |
|
1186 |
|
1187 TBuf<30> string; |
|
1188 _LIT( KFormat, "%*E%*D%X%*N%*Y %1 %2 '%3 %H%:1%T%:2%S"); |
|
1189 TTime setTime(TDateTime(2006,EJanuary,01,12,0,0,0)); |
|
1190 TTime getTime; |
|
1191 TInt numQuarterHrs; |
|
1192 //void ServiceCenterTimeStamp(TTime& aTime,TInt& aNumQuarterHours); |
|
1193 aDeliver.ServiceCenterTimeStamp(getTime, numQuarterHrs); |
|
1194 |
|
1195 if( getTime == setTime ) |
|
1196 { |
|
1197 getTime.FormatL(string, KFormat); |
|
1198 aLog->Log(_L("ServiceCenterTimeStamp() Completed")); |
|
1199 aLog->Log(_L("Result data:Time stamp: %S"), &string); |
|
1200 //aLog->Log(_L("Time zone difference: %d"), ); |
|
1201 aLog->Log(_L("Get service center time stamp == PASS")); |
|
1202 } |
|
1203 else |
|
1204 { |
|
1205 result = KErrGeneral; |
|
1206 aLog->Log(_L("Get service center time stamp == FAIL")); |
|
1207 } |
|
1208 |
|
1209 return result; |
|
1210 } |
|
1211 |
|
1212 // ----------------------------------------------------------------------------- |
|
1213 // TestGetProtocolIdentifier |
|
1214 // ----------------------------------------------------------------------------- |
|
1215 LOCAL_C TInt TestGetProtocolIdentifier( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1216 { |
|
1217 aLog->Log(_L("---------------------------------------------")); |
|
1218 aLog->Log(_L("Calling ProtocolIdentifier()")); |
|
1219 TInt result = KErrNone; |
|
1220 |
|
1221 //const TSmsProtocolIdentifier* ProtocolIdentifier() const; |
|
1222 const TSmsProtocolIdentifier* id = aDeliver.ProtocolIdentifier(); |
|
1223 |
|
1224 aLog->Log(_L("ProtocolIdentifier() Completed")); |
|
1225 aLog->Log(_L("Result data:Protocol identifier: %d"), id->operator TInt()); |
|
1226 aLog->Log(_L("Get protocol identifier == PASS")); |
|
1227 |
|
1228 return result; |
|
1229 } |
|
1230 |
|
1231 // ----------------------------------------------------------------------------- |
|
1232 // TestSmsDeliverDuplicateL |
|
1233 // Creates a copy of the object |
|
1234 // ----------------------------------------------------------------------------- |
|
1235 // |
|
1236 LOCAL_C TInt TestSmsDeliverDuplicateL( CStifLogger* aLog, CSmsDeliver& aDeliver) |
|
1237 { |
|
1238 aLog->Log(_L("---------------------------------------------")); |
|
1239 aLog->Log(_L("Calling SmsDeliverDuplicateL()")); |
|
1240 |
|
1241 TInt result = KErrNone; |
|
1242 |
|
1243 CSmsDeliver* dupObj = aDeliver.DuplicateL(); |
|
1244 |
|
1245 if( dupObj ) |
|
1246 { |
|
1247 aLog->Log(_L("TestSmsDeliverDuplicateL() completed")); |
|
1248 aLog->Log(_L("Object successfully created")); |
|
1249 aLog->Log(_L("SmsDeliverDuplicateL == PASS")); |
|
1250 |
|
1251 } |
|
1252 else |
|
1253 { |
|
1254 result = KErrGeneral; |
|
1255 aLog->Log(_L("SmsDeliverDuplicateL == FAIL")); |
|
1256 } |
|
1257 return result; |
|
1258 } |
|
1259 |
|
1260 // ----------------------------------------------------------------------------- |
|
1261 // TestGetIsRPError |
|
1262 // Gets the Reply Path Error flag |
|
1263 // ----------------------------------------------------------------------------- |
|
1264 LOCAL_C TInt TestGetIsRPError (CStifLogger* aLog, CSmsDeliverReport& aDeliverReport) |
|
1265 { |
|
1266 aLog->Log( _L("--------------------------------------------------------")); |
|
1267 aLog->Log( _L("Calling IsRPError()")); |
|
1268 |
|
1269 TInt result = KErrNone; |
|
1270 |
|
1271 // TBool IsRPError() const |
|
1272 TBool checkres = aDeliverReport.IsRPError(); |
|
1273 |
|
1274 if( checkres ) |
|
1275 { |
|
1276 aLog->Log( _L("IsRPError() completed")); |
|
1277 aLog->Log(_L("Result data:is RP error flag: %d"),checkres); |
|
1278 aLog->Log( _L("Get is RP error == PASS")); |
|
1279 } |
|
1280 else |
|
1281 aLog->Log( _L("Get is RP error == FAIL")); |
|
1282 |
|
1283 return result; |
|
1284 } |
|
1285 |
|
1286 |
|
1287 // ----------------------------------------------------------------------------- |
|
1288 // TestSetIsRPError |
|
1289 // Gets the Reply Path Error flag |
|
1290 // ----------------------------------------------------------------------------- |
|
1291 LOCAL_C TInt TestSetIsRPError (CStifLogger* aLog, CSmsDeliverReport& aDeliverReport) |
|
1292 { |
|
1293 aLog->Log( _L("--------------------------------------------------------")); |
|
1294 aLog->Log( _L("Calling SetIsRPError()")); |
|
1295 |
|
1296 TInt result = KErrNone; |
|
1297 TBool tempVar = ETrue; |
|
1298 |
|
1299 // inline void SetIsRPError(TBool aIsRPError) |
|
1300 aDeliverReport.SetIsRPError (tempVar); |
|
1301 |
|
1302 aLog->Log( _L("SetIsRPError() completed")); |
|
1303 aLog->Log( _L("Is RP error flag stored successfully")); |
|
1304 aLog->Log( _L("Set is RP error == PASS")); |
|
1305 |
|
1306 return result; |
|
1307 } |
|
1308 |
|
1309 |
|
1310 // ----------------------------------------------------------------------------- |
|
1311 // TestGetFailureCause |
|
1312 // Gets the Failure Cause |
|
1313 // ----------------------------------------------------------------------------- |
|
1314 LOCAL_C TInt TestGetFailureCause (CStifLogger* aLog, CSmsDeliverReport& aDeliverReport) |
|
1315 { |
|
1316 aLog->Log( _L("--------------------------------------------------------")); |
|
1317 aLog->Log( _L("Calling FailureCause()")); |
|
1318 |
|
1319 TInt result = KErrNone; |
|
1320 |
|
1321 // IMPORT_C TInt FailureCause() const |
|
1322 TInt checkres = aDeliverReport.FailureCause (); |
|
1323 |
|
1324 if(checkres == TSmsFailureCause::ESmsPIDErrorCannotReplaceShortMessage) |
|
1325 { |
|
1326 aLog->Log( _L("FailureCause() completed")); |
|
1327 _LIT(tempVal,"result data:failure cause: %d"); |
|
1328 aLog->Log(tempVal,checkres); |
|
1329 aLog->Log( _L("Get failure cause == PASS")); |
|
1330 } |
|
1331 else |
|
1332 aLog->Log( _L("Get failure cause == FAIL")); |
|
1333 |
|
1334 return result; |
|
1335 } |
|
1336 |
|
1337 |
|
1338 // ----------------------------------------------------------------------------- |
|
1339 // TestSetFailureCause |
|
1340 // Sets the Failure Cause |
|
1341 // ----------------------------------------------------------------------------- |
|
1342 LOCAL_C TInt TestSetFailureCause (CStifLogger* aLog, CSmsDeliverReport& aDeliverReport) |
|
1343 { |
|
1344 aLog->Log( _L("--------------------------------------------------------")); |
|
1345 aLog->Log( _L("Calling SetFailureCause()")); |
|
1346 |
|
1347 TInt result = KErrNone; |
|
1348 TSmsFailureCause::TSmsFailureCauseError aFailureCause = |
|
1349 TSmsFailureCause::ESmsPIDErrorCannotReplaceShortMessage; |
|
1350 |
|
1351 // IMPORT_C void SetFailureCause |
|
1352 // (TSmsFailureCause::TSmsFailureCauseError aFailureCause) |
|
1353 aDeliverReport.SetFailureCause (aFailureCause); |
|
1354 |
|
1355 if(result == KErrNone) |
|
1356 { |
|
1357 aLog->Log( _L("SetFailureCause() completed")); |
|
1358 aLog->Log( _L("Failure cause stored successfully")); |
|
1359 aLog->Log( _L("Set failure cause == PASS")); |
|
1360 } |
|
1361 else |
|
1362 aLog->Log( _L("Set failure cause == FAIL")); |
|
1363 |
|
1364 return result; |
|
1365 } |
|
1366 |
|
1367 // ----------------------------------------------------------------------------- |
|
1368 // TestSmsDeliverReportDuplicateL |
|
1369 // Creates a copy of the object |
|
1370 // ----------------------------------------------------------------------------- |
|
1371 // |
|
1372 LOCAL_C TInt TestSmsDeliverReportDuplicateL( CStifLogger* aLog, CSmsDeliverReport& aDeliverReport) |
|
1373 { |
|
1374 aLog->Log(_L("---------------------------------------------")); |
|
1375 aLog->Log(_L("Calling SmsDeliverReportDuplicateL()")); |
|
1376 |
|
1377 TInt result = KErrNone; |
|
1378 |
|
1379 CSmsDeliverReport* dupObj = aDeliverReport.DuplicateL(); |
|
1380 |
|
1381 if( dupObj ) |
|
1382 { |
|
1383 aLog->Log(_L("TestSmsDeliverReportDuplicateL() completed")); |
|
1384 aLog->Log(_L("Object successfully created")); |
|
1385 aLog->Log(_L("SmsDeliverReportDuplicateL == PASS")); |
|
1386 |
|
1387 } |
|
1388 else |
|
1389 { |
|
1390 result = KErrGeneral; |
|
1391 aLog->Log(_L("SmsDeliverReportDuplicateL == FAIL")); |
|
1392 } |
|
1393 return result; |
|
1394 } |
|
1395 |
|
1396 // ----------------------------------------------------------------------------- |
|
1397 // TestDelete |
|
1398 // Deletes data from the buffer |
|
1399 // ----------------------------------------------------------------------------- |
|
1400 // |
|
1401 LOCAL_C TInt TestDelete( CStifLogger* aLog, CSmsEditorBuffer& aBuffer) |
|
1402 { |
|
1403 aLog->Log(_L("---------------------------------------------")); |
|
1404 aLog->Log(_L("Calling DeleteL()")); |
|
1405 |
|
1406 TInt position = 2; |
|
1407 TInt length = 2; |
|
1408 //IMPORT_C void DeleteL(TInt aPos,TInt aLength); |
|
1409 TRAPD( result, aBuffer.DeleteL( position, length)); |
|
1410 |
|
1411 if( result == KErrNone ) |
|
1412 { |
|
1413 aLog->Log(_L("DeleteL() Completed")); |
|
1414 aLog->Log(_L("Data successfully deleted")); |
|
1415 aLog->Log(_L("Delete == PASS")); |
|
1416 } |
|
1417 else |
|
1418 aLog->Log(_L("Delete == FAIL")); |
|
1419 |
|
1420 return result; |
|
1421 } |
|
1422 |
|
1423 // ----------------------------------------------------------------------------- |
|
1424 // TestReset |
|
1425 // Resets the buffer |
|
1426 // ----------------------------------------------------------------------------- |
|
1427 // |
|
1428 LOCAL_C TInt TestReset( CStifLogger* aLog, CSmsEditorBuffer& aBuffer) |
|
1429 { |
|
1430 aLog->Log(_L("---------------------------------------------")); |
|
1431 aLog->Log(_L("Calling Reset()")); |
|
1432 TInt result = KErrNone; |
|
1433 |
|
1434 //IMPORT_C void Reset(); |
|
1435 aBuffer.Reset(); |
|
1436 |
|
1437 aLog->Log(_L("Reset() Completed")); |
|
1438 aLog->Log(_L("Data successfully reseted")); |
|
1439 aLog->Log(_L("Reset == PASS")); |
|
1440 return result; |
|
1441 } |
|
1442 |
|
1443 // ----------------------------------------------------------------------------- |
|
1444 // TestExtract |
|
1445 // Extracts buffer data to a descriptor |
|
1446 // ----------------------------------------------------------------------------- |
|
1447 // |
|
1448 LOCAL_C TInt TestExtract( CStifLogger* aLog, CSmsEditorBuffer& aBuffer) |
|
1449 { |
|
1450 aLog->Log(_L("---------------------------------------------")); |
|
1451 aLog->Log(_L("Calling Extract()")); |
|
1452 TInt result = KErrNone; |
|
1453 |
|
1454 TBuf<24> buffer; |
|
1455 TInt position = 2; |
|
1456 TInt length = 6; |
|
1457 //IMPORT_C void Extract(TDes& aBuf,TInt aPos,TInt aLength) const; |
|
1458 aBuffer.Extract(buffer, position, length); |
|
1459 |
|
1460 aLog->Log(_L("Extract() Completed")); |
|
1461 aLog->Log(_L("Data successfully extracted")); |
|
1462 aLog->Log(_L("Extract == PASS")); |
|
1463 return result; |
|
1464 } |
|
1465 |
|
1466 // ----------------------------------------------------------------------------- |
|
1467 // TestInsert |
|
1468 // Inserts data into the buffer |
|
1469 // ----------------------------------------------------------------------------- |
|
1470 // |
|
1471 LOCAL_C TInt TestInsert( CStifLogger* aLog, CSmsEditorBuffer& aBuffer) |
|
1472 { |
|
1473 aLog->Log(_L("---------------------------------------------")); |
|
1474 aLog->Log(_L("Calling InsertL()")); |
|
1475 |
|
1476 TBufC<24> buffer(KTestBuffer1); |
|
1477 TInt position = 0; |
|
1478 //IMPORT_C void InsertL(TInt aPos,const TDesC& aBuf); |
|
1479 TRAPD( result, aBuffer.InsertL(position, buffer)); |
|
1480 |
|
1481 if( result == KErrNone ) |
|
1482 { |
|
1483 aLog->Log(_L("InsertL() Completed")); |
|
1484 aLog->Log(_L("Data successfully Inserted")); |
|
1485 aLog->Log(_L("Delete == PASS")); |
|
1486 } |
|
1487 else |
|
1488 aLog->Log(_L("Delete == FAIL")); |
|
1489 |
|
1490 return result; |
|
1491 } |
|
1492 |
|
1493 // ----------------------------------------------------------------------------- |
|
1494 // TestGetLength |
|
1495 // Gets the amount of space currently used in the buffer. |
|
1496 // ----------------------------------------------------------------------------- |
|
1497 // |
|
1498 LOCAL_C TInt TestGetLength( CStifLogger* aLog, CSmsEditorBuffer& aBuffer) |
|
1499 { |
|
1500 aLog->Log(_L("---------------------------------------------")); |
|
1501 aLog->Log(_L("Calling Length()")); |
|
1502 TInt result = KErrNone; |
|
1503 |
|
1504 //IMPORT_C TInt Length() const; |
|
1505 TInt length = aBuffer.Length(); |
|
1506 |
|
1507 if(length == 22) |
|
1508 { |
|
1509 aLog->Log(_L("Length() Completed")); |
|
1510 aLog->Log(_L("Result data: Length: %d"), length); |
|
1511 aLog->Log(_L("Length == PASS")); |
|
1512 } |
|
1513 else |
|
1514 { |
|
1515 result = KErrGeneral; |
|
1516 aLog->Log(_L("Length == FAIL")); |
|
1517 } |
|
1518 |
|
1519 return result; |
|
1520 } |
|
1521 |
|
1522 // ----------------------------------------------------------------------------- |
|
1523 // TestGetIdentifier |
|
1524 // |
|
1525 // ----------------------------------------------------------------------------- |
|
1526 LOCAL_C TInt TestGetIdentifier( CStifLogger* aLog, CSmsInformationElement& aElement) |
|
1527 { |
|
1528 aLog->Log(_L("---------------------------------------------")); |
|
1529 aLog->Log(_L("Calling Identifier()")); |
|
1530 TInt result = KErrNone; |
|
1531 |
|
1532 //TSmsInformationElementIdentifier Identifier() const; |
|
1533 CSmsInformationElement::TSmsInformationElementIdentifier id = aElement.Identifier(); |
|
1534 |
|
1535 aLog->Log(_L("Identifier() Completed")); |
|
1536 aLog->Log(_L("Result data: Identifier: %d"),id); |
|
1537 aLog->Log(_L("Get identifier == PASS")); |
|
1538 |
|
1539 return result; |
|
1540 } |
|
1541 |
|
1542 // ----------------------------------------------------------------------------- |
|
1543 // TestGetDataTPtr8 |
|
1544 // |
|
1545 // ----------------------------------------------------------------------------- |
|
1546 LOCAL_C TInt TestGetDataTPtr8( CStifLogger* aLog, CSmsInformationElement& aElement) |
|
1547 { |
|
1548 aLog->Log(_L("---------------------------------------------")); |
|
1549 aLog->Log(_L("Calling TPtr8 Data()")); |
|
1550 TInt result = KErrNone; |
|
1551 |
|
1552 //TPtr8 Data(); |
|
1553 TPtr8 data = aElement.Data(); |
|
1554 |
|
1555 aLog->Log(_L("TPtr8 Data() Completed")); |
|
1556 aLog->Log(_L("Result data: Data: %s"), data.Ptr()); |
|
1557 aLog->Log(_L("Get data (TPtr8) == PASS")); |
|
1558 |
|
1559 return result; |
|
1560 } |
|
1561 |
|
1562 // ----------------------------------------------------------------------------- |
|
1563 // TestGetDataTDesC8 |
|
1564 // |
|
1565 // ----------------------------------------------------------------------------- |
|
1566 LOCAL_C TInt TestGetDataTDesC8( CStifLogger* aLog, CSmsInformationElement& aElement) |
|
1567 { |
|
1568 aLog->Log(_L("---------------------------------------------")); |
|
1569 aLog->Log(_L("Calling TDesC8& Data()")); |
|
1570 TInt result = KErrNone; |
|
1571 |
|
1572 //const TDesC8& Data() const; |
|
1573 const TBufC8<32> data = aElement.Data(); |
|
1574 |
|
1575 aLog->Log(_L("TDesC8& Data() Completed")); |
|
1576 aLog->Log(_L("Result data: Data: %s"), data.Ptr()); |
|
1577 aLog->Log(_L("Get data (TDesC8) == PASS")); |
|
1578 |
|
1579 return result; |
|
1580 } |
|
1581 |
|
1582 // ----------------------------------------------------------------------------- |
|
1583 // TestConstructionSmsPDUType |
|
1584 // |
|
1585 // ----------------------------------------------------------------------------- |
|
1586 LOCAL_C TInt TestConstructionTGsmSms_MessageL(CStifLogger* aLog) |
|
1587 { |
|
1588 aLog->Log(_L("---------------------------------------------")); |
|
1589 aLog->Log(_L("Calling CSmsMessage::NewL(TGsmSms)")); |
|
1590 TInt result = KErrNone; |
|
1591 |
|
1592 RFs session; |
|
1593 User::LeaveIfError(session.Connect()); |
|
1594 TGsmSms sms; |
|
1595 CSmsBuffer* buffer = CSmsBuffer::NewL(); |
|
1596 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
1597 //static CSmsPDU* NewL(TSmsPDUType aType,CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TBool aIsRPError=EFalse); |
|
1598 CSmsPDU* PDU = CSmsPDU::NewL(CSmsPDU::ESmsDeliver, *characterSetConverter, session); |
|
1599 PDU->EncodeMessagePDUL( sms ); |
|
1600 |
|
1601 //static CSmsMessage* NewL(RFs& aFs, const TGsmSms& aGsmSms,CSmsBufferBase* aBuffer, |
|
1602 // TBool aIsRPError=EFalse,TBool aIsMobileTerminated=ETrue); |
|
1603 CSmsMessage* message = CSmsMessage::NewL(session, sms, buffer); |
|
1604 CleanupStack::PushL(message); |
|
1605 |
|
1606 if(message == NULL ) |
|
1607 result = KErrGeneral; |
|
1608 |
|
1609 CleanupStack::PopAndDestroy(); |
|
1610 session.Close(); |
|
1611 return result; |
|
1612 } |
|
1613 |
|
1614 // ----------------------------------------------------------------------------- |
|
1615 // TestGetType |
|
1616 // |
|
1617 // ----------------------------------------------------------------------------- |
|
1618 LOCAL_C TInt TestGetType(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1619 { |
|
1620 aLog->Log(_L("---------------------------------------------")); |
|
1621 aLog->Log(_L("Calling Type()")); |
|
1622 TInt result = KErrNone; |
|
1623 |
|
1624 //CSmsPDU::TSmsPDUType Type() const; |
|
1625 CSmsPDU::TSmsPDUType type = aMessage.Type(); |
|
1626 |
|
1627 if( type == CSmsPDU::ESmsDeliver ) |
|
1628 { |
|
1629 aLog->Log(_L("Type() Completed")); |
|
1630 aLog->Log(_L("Result data: Type: %d"), type); |
|
1631 aLog->Log(_L("Get type == PASS")); |
|
1632 } |
|
1633 else |
|
1634 { |
|
1635 result = KErrGeneral; |
|
1636 aLog->Log(_L("Get type == FAIL")); |
|
1637 } |
|
1638 |
|
1639 return result; |
|
1640 } |
|
1641 |
|
1642 // ----------------------------------------------------------------------------- |
|
1643 // TestGetIsComplete |
|
1644 // |
|
1645 // ----------------------------------------------------------------------------- |
|
1646 LOCAL_C TInt TestGetIsComplete(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1647 { |
|
1648 aLog->Log(_L("---------------------------------------------")); |
|
1649 aLog->Log(_L("Calling IsComplete()")); |
|
1650 TInt result = KErrNone; |
|
1651 |
|
1652 //TBool IsComplete() const; |
|
1653 TBool res = aMessage.IsComplete(); |
|
1654 |
|
1655 aLog->Log(_L("IsComplete() Completed")); |
|
1656 aLog->Log(_L("Result data: Is completed: %d"), res); |
|
1657 aLog->Log(_L("Get is complete == PASS")); |
|
1658 |
|
1659 return result; |
|
1660 } |
|
1661 // ----------------------------------------------------------------------------- |
|
1662 // TestIsDecoded |
|
1663 // |
|
1664 // ----------------------------------------------------------------------------- |
|
1665 LOCAL_C TInt TestIsDecoded(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1666 { |
|
1667 aLog->Log(_L("---------------------------------------------")); |
|
1668 aLog->Log(_L("Calling IsDecoded()")); |
|
1669 TInt result = KErrNone; |
|
1670 |
|
1671 //TBool IsDecoded() const |
|
1672 TBool res = aMessage.IsDecoded(); |
|
1673 |
|
1674 aLog->Log(_L("IsDecoded() Completed")); |
|
1675 aLog->Log(_L("Result data: IsDecoded: %d"), res); |
|
1676 aLog->Log(_L("Get is decoded == PASS")); |
|
1677 |
|
1678 return result; |
|
1679 } |
|
1680 |
|
1681 // ----------------------------------------------------------------------------- |
|
1682 // TestSetStorage |
|
1683 // |
|
1684 // ----------------------------------------------------------------------------- |
|
1685 LOCAL_C TInt TestSetStorage(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1686 { |
|
1687 aLog->Log(_L("---------------------------------------------")); |
|
1688 aLog->Log(_L("Calling SetStorage()")); |
|
1689 TInt result = KErrNone; |
|
1690 |
|
1691 //void SetStorage(TMobileSmsStorage aStorage) |
|
1692 CSmsMessage::TMobileSmsStorage storage = CSmsMessage::ESmsNoStorage; |
|
1693 aMessage.SetStorage(storage); |
|
1694 |
|
1695 aLog->Log(_L("SetStorage() Completed")); |
|
1696 aLog->Log(_L("Storage successfully set")); |
|
1697 aLog->Log(_L("Set storage == PASS")); |
|
1698 |
|
1699 return result; |
|
1700 } |
|
1701 |
|
1702 // ----------------------------------------------------------------------------- |
|
1703 // TestGetStorage |
|
1704 // |
|
1705 // ----------------------------------------------------------------------------- |
|
1706 LOCAL_C TInt TestGetStorage(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1707 { |
|
1708 aLog->Log(_L("---------------------------------------------")); |
|
1709 aLog->Log(_L("Calling Storage()")); |
|
1710 TInt result = KErrNone; |
|
1711 |
|
1712 //TMobileSmsStorage Storage() const |
|
1713 CSmsMessage::TMobileSmsStorage storage = aMessage.Storage(); |
|
1714 |
|
1715 if( storage == CSmsMessage::ESmsNoStorage) |
|
1716 { |
|
1717 aLog->Log(_L("Storage() Completed")); |
|
1718 aLog->Log(_L("Result data: storage: %d"), storage); |
|
1719 aLog->Log(_L("Get storage == PASS")); |
|
1720 } |
|
1721 else |
|
1722 { |
|
1723 result = KErrGeneral; |
|
1724 aLog->Log(_L("Get storage == FAIL")); |
|
1725 } |
|
1726 |
|
1727 return result; |
|
1728 } |
|
1729 |
|
1730 // ----------------------------------------------------------------------------- |
|
1731 // TestSetStatus |
|
1732 // |
|
1733 // ----------------------------------------------------------------------------- |
|
1734 LOCAL_C TInt TestSetStatus(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1735 { |
|
1736 aLog->Log(_L("---------------------------------------------")); |
|
1737 aLog->Log(_L("Calling SetStatus()")); |
|
1738 TInt result = KErrNone; |
|
1739 |
|
1740 //void SetStatus(NMobileSmsStore::TMobileSmsStoreStatus aStatus) |
|
1741 NMobileSmsStore::TMobileSmsStoreStatus status = NMobileSmsStore::EStoredMessageUnknownStatus; |
|
1742 aMessage.SetStatus(status); |
|
1743 |
|
1744 aLog->Log(_L("Status() Completed")); |
|
1745 aLog->Log(_L("Result data: status: %d"), status); |
|
1746 aLog->Log(_L("Get status == PASS")); |
|
1747 |
|
1748 return result; |
|
1749 } |
|
1750 |
|
1751 // ----------------------------------------------------------------------------- |
|
1752 // TestGetStatus |
|
1753 // |
|
1754 // ----------------------------------------------------------------------------- |
|
1755 LOCAL_C TInt TestGetStatus(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1756 { |
|
1757 aLog->Log(_L("---------------------------------------------")); |
|
1758 aLog->Log(_L("Calling Status()")); |
|
1759 TInt result = KErrNone; |
|
1760 |
|
1761 //NMobileSmsStore::TMobileSmsStoreStatus Status() const |
|
1762 NMobileSmsStore::TMobileSmsStoreStatus status = aMessage.Status(); |
|
1763 |
|
1764 if( status == NMobileSmsStore::EStoredMessageUnknownStatus ) |
|
1765 { |
|
1766 aLog->Log(_L("Status() Completed")); |
|
1767 aLog->Log(_L("Result data: status: %d"), status); |
|
1768 aLog->Log(_L("Get status == PASS")); |
|
1769 } |
|
1770 else |
|
1771 { |
|
1772 result = KErrGeneral; |
|
1773 aLog->Log(_L("Get status == FAIL")); |
|
1774 } |
|
1775 |
|
1776 return result; |
|
1777 } |
|
1778 |
|
1779 // ----------------------------------------------------------------------------- |
|
1780 // TestSetLogServerId |
|
1781 // |
|
1782 // ----------------------------------------------------------------------------- |
|
1783 LOCAL_C TInt TestSetLogServerId(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1784 { |
|
1785 aLog->Log(_L("---------------------------------------------")); |
|
1786 aLog->Log(_L("Calling SetLogServerId()")); |
|
1787 TInt result = KErrNone; |
|
1788 |
|
1789 //void SetLogServerId(TInt aId) |
|
1790 TInt id = 1; |
|
1791 aMessage.SetLogServerId(id); |
|
1792 |
|
1793 aLog->Log(_L("SetLogServerId() completed")); |
|
1794 aLog->Log(_L("Log server id successfully stored")); |
|
1795 aLog->Log(_L("Set log server id == PASS")); |
|
1796 |
|
1797 return result; |
|
1798 } |
|
1799 |
|
1800 // ----------------------------------------------------------------------------- |
|
1801 // TestGetLogServerId |
|
1802 // |
|
1803 // ----------------------------------------------------------------------------- |
|
1804 LOCAL_C TInt TestGetLogServerId(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1805 { |
|
1806 aLog->Log(_L("---------------------------------------------")); |
|
1807 aLog->Log(_L("Calling LogServerId()")); |
|
1808 TInt result = KErrNone; |
|
1809 |
|
1810 //TInt LogServerId() const |
|
1811 TInt id = aMessage.LogServerId(); |
|
1812 |
|
1813 if( id == 1) |
|
1814 { |
|
1815 aLog->Log(_L("LogServerId() completed")); |
|
1816 aLog->Log(_L("result data: log server id: %d"), id); |
|
1817 aLog->Log(_L("Get log server id == PASS")); |
|
1818 } |
|
1819 else |
|
1820 { |
|
1821 result = KErrGeneral; |
|
1822 aLog->Log(_L("Get log server id == FAIL")); |
|
1823 } |
|
1824 |
|
1825 return result; |
|
1826 } |
|
1827 |
|
1828 // ----------------------------------------------------------------------------- |
|
1829 // TestSetTime |
|
1830 // |
|
1831 // ----------------------------------------------------------------------------- |
|
1832 LOCAL_C TInt TestSetTime(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1833 { |
|
1834 aLog->Log(_L("---------------------------------------------")); |
|
1835 aLog->Log(_L("Calling SetTime()")); |
|
1836 TInt result = KErrNone; |
|
1837 |
|
1838 TTime time(TDateTime(2006,EJanuary,01,12,0,0,0)); |
|
1839 //void SetTime(const TTime &aTime) |
|
1840 aMessage.SetTime(time); |
|
1841 |
|
1842 aLog->Log(_L("SetTime() completed")); |
|
1843 aLog->Log(_L("Time successfully stored")); |
|
1844 aLog->Log(_L("Set time == PASS")); |
|
1845 |
|
1846 return result; |
|
1847 } |
|
1848 |
|
1849 // ----------------------------------------------------------------------------- |
|
1850 // TestGetTime |
|
1851 // |
|
1852 // ----------------------------------------------------------------------------- |
|
1853 LOCAL_C TInt TestGetTimeL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1854 { |
|
1855 aLog->Log(_L("---------------------------------------------")); |
|
1856 aLog->Log(_L("Calling Time()")); |
|
1857 TInt result = KErrNone; |
|
1858 |
|
1859 TBuf<30> string; |
|
1860 _LIT( KFormat, "%*E%*D%X%*N%*Y %1 %2 '%3 %H%:1%T%:2%S"); |
|
1861 TTime setTime(TDateTime(2006,EJanuary,01,12,0,0,0)); |
|
1862 //const TTime &Time() const |
|
1863 TTime time = aMessage.Time(); |
|
1864 |
|
1865 if( time == setTime ) |
|
1866 { |
|
1867 time.FormatL(string, KFormat); |
|
1868 aLog->Log(_L("Time() completed")); |
|
1869 aLog->Log(_L("result data: time: %S"), &string); |
|
1870 aLog->Log(_L("Get time == PASS")); |
|
1871 } |
|
1872 else |
|
1873 { |
|
1874 result = KErrGeneral; |
|
1875 aLog->Log(_L("Get time == FAIL")); |
|
1876 } |
|
1877 |
|
1878 return result; |
|
1879 } |
|
1880 |
|
1881 // ----------------------------------------------------------------------------- |
|
1882 // TestGetSMSPDU |
|
1883 // |
|
1884 // ----------------------------------------------------------------------------- |
|
1885 LOCAL_C TInt TestGetSMSPduL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1886 { |
|
1887 aLog->Log(_L("---------------------------------------------")); |
|
1888 aLog->Log(_L("Calling SmsPduL()")); |
|
1889 TInt result = KErrNone; |
|
1890 |
|
1891 //CSmsPDU &SmsPduL() |
|
1892 CSmsPDU& smspdu = aMessage.SmsPDU(); |
|
1893 |
|
1894 aLog->Log(_L("SmsPduL() completed")); |
|
1895 aLog->Log(_L("result data: PDU type: %d"), smspdu.Type()); |
|
1896 aLog->Log(_L("Get SMS PDU == PASS")); |
|
1897 |
|
1898 return result; |
|
1899 } |
|
1900 |
|
1901 // ----------------------------------------------------------------------------- |
|
1902 // TestGetSMSPDUConst |
|
1903 // |
|
1904 // ----------------------------------------------------------------------------- |
|
1905 LOCAL_C TInt TestGetSMSPDUConst(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1906 { |
|
1907 aLog->Log(_L("---------------------------------------------")); |
|
1908 aLog->Log(_L("Calling SmsPduL() const")); |
|
1909 TInt result = KErrNone; |
|
1910 |
|
1911 //const CSmsPDU &SmsPduL() const |
|
1912 const CSmsPDU& smspdu = aMessage.SmsPDU(); |
|
1913 |
|
1914 aLog->Log(_L("SmsPduL() const completed")); |
|
1915 aLog->Log(_L("result data: PDU type: %d"), smspdu.Type()); |
|
1916 aLog->Log(_L("Get SMS PDU == PASS")); |
|
1917 |
|
1918 return result; |
|
1919 } |
|
1920 |
|
1921 // ----------------------------------------------------------------------------- |
|
1922 // TestSetSeviceCenterAddress |
|
1923 // |
|
1924 // ----------------------------------------------------------------------------- |
|
1925 LOCAL_C TInt TestSetServiceCenterAddress(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1926 { |
|
1927 aLog->Log(_L("---------------------------------------------")); |
|
1928 aLog->Log(_L("Calling SetServiceCenterAddressL()")); |
|
1929 |
|
1930 TPtrC serviceCenter = _L("nokia house"); |
|
1931 //void SetServiceCenterAddressL(const TDesC &aAddress) |
|
1932 TRAPD( result,aMessage.SetServiceCenterAddressL(serviceCenter)); |
|
1933 |
|
1934 if( result == KErrNone ) |
|
1935 { |
|
1936 aLog->Log(_L("SetServiceCenterAddressL() completed")); |
|
1937 aLog->Log(_L("Service center address successfully stored")); |
|
1938 aLog->Log(_L("Set service center address == PASS")); |
|
1939 } |
|
1940 else |
|
1941 { |
|
1942 aLog->Log(_L("Set service center address == FAIL")); |
|
1943 } |
|
1944 |
|
1945 return result; |
|
1946 } |
|
1947 |
|
1948 // ----------------------------------------------------------------------------- |
|
1949 // TestGetSeviceCenterAddress |
|
1950 // |
|
1951 // ----------------------------------------------------------------------------- |
|
1952 LOCAL_C TInt TestGetServiceCenterAddress(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1953 { |
|
1954 aLog->Log(_L("---------------------------------------------")); |
|
1955 aLog->Log(_L("Calling ServiceCenterAddress()")); |
|
1956 TInt result = KErrNone; |
|
1957 |
|
1958 TPtrC setServiceCenter = _L("nokia house"); |
|
1959 //TPtrC ServiceCenterAddress() const |
|
1960 TPtrC serviceCenter = aMessage.ServiceCenterAddress(); |
|
1961 |
|
1962 if( !setServiceCenter.Compare(serviceCenter) ) |
|
1963 { |
|
1964 aLog->Log(_L("ServiceCenterAddress() completed")); |
|
1965 aLog->Log(_L("result data: address: %s"), serviceCenter.Ptr()); |
|
1966 aLog->Log(_L("Get service center address == PASS")); |
|
1967 } |
|
1968 else |
|
1969 { |
|
1970 aLog->Log(_L("Get service center address == FAIL")); |
|
1971 } |
|
1972 |
|
1973 return result; |
|
1974 } |
|
1975 |
|
1976 // ----------------------------------------------------------------------------- |
|
1977 // TestSetParsedServiceCenterAddress |
|
1978 // |
|
1979 // ----------------------------------------------------------------------------- |
|
1980 LOCAL_C TInt TestSetParsedServiceCenterAddress(CStifLogger* aLog,CSmsMessage& aMessage) |
|
1981 { |
|
1982 aLog->Log(_L("---------------------------------------------")); |
|
1983 aLog->Log(_L("Calling SetParsedServiceCenterAddressL()")); |
|
1984 |
|
1985 //void SetParsedServiceCenterAddressL(const TGsmSmsTelNumber &aParsedAddress); |
|
1986 TGsmSmsTelNumber telNumber; |
|
1987 telNumber.iTelNumber = _L("919886757059"); |
|
1988 TRAPD( result, aMessage.SetParsedServiceCenterAddressL(telNumber)); |
|
1989 |
|
1990 if( result == KErrNone ) |
|
1991 { |
|
1992 aLog->Log(_L("SetParsedServiceCenterAddressL() completed")); |
|
1993 aLog->Log(_L("Parsed address successfully stored")); |
|
1994 aLog->Log(_L("Set parsed service center address == PASS")); |
|
1995 } |
|
1996 else |
|
1997 { |
|
1998 aLog->Log(_L("Set parsed service center address == FAIL")); |
|
1999 } |
|
2000 |
|
2001 return result; |
|
2002 } |
|
2003 |
|
2004 // ----------------------------------------------------------------------------- |
|
2005 // TestGetParsedServiceCenterAddress |
|
2006 // |
|
2007 // ----------------------------------------------------------------------------- |
|
2008 LOCAL_C TInt TestGetParsedServiceCenterAddress(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2009 { |
|
2010 aLog->Log(_L("---------------------------------------------")); |
|
2011 aLog->Log(_L("Calling ParsedServiceCenterAddress()")); |
|
2012 TInt result = KErrNone; |
|
2013 |
|
2014 TGsmSmsTelNumber setTelNumber; |
|
2015 setTelNumber.iTelNumber = _L("919886757059"); |
|
2016 //void ParsedServiceCenterAddress(TGsmSmsTelNumber &aParsedAddress) const |
|
2017 TGsmSmsTelNumber telNumber; |
|
2018 aMessage.ParsedServiceCenterAddress(telNumber); |
|
2019 |
|
2020 if(setTelNumber.iTelNumber == telNumber.iTelNumber) |
|
2021 { |
|
2022 aLog->Log(_L("ParsedServiceCenterAddress() completed")); |
|
2023 aLog->Log(_L("result data: parsed address: %s"), telNumber.iTelNumber.Ptr()); |
|
2024 aLog->Log(_L("Get parsed service center address == PASS")); |
|
2025 } |
|
2026 else |
|
2027 { |
|
2028 aLog->Log(_L("Get parsed service center address == FAIL")); |
|
2029 } |
|
2030 |
|
2031 return result; |
|
2032 } |
|
2033 |
|
2034 // ----------------------------------------------------------------------------- |
|
2035 // TestSetToFromAddress |
|
2036 // |
|
2037 // ----------------------------------------------------------------------------- |
|
2038 LOCAL_C TInt TestSetToFromAddress(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2039 { |
|
2040 aLog->Log(_L("---------------------------------------------")); |
|
2041 aLog->Log(_L("Calling SetToFromAddressL()")); |
|
2042 |
|
2043 TBufC<12> address(_L("nokia house")); |
|
2044 |
|
2045 //void SetToFromAddressL(const TDesC &aAddress) |
|
2046 TRAPD( result, aMessage.SetToFromAddressL(address)); |
|
2047 |
|
2048 if( result == KErrNone ) |
|
2049 { |
|
2050 aLog->Log(_L("SetToFromAddressL() completed")); |
|
2051 aLog->Log(_L("To from addresses successfully stored")); |
|
2052 aLog->Log(_L("Set to from address == PASS")); |
|
2053 } |
|
2054 else |
|
2055 { |
|
2056 aLog->Log(_L("Set to from address == FAIL")); |
|
2057 } |
|
2058 |
|
2059 return result; |
|
2060 } |
|
2061 |
|
2062 // ----------------------------------------------------------------------------- |
|
2063 // TestGetToFromAddress |
|
2064 // |
|
2065 // ----------------------------------------------------------------------------- |
|
2066 LOCAL_C TInt TestGetToFromAddress(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2067 { |
|
2068 aLog->Log(_L("---------------------------------------------")); |
|
2069 aLog->Log(_L("Calling ToFromAddress()")); |
|
2070 TInt result = KErrNone; |
|
2071 |
|
2072 TBufC<12> address(_L("nokia house")); |
|
2073 //TPtrC ToFromAddress() const |
|
2074 TPtrC addressPtr = aMessage.ToFromAddress(); |
|
2075 |
|
2076 if( !addressPtr.Compare(address) ) |
|
2077 { |
|
2078 aLog->Log(_L("ToFromAddress() completed")); |
|
2079 aLog->Log(_L("result data: to from address: %s"), addressPtr.Ptr()); |
|
2080 aLog->Log(_L("Get to from address == PASS")); |
|
2081 } |
|
2082 else |
|
2083 { |
|
2084 result = KErrGeneral; |
|
2085 aLog->Log(_L("Get to from address == FAIL")); |
|
2086 } |
|
2087 |
|
2088 return result; |
|
2089 } |
|
2090 |
|
2091 // ----------------------------------------------------------------------------- |
|
2092 // TestSetParsedToFromAddress |
|
2093 // |
|
2094 // ----------------------------------------------------------------------------- |
|
2095 LOCAL_C TInt TestSetParsedToFromAddress(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2096 { |
|
2097 aLog->Log(_L("---------------------------------------------")); |
|
2098 aLog->Log(_L("Calling SetParsedToFromAddressL()")); |
|
2099 |
|
2100 //void SetParsedToFromAddressL(const TGsmSmsTelNumber &aParsedAddress) |
|
2101 TGsmSmsTelNumber address; |
|
2102 address.iTelNumber = _L("919886757059"); |
|
2103 TRAPD( result, aMessage.SetParsedToFromAddressL(address)); |
|
2104 |
|
2105 if( result == KErrNone ) |
|
2106 { |
|
2107 aLog->Log(_L("SetParsedToFromAddressL() completed")); |
|
2108 aLog->Log(_L("Parsed to from addresses successfully stored")); |
|
2109 aLog->Log(_L("Set to from address == PASS")); |
|
2110 } |
|
2111 else |
|
2112 { |
|
2113 aLog->Log(_L("Set to from address == FAIL")); |
|
2114 } |
|
2115 |
|
2116 return result; |
|
2117 } |
|
2118 |
|
2119 // ----------------------------------------------------------------------------- |
|
2120 // TestGetParsedToFromAddress |
|
2121 // |
|
2122 // ----------------------------------------------------------------------------- |
|
2123 LOCAL_C TInt TestGetParsedToFromAddress(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2124 { |
|
2125 aLog->Log(_L("---------------------------------------------")); |
|
2126 aLog->Log(_L("Calling ParsedToFromAddress()")); |
|
2127 TInt result = KErrNone; |
|
2128 |
|
2129 TGsmSmsTelNumber setAddress; |
|
2130 setAddress.iTelNumber = _L("919886757059"); |
|
2131 //void ParsedToFromAddress(TGsmSmsTelNumber &aParsedAddress) const |
|
2132 TGsmSmsTelNumber address; |
|
2133 aMessage.ParsedToFromAddress(address); |
|
2134 |
|
2135 if(setAddress.iTelNumber == address.iTelNumber) |
|
2136 { |
|
2137 aLog->Log(_L("ParsedToFromAddress() completed")); |
|
2138 aLog->Log(_L("result data: parsed to from address: %s"), address.iTelNumber.Ptr()); |
|
2139 aLog->Log(_L("Get to from address == PASS")); |
|
2140 } |
|
2141 else |
|
2142 { |
|
2143 aLog->Log(_L("Get to from address == FAIL")); |
|
2144 } |
|
2145 |
|
2146 return result; |
|
2147 } |
|
2148 |
|
2149 // ----------------------------------------------------------------------------- |
|
2150 // TestInternalizeWithoutBuffer |
|
2151 // |
|
2152 // ----------------------------------------------------------------------------- |
|
2153 LOCAL_C TInt TestInternalizeWithoutBufferL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2154 { |
|
2155 aLog->Log(_L("---------------------------------------------")); |
|
2156 aLog->Log(_L("Calling InternalizeWithoutBufferL()")); |
|
2157 |
|
2158 RFs session; |
|
2159 User::LeaveIfError(session.Connect()); |
|
2160 TBufC<64> storename = _L("C:\\SMSGSMUtilities_CSmsMessage"); |
|
2161 RFileReadStream read; |
|
2162 |
|
2163 TInt erro = read.Open(session, storename, EFileRead); |
|
2164 |
|
2165 //void InternalizeWithoutBufferL(RReadStream &aStream) |
|
2166 TRAPD( result, aMessage.InternalizeWithoutBufferL(read)); |
|
2167 |
|
2168 read.Close(); |
|
2169 |
|
2170 //now delete the store |
|
2171 TInt err = session.Delete(storename); |
|
2172 if(err != KErrNone) |
|
2173 { |
|
2174 RDebug::Print(_L("Error %d deleting \"%S\" file.\n"), err, &storename); |
|
2175 } |
|
2176 |
|
2177 session.Close(); |
|
2178 if( result == KErrNone ) |
|
2179 { |
|
2180 aLog->Log(_L("InternalizeWithoutBufferL() completed")); |
|
2181 aLog->Log(_L("Data internalized successfully")); |
|
2182 aLog->Log(_L("Internalize without buffer == PASS")); |
|
2183 } |
|
2184 else |
|
2185 aLog->Log(_L("Internalize without buffer == FAIL")); |
|
2186 |
|
2187 return result; |
|
2188 } |
|
2189 |
|
2190 // ----------------------------------------------------------------------------- |
|
2191 // TestExternalizeWithoutBufferL |
|
2192 // |
|
2193 // ----------------------------------------------------------------------------- |
|
2194 LOCAL_C TInt TestExternalizeWithoutBufferL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2195 { |
|
2196 aLog->Log(_L("---------------------------------------------")); |
|
2197 aLog->Log(_L("Calling ExternalizeWithoutBufferL()")); |
|
2198 |
|
2199 RFs session; |
|
2200 User::LeaveIfError(session.Connect()); |
|
2201 TBufC<64> storename = _L("C:\\SMSGSMUtilities_CSmsMessage"); |
|
2202 RFileWriteStream write; |
|
2203 |
|
2204 write.Create(session, storename, EFileWrite); |
|
2205 TInt err = write.Open(session, storename, EFileWrite); |
|
2206 |
|
2207 //void ExternalizeWithoutBufferL(RWriteStream &aStream) const |
|
2208 TRAPD( result, aMessage.ExternalizeWithoutBufferL(write)); |
|
2209 |
|
2210 write.CommitL(); |
|
2211 write.Close(); |
|
2212 |
|
2213 session.Close(); |
|
2214 if( result == KErrNone ) |
|
2215 { |
|
2216 aLog->Log(_L("ExternalizeWithoutBufferL() completed")); |
|
2217 aLog->Log(_L("Data externalized successfully")); |
|
2218 aLog->Log(_L("Externalize without buffer == PASS")); |
|
2219 } |
|
2220 else |
|
2221 aLog->Log(_L("Externalize without buffer == FAIL")); |
|
2222 |
|
2223 return result; |
|
2224 } |
|
2225 |
|
2226 // ----------------------------------------------------------------------------- |
|
2227 // TestInternalize |
|
2228 // |
|
2229 // ----------------------------------------------------------------------------- |
|
2230 LOCAL_C TInt TestInternalizeL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2231 { |
|
2232 aLog->Log(_L("---------------------------------------------")); |
|
2233 aLog->Log(_L("Calling InternalizeL()")); |
|
2234 |
|
2235 RFs session; |
|
2236 User::LeaveIfError(session.Connect()); |
|
2237 TBufC<64> storename = _L("C:\\SMSGSMUtilities_CSmsMessage"); |
|
2238 RFileReadStream read; |
|
2239 |
|
2240 TInt erro = read.Open(session, storename, EFileRead); |
|
2241 |
|
2242 //IMPORT_C void InternalizeL(RReadStream &aStream) |
|
2243 TRAPD( result, aMessage.InternalizeL( read )); |
|
2244 |
|
2245 read.Close(); |
|
2246 |
|
2247 //now delete the store |
|
2248 TInt err = session.Delete(storename); |
|
2249 if(err != KErrNone) |
|
2250 { |
|
2251 RDebug::Print(_L("Error %d deleting \"%S\" file.\n"), err, &storename); |
|
2252 } |
|
2253 |
|
2254 session.Close(); |
|
2255 if( result == KErrNone ) |
|
2256 { |
|
2257 aLog->Log(_L("InternalizeL() completed")); |
|
2258 aLog->Log(_L("Data internalized successfully")); |
|
2259 aLog->Log(_L("Internalize == PASS")); |
|
2260 } |
|
2261 else |
|
2262 aLog->Log(_L("Internalize == FAIL")); |
|
2263 |
|
2264 return result; |
|
2265 |
|
2266 } |
|
2267 |
|
2268 // ----------------------------------------------------------------------------- |
|
2269 // TestExternalize |
|
2270 // |
|
2271 // ----------------------------------------------------------------------------- |
|
2272 LOCAL_C TInt TestExternalizeL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2273 { |
|
2274 aLog->Log(_L("---------------------------------------------")); |
|
2275 aLog->Log(_L("Calling ExternalizeL()")); |
|
2276 |
|
2277 RFs session; |
|
2278 User::LeaveIfError(session.Connect()); |
|
2279 TBufC<64> storename = _L("C:\\SMSGSMUtilities_CSmsMessage"); |
|
2280 RFileWriteStream write; |
|
2281 |
|
2282 write.Create(session, storename, EFileWrite); |
|
2283 TInt err = write.Open(session, storename, EFileWrite); |
|
2284 |
|
2285 //IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
2286 TRAPD( result, aMessage.ExternalizeL( write )); |
|
2287 |
|
2288 write.CommitL(); |
|
2289 write.Close(); |
|
2290 |
|
2291 session.Close(); |
|
2292 if( result == KErrNone ) |
|
2293 { |
|
2294 aLog->Log(_L("ExternalizeL() completed")); |
|
2295 aLog->Log(_L("Data externalized successfully")); |
|
2296 aLog->Log(_L("Externalize == PASS")); |
|
2297 } |
|
2298 else |
|
2299 aLog->Log(_L("Externalize == FAIL")); |
|
2300 |
|
2301 return result; |
|
2302 } |
|
2303 |
|
2304 // ----------------------------------------------------------------------------- |
|
2305 // TestGetBuffer |
|
2306 // |
|
2307 // ----------------------------------------------------------------------------- |
|
2308 LOCAL_C TInt TestGetBufferL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2309 { |
|
2310 aLog->Log(_L("---------------------------------------------")); |
|
2311 aLog->Log(_L("Calling Buffer()")); |
|
2312 TInt result = KErrNone; |
|
2313 |
|
2314 //CSmsBufferBase &Buffer() |
|
2315 CSmsBuffer& buffer = STATIC_CAST(CSmsBuffer&, aMessage.Buffer()); |
|
2316 HBufC* buf = HBufC::NewL(buffer.Length()); |
|
2317 TPtr bufPtr = buf->Des(); |
|
2318 |
|
2319 aLog->Log(_L("Buffer() completed")); |
|
2320 buffer.Extract(bufPtr, 0, buffer.Length()); |
|
2321 aLog->Log(_L("result data: buffer: %s"), buf); |
|
2322 aLog->Log(_L("Get buffer == PASS")); |
|
2323 |
|
2324 return result; |
|
2325 } |
|
2326 |
|
2327 // ----------------------------------------------------------------------------- |
|
2328 // TestGetBufferConst |
|
2329 // |
|
2330 // ----------------------------------------------------------------------------- |
|
2331 LOCAL_C TInt TestGetBufferConstL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2332 { |
|
2333 aLog->Log(_L("---------------------------------------------")); |
|
2334 aLog->Log(_L("Calling const Buffer()")); |
|
2335 TInt result = KErrNone; |
|
2336 |
|
2337 //const CSmsBufferBase &Buffer() const |
|
2338 const CSmsBuffer& buffer = STATIC_CAST(const CSmsBuffer&, aMessage.Buffer()); |
|
2339 HBufC* buf = HBufC::NewL(buffer.Length()); |
|
2340 TPtr bufPtr = buf->Des(); |
|
2341 |
|
2342 aLog->Log(_L("const Buffer() completed")); |
|
2343 buffer.Extract(bufPtr, 0, buffer.Length()); |
|
2344 aLog->Log(_L("result data: buffer: %s"), buf); |
|
2345 aLog->Log(_L("Get buffer const == PASS")); |
|
2346 |
|
2347 return result; |
|
2348 } |
|
2349 |
|
2350 // ----------------------------------------------------------------------------- |
|
2351 // TestGetTextPresent |
|
2352 // |
|
2353 // ----------------------------------------------------------------------------- |
|
2354 LOCAL_C TInt TestGetTextPresent(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2355 { |
|
2356 aLog->Log(_L("---------------------------------------------")); |
|
2357 aLog->Log(_L("Calling TextPresent()")); |
|
2358 TInt result = KErrNone; |
|
2359 |
|
2360 //TBool TextPresent() const |
|
2361 TBool res = aMessage.TextPresent(); |
|
2362 |
|
2363 aLog->Log(_L("TextPresent() completed")); |
|
2364 aLog->Log(_L("result data: text present: %d"), res); |
|
2365 aLog->Log(_L("Get text present == PASS")); |
|
2366 |
|
2367 return result; |
|
2368 } |
|
2369 |
|
2370 // ----------------------------------------------------------------------------- |
|
2371 // TestGetNumberOfMessagePDU |
|
2372 // |
|
2373 // ----------------------------------------------------------------------------- |
|
2374 LOCAL_C TInt TestGetNumberOfMessagePduL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2375 { |
|
2376 aLog->Log(_L("---------------------------------------------")); |
|
2377 aLog->Log(_L("Calling NumMessagePDUsL()")); |
|
2378 |
|
2379 //TInt NumMessagePDUsL() |
|
2380 TInt res = 0; |
|
2381 TRAPD(result, res = aMessage.NumMessagePDUsL()); |
|
2382 if(result != KErrNone) |
|
2383 { |
|
2384 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2385 } |
|
2386 else |
|
2387 { |
|
2388 aLog->Log(_L("NumMessagePDUsL() completed")); |
|
2389 aLog->Log(_L("result data: number of PDUs: %d"), res); |
|
2390 aLog->Log(_L("Get number of message PDUs == PASS")); |
|
2391 } |
|
2392 return result; |
|
2393 } |
|
2394 |
|
2395 // ----------------------------------------------------------------------------- |
|
2396 // TestGetMaxLength |
|
2397 // |
|
2398 // ----------------------------------------------------------------------------- |
|
2399 LOCAL_C TInt TestGetMaxLength(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2400 { |
|
2401 aLog->Log(_L("---------------------------------------------")); |
|
2402 aLog->Log(_L("Calling MaxMessageLength()")); |
|
2403 TInt result = KErrNone; |
|
2404 |
|
2405 //TInt MaxMessageLength() |
|
2406 TInt res = aMessage.MaxMessageLength(); |
|
2407 |
|
2408 aLog->Log(_L("MaxMessageLength() completed")); |
|
2409 aLog->Log(_L("result data: max message length: %d"), res); |
|
2410 aLog->Log(_L("Get max message length == PASS")); |
|
2411 |
|
2412 return result; |
|
2413 } |
|
2414 |
|
2415 // ----------------------------------------------------------------------------- |
|
2416 // TestGetMessageLength |
|
2417 // |
|
2418 // ----------------------------------------------------------------------------- |
|
2419 LOCAL_C TInt TestGetMessageLength(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2420 { |
|
2421 aLog->Log(_L("---------------------------------------------")); |
|
2422 aLog->Log(_L("Calling MessageLengthL()")); |
|
2423 |
|
2424 //TInt MessageLengthL() |
|
2425 TInt res = 0; |
|
2426 TRAPD(result, res = aMessage.MessageLengthL()); |
|
2427 if(result != KErrNone) |
|
2428 { |
|
2429 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2430 } |
|
2431 else |
|
2432 { |
|
2433 aLog->Log(_L("MessageLengthL() completed")); |
|
2434 aLog->Log(_L("result data: message length: %d"), res); |
|
2435 aLog->Log(_L("Get message length == PASS")); |
|
2436 } |
|
2437 |
|
2438 return result; |
|
2439 } |
|
2440 |
|
2441 // ----------------------------------------------------------------------------- |
|
2442 // TestOptimizeSettings |
|
2443 // |
|
2444 // ----------------------------------------------------------------------------- |
|
2445 LOCAL_C TInt TestOptimizeSettings(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2446 { |
|
2447 aLog->Log(_L("---------------------------------------------")); |
|
2448 aLog->Log(_L("Calling OptimizeSettingsL()")); |
|
2449 |
|
2450 //void OptimizeSettingsL(TInt aOptions) |
|
2451 TRAPD( result, aMessage.OptimizeSettingsL(CSmsMessage::ESmsFlagOptimizeAlphabet)); |
|
2452 if(result != KErrNone) |
|
2453 { |
|
2454 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2455 } |
|
2456 else |
|
2457 { |
|
2458 aLog->Log(_L("OptimizeSettingsL() completed")); |
|
2459 aLog->Log(_L("User data settings successfully optimized")); |
|
2460 aLog->Log(_L("Optimize settings == PASS")); |
|
2461 } |
|
2462 |
|
2463 return result; |
|
2464 } |
|
2465 |
|
2466 // ----------------------------------------------------------------------------- |
|
2467 // TestGetIsSupported |
|
2468 // |
|
2469 // ----------------------------------------------------------------------------- |
|
2470 LOCAL_C TInt TestGetIsSupported(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2471 { |
|
2472 aLog->Log(_L("---------------------------------------------")); |
|
2473 aLog->Log(_L("Calling IsSupportedL()")); |
|
2474 |
|
2475 //TBool IsSupportedL(const TDesC &aDes, TInt &aNumberOfUnconvertibleCharacters, TInt &aIndexOfFirstUnconvertibleCharacter) |
|
2476 TBufC<50> testBuffer = _L("Nokia$123has*some%employees"); |
|
2477 TInt numUnconvertable; |
|
2478 TInt posFirstUnconvertable; |
|
2479 TBool res = 0; |
|
2480 TRAPD( result, res = aMessage.IsSupportedL(testBuffer, numUnconvertable, posFirstUnconvertable)); |
|
2481 |
|
2482 if(result != KErrNone) |
|
2483 { |
|
2484 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2485 } |
|
2486 else |
|
2487 { |
|
2488 aLog->Log(_L("IsSupportedL() completed")); |
|
2489 aLog->Log(_L("result data: is supported: %d"), res); |
|
2490 aLog->Log(_L("Get is supported == PASS")); |
|
2491 } |
|
2492 return result; |
|
2493 } |
|
2494 |
|
2495 |
|
2496 // ----------------------------------------------------------------------------- |
|
2497 // TestEncodeMessagePDU |
|
2498 // |
|
2499 // ----------------------------------------------------------------------------- |
|
2500 LOCAL_C TInt TestEncodeMessagePDUL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2501 { |
|
2502 aLog->Log(_L("---------------------------------------------")); |
|
2503 aLog->Log(_L("Calling EncodeMessagePDUsL()")); |
|
2504 |
|
2505 CArrayFix<TGsmSms>* singlePDU = new (ELeave) CArrayFixFlat<TGsmSms>(10); |
|
2506 aMessage.EncodeIntoSinglePDUL(*singlePDU); |
|
2507 CArrayFix<TGsmSms>* encodedPDU = new (ELeave) CArrayFixFlat<TGsmSms>(10); |
|
2508 //EncodeMessagePDUsL(CArrayFix< TGsmSms > &aSmsArray, TInt aReference=0) |
|
2509 TRAPD( result, aMessage.EncodeMessagePDUsL(*encodedPDU)); |
|
2510 if(result != KErrNone) |
|
2511 { |
|
2512 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2513 } |
|
2514 else |
|
2515 { |
|
2516 aLog->Log(_L("EncodeMessagePDUsL() completed")); |
|
2517 aLog->Log(_L("Message PDUs encoded successfully")); |
|
2518 aLog->Log(_L("Encode message PDUs == PASS")); |
|
2519 } |
|
2520 |
|
2521 delete singlePDU; |
|
2522 delete encodedPDU; |
|
2523 return result; |
|
2524 } |
|
2525 |
|
2526 // ----------------------------------------------------------------------------- |
|
2527 // TestDecodeMessagePDU |
|
2528 // |
|
2529 // ----------------------------------------------------------------------------- |
|
2530 LOCAL_C TInt TestDecodeMessagePDUL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2531 { |
|
2532 aLog->Log(_L("---------------------------------------------")); |
|
2533 aLog->Log(_L("Calling DecodeMessagePDUsL()")); |
|
2534 |
|
2535 CArrayFix<TGsmSms>* PDU = new (ELeave) CArrayFixFlat<TGsmSms>(10); |
|
2536 const TGsmSms* gsmSms = new (ELeave) TGsmSms(); |
|
2537 |
|
2538 TInt i = 0; |
|
2539 for(; i<10; i++ ) |
|
2540 { |
|
2541 PDU->InsertL(i,*gsmSms); |
|
2542 } |
|
2543 |
|
2544 //void DecodeMessagePDUsL(const CArrayFix<TGsmSms>& aSmsArray); |
|
2545 TRAPD( result, aMessage.DecodeMessagePDUsL(*PDU)); |
|
2546 if(result != KErrNone) |
|
2547 { |
|
2548 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2549 } |
|
2550 else |
|
2551 { |
|
2552 aLog->Log(_L("DecodeMessagePDUsL() completed")); |
|
2553 aLog->Log(_L("Message PDUs decoded successfully")); |
|
2554 aLog->Log(_L("Decode message PDUs == PASS")); |
|
2555 } |
|
2556 |
|
2557 delete PDU; |
|
2558 return result; |
|
2559 } |
|
2560 |
|
2561 // ----------------------------------------------------------------------------- |
|
2562 // TestAddEMSInformationElements |
|
2563 // |
|
2564 // ----------------------------------------------------------------------------- |
|
2565 /*LOCAL_C TInt TestAddEMSInformationElements(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2566 { |
|
2567 aLog->Log(_L("---------------------------------------------")); |
|
2568 aLog->Log(_L("Calling AddEMSInformationElementL()")); |
|
2569 TInt result = KErrNone; |
|
2570 RFs rfServer; |
|
2571 User::LeaveIfError(rfServer.Connect()); |
|
2572 |
|
2573 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
2574 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
2575 CSmsMessage* smsMessage = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsCommand, smsBuffer ); |
|
2576 CSmsCommand& command = STATIC_CAST(CSmsCommand&, smsMessage->SmsPduL() ); |
|
2577 |
|
2578 CSmsInformationElement::TSmsInformationElementIdentifier identifier = CSmsInformationElement::ESmsEnhancedVariablePicture; |
|
2579 TBufC8<24> information(KTestInfo8); |
|
2580 command.AddInformationElementL( identifier, information); |
|
2581 |
|
2582 CEmsInformationElement& element = STATIC_CAST(CEmsInformationElement&, command.InformationElement(0)); |
|
2583 CleanupStack::PushL(&element); |
|
2584 |
|
2585 element.SetStartPosition(0); |
|
2586 |
|
2587 //currently not exported |
|
2588 CEmsSoundIE* element = CEmsSoundIE::NewL(); |
|
2589 CleanupStack::PushL(element); |
|
2590 |
|
2591 //void AddEMSInformationElementL(const CEmsInformationElement &aEmsIE) |
|
2592 TRAPD( result, aMessage.AddEMSInformationElementL(*element)); |
|
2593 |
|
2594 if(result != KErrNone) |
|
2595 { |
|
2596 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2597 } |
|
2598 else |
|
2599 { |
|
2600 aLog->Log(_L("AddEMSInformationElementL() completed")); |
|
2601 aLog->Log(_L("EMS information element added")); |
|
2602 aLog->Log(_L("Add EMS information elements == PASS")); |
|
2603 } |
|
2604 |
|
2605 CleanupStack::PopAndDestroy(element); |
|
2606 rfServer.Close(); |
|
2607 return result; |
|
2608 } |
|
2609 */ |
|
2610 // ----------------------------------------------------------------------------- |
|
2611 // TestGetEMSInformationElements |
|
2612 // |
|
2613 // ----------------------------------------------------------------------------- |
|
2614 LOCAL_C TInt TestGetEMSInformationElements(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2615 { |
|
2616 aLog->Log(_L("---------------------------------------------")); |
|
2617 aLog->Log(_L("Calling GetEMSInformationElementsL()")); |
|
2618 |
|
2619 //const RPointerArray< const CEmsInformationElement > &GetEMSInformationElementsL() const |
|
2620 RPointerArray<const CEmsInformationElement> arrayEmsInfo; |
|
2621 TRAPD( result, arrayEmsInfo = aMessage.GetEMSInformationElementsL()); |
|
2622 |
|
2623 if(result != KErrNone) |
|
2624 { |
|
2625 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2626 } |
|
2627 else |
|
2628 { |
|
2629 aLog->Log(_L("GetEMSInformationElementsL() completed")); |
|
2630 aLog->Log(_L("EMS information elements fetched")); |
|
2631 aLog->Log(_L("Get EMS information elements == PASS")); |
|
2632 } |
|
2633 |
|
2634 return result; |
|
2635 } |
|
2636 |
|
2637 // ----------------------------------------------------------------------------- |
|
2638 // TestRemoveEMSInformationElements |
|
2639 // |
|
2640 // ----------------------------------------------------------------------------- |
|
2641 LOCAL_C TInt TestRemoveEMSInformationElements(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2642 { |
|
2643 aLog->Log(_L("---------------------------------------------")); |
|
2644 aLog->Log(_L("Calling RemoveEMSInformationElementsL()")); |
|
2645 |
|
2646 //RPointerArray< CEmsInformationElement > *RemoveEMSInformationElementsL(const TUint aStartPosition, const TSmsId aEmsId); |
|
2647 RPointerArray<CEmsInformationElement>* arrayEmsInfo = new RPointerArray<CEmsInformationElement>(5); |
|
2648 TRAPD( result, arrayEmsInfo = aMessage.RemoveEMSInformationElementsL(0, CEmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference)); |
|
2649 |
|
2650 if(result != KErrNone) |
|
2651 { |
|
2652 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2653 } |
|
2654 else |
|
2655 { |
|
2656 aLog->Log(_L("RemoveEMSInformationElementsL() completed")); |
|
2657 aLog->Log(_L("EMS information elements removed")); |
|
2658 aLog->Log(_L("Remove EMS information elements PASS")); |
|
2659 } |
|
2660 |
|
2661 delete arrayEmsInfo; |
|
2662 return result; |
|
2663 } |
|
2664 |
|
2665 // ----------------------------------------------------------------------------- |
|
2666 // TestRemoveEMSInformationElement |
|
2667 // |
|
2668 // ----------------------------------------------------------------------------- |
|
2669 LOCAL_C TInt TestRemoveEMSInformationElement(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2670 { |
|
2671 aLog->Log(_L("---------------------------------------------")); |
|
2672 aLog->Log(_L("Calling RemoveEMSInformationElementL()")); |
|
2673 |
|
2674 //CEmsInformationElement *RemoveEMSInformationElementL(const TUint aStartPosition, const TSmsId aEmsId) |
|
2675 TRAPD( result, CEmsInformationElement* removedElement = aMessage.RemoveEMSInformationElementL(0, CEmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference)); |
|
2676 |
|
2677 if(result != KErrNone) |
|
2678 { |
|
2679 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2680 } |
|
2681 else |
|
2682 { |
|
2683 aLog->Log(_L("RemoveEMSInformationElementL() completed")); |
|
2684 aLog->Log(_L("EMS information element removed")); |
|
2685 aLog->Log(_L("Remove EMS information element PASS")); |
|
2686 } |
|
2687 |
|
2688 return result; |
|
2689 } |
|
2690 |
|
2691 // ----------------------------------------------------------------------------- |
|
2692 // TestResetEMS |
|
2693 // |
|
2694 // ----------------------------------------------------------------------------- |
|
2695 LOCAL_C TInt TestResetEMS(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2696 { |
|
2697 aLog->Log( _L("--------------------------------------------------------")); |
|
2698 aLog->Log( _L("Calling ResetEMSL()")); |
|
2699 |
|
2700 //void ResetEMSL(); |
|
2701 TRAPD( result, aMessage.ResetEMSL()); |
|
2702 |
|
2703 if(result != KErrNone) |
|
2704 { |
|
2705 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2706 } |
|
2707 else |
|
2708 { |
|
2709 aLog->Log( _L("ResetEMSL() completed")); |
|
2710 aLog->Log (_L("EMS information element successfully reseted")); |
|
2711 aLog->Log( _L("Reset EMS == PASS")); |
|
2712 } |
|
2713 |
|
2714 return result; |
|
2715 } |
|
2716 |
|
2717 // ----------------------------------------------------------------------------- |
|
2718 // TestCopyEMSElements |
|
2719 // |
|
2720 // ----------------------------------------------------------------------------- |
|
2721 LOCAL_C TInt TestCopyEMSElementsL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2722 { |
|
2723 aLog->Log( _L("--------------------------------------------------------")); |
|
2724 aLog->Log( _L("Calling CopyEmsElementsL()")); |
|
2725 |
|
2726 RFs rfServer; |
|
2727 User::LeaveIfError(rfServer.Connect()); |
|
2728 |
|
2729 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
2730 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
2731 CSmsMessage* message = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsDeliver, smsBuffer ); |
|
2732 |
|
2733 //void CopyEmsElementsL(CSmsMessage &aToMessage) const |
|
2734 TRAPD( result, aMessage.CopyEmsElementsL(*message)); |
|
2735 |
|
2736 if(result != KErrNone) |
|
2737 { |
|
2738 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2739 } |
|
2740 else |
|
2741 { |
|
2742 aLog->Log(_L("CopyEmsElementsL() completed")); |
|
2743 aLog->Log(_L("EMS elements copied successfully")); |
|
2744 aLog->Log(_L("Copy EMS elements == PASS")); |
|
2745 } |
|
2746 |
|
2747 delete message; |
|
2748 rfServer.Close(); |
|
2749 |
|
2750 return result; |
|
2751 } |
|
2752 |
|
2753 // ----------------------------------------------------------------------------- |
|
2754 // TestEncodeIntoSinglePDU |
|
2755 // |
|
2756 // ----------------------------------------------------------------------------- |
|
2757 LOCAL_C TInt TestEncodeIntoSinglePDUL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2758 { |
|
2759 aLog->Log( _L("--------------------------------------------------------")); |
|
2760 aLog->Log( _L("Calling EncodeIntoSinglePDUL()")); |
|
2761 |
|
2762 //TBool EncodeIntoSinglePDUL(CArrayFix< TGsmSms > &aSmsArray); |
|
2763 CArrayFix<TGsmSms>* singlePDU = new (ELeave) CArrayFixFlat<TGsmSms>(10); |
|
2764 TRAPD( result, TBool res = aMessage.EncodeIntoSinglePDUL(*singlePDU)); |
|
2765 |
|
2766 if(result != KErrNone) |
|
2767 { |
|
2768 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2769 } |
|
2770 else |
|
2771 { |
|
2772 aLog->Log( _L("EncodeIntoSinglePDUL() completed")); |
|
2773 aLog->Log (_L("Encoded into single PDU successfully")); |
|
2774 aLog->Log( _L("Get is email header == PASS")); |
|
2775 } |
|
2776 |
|
2777 delete singlePDU; |
|
2778 return result; |
|
2779 } |
|
2780 |
|
2781 // ----------------------------------------------------------------------------- |
|
2782 // TestAddSlot |
|
2783 // |
|
2784 // ----------------------------------------------------------------------------- |
|
2785 LOCAL_C TInt TestAddSlot(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2786 { |
|
2787 aLog->Log( _L("--------------------------------------------------------")); |
|
2788 aLog->Log( _L("Calling AddSlotL()")); |
|
2789 |
|
2790 TGsmSmsSlotEntry slotEntry; |
|
2791 TRAPD( result, aMessage.AddSlotL(slotEntry)); |
|
2792 |
|
2793 if(result != KErrNone) |
|
2794 { |
|
2795 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2796 } |
|
2797 else |
|
2798 { |
|
2799 aLog->Log(_L("AddSlotL() completed")); |
|
2800 aLog->Log(_L("Slot added successfully")); |
|
2801 aLog->Log(_L("Add slot == PASS")); |
|
2802 } |
|
2803 |
|
2804 return result; |
|
2805 } |
|
2806 |
|
2807 // ----------------------------------------------------------------------------- |
|
2808 // TestMatchSlots |
|
2809 // |
|
2810 // ----------------------------------------------------------------------------- |
|
2811 LOCAL_C TInt TestMatchSlotsL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2812 { |
|
2813 aLog->Log( _L("--------------------------------------------------------")); |
|
2814 aLog->Log( _L("Calling MatchSlots()")); |
|
2815 TInt result = KErrNone; |
|
2816 |
|
2817 const CArrayFixFlat<TGsmSmsSlotEntry>* slotArray = new(ELeave) CArrayFixFlat<TGsmSmsSlotEntry>(5); |
|
2818 //TBool MatchSlots(const CArrayFixFlat<TGsmSmsSlotEntry>& aSlotArray); |
|
2819 TBool match = aMessage.MatchSlots(*slotArray); |
|
2820 |
|
2821 aLog->Log(_L("MatchSlots() Completed")); |
|
2822 aLog->Log(_L("Slots matched successfully")); |
|
2823 aLog->Log(_L("Match Slots == PASS")); |
|
2824 |
|
2825 return result; |
|
2826 } |
|
2827 |
|
2828 // ----------------------------------------------------------------------------- |
|
2829 // TestAddEmailHeader |
|
2830 // |
|
2831 // ----------------------------------------------------------------------------- |
|
2832 LOCAL_C TInt TestAddEmailHeader(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2833 { |
|
2834 aLog->Log( _L("--------------------------------------------------------")); |
|
2835 aLog->Log( _L("Calling AddEmailHeader()")); |
|
2836 |
|
2837 const TBufC<24> header(_L("EMail Header")); |
|
2838 TBufC<64> body(_L("EMail Body")); |
|
2839 //void AddEmailHeaderL(const TDesC& aEmailHeader,const TDesC& aEmailBody); |
|
2840 TRAPD( result, aMessage.AddEmailHeaderL(header, body)); |
|
2841 if(result != KErrNone) |
|
2842 { |
|
2843 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2844 } |
|
2845 else |
|
2846 { |
|
2847 aLog->Log(_L("AddEmailHeaderL() completed")); |
|
2848 aLog->Log(_L("Email header added successfully")); |
|
2849 aLog->Log(_L("Add email header == PASS")); |
|
2850 } |
|
2851 |
|
2852 return result; |
|
2853 } |
|
2854 |
|
2855 // ----------------------------------------------------------------------------- |
|
2856 // TestGetIsEmailHeader |
|
2857 // |
|
2858 // ----------------------------------------------------------------------------- |
|
2859 LOCAL_C TInt TestGetIsEmailHeader(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2860 { |
|
2861 aLog->Log( _L("--------------------------------------------------------")); |
|
2862 aLog->Log( _L("Calling IsEmailHeader()")); |
|
2863 |
|
2864 TInt result = KErrNone; |
|
2865 |
|
2866 //TBool IsEmailHeader() const |
|
2867 TBool res = aMessage.IsEmailHeader(); |
|
2868 |
|
2869 aLog->Log( _L("IsEmailHeader() completed")); |
|
2870 aLog->Log (_L("result data: is e-mail header : %d"), res); |
|
2871 aLog->Log( _L("Get is email header == PASS")); |
|
2872 |
|
2873 return result; |
|
2874 } |
|
2875 |
|
2876 // ----------------------------------------------------------------------------- |
|
2877 // TestGetEmailHeader |
|
2878 // |
|
2879 // ----------------------------------------------------------------------------- |
|
2880 LOCAL_C TInt TestGetEmailHeaderL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2881 { |
|
2882 aLog->Log( _L("--------------------------------------------------------")); |
|
2883 aLog->Log( _L("Calling GetEmailHeaderL()")); |
|
2884 |
|
2885 HBufC* emailHeader = HBufC::NewL(1024); |
|
2886 HBufC* emailBody = HBufC::NewL(1024); |
|
2887 TBool res; |
|
2888 //TBool GetEmailHeaderL(HBufC **aEmailHeader, HBufC **aEmailBody); |
|
2889 TRAPD( result, res = aMessage.GetEmailHeaderL(&emailHeader, &emailBody)); |
|
2890 |
|
2891 if( res && (result == KErrNone) ) |
|
2892 { |
|
2893 aLog->Log( _L("GetEmailHeaderL() completed")); |
|
2894 aLog->Log (_L("result data: e-mail header: %s"), emailHeader); |
|
2895 aLog->Log (_L("result data: e-mail body: %s"), emailBody); |
|
2896 aLog->Log( _L("Get email header == PASS")); |
|
2897 } |
|
2898 else |
|
2899 { |
|
2900 result = KErrGeneral; |
|
2901 aLog->Log( _L("Get email header == FAIL")); |
|
2902 } |
|
2903 |
|
2904 return result; |
|
2905 } |
|
2906 |
|
2907 // ----------------------------------------------------------------------------- |
|
2908 // TestSetIs16BitConcatenation |
|
2909 // |
|
2910 // ----------------------------------------------------------------------------- |
|
2911 LOCAL_C TInt TestSetIs16BitConcatenation(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2912 { |
|
2913 aLog->Log( _L("--------------------------------------------------------")); |
|
2914 aLog->Log( _L("Calling Set16BitConcatenation()")); |
|
2915 |
|
2916 TInt result = KErrNone; |
|
2917 |
|
2918 //void Set16BitConcatenation(TBool aIs16BitConcatenation) |
|
2919 aMessage.Set16BitConcatenation(ETrue); |
|
2920 |
|
2921 if( aMessage.Is16BitConcatenation() ) |
|
2922 { |
|
2923 aLog->Log( _L("Set16BitConcatenation() completed")); |
|
2924 aLog->Log (_L("16 bit concatenation flag stored successfully")); |
|
2925 aLog->Log( _L("Set is 16 bit concatenation == PASS")); |
|
2926 } |
|
2927 else |
|
2928 { |
|
2929 aLog->Log( _L("Set is 16 bit concatenation == FAIL")); |
|
2930 } |
|
2931 |
|
2932 return result; |
|
2933 } |
|
2934 |
|
2935 // ----------------------------------------------------------------------------- |
|
2936 // TestGetIs16BitConcatenation |
|
2937 // |
|
2938 // ----------------------------------------------------------------------------- |
|
2939 LOCAL_C TInt TestGetIs16BitConcatenation(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2940 { |
|
2941 aLog->Log( _L("--------------------------------------------------------")); |
|
2942 aLog->Log( _L("Calling Is16BitConcatenation()")); |
|
2943 |
|
2944 TInt result = KErrNone; |
|
2945 |
|
2946 //TBool Is16BitConcatenation() const |
|
2947 TBool res = aMessage.Is16BitConcatenation(); |
|
2948 |
|
2949 aLog->Log( _L("Is16BitConcatenation() completed")); |
|
2950 aLog->Log (_L("result data: 16 bit concatenation flag : %d"), res); |
|
2951 aLog->Log( _L("Get is 16 bit concatenation == PASS")); |
|
2952 |
|
2953 return result; |
|
2954 } |
|
2955 |
|
2956 // ----------------------------------------------------------------------------- |
|
2957 // TestUpdateSlots |
|
2958 // |
|
2959 // ----------------------------------------------------------------------------- |
|
2960 LOCAL_C TInt TestUpdateSlotsL(CStifLogger* aLog,CSmsMessage& aMessage) |
|
2961 { |
|
2962 aLog->Log( _L("--------------------------------------------------------")); |
|
2963 aLog->Log( _L("Calling UpdateSlotsL()")); |
|
2964 |
|
2965 TInt8 storeid = CSmsMessage::ESmsSIMStorage; |
|
2966 TBuf8<128> slot_buffer; |
|
2967 TBufC<32> file(_L("c:\\SmsSlots")); |
|
2968 CArrayFixFlat<TGsmSmsSlotEntry>* slot = new(ELeave) CArrayFixFlat<TGsmSmsSlotEntry>(5); |
|
2969 RFs session; |
|
2970 RFileWriteStream write; |
|
2971 RFileReadStream read; |
|
2972 |
|
2973 User::LeaveIfError( session.Connect() ); |
|
2974 write.Create(session, file, EFileWrite); |
|
2975 TInt err = write.Open(session, file, EFileWrite); |
|
2976 |
|
2977 TInt size = sizeof(slot); |
|
2978 write.WriteUint8L(storeid); |
|
2979 write.WriteL((TUint16*)slot, size); |
|
2980 write.CommitL(); |
|
2981 write.Close(); |
|
2982 TInt erro = read.Open(session, file, EFileRead); |
|
2983 |
|
2984 read.ReadL(slot_buffer, size+1); |
|
2985 //void UpdateSlotsL(TDesC8& aBuf); |
|
2986 TRAPD( result, aMessage.UpdateSlotsL(slot_buffer)); |
|
2987 |
|
2988 read.Close(); |
|
2989 session.Delete(file); |
|
2990 session.Close(); |
|
2991 |
|
2992 if(result != KErrNone) |
|
2993 { |
|
2994 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
2995 } |
|
2996 else |
|
2997 { |
|
2998 aLog->Log(_L("UpdateSlotsL() completed")); |
|
2999 aLog->Log(_L("Slot information updated successfully")); |
|
3000 aLog->Log(_L("Update slots == PASS")); |
|
3001 } |
|
3002 return result; |
|
3003 } |
|
3004 |
|
3005 // ----------------------------------------------------------------------------- |
|
3006 // TestGetEncodingInfoL |
|
3007 // |
|
3008 // ----------------------------------------------------------------------------- |
|
3009 |
|
3010 LOCAL_C TInt TestGetEncodingInfoL(CStifLogger* aLog, CSmsMessage& aMessage) |
|
3011 { |
|
3012 aLog->Log( _L("--------------------------------------------------------")); |
|
3013 aLog->Log( _L("Calling GetEncodingInfoL()")); |
|
3014 |
|
3015 TInt pdus =1; |
|
3016 TInt unconvertedchars=0; |
|
3017 TInt downgradedchars = 0; |
|
3018 TInt freeudunitsinlastfreepdu = 0; |
|
3019 |
|
3020 aMessage.GetEncodingInfoL(pdus, unconvertedchars, downgradedchars, freeudunitsinlastfreepdu); |
|
3021 |
|
3022 return KErrNone; |
|
3023 } |
|
3024 |
|
3025 // ----------------------------------------------------------------------------- |
|
3026 // TestSetAlternative7bitEncoding |
|
3027 // |
|
3028 // ----------------------------------------------------------------------------- |
|
3029 |
|
3030 LOCAL_C TInt TestSetAlternative7bitEncoding(CStifLogger* aLog, CSmsMessage& aMessage) |
|
3031 { |
|
3032 aLog->Log( _L("--------------------------------------------------------")); |
|
3033 aLog->Log( _L("Calling SetAlternative7bitEncoding()")); |
|
3034 |
|
3035 |
|
3036 TInt ret = aMessage.SetAlternative7bitEncoding(ESmsEncodingNone); |
|
3037 TSmsEncoding id = aMessage.Alternative7bitEncoding(); |
|
3038 |
|
3039 return ret; |
|
3040 } |
|
3041 |
|
3042 LOCAL_C TInt TestGetIsSupported2(CStifLogger* aLog,CSmsMessage& aMessage) |
|
3043 { |
|
3044 aLog->Log(_L("---------------------------------------------")); |
|
3045 aLog->Log(_L("Calling IsSupported2L()")); |
|
3046 |
|
3047 //TBool IsSupportedL(const TDesC &aDes, TInt &aNumberOfUnconvertibleCharacters, TInt &aIndexOfFirstUnconvertibleCharacter) |
|
3048 TBufC<50> testBuffer = _L("Nokia$123has*some%employees"); |
|
3049 TInt numUnconvertable; |
|
3050 TInt posFirstUnconvertable; |
|
3051 TInt numreqAlternativeEncoding; |
|
3052 TInt numDowngradedChars; |
|
3053 TBool res = 0; |
|
3054 TRAPD( result, res = aMessage.IsSupportedL(testBuffer, numUnconvertable, numDowngradedChars, numreqAlternativeEncoding, posFirstUnconvertable)); |
|
3055 |
|
3056 if(result != KErrNone) |
|
3057 { |
|
3058 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
3059 } |
|
3060 else |
|
3061 { |
|
3062 aLog->Log(_L("IsSupported2L() completed")); |
|
3063 aLog->Log(_L("result data: is supported: %d"), res); |
|
3064 aLog->Log(_L("Get is supported == PASS")); |
|
3065 } |
|
3066 return result; |
|
3067 } |
|
3068 //---------------------------------------------------------------- |
|
3069 // TestConstructionTGsmSms |
|
3070 // |
|
3071 // ----------------------------------------------------------------------------- |
|
3072 LOCAL_C TInt TestConstructionTGsmSms_PduL(CStifLogger* aLog, CSmsPDU& pdu) |
|
3073 { |
|
3074 aLog->Log(_L("---------------------------------------------")); |
|
3075 aLog->Log(_L("Calling CSmsPDU::NewL(TGsmSms)")); |
|
3076 TInt result = KErrNone; |
|
3077 |
|
3078 RFs session; |
|
3079 User::LeaveIfError(session.Connect()); |
|
3080 TGsmSms sms; |
|
3081 pdu.EncodeMessagePDUL( sms ); |
|
3082 CCnvCharacterSetConverter* converter = CCnvCharacterSetConverter::NewL(); |
|
3083 CleanupStack::PushL(converter); |
|
3084 |
|
3085 //static CSmsPDU* NewL(const TGsmSms& aGsmSms,CCnvCharacterSetConverter& aCharacterSetConverter |
|
3086 //,RFs& aFs,TBool aIsRPError=EFalse,TBool aIsMobileTerminated=ETrue); |
|
3087 CSmsPDU* PDU = CSmsPDU::NewL(sms, *converter, session, ETrue, EFalse); |
|
3088 CleanupStack::PushL(PDU); |
|
3089 |
|
3090 if( PDU != NULL) |
|
3091 { |
|
3092 aLog->Log(_L("CSmsPDU::NewL(TGsmSms) Completed")); |
|
3093 aLog->Log(_L("CSmsPDU::NewL(TGsmSms) == PASS")); |
|
3094 } |
|
3095 else |
|
3096 { |
|
3097 result = KErrGeneral; |
|
3098 aLog->Log(_L("CSmsPDU::NewL(TGsmSms) == FAIL")); |
|
3099 } |
|
3100 |
|
3101 CleanupStack::PopAndDestroy(2); |
|
3102 session.Close(); |
|
3103 return result; |
|
3104 } |
|
3105 |
|
3106 // ----------------------------------------------------------------------------- |
|
3107 // TestConstructionStream |
|
3108 // |
|
3109 // ----------------------------------------------------------------------------- |
|
3110 LOCAL_C TInt TestConstructionStreamL(CStifLogger* aLog, CSmsPDU& PDU) |
|
3111 { |
|
3112 aLog->Log( _L("--------------------------------------------------------")); |
|
3113 aLog->Log( _L("Calling CSmsPDU::NewL(RReadStream)")); |
|
3114 TInt result = KErrNone; |
|
3115 |
|
3116 RFs session; |
|
3117 User::LeaveIfError(session.Connect()); |
|
3118 TBufC<64> storename = _L("C:\\CSmsPDU_Construction"); |
|
3119 RFileWriteStream write; |
|
3120 RFileReadStream read; |
|
3121 CCnvCharacterSetConverter* charSet = CCnvCharacterSetConverter::NewL(); |
|
3122 write.Create(session, storename, EFileWrite); |
|
3123 TInt erro = write.Open(session, storename, EFileWrite); |
|
3124 PDU.ExternalizeL( write ); |
|
3125 write.CommitL(); |
|
3126 write.Close(); |
|
3127 |
|
3128 erro = read.Open(session, storename, EFileRead); |
|
3129 CSmsPDU* aPDU = CSmsPDU::NewL( read, *charSet, session); |
|
3130 read.Close(); |
|
3131 //now delete the store |
|
3132 TInt err = session.Delete(storename); |
|
3133 session.Close(); |
|
3134 |
|
3135 if( aPDU != NULL) |
|
3136 { |
|
3137 aLog->Log(_L("CSmsPDU::NewL(RReadStream) Completed")); |
|
3138 aLog->Log(_L("CSmsPDU::NewL(RReadStream) == PASS")); |
|
3139 } |
|
3140 else |
|
3141 { |
|
3142 result = KErrGeneral; |
|
3143 aLog->Log(_L("CSmsPDU::NewL(RReadStream) == FAIL")); |
|
3144 } |
|
3145 |
|
3146 delete aPDU; |
|
3147 delete charSet; |
|
3148 return result; |
|
3149 } |
|
3150 |
|
3151 // ----------------------------------------------------------------------------- |
|
3152 // TestGetType |
|
3153 // Gets the PDU type |
|
3154 // ----------------------------------------------------------------------------- |
|
3155 LOCAL_C TInt TestGetType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3156 { |
|
3157 aLog->Log( _L("--------------------------------------------------------")); |
|
3158 aLog->Log( _L("Calling Type ()")); |
|
3159 TInt result = KErrNone; |
|
3160 |
|
3161 // inline TSmsPDUType Type() const |
|
3162 CSmsPDU::TSmsPDUType checkres = aSmsPdu.Type (); |
|
3163 |
|
3164 if( checkres == CSmsPDU::ESmsDeliver) |
|
3165 { |
|
3166 aLog->Log( _L("Type() completed")); |
|
3167 aLog->Log (_L("Result data:type: %d"),checkres); |
|
3168 aLog->Log( _L("Get type == PASS")); |
|
3169 } |
|
3170 else |
|
3171 { |
|
3172 result = KErrGeneral; |
|
3173 aLog->Log( _L("Get type == FAIL")); |
|
3174 } |
|
3175 |
|
3176 return result; |
|
3177 } |
|
3178 |
|
3179 // ----------------------------------------------------------------------------- |
|
3180 // TestExternalizeL |
|
3181 // Externalises the object |
|
3182 // ----------------------------------------------------------------------------- |
|
3183 LOCAL_C TInt TestExternalizeL (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3184 { |
|
3185 aLog->Log(_L("---------------------------------------------")); |
|
3186 aLog->Log(_L("Calling ExternalizeL()")); |
|
3187 |
|
3188 RFs session; |
|
3189 User::LeaveIfError(session.Connect()); |
|
3190 TBufC<64> storename = _L("C:\\SMSGSMUtilities_CSmsPDU"); |
|
3191 RFileWriteStream write; |
|
3192 |
|
3193 write.Create(session, storename, EFileWrite); |
|
3194 TInt err = write.Open(session, storename, EFileWrite); |
|
3195 |
|
3196 //IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
3197 TRAPD( result, aSmsPdu.ExternalizeL( write )); |
|
3198 |
|
3199 write.CommitL(); |
|
3200 write.Close(); |
|
3201 |
|
3202 session.Close(); |
|
3203 if( result == KErrNone ) |
|
3204 { |
|
3205 aLog->Log( _L("ExternalizeL() completed")); |
|
3206 aLog->Log( _L("Data externalized successfully")); |
|
3207 aLog->Log( _L("Externalize == PASS")); |
|
3208 } |
|
3209 else |
|
3210 aLog->Log( _L("Externalize == FAIL")); |
|
3211 |
|
3212 return result; |
|
3213 } |
|
3214 |
|
3215 |
|
3216 // ----------------------------------------------------------------------------- |
|
3217 // TestEncodeMessagePDUs |
|
3218 // Encodes a TGsmSms for the given type of CSmsPDU |
|
3219 // ----------------------------------------------------------------------------- |
|
3220 LOCAL_C TInt TestEncodeMessagePDUs (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3221 { |
|
3222 aLog->Log( _L("--------------------------------------------------------")); |
|
3223 aLog->Log( _L("Calling EncodeMessagePDUsL()")); |
|
3224 TGsmSms testSms; |
|
3225 |
|
3226 // IMPORT_C void EncodeMessagePDUL(TGsmSms &aGsmSms) const |
|
3227 TRAPD(result, aSmsPdu.EncodeMessagePDUL (testSms)); |
|
3228 |
|
3229 if( result == KErrNone) |
|
3230 { |
|
3231 aLog->Log( _L("EncodeMessagePDUsL() completed")); |
|
3232 aLog->Log( _L("Message PDUs encoded successfully")); |
|
3233 aLog->Log( _L("Encode message PDUs == PASS")); |
|
3234 |
|
3235 } |
|
3236 else |
|
3237 aLog->Log( _L("Encode message PDUs == FAIL")); |
|
3238 |
|
3239 return result; |
|
3240 } |
|
3241 |
|
3242 |
|
3243 // ----------------------------------------------------------------------------- |
|
3244 // TestGetServiceCenterAddress |
|
3245 // Gets the service center address |
|
3246 // ----------------------------------------------------------------------------- |
|
3247 LOCAL_C TInt TestGetServiceCenterAddress (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3248 { |
|
3249 aLog->Log( _L("--------------------------------------------------------")); |
|
3250 aLog->Log( _L("Calling ServiceCenterAddress()")); |
|
3251 |
|
3252 TInt result = KErrNone; |
|
3253 TPtrC address = _L("Test String"); |
|
3254 |
|
3255 // IMPORT_C TPtrC ServiceCenterAddress() const |
|
3256 TPtrC checkres = aSmsPdu.ServiceCenterAddress (); |
|
3257 |
|
3258 if(!checkres.Compare (address)) |
|
3259 { |
|
3260 aLog->Log( _L("GetServiceCenterAddressL() completed")); |
|
3261 aLog->Log (_L("Result data:address: %s"),checkres.Ptr()); |
|
3262 aLog->Log( _L("Get service center address == PASS")); |
|
3263 } |
|
3264 else |
|
3265 aLog->Log( _L("Get service center address == FAIL")); |
|
3266 |
|
3267 return result; |
|
3268 } |
|
3269 |
|
3270 |
|
3271 // ----------------------------------------------------------------------------- |
|
3272 // TestSetServiceCenterAddress |
|
3273 // Sets the service center address |
|
3274 // ----------------------------------------------------------------------------- |
|
3275 LOCAL_C TInt TestSetServiceCenterAddress (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3276 { |
|
3277 aLog->Log( _L("--------------------------------------------------------")); |
|
3278 aLog->Log( _L("Calling SetServiceCenterAddressL()")); |
|
3279 |
|
3280 TPtrC address = _L("Test String"); |
|
3281 |
|
3282 // IMPORT_C void SetServiceCenterAddressL(const TDesC &aAddress); |
|
3283 TRAPD(result, aSmsPdu.SetServiceCenterAddressL (address)); |
|
3284 |
|
3285 if(result == KErrNone) |
|
3286 { |
|
3287 aLog->Log( _L("SetServiceCenterAddressL() completed")); |
|
3288 aLog->Log( _L("Service center address successfully stored")); |
|
3289 aLog->Log( _L("Set service center address == PASS")); |
|
3290 } |
|
3291 else |
|
3292 aLog->Log( _L("Set service center address == FAIL")); |
|
3293 |
|
3294 return result; |
|
3295 } |
|
3296 |
|
3297 |
|
3298 // ----------------------------------------------------------------------------- |
|
3299 // TestGetParsedServiceCenterAddress |
|
3300 // Gets the service center address in a TGsmSmsTelNumber object |
|
3301 // ----------------------------------------------------------------------------- |
|
3302 LOCAL_C TInt TestGetParsedServiceCenterAddress (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3303 { |
|
3304 aLog->Log( _L("--------------------------------------------------------")); |
|
3305 aLog->Log( _L("Calling ParsedServiceCenterAddress()")); |
|
3306 |
|
3307 TInt result = KErrNone; |
|
3308 TGsmSmsTelNumber testTelNo; |
|
3309 _LIT(str,"9945563472"); |
|
3310 TBuf<20> telno (str); |
|
3311 |
|
3312 |
|
3313 // IMPORT_C void ParsedServiceCenterAddress(TGsmSmsTelNumber |
|
3314 // &aParsedAddress) const |
|
3315 aSmsPdu.ParsedServiceCenterAddress (testTelNo); |
|
3316 |
|
3317 if(!(testTelNo.iTelNumber).Compare (telno)) |
|
3318 { |
|
3319 aLog->Log( _L("ParsedServiceCenterAddress() completed")); |
|
3320 aLog->Log (_L("result data:parsed address: %s"),testTelNo.iTelNumber.Ptr()); |
|
3321 aLog->Log( _L("Get parsed service center address == PASS")); |
|
3322 } |
|
3323 else |
|
3324 aLog->Log( _L("Get parsed service center address == FAIL")); |
|
3325 |
|
3326 return result; |
|
3327 } |
|
3328 |
|
3329 |
|
3330 // ----------------------------------------------------------------------------- |
|
3331 // TestSetParsedServiceCenterAddress |
|
3332 // Sets the service center address in a TGsmSmsTelNumber object |
|
3333 // ----------------------------------------------------------------------------- |
|
3334 LOCAL_C TInt TestSetParsedServiceCenterAddress (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3335 { |
|
3336 aLog->Log( _L("--------------------------------------------------------")); |
|
3337 aLog->Log( _L("Calling SetParsedServiceCenterAddressL()")); |
|
3338 |
|
3339 TGsmSmsTelNumber testTelNo; |
|
3340 _LIT(str,"9945563472"); |
|
3341 TBuf<20> telno (str); |
|
3342 testTelNo.iTelNumber = telno; |
|
3343 |
|
3344 |
|
3345 // IMPORT_C void SetParsedServiceCenterAddressL(const TGsmSmsTelNumber |
|
3346 // &aParsedAddress); |
|
3347 TRAPD(result, aSmsPdu.SetParsedServiceCenterAddressL (testTelNo)); |
|
3348 |
|
3349 if(result == KErrNone) |
|
3350 { |
|
3351 aLog->Log( _L("SetParsedServiceCenterAddressL() completed")); |
|
3352 aLog->Log( _L("Parsed address successfully stored")); |
|
3353 aLog->Log( _L("Set parsed service center address == PASS")); |
|
3354 } |
|
3355 else |
|
3356 aLog->Log( _L("Set parsed service center address == FAIL")); |
|
3357 |
|
3358 return result; |
|
3359 } |
|
3360 |
|
3361 // ----------------------------------------------------------------------------- |
|
3362 // TestGetToFromAddress |
|
3363 // Gets the "to from" address |
|
3364 // ----------------------------------------------------------------------------- |
|
3365 LOCAL_C TInt TestGetToFromAddress (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3366 { |
|
3367 aLog->Log( _L("--------------------------------------------------------")); |
|
3368 aLog->Log( _L("Calling ToFromAddress()")); |
|
3369 |
|
3370 TInt result = KErrNone; |
|
3371 _LIT(str,"TestAddress"); |
|
3372 TBufC<20> testadd (str); |
|
3373 |
|
3374 // IMPORT_C TPtrC ToFromAddress() const |
|
3375 TPtrC checkres = aSmsPdu.ToFromAddress(); |
|
3376 |
|
3377 if( ! checkres.Compare (testadd)) |
|
3378 { |
|
3379 aLog->Log( _L("ToFromAddress() completed")); |
|
3380 aLog->Log(_L("Result data:to from address: %s"),checkres.Ptr()); |
|
3381 aLog->Log( _L("Get to from address == PASS")); |
|
3382 } |
|
3383 else |
|
3384 aLog->Log( _L("Get to from address == FAIL")); |
|
3385 |
|
3386 return result; |
|
3387 } |
|
3388 |
|
3389 // ----------------------------------------------------------------------------- |
|
3390 // TestSetToFromAddress |
|
3391 // Gets the "to from" address |
|
3392 // ----------------------------------------------------------------------------- |
|
3393 LOCAL_C TInt TestSetToFromAddress (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3394 { |
|
3395 aLog->Log( _L("--------------------------------------------------------")); |
|
3396 aLog->Log( _L("Calling SetToFromAddressL()")); |
|
3397 |
|
3398 _LIT(str,"TestAddress"); |
|
3399 TBufC<20> testadd (str); |
|
3400 |
|
3401 // IMPORT_C void SetToFromAddressL(const TDesC &aAddress) |
|
3402 TRAPD( result, aSmsPdu.SetToFromAddressL (testadd)); |
|
3403 |
|
3404 if(result == KErrNone) |
|
3405 { |
|
3406 aLog->Log( _L("SetToFromAddressL() completed")); |
|
3407 aLog->Log( _L("To from addresses successfully stored")); |
|
3408 aLog->Log( _L("Set to from address == PASS")); |
|
3409 } |
|
3410 else |
|
3411 aLog->Log( _L("Set to from address == FAIL")); |
|
3412 |
|
3413 return result; |
|
3414 } |
|
3415 |
|
3416 |
|
3417 // ----------------------------------------------------------------------------- |
|
3418 // TestGetParsedToFromAddress |
|
3419 // Gets the "to from" in a TGsmSmsTelNumber object |
|
3420 // ----------------------------------------------------------------------------- |
|
3421 LOCAL_C TInt TestGetParsedToFromAddress (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3422 { |
|
3423 aLog->Log( _L("--------------------------------------------------------")); |
|
3424 aLog->Log( _L("Calling ParsedToFromAddress()")); |
|
3425 |
|
3426 TInt result = KErrNone; |
|
3427 TGsmSmsTelNumber testTelNo; |
|
3428 _LIT(str,"9945563472"); |
|
3429 TBuf<20> telno (str); |
|
3430 |
|
3431 // IMPORT_C void ParsedToFromAddress(TGsmSmsTelNumber &aParsedAddress) const |
|
3432 aSmsPdu.ParsedToFromAddress (testTelNo); |
|
3433 |
|
3434 if(!(testTelNo.iTelNumber).Compare (telno)) |
|
3435 { |
|
3436 aLog->Log( _L("ParsedToFromAddress() completed")); |
|
3437 _LIT(tempVal,"result data:parsed to from address: %s"); |
|
3438 aLog->Log (tempVal,testTelNo.iTelNumber.Ptr()); |
|
3439 aLog->Log( _L("Get parsed to from address == PASS")); |
|
3440 } |
|
3441 else |
|
3442 aLog->Log( _L("Get parsed to from address == FAIL")); |
|
3443 |
|
3444 return result; |
|
3445 } |
|
3446 |
|
3447 |
|
3448 // ----------------------------------------------------------------------------- |
|
3449 // TestSetParsedToFromAddress |
|
3450 // Sets the "to from" with a TGsmSmsTelNumber object |
|
3451 // ----------------------------------------------------------------------------- |
|
3452 LOCAL_C TInt TestSetParsedToFromAddress (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3453 { |
|
3454 aLog->Log( _L("--------------------------------------------------------")); |
|
3455 aLog->Log( _L("Calling SetParsedToFromAddressL()")); |
|
3456 |
|
3457 TGsmSmsTelNumber testTelNo; |
|
3458 _LIT(str,"9945563472"); |
|
3459 TBuf<20> telno (str); |
|
3460 testTelNo.iTelNumber = telno; |
|
3461 |
|
3462 |
|
3463 // IMPORT_C void SetParsedToFromAddressL(const TGsmSmsTelNumber |
|
3464 // &aParsedAddress); |
|
3465 TRAPD( result, aSmsPdu.SetParsedToFromAddressL (testTelNo)); |
|
3466 |
|
3467 if(result == KErrNone) |
|
3468 { |
|
3469 aLog->Log( _L("SetParsedToFromAddressL() completed")); |
|
3470 aLog->Log( _L("Parsed to from addresses successfully stored")); |
|
3471 aLog->Log( _L("Set parsed to from address == PASS")); |
|
3472 } |
|
3473 else |
|
3474 aLog->Log( _L("Set parsed to from address == FAIL")); |
|
3475 |
|
3476 return result; |
|
3477 } |
|
3478 |
|
3479 |
|
3480 // ----------------------------------------------------------------------------- |
|
3481 // TestGetBits7To4 |
|
3482 // Gets bits 7 to 4 on the data coding scheme |
|
3483 // ----------------------------------------------------------------------------- |
|
3484 LOCAL_C TInt TestGetBits7To4 (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3485 { |
|
3486 aLog->Log( _L("--------------------------------------------------------")); |
|
3487 aLog->Log( _L("Calling Bits7To4()")); |
|
3488 |
|
3489 TInt result = KErrNone; |
|
3490 TSmsDataCodingScheme::TSmsDCSBits7To4 bitsVal; |
|
3491 |
|
3492 // IMPORT_C TSmsDataCodingScheme::TSmsDCSBits7To4 Bits7To4() const |
|
3493 bitsVal = aSmsPdu.Bits7To4 (); |
|
3494 |
|
3495 if(bitsVal == TSmsDataCodingScheme::ESmsDCSTextUncompressedWithNoClassInfo) |
|
3496 { |
|
3497 aLog->Log( _L("Bits7To4() completed")); |
|
3498 _LIT(tempVal,"result data:bits 7 to 4: %d"); |
|
3499 aLog->Log (tempVal,bitsVal); |
|
3500 aLog->Log( _L("Get bits 7 to 4 == PASS")); |
|
3501 } |
|
3502 else |
|
3503 aLog->Log( _L("Get bits 7 to 4 == FAIL")); |
|
3504 |
|
3505 return result; |
|
3506 } |
|
3507 |
|
3508 |
|
3509 // ----------------------------------------------------------------------------- |
|
3510 // TestSetBits7To4 |
|
3511 // Sets bits 7 to 4 on the data coding scheme |
|
3512 // ----------------------------------------------------------------------------- |
|
3513 LOCAL_C TInt TestSetBits7To4 (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3514 { |
|
3515 aLog->Log( _L("--------------------------------------------------------")); |
|
3516 aLog->Log( _L("Calling SetBits7To4()")); |
|
3517 |
|
3518 TInt result = KErrNone; |
|
3519 TSmsDataCodingScheme::TSmsDCSBits7To4 bitsVal (TSmsDataCodingScheme:: |
|
3520 ESmsDCSTextUncompressedWithNoClassInfo); |
|
3521 |
|
3522 // IMPORT_C void SetBits7To4(TSmsDataCodingScheme::TSmsDCSBits7To4 |
|
3523 // aBits7To4) |
|
3524 aSmsPdu.SetBits7To4 (bitsVal); |
|
3525 |
|
3526 aLog->Log( _L("SetBits7To4() completed")); |
|
3527 aLog->Log( _L("Bits 7 to 4 stored successfully")); |
|
3528 aLog->Log( _L("Set bits 7 to 4 == PASS")); |
|
3529 |
|
3530 return result; |
|
3531 } |
|
3532 |
|
3533 // ----------------------------------------------------------------------------- |
|
3534 // TestGetAlphabet |
|
3535 // Gets the alphabet encoded in the data coding scheme |
|
3536 // ----------------------------------------------------------------------------- |
|
3537 LOCAL_C TInt TestGetAlphabet (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3538 { |
|
3539 aLog->Log( _L("--------------------------------------------------------")); |
|
3540 aLog->Log( _L("Calling Alphabet()")); |
|
3541 |
|
3542 TInt result = KErrNone; |
|
3543 TSmsDataCodingScheme::TSmsAlphabet testAlphabet; |
|
3544 |
|
3545 // IMPORT_C TSmsDataCodingScheme::TSmsAlphabet Alphabet() const |
|
3546 testAlphabet = aSmsPdu.Alphabet(); |
|
3547 |
|
3548 if(testAlphabet == TSmsDataCodingScheme::ESmsAlphabet7Bit) |
|
3549 { |
|
3550 aLog->Log( _L("Alphabet() completed")); |
|
3551 _LIT(tempVal,"result data:alphabet: %d"); |
|
3552 aLog->Log (tempVal,testAlphabet); |
|
3553 aLog->Log( _L("Get alphabet == PASS")); |
|
3554 } |
|
3555 else |
|
3556 aLog->Log( _L("Get alphabet == FAIL")); |
|
3557 |
|
3558 return result; |
|
3559 } |
|
3560 |
|
3561 |
|
3562 // ----------------------------------------------------------------------------- |
|
3563 // TestSetAlphabet |
|
3564 // Sets the alphabet encoded in the data coding scheme |
|
3565 // ----------------------------------------------------------------------------- |
|
3566 LOCAL_C TInt TestSetAlphabet (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3567 { |
|
3568 aLog->Log( _L("--------------------------------------------------------")); |
|
3569 aLog->Log( _L("Calling SetAlphabet()")); |
|
3570 |
|
3571 TInt result = KErrNone; |
|
3572 TSmsDataCodingScheme::TSmsAlphabet testAlphabet (TSmsDataCodingScheme:: |
|
3573 ESmsAlphabet7Bit); |
|
3574 |
|
3575 // IMPORT_C void SetAlphabet(TSmsDataCodingScheme::TSmsAlphabet aAlphabet) |
|
3576 aSmsPdu.SetAlphabet (testAlphabet); |
|
3577 |
|
3578 aLog->Log( _L("SetAlphabet() completed")); |
|
3579 aLog->Log( _L("Alphabet stored successfully")); |
|
3580 aLog->Log( _L("Set alphabet == PASS")); |
|
3581 |
|
3582 return result; |
|
3583 } |
|
3584 |
|
3585 |
|
3586 // ----------------------------------------------------------------------------- |
|
3587 // TestGetClass |
|
3588 // Gets the GSM SMS PDU class in the data coding scheme |
|
3589 // ----------------------------------------------------------------------------- |
|
3590 LOCAL_C TInt TestGetClass (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3591 { |
|
3592 aLog->Log( _L("--------------------------------------------------------")); |
|
3593 aLog->Log( _L("Calling Class()")); |
|
3594 |
|
3595 TInt result = KErrNone; |
|
3596 TSmsDataCodingScheme::TSmsClass testClass (TSmsDataCodingScheme:: |
|
3597 ESmsClass0); |
|
3598 |
|
3599 //TBool Class(TSmsDataCodingScheme::TSmsClass &aClass) const |
|
3600 TBool checkres = aSmsPdu.Class (testClass); |
|
3601 |
|
3602 if( checkres ) |
|
3603 { |
|
3604 aLog->Log( _L("Class() completed")); |
|
3605 aLog->Log(_L("Result data:class: %d"),testClass); |
|
3606 aLog->Log( _L("Get class == PASS")); |
|
3607 } |
|
3608 else |
|
3609 aLog->Log( _L("Get class == FAIL")); |
|
3610 |
|
3611 return result; |
|
3612 } |
|
3613 |
|
3614 |
|
3615 // ----------------------------------------------------------------------------- |
|
3616 // TestSetClass |
|
3617 // Sets the GSM SMS PDU class in the data coding scheme |
|
3618 // ----------------------------------------------------------------------------- |
|
3619 LOCAL_C TInt TestSetClass (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3620 { |
|
3621 aLog->Log( _L("--------------------------------------------------------")); |
|
3622 aLog->Log( _L("Calling SetClass()")); |
|
3623 |
|
3624 TInt result = KErrNone; |
|
3625 TSmsDataCodingScheme::TSmsClass testClass (TSmsDataCodingScheme::ESmsClass0); |
|
3626 |
|
3627 //void SetClass(TBool aClassDefined, TSmsDataCodingScheme::TSmsClass aClass) |
|
3628 aSmsPdu.SetClass (ETrue, testClass); |
|
3629 |
|
3630 aLog->Log( _L("SetClass() completed")); |
|
3631 aLog->Log( _L("Class stored successfully")); |
|
3632 aLog->Log( _L("Set class == PASS")); |
|
3633 |
|
3634 return result; |
|
3635 } |
|
3636 |
|
3637 |
|
3638 // ----------------------------------------------------------------------------- |
|
3639 // TestGetTextCompressed |
|
3640 // True if Text Compressed is encoded in the data coding scheme |
|
3641 // ----------------------------------------------------------------------------- |
|
3642 LOCAL_C TInt TestGetTextCompressed (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3643 { |
|
3644 aLog->Log( _L("--------------------------------------------------------")); |
|
3645 aLog->Log( _L("Calling TextCompressed()")); |
|
3646 |
|
3647 TInt result = KErrNone; |
|
3648 |
|
3649 // IMPORT_C TBool TextCompressed() const |
|
3650 TBool checkres = aSmsPdu.TextCompressed (); |
|
3651 |
|
3652 if( checkres ) |
|
3653 { |
|
3654 aLog->Log( _L("TextCompressed() completed")); |
|
3655 _LIT(tempVal,"result data:text compressed: %d"); |
|
3656 aLog->Log (tempVal,checkres); |
|
3657 aLog->Log( _L("Get text compresed == PASS")); |
|
3658 } |
|
3659 else |
|
3660 aLog->Log( _L("Get text compresed == FAIL")); |
|
3661 |
|
3662 return result; |
|
3663 } |
|
3664 |
|
3665 |
|
3666 |
|
3667 // ----------------------------------------------------------------------------- |
|
3668 // TestSetTextCompressed |
|
3669 // Set to encode Text Compressed in the data coding scheme |
|
3670 // ----------------------------------------------------------------------------- |
|
3671 LOCAL_C TInt TestSetTextCompressed (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3672 { |
|
3673 aLog->Log( _L("--------------------------------------------------------")); |
|
3674 aLog->Log( _L("Calling SetTextCompressed()")); |
|
3675 |
|
3676 TInt result = KErrNone; |
|
3677 |
|
3678 // IMPORT_C void SetTextCompressed(TBool aCompressed); |
|
3679 aSmsPdu.SetTextCompressed (ETrue); |
|
3680 |
|
3681 aLog->Log( _L("SetTextCompressed() completed")); |
|
3682 aLog->Log( _L("Text compressed flag successfully stored")); |
|
3683 aLog->Log( _L("Set text compresed == PASS")); |
|
3684 |
|
3685 return result; |
|
3686 } |
|
3687 |
|
3688 |
|
3689 // ----------------------------------------------------------------------------- |
|
3690 // TestGetIndicationState |
|
3691 // Gets the Indication State encoded in the data coding scheme. |
|
3692 // ----------------------------------------------------------------------------- |
|
3693 LOCAL_C TInt TestGetIndicationState (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3694 { |
|
3695 aLog->Log( _L("--------------------------------------------------------")); |
|
3696 aLog->Log( _L("Calling IndicationState()")); |
|
3697 |
|
3698 TInt result = KErrNone; |
|
3699 TSmsDataCodingScheme::TSmsIndicationState testState; |
|
3700 |
|
3701 // IMPORT_C TSmsDataCodingScheme::TSmsIndicationState IndicationState() const |
|
3702 testState = aSmsPdu.IndicationState (); |
|
3703 |
|
3704 if(testState == TSmsDataCodingScheme::ESmsIndicationInactive) |
|
3705 { |
|
3706 aLog->Log( _L("IndicationState() completed")); |
|
3707 _LIT(tempVal,"result data:indication state: %d"); |
|
3708 aLog->Log (tempVal,testState); |
|
3709 aLog->Log( _L("Get indication state == PASS")); |
|
3710 } |
|
3711 else |
|
3712 aLog->Log( _L("Get indication state == FAIL")); |
|
3713 |
|
3714 return result; |
|
3715 } |
|
3716 |
|
3717 |
|
3718 // ----------------------------------------------------------------------------- |
|
3719 // TestSetIndicationState |
|
3720 // Sets the Indication State encoded in the data coding scheme. |
|
3721 // ----------------------------------------------------------------------------- |
|
3722 LOCAL_C TInt TestSetIndicationState (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3723 { |
|
3724 aLog->Log( _L("--------------------------------------------------------")); |
|
3725 aLog->Log( _L("Calling SetIndicationState()")); |
|
3726 |
|
3727 TInt result = KErrNone; |
|
3728 TSmsDataCodingScheme::TSmsIndicationState testState (TSmsDataCodingScheme:: |
|
3729 ESmsIndicationInactive); |
|
3730 |
|
3731 // IMPORT_C void SetIndicationState(TSmsDataCodingScheme:: |
|
3732 // TSmsIndicationState aState); |
|
3733 aSmsPdu.SetIndicationState (testState); |
|
3734 |
|
3735 aLog->Log( _L("SetIndicationState() completed")); |
|
3736 aLog->Log( _L("Indication state stored successfully")); |
|
3737 aLog->Log( _L("Set indication state == PASS")); |
|
3738 |
|
3739 return result; |
|
3740 } |
|
3741 |
|
3742 |
|
3743 // ----------------------------------------------------------------------------- |
|
3744 // TestGetIndicationType |
|
3745 // Gets the Indication Type encoded in the data coding scheme. |
|
3746 // ----------------------------------------------------------------------------- |
|
3747 LOCAL_C TInt TestGetIndicationType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3748 { |
|
3749 aLog->Log( _L("--------------------------------------------------------")); |
|
3750 aLog->Log( _L("Calling IndicationType()")); |
|
3751 |
|
3752 TInt result = KErrNone; |
|
3753 TSmsDataCodingScheme::TSmsIndicationType testIndicationType; |
|
3754 |
|
3755 //TSmsDataCodingScheme::TSmsIndicationType IndicationType() const |
|
3756 testIndicationType = aSmsPdu.IndicationType (); |
|
3757 |
|
3758 if(testIndicationType == TSmsDataCodingScheme::ESmsVoicemailMessageWaiting) |
|
3759 { |
|
3760 aLog->Log( _L("IndicationType() completed")); |
|
3761 _LIT(tempVal,"result data:indication type: %d"); |
|
3762 aLog->Log (tempVal,testIndicationType); |
|
3763 aLog->Log( _L("Get indication type == PASS")); |
|
3764 } |
|
3765 else |
|
3766 aLog->Log( _L("Get indication type == FAIL")); |
|
3767 |
|
3768 return result; |
|
3769 } |
|
3770 |
|
3771 |
|
3772 // ----------------------------------------------------------------------------- |
|
3773 // TestSetIndicationType |
|
3774 // Sets the Indication Type encoded in the data coding scheme. |
|
3775 // ----------------------------------------------------------------------------- |
|
3776 LOCAL_C TInt TestSetIndicationType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3777 { |
|
3778 aLog->Log( _L("--------------------------------------------------------")); |
|
3779 aLog->Log( _L("Calling SetIndicationType()")); |
|
3780 |
|
3781 TInt result = KErrNone; |
|
3782 TSmsDataCodingScheme::TSmsIndicationType testIndicationType ( |
|
3783 TSmsDataCodingScheme::ESmsVoicemailMessageWaiting); |
|
3784 |
|
3785 //void SetIndicationType(TSmsDataCodingScheme::TSmsIndicationType aType); |
|
3786 aSmsPdu.SetIndicationType (testIndicationType); |
|
3787 |
|
3788 aLog->Log( _L("SetIndicationType() completed")); |
|
3789 aLog->Log( _L("Indication type stored successfully")); |
|
3790 aLog->Log( _L("Set indication type == PASS")); |
|
3791 |
|
3792 return result; |
|
3793 } |
|
3794 |
|
3795 |
|
3796 // ----------------------------------------------------------------------------- |
|
3797 // TestGetTextConcatenated |
|
3798 // Tests if the PDU is part of a concatenated message |
|
3799 // ----------------------------------------------------------------------------- |
|
3800 LOCAL_C TInt TestGetTextConcatenated (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3801 { |
|
3802 aLog->Log( _L("--------------------------------------------------------")); |
|
3803 aLog->Log( _L("Calling TextConcatenated()")); |
|
3804 |
|
3805 TInt result = KErrNone; |
|
3806 |
|
3807 // IMPORT_C TBool TextConcatenated(TBool *aIs16Bit=0) const |
|
3808 TBool checkres = aSmsPdu.TextConcatenated (); |
|
3809 |
|
3810 if( checkres ) |
|
3811 { |
|
3812 aLog->Log( _L("TextConcatenated() completed")); |
|
3813 _LIT(tempVal,"result data:text concatenated: %d"); |
|
3814 aLog->Log (tempVal,checkres); |
|
3815 aLog->Log( _L("Get text concatenated == PASS")); |
|
3816 } |
|
3817 else |
|
3818 aLog->Log( _L("Get text concatenated == FAIL")); |
|
3819 |
|
3820 return result; |
|
3821 } |
|
3822 |
|
3823 |
|
3824 // ----------------------------------------------------------------------------- |
|
3825 // TestSetTextConcatenated |
|
3826 // Tests if the PDU is part of a concatenated message. |
|
3827 // ----------------------------------------------------------------------------- |
|
3828 LOCAL_C TInt TestSetTextConcatenated (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3829 { |
|
3830 aLog->Log( _L("--------------------------------------------------------")); |
|
3831 aLog->Log( _L("Calling SetTextConcatenatedL()")); |
|
3832 |
|
3833 // IMPORT_C void SetTextConcatenatedL(TBool aConcatenated, |
|
3834 // TBool aIs16Bit=EFalse); |
|
3835 TRAPD( result, aSmsPdu.SetTextConcatenatedL (ETrue)); |
|
3836 |
|
3837 if(result == KErrNone) |
|
3838 { |
|
3839 aLog->Log( _L("SetTextConcatenatedL() completed")); |
|
3840 aLog->Log( _L("Text concatenated flag successfully stored")); |
|
3841 aLog->Log( _L("Set text concatenated == PASS")); |
|
3842 } |
|
3843 else |
|
3844 aLog->Log( _L("Set text concatenated == FAIL")); |
|
3845 |
|
3846 return result; |
|
3847 } |
|
3848 |
|
3849 // ----------------------------------------------------------------------------- |
|
3850 // TestGetConcatenatedMessageReference |
|
3851 // Gets the reference contained in the Concatenation Information Element |
|
3852 // ----------------------------------------------------------------------------- |
|
3853 LOCAL_C TInt TestGetConcatenatedMessageReference (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3854 { |
|
3855 aLog->Log( _L("--------------------------------------------------------")); |
|
3856 aLog->Log( _L("Calling ConcatenatedMessageReference()")); |
|
3857 |
|
3858 TInt result = KErrNone; |
|
3859 |
|
3860 // IMPORT_C TInt ConcatenatedMessageReference() const |
|
3861 TInt checkres = aSmsPdu.ConcatenatedMessageReference (); |
|
3862 |
|
3863 if(checkres == 1) |
|
3864 { |
|
3865 aLog->Log( _L("ConcatenatedMessageReference() completed")); |
|
3866 _LIT(tempVal,"result data:concatenated message reference: %d"); |
|
3867 aLog->Log (tempVal, checkres); |
|
3868 aLog->Log( _L("Get concatenated message reference == PASS")); |
|
3869 } |
|
3870 else |
|
3871 aLog->Log( _L("Get concatenated message reference == FAIL")); |
|
3872 |
|
3873 return result; |
|
3874 } |
|
3875 |
|
3876 |
|
3877 // ----------------------------------------------------------------------------- |
|
3878 // TestSetConcatenatedMessageReference |
|
3879 // Sets the reference contained in the Concatenation Information Element |
|
3880 // ----------------------------------------------------------------------------- |
|
3881 LOCAL_C TInt TestSetConcatenatedMessageReference (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3882 { |
|
3883 aLog->Log( _L("--------------------------------------------------------")); |
|
3884 aLog->Log( _L("Calling SetConcatenatedMessageReference()")); |
|
3885 |
|
3886 TInt result = KErrNone; |
|
3887 TInt SetVal = 1; |
|
3888 |
|
3889 // IMPORT_C void SetConcatenatedMessageReference(TInt aReference) |
|
3890 aSmsPdu.SetConcatenatedMessageReference (SetVal); |
|
3891 |
|
3892 aLog->Log( _L("SetConcatenatedMessageReference() completed")); |
|
3893 aLog->Log( _L("Concatenated message reference stored successfully")); |
|
3894 aLog->Log( _L("Set concatenated message reference == PASS")); |
|
3895 |
|
3896 return result; |
|
3897 } |
|
3898 |
|
3899 |
|
3900 // ----------------------------------------------------------------------------- |
|
3901 // TestGetNumberOfConcatenatedMessageL |
|
3902 // Gets the number of PDU's in a Concatenated Message. |
|
3903 // ----------------------------------------------------------------------------- |
|
3904 LOCAL_C TInt TestGetNumberOfConcatenatedMessageL (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3905 { |
|
3906 aLog->Log( _L("--------------------------------------------------------")); |
|
3907 aLog->Log( _L("Calling NumConcatenatedMessagePDUs()")); |
|
3908 |
|
3909 TInt result = KErrNone; |
|
3910 |
|
3911 // IMPORT_C TInt NumConcatenatedMessagePDUs() const |
|
3912 TInt checkres = aSmsPdu.NumConcatenatedMessagePDUs (); |
|
3913 |
|
3914 if(checkres == 10) |
|
3915 { |
|
3916 aLog->Log( _L("NumConcatenatedMessagePDUs() completed")); |
|
3917 _LIT(tempVal,"result data:number of concatenated PDUs: %d"); |
|
3918 aLog->Log (tempVal,checkres); |
|
3919 aLog->Log( _L("Get number of concatenated message PDUs == PASS")); |
|
3920 } |
|
3921 else |
|
3922 aLog->Log( _L("Get number of concatenated message PDUs == FAIL")); |
|
3923 |
|
3924 return result; |
|
3925 } |
|
3926 |
|
3927 |
|
3928 // ----------------------------------------------------------------------------- |
|
3929 // TestSetNumberOfConcatenatedMessageL |
|
3930 // Sets the number of PDU's in a Concatenated Message. |
|
3931 // ----------------------------------------------------------------------------- |
|
3932 LOCAL_C TInt TestSetNumberOfConcatenatedMessageL (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3933 { |
|
3934 aLog->Log( _L("--------------------------------------------------------")); |
|
3935 aLog->Log( _L("Calling SetNumConcatenatedMessagePDUs()")); |
|
3936 |
|
3937 TInt result = KErrNone; |
|
3938 TInt setVal = 10; |
|
3939 |
|
3940 // IMPORT_C void SetNumConcatenatedMessagePDUs(TInt aNum); |
|
3941 aSmsPdu.SetNumConcatenatedMessagePDUs (setVal); |
|
3942 |
|
3943 aLog->Log( _L("SetNumConcatenatedMessagePDUs() completed")); |
|
3944 aLog->Log( _L("Number of concatenated PDUs stored successfully")); |
|
3945 aLog->Log( _L("Set number of concatenated message PDUs == PASS")); |
|
3946 |
|
3947 return result; |
|
3948 } |
|
3949 |
|
3950 |
|
3951 // ----------------------------------------------------------------------------- |
|
3952 // TestGetConcatenatedMessagePDUIndex |
|
3953 // Gets the index of the PDU within the Concatenated Message. |
|
3954 // ----------------------------------------------------------------------------- |
|
3955 LOCAL_C TInt TestGetConcatenatedMessagePDUIndex (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3956 { |
|
3957 aLog->Log( _L("--------------------------------------------------------")); |
|
3958 aLog->Log( _L("Calling ConcatenatedMessagePDUIndex()")); |
|
3959 |
|
3960 TInt result = KErrNone; |
|
3961 |
|
3962 // IMPORT_C TInt ConcatenatedMessagePDUIndex() const; |
|
3963 TInt checkres = aSmsPdu.ConcatenatedMessagePDUIndex (); |
|
3964 |
|
3965 if(checkres == 5) |
|
3966 { |
|
3967 aLog->Log( _L("ConcatenatedMessagePDUIndex() completed")); |
|
3968 _LIT(tempVal,"result data:concatenated message PDU index: %d"); |
|
3969 aLog->Log (tempVal, checkres); |
|
3970 aLog->Log( _L("Get concatenated message PDU index == PASS")); |
|
3971 } |
|
3972 else |
|
3973 aLog->Log( _L("Get concatenated message PDU index == FAIL")); |
|
3974 |
|
3975 return result; |
|
3976 } |
|
3977 |
|
3978 |
|
3979 // ----------------------------------------------------------------------------- |
|
3980 // TestSetConcatenatedMessagePDUIndex |
|
3981 // Sets the index of the PDU within the Concatenated Message. |
|
3982 // ----------------------------------------------------------------------------- |
|
3983 LOCAL_C TInt TestSetConcatenatedMessagePDUIndex (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
3984 { |
|
3985 aLog->Log( _L("--------------------------------------------------------")); |
|
3986 aLog->Log( _L("Calling SetConcatenatedMessagePDUIndex()")); |
|
3987 |
|
3988 TInt result = KErrNone; |
|
3989 TInt setVal = 5; |
|
3990 |
|
3991 // IMPORT_C void SetConcatenatedMessagePDUIndex(TInt aIndex) |
|
3992 aSmsPdu.SetConcatenatedMessagePDUIndex (setVal); |
|
3993 |
|
3994 aLog->Log( _L("SetConcatenatedMessagePDUIndex() completed")); |
|
3995 aLog->Log( _L("Concatenated message PDU index stored successfully")); |
|
3996 aLog->Log( _L("Set concatenated message PDU index == PASS")); |
|
3997 |
|
3998 return result; |
|
3999 } |
|
4000 |
|
4001 |
|
4002 // ----------------------------------------------------------------------------- |
|
4003 // TestGetApplicationPortAddressing |
|
4004 // Gets application port addressing information in the user data. |
|
4005 // ----------------------------------------------------------------------------- |
|
4006 LOCAL_C TInt TestGetApplicationPortAddressing (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4007 { |
|
4008 aLog->Log( _L("--------------------------------------------------------")); |
|
4009 aLog->Log( _L("Calling ApplicationPortAddressing()")); |
|
4010 |
|
4011 TInt result = KErrNone; |
|
4012 TInt aDestination, aOriginator; |
|
4013 |
|
4014 // IMPORT_C TBool ApplicationPortAddressing(TInt &aDestination, |
|
4015 // TInt &aOriginator, TBool *aIs16Bit=0) const |
|
4016 TBool checkres = aSmsPdu.ApplicationPortAddressing (aDestination,aOriginator); |
|
4017 |
|
4018 if( checkres ) |
|
4019 { |
|
4020 aLog->Log( _L("ApplicationPortAddressing() completed")); |
|
4021 _LIT(tempVal,"result data:destination: %d originator: %d is 16 bit: %d"); |
|
4022 aLog->Log (tempVal, aDestination, aOriginator, checkres); |
|
4023 aLog->Log( _L("Get application port addressing == PASS")); |
|
4024 } |
|
4025 else |
|
4026 aLog->Log( _L("Get application port addressing == FAIL")); |
|
4027 |
|
4028 return result; |
|
4029 } |
|
4030 |
|
4031 // ----------------------------------------------------------------------------- |
|
4032 // TestSetApplicationPortAddressing |
|
4033 // Sets application port addressing information in the user data. |
|
4034 // ----------------------------------------------------------------------------- |
|
4035 LOCAL_C TInt TestSetApplicationPortAddressing (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4036 { |
|
4037 aLog->Log( _L("--------------------------------------------------------")); |
|
4038 aLog->Log( _L("SetCalling ApplicationPortAddressingL()")); |
|
4039 |
|
4040 // IMPORT_C void SetApplicationPortAddressingL(TBool aAddressing, |
|
4041 // TInt aDestination, TInt aOriginator, TBool aIs16Bit=EFalse) |
|
4042 TRAPD( result, aSmsPdu.SetApplicationPortAddressingL (ETrue, 240,241)); |
|
4043 |
|
4044 if(result == KErrNone) |
|
4045 { |
|
4046 aLog->Log( _L("SetApplicationPortAddressingL() completed")); |
|
4047 aLog->Log( _L("Application port addressing settings successfully stored")); |
|
4048 aLog->Log( _L("Set application port addressing == PASS")); |
|
4049 } |
|
4050 else |
|
4051 aLog->Log( _L("Set application port addressing == FAIL")); |
|
4052 |
|
4053 return result; |
|
4054 } |
|
4055 |
|
4056 |
|
4057 // ----------------------------------------------------------------------------- |
|
4058 // TestGetPIDType |
|
4059 // Gets key bits 7 and 6 of the PID field. |
|
4060 // ----------------------------------------------------------------------------- |
|
4061 LOCAL_C TInt TestGetPIDType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4062 { |
|
4063 aLog->Log( _L("--------------------------------------------------------")); |
|
4064 aLog->Log( _L("Calling PIDType()")); |
|
4065 |
|
4066 TInt result = KErrNone; |
|
4067 TSmsProtocolIdentifier::TSmsPIDType testPIDType; |
|
4068 |
|
4069 // IMPORT_C TSmsProtocolIdentifier::TSmsPIDType PIDType() const |
|
4070 testPIDType = aSmsPdu.PIDType (); |
|
4071 |
|
4072 if(testPIDType == TSmsProtocolIdentifier::ESmsPIDTelematicInterworking) |
|
4073 { |
|
4074 aLog->Log( _L("PIDType() completed")); |
|
4075 _LIT(tempVal,"result data:PID type: %d"); |
|
4076 aLog->Log (tempVal,testPIDType); |
|
4077 aLog->Log( _L("Get PID type == PASS")); |
|
4078 } |
|
4079 else |
|
4080 aLog->Log( _L("Get PID type == FAIL")); |
|
4081 |
|
4082 return result; |
|
4083 } |
|
4084 |
|
4085 |
|
4086 // ----------------------------------------------------------------------------- |
|
4087 // TestSetPIDType |
|
4088 // Sets key bits 7 and 6 of the PID field. |
|
4089 // ----------------------------------------------------------------------------- |
|
4090 LOCAL_C TInt TestSetPIDType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4091 { |
|
4092 aLog->Log( _L("--------------------------------------------------------")); |
|
4093 aLog->Log( _L("Calling SetPIDType()")); |
|
4094 TInt result = KErrNone; |
|
4095 |
|
4096 TSmsProtocolIdentifier::TSmsPIDType testPIDType (TSmsProtocolIdentifier:: |
|
4097 ESmsPIDShortMessageType); |
|
4098 |
|
4099 // IMPORT_C void SetPIDType(TSmsProtocolIdentifier::TSmsPIDType aSmsPIDType) |
|
4100 aSmsPdu.SetPIDType (testPIDType); |
|
4101 |
|
4102 aLog->Log( _L("SetPIDType() completed")); |
|
4103 aLog->Log( _L("PID type stored successfully")); |
|
4104 aLog->Log( _L("Set PID type == PASS")); |
|
4105 |
|
4106 return result; |
|
4107 } |
|
4108 |
|
4109 |
|
4110 // ----------------------------------------------------------------------------- |
|
4111 // TestGetTelematicDeviceIndicator |
|
4112 // Gets the Telematic device indicator from the PID field. |
|
4113 // ----------------------------------------------------------------------------- |
|
4114 LOCAL_C TInt TestGetTelematicDeviceIndicator (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4115 { |
|
4116 aLog->Log( _L("--------------------------------------------------------")); |
|
4117 aLog->Log( _L("Calling TelematicDeviceIndicator()")); |
|
4118 |
|
4119 TInt result = KErrNone; |
|
4120 TSmsProtocolIdentifier::TSmsTelematicDeviceIndicator testDeviceIndicator; |
|
4121 |
|
4122 // IMPORT_C TSmsProtocolIdentifier::TSmsTelematicDeviceIndicator |
|
4123 // TelematicDeviceIndicator() const |
|
4124 testDeviceIndicator = aSmsPdu.TelematicDeviceIndicator (); |
|
4125 |
|
4126 if(testDeviceIndicator == TSmsProtocolIdentifier::ESmsNoTelematicDevice) |
|
4127 { |
|
4128 aLog->Log( _L("TelematicDeviceIndicator() completed")); |
|
4129 _LIT(tempVal,"result data:telematic device indicator: %d"); |
|
4130 aLog->Log (tempVal, testDeviceIndicator); |
|
4131 aLog->Log( _L("Get telematic device indicator == PASS")); |
|
4132 } |
|
4133 else |
|
4134 aLog->Log( _L("Get telematic device indicator == FAIL")); |
|
4135 |
|
4136 return result; |
|
4137 } |
|
4138 |
|
4139 |
|
4140 // ----------------------------------------------------------------------------- |
|
4141 // TestSetTelematicDeviceIndicator |
|
4142 // Sets the Telematic device indicator from the PID field. |
|
4143 // ----------------------------------------------------------------------------- |
|
4144 LOCAL_C TInt TestSetTelematicDeviceIndicator (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4145 { |
|
4146 aLog->Log( _L("--------------------------------------------------------")); |
|
4147 aLog->Log( _L("Calling SetTelematicDeviceIndicator()")); |
|
4148 TInt result = KErrNone; |
|
4149 |
|
4150 TSmsProtocolIdentifier::TSmsPIDType testPIDType (TSmsProtocolIdentifier::ESmsPIDTelematicInterworking); |
|
4151 aSmsPdu.SetPIDType (testPIDType); |
|
4152 |
|
4153 TSmsProtocolIdentifier::TSmsTelematicDeviceIndicator testDeviceIndicator ( |
|
4154 TSmsProtocolIdentifier::ESmsTelematicDevice); |
|
4155 |
|
4156 // IMPORT_C void SetTelematicDeviceIndicator(TSmsProtocolIdentifier:: |
|
4157 // TSmsTelematicDeviceIndicator aIndicator); |
|
4158 aSmsPdu.SetTelematicDeviceIndicator (testDeviceIndicator); |
|
4159 |
|
4160 aLog->Log( _L("SetTelematicDeviceIndicator() completed")); |
|
4161 aLog->Log( _L("Telematic device indicator stored successfully")); |
|
4162 aLog->Log( _L("Set telematic device indicator == PASS")); |
|
4163 |
|
4164 return result; |
|
4165 } |
|
4166 |
|
4167 |
|
4168 // ----------------------------------------------------------------------------- |
|
4169 // TestGetShortMessageType |
|
4170 // Gets the Short Message Type in the PID field. |
|
4171 // ----------------------------------------------------------------------------- |
|
4172 LOCAL_C TInt TestGetShortMessageType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4173 { |
|
4174 aLog->Log( _L("--------------------------------------------------------")); |
|
4175 aLog->Log( _L("Calling ShortMessageType()")); |
|
4176 |
|
4177 TInt result = KErrNone; |
|
4178 TSmsProtocolIdentifier::TSmsShortMessageType testMessageType; |
|
4179 |
|
4180 // IMPORT_C TSmsProtocolIdentifier::TSmsShortMessageType |
|
4181 // ShortMessageType() const; |
|
4182 testMessageType = aSmsPdu.ShortMessageType (); |
|
4183 |
|
4184 if(testMessageType == TSmsProtocolIdentifier::ESmsShortMessageType0) |
|
4185 { |
|
4186 aLog->Log( _L("ShortMessageType() completed")); |
|
4187 _LIT(tempVal, "result data:short message type: %d"); |
|
4188 aLog->Log (tempVal, testMessageType); |
|
4189 aLog->Log( _L("Get short message type == PASS")); |
|
4190 } |
|
4191 else |
|
4192 aLog->Log( _L("Get short message type == FAIL")); |
|
4193 |
|
4194 return result; |
|
4195 } |
|
4196 |
|
4197 |
|
4198 // ----------------------------------------------------------------------------- |
|
4199 // TestSetShortMessageType |
|
4200 // Sets the Short Message Type in the PID field. |
|
4201 // ----------------------------------------------------------------------------- |
|
4202 LOCAL_C TInt TestSetShortMessageType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4203 { |
|
4204 aLog->Log( _L("--------------------------------------------------------")); |
|
4205 aLog->Log( _L("Calling SetShortMessageType()")); |
|
4206 TInt result = KErrNone; |
|
4207 |
|
4208 TSmsProtocolIdentifier::TSmsShortMessageType testMessageType ( |
|
4209 TSmsProtocolIdentifier::ESmsShortMessageType0); |
|
4210 |
|
4211 // IMPORT_C void SetShortMessageType(TSmsProtocolIdentifier:: |
|
4212 // TSmsShortMessageType aShortMessageType); |
|
4213 aSmsPdu.SetShortMessageType (testMessageType); |
|
4214 |
|
4215 aLog->Log( _L("SetShortMessageType() completed")); |
|
4216 aLog->Log( _L("Short message type stored successfully")); |
|
4217 aLog->Log( _L("Set short message type == PASS")); |
|
4218 |
|
4219 return result; |
|
4220 } |
|
4221 |
|
4222 |
|
4223 // ----------------------------------------------------------------------------- |
|
4224 // TestGetTelematicDeviceType |
|
4225 // Gets the Telematic device type in the PID field |
|
4226 // ----------------------------------------------------------------------------- |
|
4227 LOCAL_C TInt TestGetTelematicDeviceType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4228 { |
|
4229 aLog->Log( _L("--------------------------------------------------------")); |
|
4230 aLog->Log( _L("Calling TelematicDeviceType()")); |
|
4231 |
|
4232 TInt result = KErrNone; |
|
4233 TSmsProtocolIdentifier::TSmsTelematicDeviceType testDeviceType; |
|
4234 |
|
4235 // IMPORT_C TSmsProtocolIdentifier::TSmsTelematicDeviceType |
|
4236 // TelematicDeviceType() const |
|
4237 testDeviceType = aSmsPdu.TelematicDeviceType (); |
|
4238 |
|
4239 if(testDeviceType == TSmsProtocolIdentifier::ESmsSCSpecificDevice) |
|
4240 { |
|
4241 aLog->Log( _L("TelematicDeviceType() completed")); |
|
4242 _LIT(tempVal,"result data:telematic device type: %d"); |
|
4243 aLog->Log (tempVal, testDeviceType); |
|
4244 aLog->Log( _L("Get telematic device type == PASS")); |
|
4245 } |
|
4246 else |
|
4247 aLog->Log( _L("Get telematic device type == FAIL")); |
|
4248 |
|
4249 return result; |
|
4250 } |
|
4251 |
|
4252 |
|
4253 // ----------------------------------------------------------------------------- |
|
4254 // TestSetTelematicDeviceType |
|
4255 // Sets the Telematic device type in the PID field |
|
4256 // ----------------------------------------------------------------------------- |
|
4257 LOCAL_C TInt TestSetTelematicDeviceType (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4258 { |
|
4259 aLog->Log( _L("--------------------------------------------------------")); |
|
4260 aLog->Log( _L("Calling SetTelematicDeviceType()")); |
|
4261 |
|
4262 TInt result = KErrNone; |
|
4263 TSmsProtocolIdentifier::TSmsTelematicDeviceType testDeviceType ( |
|
4264 TSmsProtocolIdentifier::ESmsSCSpecificDevice); |
|
4265 |
|
4266 // IMPORT_C void SetTelematicDeviceType(TSmsProtocolIdentifier:: |
|
4267 // TSmsTelematicDeviceType aDeviceType); |
|
4268 aSmsPdu.SetTelematicDeviceType (testDeviceType); |
|
4269 |
|
4270 aLog->Log( _L("SetTelematicDeviceType() completed")); |
|
4271 aLog->Log( _L("Telematic device type stored successfully")); |
|
4272 aLog->Log( _L("Set telematic device type == PASS")); |
|
4273 |
|
4274 return result; |
|
4275 } |
|
4276 |
|
4277 |
|
4278 // ----------------------------------------------------------------------------- |
|
4279 // TestGetUserDataPresent |
|
4280 // Tests if the User Data Header Indicator is set. |
|
4281 // ----------------------------------------------------------------------------- |
|
4282 LOCAL_C TInt TestGetUserDataPresent (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4283 { |
|
4284 aLog->Log( _L("--------------------------------------------------------")); |
|
4285 aLog->Log( _L("Calling UserDataPresent()")); |
|
4286 TInt result = KErrNone; |
|
4287 |
|
4288 // IMPORT_C TBool UserDataPresent() const |
|
4289 TBool checkres = aSmsPdu.UserDataPresent (); |
|
4290 |
|
4291 if( checkres ) |
|
4292 { |
|
4293 aLog->Log( _L("UserDataPresent() completed")); |
|
4294 aLog->Log( _L("result data:user data present: %d"), checkres); |
|
4295 aLog->Log( _L("Get user data present == PASS")); |
|
4296 } |
|
4297 else |
|
4298 aLog->Log( _L("Get user data present == FAIL")); |
|
4299 |
|
4300 return result; |
|
4301 } |
|
4302 |
|
4303 |
|
4304 // ----------------------------------------------------------------------------- |
|
4305 // TestSetUserDataPresent |
|
4306 // Sets or unsets the User Data Header Indicator. |
|
4307 // ----------------------------------------------------------------------------- |
|
4308 LOCAL_C TInt TestSetUserDataPresent (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4309 { |
|
4310 aLog->Log( _L("--------------------------------------------------------")); |
|
4311 aLog->Log( _L("Calling SetUserDataPresent()")); |
|
4312 |
|
4313 TInt result = KErrNone; |
|
4314 TBool SetVal = ETrue; |
|
4315 |
|
4316 // IMPORT_C void SetUserDataPresent(TBool aPresent); |
|
4317 aSmsPdu.SetUserDataPresent (SetVal); |
|
4318 |
|
4319 aLog->Log( _L("SetUserDataPresent() completed")); |
|
4320 aLog->Log( _L("User data present flag stored successfully")); |
|
4321 aLog->Log( _L("Set user data present == PASS")); |
|
4322 |
|
4323 return result; |
|
4324 } |
|
4325 |
|
4326 |
|
4327 // ----------------------------------------------------------------------------- |
|
4328 // TestGetDataCodingSchemePresent |
|
4329 // Tests if data coding scheme is present. |
|
4330 // ----------------------------------------------------------------------------- |
|
4331 LOCAL_C TInt TestGetDataCodingSchemePresent (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4332 { |
|
4333 aLog->Log( _L("--------------------------------------------------------")); |
|
4334 aLog->Log( _L("Calling DataCodingSchemePresent()")); |
|
4335 |
|
4336 TInt result = KErrNone; |
|
4337 |
|
4338 // IMPORT_C TBool DataCodingSchemePresent() const; |
|
4339 TBool checkres = aSmsPdu.DataCodingSchemePresent (); |
|
4340 |
|
4341 if( checkres ) |
|
4342 { |
|
4343 aLog->Log( _L("DataCodingSchemePresent() completed")); |
|
4344 aLog->Log (_L("result data:data coding scheme present: %d"),checkres); |
|
4345 aLog->Log (_L("Get data coding scheme present == PASS")); |
|
4346 } |
|
4347 else |
|
4348 aLog->Log( _L("Get data coding scheme present == FAIL")); |
|
4349 |
|
4350 return result; |
|
4351 } |
|
4352 |
|
4353 |
|
4354 // ----------------------------------------------------------------------------- |
|
4355 // TestSetDataCodingSchemePresent |
|
4356 // Sets if data coding scheme is present. |
|
4357 // ----------------------------------------------------------------------------- |
|
4358 LOCAL_C TInt TestSetDataCodingSchemePresent (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4359 { |
|
4360 aLog->Log( _L("--------------------------------------------------------")); |
|
4361 aLog->Log( _L("Calling SetDataCodingSchemePresent()")); |
|
4362 |
|
4363 TInt result = KErrNone; |
|
4364 TBool SetVal = ETrue; |
|
4365 |
|
4366 // IMPORT_C void SetDataCodingSchemePresent(TBool aPresent) |
|
4367 aSmsPdu.SetDataCodingSchemePresent (SetVal); |
|
4368 |
|
4369 aLog->Log( _L("SetDataCodingSchemePresent() completed")); |
|
4370 aLog->Log( _L("Data coding scheme present flag stored successfully")); |
|
4371 aLog->Log( _L("Set data coding scheme present == PASS")); |
|
4372 |
|
4373 return result; |
|
4374 } |
|
4375 |
|
4376 // ----------------------------------------------------------------------------- |
|
4377 // TestGetProtocolIdentifierPresent |
|
4378 // Tests if Protocol Identifier is present. |
|
4379 // ----------------------------------------------------------------------------- |
|
4380 LOCAL_C TInt TestGetProtocolIdentifierPresent (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4381 { |
|
4382 aLog->Log( _L("--------------------------------------------------------")); |
|
4383 aLog->Log( _L("Calling ProtocolIdentifierPresent()")); |
|
4384 |
|
4385 TInt result = KErrNone; |
|
4386 |
|
4387 // IMPORT_C TBool ProtocolIdentifierPresent() const |
|
4388 TBool checkres = aSmsPdu.ProtocolIdentifierPresent (); |
|
4389 |
|
4390 if( checkres ) |
|
4391 { |
|
4392 aLog->Log( _L("ProtocolIdentifierPresent() completed")); |
|
4393 _LIT(tempVal,"result data:protocol identifier present: %d"); |
|
4394 aLog->Log (tempVal, checkres); |
|
4395 aLog->Log( _L("Get protocol identifier present == PASS")); |
|
4396 } |
|
4397 else |
|
4398 aLog->Log( _L("Get protocol identifier present == FAIL")); |
|
4399 |
|
4400 return result; |
|
4401 } |
|
4402 |
|
4403 |
|
4404 // ----------------------------------------------------------------------------- |
|
4405 // TestSetProtocolIdentifierPresent |
|
4406 // Tests if Protocol Identifier is present. |
|
4407 // ----------------------------------------------------------------------------- |
|
4408 LOCAL_C TInt TestSetProtocolIdentifierPresent (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4409 { |
|
4410 aLog->Log( _L("--------------------------------------------------------")); |
|
4411 aLog->Log( _L("Calling SetProtocolIdentifierPresent()")); |
|
4412 |
|
4413 TInt result = KErrNone; |
|
4414 TBool SetVal = ETrue; |
|
4415 |
|
4416 // IMPORT_C void SetProtocolIdentifierPresent(TBool aPresent); |
|
4417 aSmsPdu.SetProtocolIdentifierPresent (SetVal); |
|
4418 |
|
4419 aLog->Log( _L("SetProtocolIdentifierPresent() completed")); |
|
4420 aLog->Log( _L("Protocol identifier present flag stored successfully")); |
|
4421 aLog->Log( _L("Set protocol identifier present == PASS")); |
|
4422 |
|
4423 return result; |
|
4424 } |
|
4425 |
|
4426 // ----------------------------------------------------------------------------- |
|
4427 // TestGetUserData |
|
4428 // Gets User Data (non-const). |
|
4429 // ----------------------------------------------------------------------------- |
|
4430 LOCAL_C TInt TestGetUserData (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4431 { |
|
4432 aLog->Log( _L("--------------------------------------------------------")); |
|
4433 aLog->Log( _L("Calling UserData()")); |
|
4434 |
|
4435 TInt result = KErrNone; |
|
4436 |
|
4437 // IMPORT_C CSmsUserData &UserData(); |
|
4438 CSmsUserData& testUserData = aSmsPdu.UserData (); |
|
4439 |
|
4440 aLog->Log(_L("UserData() completed")); |
|
4441 aLog->Log(_L("result data:user data (body): %s"), testUserData.Body().Ptr()); |
|
4442 aLog->Log(_L("Get user data == PASS")); |
|
4443 |
|
4444 return result; |
|
4445 } |
|
4446 |
|
4447 |
|
4448 // ----------------------------------------------------------------------------- |
|
4449 // TestGetUserDataConst |
|
4450 // Gets User Data (const). |
|
4451 // ----------------------------------------------------------------------------- |
|
4452 LOCAL_C TInt TestGetUserDataConst (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4453 { |
|
4454 aLog->Log( _L("--------------------------------------------------------")); |
|
4455 aLog->Log( _L("Calling UserData()")); |
|
4456 |
|
4457 TInt result = KErrNone; |
|
4458 |
|
4459 // IMPORT_C const CSmsUserData &UserData() const |
|
4460 const CSmsUserData& testUserData = aSmsPdu.UserData (); |
|
4461 |
|
4462 aLog->Log( _L("UserData() completed")); |
|
4463 aLog->Log (_L("result data:user data (body): %s"),testUserData.Body().Ptr()); |
|
4464 aLog->Log( _L("Get user data == PASS")); |
|
4465 |
|
4466 return result; |
|
4467 } |
|
4468 |
|
4469 LOCAL_C TInt TestSetNationalLanguageEncodingL (CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4470 { |
|
4471 aLog->Log( _L("--------------------------------------------------------")); |
|
4472 aLog->Log( _L("Calling SetNationalLanguageEncodingL()")); |
|
4473 |
|
4474 TInt result = KErrNone; |
|
4475 |
|
4476 aSmsPdu.SetNationalLanguageEncodingL (ESmsEncodingNone); |
|
4477 TSmsEncoding id = aSmsPdu.NationalLanguageEncoding(); |
|
4478 |
|
4479 aLog->Log( _L("SetDataCodingSchemePresent() completed")); |
|
4480 aLog->Log( _L("Data coding scheme present flag stored successfully")); |
|
4481 aLog->Log( _L("Set data coding scheme present == PASS")); |
|
4482 |
|
4483 return result; |
|
4484 } |
|
4485 |
|
4486 // ----------------------------------------------------------------------------- |
|
4487 // TestSmsPDUDuplicateL |
|
4488 // Creates a copy of the object |
|
4489 // ----------------------------------------------------------------------------- |
|
4490 // |
|
4491 LOCAL_C TInt TestSmsPDUDuplicateL( CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4492 { |
|
4493 aLog->Log(_L("---------------------------------------------")); |
|
4494 aLog->Log(_L("Calling SmsPDUDuplicateL()")); |
|
4495 |
|
4496 TInt result = KErrNone; |
|
4497 |
|
4498 CSmsPDU* dupObj = aSmsPdu.DuplicateL(); |
|
4499 |
|
4500 if( dupObj ) |
|
4501 { |
|
4502 aLog->Log(_L("TestSmsPDUDuplicateL() completed")); |
|
4503 aLog->Log(_L("Object successfully created")); |
|
4504 aLog->Log(_L("SmsPDUDuplicateL == PASS")); |
|
4505 |
|
4506 } |
|
4507 else |
|
4508 { |
|
4509 result = KErrGeneral; |
|
4510 aLog->Log(_L("SmsPDUDuplicateL == FAIL")); |
|
4511 } |
|
4512 return result; |
|
4513 } |
|
4514 |
|
4515 // ----------------------------------------------------------------------------- |
|
4516 // TestDecode |
|
4517 // ----------------------------------------------------------------------------- |
|
4518 /*LOCAL_C TInt TestDecode(CStifLogger* aLog, CSmsPDU& aSmsPdu) |
|
4519 { |
|
4520 aLog->Log( _L("--------------------------------------------------------")); |
|
4521 aLog->Log( _L("Calling DecodeL()")); |
|
4522 |
|
4523 TBufC8<16> str(KTestGsmPdu8); |
|
4524 TGsmuLex8 aPduL(str); |
|
4525 |
|
4526 // virtual void DecodeL(TGsmuLex8 &aPdu)=0; |
|
4527 TRAPD( result, aSmsPdu.DecodeL (aPdu)); |
|
4528 |
|
4529 if(result == KErrNone) |
|
4530 { |
|
4531 aLog->Log( _L("DecodeL() completed")); |
|
4532 aLog->Log( _L("Decode performed successfully")); |
|
4533 aLog->Log( _L("Decode == PASS")); |
|
4534 } |
|
4535 else |
|
4536 aLog->Log( _L("Decode == FAIL")); |
|
4537 |
|
4538 CleanupStack::Pop(); |
|
4539 return result; |
|
4540 } |
|
4541 */ |
|
4542 // ----------------------------------------------------------------------------- |
|
4543 // TestSetParameterIndicatorPresent |
|
4544 // |
|
4545 // ----------------------------------------------------------------------------- |
|
4546 LOCAL_C TInt TestSetParameterIndicatorPresent( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4547 { |
|
4548 aLog->Log(_L("---------------------------------------------")); |
|
4549 aLog->Log(_L("Calling SetParameterIndicatorPresent()")); |
|
4550 TInt result = KErrNone; |
|
4551 |
|
4552 //inline void SetParameterIndicatorPresent(TBool aPresent); |
|
4553 aReport.SetParameterIndicatorPresent(ETrue); |
|
4554 |
|
4555 aLog->Log(_L("SetParameterIndicatorPresent() completed")); |
|
4556 aLog->Log(_L("Parameter indicator present flag stored successfully")); |
|
4557 aLog->Log(_L("Set parameter indicator present == PASS")); |
|
4558 |
|
4559 return result; |
|
4560 } |
|
4561 |
|
4562 // ----------------------------------------------------------------------------- |
|
4563 // TestGetParameterIndicatorPresent |
|
4564 // |
|
4565 // ----------------------------------------------------------------------------- |
|
4566 LOCAL_C TInt TestGetParameterIndicatorPresent( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4567 { |
|
4568 aLog->Log(_L("---------------------------------------------")); |
|
4569 aLog->Log(_L("Calling ParameterIndicatorPresent()")); |
|
4570 TInt result = KErrNone; |
|
4571 |
|
4572 //inline TBool ParameterIndicatorPresent() const; |
|
4573 TBool indicator = aReport.ParameterIndicatorPresent(); |
|
4574 |
|
4575 if( indicator ) |
|
4576 { |
|
4577 aLog->Log(_L("ParameterIndicatorPresent() Completed")); |
|
4578 aLog->Log(_L("Result data: Parameter indicator present: %d"), indicator); |
|
4579 aLog->Log(_L("Get parameter indicator present == PASS")); |
|
4580 } |
|
4581 else |
|
4582 aLog->Log(_L("Get parameter indicator present == FAIL")); |
|
4583 |
|
4584 return result; |
|
4585 } |
|
4586 |
|
4587 // ----------------------------------------------------------------------------- |
|
4588 // TestSetMoreMessagesToSend |
|
4589 // |
|
4590 // ----------------------------------------------------------------------------- |
|
4591 LOCAL_C TInt TestSetMoreMessagesToSend( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4592 { |
|
4593 aLog->Log(_L("---------------------------------------------")); |
|
4594 aLog->Log(_L("Calling SetMoreMessagesToSend()")); |
|
4595 TInt result = KErrNone; |
|
4596 |
|
4597 //void SetMoreMessagesToSend(TBool aMore); |
|
4598 aReport.SetMoreMessagesToSend(ETrue); |
|
4599 |
|
4600 aLog->Log(_L("SetMoreMessagesToSend() Completed")); |
|
4601 aLog->Log(_L("More messages to send - flag successfully stored")); |
|
4602 aLog->Log(_L("Set more messages to send == PASS")); |
|
4603 |
|
4604 return result; |
|
4605 } |
|
4606 |
|
4607 // ----------------------------------------------------------------------------- |
|
4608 // TestGetMoreMessagesToSend |
|
4609 // |
|
4610 // ----------------------------------------------------------------------------- |
|
4611 LOCAL_C TInt TestGetMoreMessagesToSend( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4612 { |
|
4613 aLog->Log(_L("---------------------------------------------")); |
|
4614 aLog->Log(_L("Calling MoreMessagesToSend()")); |
|
4615 TInt result = KErrNone; |
|
4616 |
|
4617 //TBool MoreMessagesToSend() const; |
|
4618 TBool msgs = aReport.MoreMessagesToSend(); |
|
4619 |
|
4620 if(msgs) |
|
4621 { |
|
4622 aLog->Log(_L("MoreMessagesToSend() Completed")); |
|
4623 aLog->Log(_L("Result Data:More messages to send flag: %d"), msgs); |
|
4624 aLog->Log(_L("Get more messages to send == PASS")); |
|
4625 } |
|
4626 else |
|
4627 { |
|
4628 result =KErrGeneral; |
|
4629 aLog->Log(_L("Get more messages to send == PASS")); |
|
4630 } |
|
4631 |
|
4632 return result; |
|
4633 } |
|
4634 |
|
4635 // ----------------------------------------------------------------------------- |
|
4636 // TestSetStatusReportQualifier |
|
4637 // |
|
4638 // ----------------------------------------------------------------------------- |
|
4639 LOCAL_C TInt TestSetStatusReportQualifier( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4640 { |
|
4641 aLog->Log(_L("---------------------------------------------")); |
|
4642 aLog->Log(_L("Calling SetStatusReportQualifier()")); |
|
4643 TInt result = KErrNone; |
|
4644 |
|
4645 TSmsFirstOctet::TSmsStatusReportQualifier qualifier = TSmsFirstOctet::ESmsStatusReportResultOfSubmit; |
|
4646 //void SetStatusReportQualifier(TSmsFirstOctet::TSmsStatusReportQualifier aQualifier); |
|
4647 aReport.SetStatusReportQualifier( qualifier ); |
|
4648 |
|
4649 aLog->Log(_L("SetStatusReportQualifier() Completed")); |
|
4650 aLog->Log(_L("Status report qualifier stored successfully")); |
|
4651 aLog->Log(_L("Set status report qualifier == PASS")); |
|
4652 |
|
4653 return result; |
|
4654 } |
|
4655 |
|
4656 // ----------------------------------------------------------------------------- |
|
4657 // TestGetStatusReportQualifier |
|
4658 // |
|
4659 // ----------------------------------------------------------------------------- |
|
4660 LOCAL_C TInt TestGetStatusReportQualifier( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4661 { |
|
4662 aLog->Log(_L("---------------------------------------------")); |
|
4663 aLog->Log(_L("Calling StatusReportQualifier()")); |
|
4664 TInt result = KErrNone; |
|
4665 |
|
4666 //TSmsFirstOctet::TSmsStatusReportQualifier StatusReportQualifier() const; |
|
4667 TSmsFirstOctet::TSmsStatusReportQualifier qualifier = aReport.StatusReportQualifier(); |
|
4668 |
|
4669 if( qualifier == TSmsFirstOctet::ESmsStatusReportResultOfSubmit ) |
|
4670 { |
|
4671 aLog->Log(_L("StatusReportQualifier() Completed")); |
|
4672 aLog->Log(_L("Result data: Status report qualifier: %d"), qualifier); |
|
4673 aLog->Log(_L("Get status report qualifier == PASS")); |
|
4674 } |
|
4675 else |
|
4676 aLog->Log(_L("Get status report qualifier == FAIL")); |
|
4677 |
|
4678 return result; |
|
4679 } |
|
4680 |
|
4681 // ----------------------------------------------------------------------------- |
|
4682 // TestGetMessageReference |
|
4683 // Gets the Message Reference |
|
4684 // ----------------------------------------------------------------------------- |
|
4685 // |
|
4686 LOCAL_C TInt TestGetMessageReference( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4687 { |
|
4688 aLog->Log(_L("---------------------------------------------")); |
|
4689 aLog->Log(_L("Calling MessageReference()")); |
|
4690 TInt result = KErrNone; |
|
4691 |
|
4692 //IMPORT_C TInt MessageReference() const; |
|
4693 TInt getRef = aReport.MessageReference(); |
|
4694 |
|
4695 aLog->Log(_L("MessageReference() Completed")); |
|
4696 aLog->Log(_L("result data:Message reference: %d"), getRef); |
|
4697 aLog->Log(_L("Get Message Reference == PASS")); |
|
4698 |
|
4699 return result; |
|
4700 } |
|
4701 |
|
4702 // ----------------------------------------------------------------------------- |
|
4703 // TestSetMessageReference |
|
4704 // Sets the Message Reference |
|
4705 // ----------------------------------------------------------------------------- |
|
4706 // |
|
4707 LOCAL_C TInt TestSetMessageReference( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4708 { |
|
4709 aLog->Log(_L("---------------------------------------------")); |
|
4710 aLog->Log(_L("Calling SetMessageReference()")); |
|
4711 TInt result = KErrNone; |
|
4712 |
|
4713 TInt setRef = 1; |
|
4714 //IMPORT_C void SetMessageReference(TInt aMessageReference); |
|
4715 aReport.SetMessageReference(setRef); |
|
4716 |
|
4717 aLog->Log(_L("SetMessageReference() Completed")); |
|
4718 aLog->Log(_L("Message reference successfully stored")); |
|
4719 aLog->Log(_L("Set Message Reference == PASS")); |
|
4720 |
|
4721 return result; |
|
4722 } |
|
4723 |
|
4724 // ----------------------------------------------------------------------------- |
|
4725 // TestSetServiceCenterTimeStamp |
|
4726 // ----------------------------------------------------------------------------- |
|
4727 LOCAL_C TInt TestSetServiceCenterTimeStamp( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4728 { |
|
4729 aLog->Log(_L("---------------------------------------------")); |
|
4730 aLog->Log(_L("Calling SetServiceCenterTimeStamp()")); |
|
4731 TInt result = KErrNone; |
|
4732 |
|
4733 const TTime time(_L("20060201:000000.000000")); |
|
4734 TInt numQuarterHours = 1; |
|
4735 //IMPORT_C void SetServiceCenterTimeStamp(const TTime& aTime,TInt& aNumQuarterHours); |
|
4736 aReport.SetServiceCenterTimeStamp(time, numQuarterHours); |
|
4737 |
|
4738 aLog->Log(_L("SetServiceCenterTimeStamp() Completed")); |
|
4739 aLog->Log(_L("Time stamp successfully stored")); |
|
4740 aLog->Log(_L("Set service center time stamp == PASS")); |
|
4741 |
|
4742 return result; |
|
4743 } |
|
4744 |
|
4745 // ----------------------------------------------------------------------------- |
|
4746 // TestGetServiceCenterTimeStamp |
|
4747 // ----------------------------------------------------------------------------- |
|
4748 LOCAL_C TInt TestGetServiceCenterTimeStampL( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4749 { |
|
4750 aLog->Log(_L("---------------------------------------------")); |
|
4751 aLog->Log(_L("Calling ServiceCenterTimeStamp()")); |
|
4752 TInt result = KErrNone; |
|
4753 |
|
4754 TBuf<30> string; |
|
4755 _LIT( KFormat, "%*E%*D%X%*N%*Y %1 %2 '%3 %H%:1%T%:2%S"); |
|
4756 TTime setTime(TDateTime(2006,EJanuary,01,12,0,0,0)); |
|
4757 TTime getTime; |
|
4758 TInt numQuarterHrs; |
|
4759 //void ServiceCenterTimeStamp(TTime& aTime,TInt& aNumQuarterHours); |
|
4760 aReport.ServiceCenterTimeStamp(getTime, numQuarterHrs); |
|
4761 |
|
4762 if( getTime == setTime ) |
|
4763 { |
|
4764 getTime.FormatL(string, KFormat); |
|
4765 aLog->Log(_L("ServiceCenterTimeStamp() Completed")); |
|
4766 aLog->Log(_L("Result data:Time stamp: %S"), &string); |
|
4767 aLog->Log(_L("Get service center time stamp == PASS")); |
|
4768 } |
|
4769 else |
|
4770 { |
|
4771 result = KErrGeneral; |
|
4772 aLog->Log(_L("Get service center time stamp == FAIL")); |
|
4773 } |
|
4774 |
|
4775 return result; |
|
4776 } |
|
4777 |
|
4778 // ----------------------------------------------------------------------------- |
|
4779 // TestSetDischargeTime |
|
4780 // ----------------------------------------------------------------------------- |
|
4781 LOCAL_C TInt TestSetDischargeTime( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4782 { |
|
4783 aLog->Log(_L("---------------------------------------------")); |
|
4784 aLog->Log(_L("Calling SetDischargeTime()")); |
|
4785 TInt result = KErrNone; |
|
4786 |
|
4787 const TTime time(_L("20060201:000000.000000")); |
|
4788 TInt numQuarterHrs = 2; |
|
4789 //void SetDischargeTime(const TTime& aTime,TInt& aNumQuarterHours); |
|
4790 aReport.SetDischargeTime(time, numQuarterHrs); |
|
4791 |
|
4792 aLog->Log(_L("SetDischargeTime Completed")); |
|
4793 aLog->Log(_L("Discharge time stored successfully")); |
|
4794 aLog->Log(_L("Set discharge time == PASS")); |
|
4795 |
|
4796 return result; |
|
4797 } |
|
4798 |
|
4799 // ----------------------------------------------------------------------------- |
|
4800 // TestGetDischargeTime |
|
4801 // ----------------------------------------------------------------------------- |
|
4802 LOCAL_C TInt TestGetDischargeTimeL( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4803 { |
|
4804 aLog->Log(_L("---------------------------------------------")); |
|
4805 aLog->Log(_L("Calling DischargeTime()")); |
|
4806 TInt result = KErrNone; |
|
4807 |
|
4808 TBuf<30> string; |
|
4809 _LIT( KFormat, "%*E%*D%X%*N%*Y %1 %2 '%3 %H%:1%T%:2%S"); |
|
4810 TTime setTime(TDateTime(2006,EJanuary,01,12,0,0,0)); |
|
4811 TTime time; |
|
4812 TInt numQuarterHrs; |
|
4813 //void DischargeTime(TTime& aTime,TInt& aNumQuarterHours); |
|
4814 aReport.DischargeTime(time, numQuarterHrs); |
|
4815 |
|
4816 if( time == setTime ) |
|
4817 { |
|
4818 time.FormatL(string, KFormat); |
|
4819 aLog->Log(_L("DischargeTime() Completed")); |
|
4820 aLog->Log(_L("Result data: Discharge time: %S"), &string); |
|
4821 aLog->Log(_L("Get discharge time == PASS")); |
|
4822 } |
|
4823 else |
|
4824 aLog->Log(_L("Get discharge time == FAIL")); |
|
4825 |
|
4826 return result; |
|
4827 } |
|
4828 |
|
4829 // ----------------------------------------------------------------------------- |
|
4830 // TestSetStatus |
|
4831 // |
|
4832 // ----------------------------------------------------------------------------- |
|
4833 LOCAL_C TInt TestSetStatus(CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4834 { |
|
4835 aLog->Log(_L("---------------------------------------------")); |
|
4836 aLog->Log(_L("Calling SetStatus()")); |
|
4837 TInt result = KErrNone; |
|
4838 |
|
4839 //void SetStatus(TSmsStatus::TSmsStatusValue aValue); |
|
4840 TSmsStatus::TSmsStatusValue status = TSmsStatus::ESmsShortMessageReceivedBySME; |
|
4841 aReport.SetStatus(status); |
|
4842 |
|
4843 aLog->Log(_L("Status() Completed")); |
|
4844 aLog->Log(_L("Result data: status: %d"), status); |
|
4845 aLog->Log(_L("Get status == PASS")); |
|
4846 |
|
4847 return result; |
|
4848 } |
|
4849 |
|
4850 // ----------------------------------------------------------------------------- |
|
4851 // TestGetStatus |
|
4852 // |
|
4853 // ----------------------------------------------------------------------------- |
|
4854 LOCAL_C TInt TestGetStatus(CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4855 { |
|
4856 aLog->Log(_L("---------------------------------------------")); |
|
4857 aLog->Log(_L("Calling Status()")); |
|
4858 TInt result = KErrNone; |
|
4859 |
|
4860 //TSmsStatus::TSmsStatusValue Status() const; |
|
4861 TSmsStatus::TSmsStatusValue status = aReport.Status(); |
|
4862 |
|
4863 if( status == TSmsStatus::ESmsShortMessageReceivedBySME ) |
|
4864 { |
|
4865 aLog->Log(_L("Status() Completed")); |
|
4866 aLog->Log(_L("Result data: status: %d"), status); |
|
4867 aLog->Log(_L("Get status == PASS")); |
|
4868 } |
|
4869 else |
|
4870 aLog->Log(_L("Get status == FAIL")); |
|
4871 |
|
4872 return result; |
|
4873 } |
|
4874 |
|
4875 // ----------------------------------------------------------------------------- |
|
4876 // TestSmsStatusReportDuplicateL |
|
4877 // Creates a copy of the object |
|
4878 // ----------------------------------------------------------------------------- |
|
4879 // |
|
4880 LOCAL_C TInt TestSmsStatusReportDuplicateL( CStifLogger* aLog, CSmsStatusReport& aReport) |
|
4881 { |
|
4882 aLog->Log(_L("---------------------------------------------")); |
|
4883 aLog->Log(_L("Calling SmsStatusReportDuplicateL()")); |
|
4884 |
|
4885 TInt result = KErrNone; |
|
4886 |
|
4887 CSmsStatusReport* dupObj = aReport.DuplicateL(); |
|
4888 |
|
4889 if( dupObj ) |
|
4890 { |
|
4891 aLog->Log(_L("TestSmsStatusReportDuplicateL() completed")); |
|
4892 aLog->Log(_L("Object successfully created")); |
|
4893 aLog->Log(_L("SmsStatusReportDuplicateL == PASS")); |
|
4894 |
|
4895 } |
|
4896 else |
|
4897 { |
|
4898 result = KErrGeneral; |
|
4899 aLog->Log(_L("SmsStatusReportDuplicateL == FAIL")); |
|
4900 } |
|
4901 return result; |
|
4902 } |
|
4903 // ----------------------------------------------------------------------------- |
|
4904 // TestGetRejectDuplicates |
|
4905 // |
|
4906 // ----------------------------------------------------------------------------- |
|
4907 LOCAL_C TInt TestGetRejectDuplicates(CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
4908 { |
|
4909 aLog->Log( _L("--------------------------------------------------------")); |
|
4910 aLog->Log( _L("Calling RejectDuplicates()")); |
|
4911 |
|
4912 TInt result = KErrNone; |
|
4913 |
|
4914 //TBool RejectDuplicates() const; |
|
4915 TBool reject = aSmsSub.RejectDuplicates(); |
|
4916 |
|
4917 if( reject ) |
|
4918 { |
|
4919 aLog->Log(_L("RejectDuplicates() Completed")); |
|
4920 aLog->Log(_L("Result data: Reject duplicates: %d"), reject); |
|
4921 aLog->Log(_L("Get reject duplicates == PASS")); |
|
4922 } |
|
4923 |
|
4924 return result; |
|
4925 } |
|
4926 |
|
4927 // ----------------------------------------------------------------------------- |
|
4928 // TestSetRejectDuplicates |
|
4929 // |
|
4930 // ----------------------------------------------------------------------------- |
|
4931 LOCAL_C TInt TestSetRejectDuplicates(CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
4932 { |
|
4933 aLog->Log( _L("--------------------------------------------------------")); |
|
4934 aLog->Log( _L("Calling SetRejectDuplicates()")); |
|
4935 |
|
4936 TInt result = KErrNone; |
|
4937 TBool reject = ETrue; |
|
4938 //void SetRejectDuplicates(TBool aRejectDuplicates); |
|
4939 aSmsSub.SetRejectDuplicates(reject); |
|
4940 |
|
4941 aLog->Log(_L("SetRejectDuplicates() Completed")); |
|
4942 aLog->Log(_L("Reject duplicate flag stored successfully")); |
|
4943 aLog->Log(_L("Set reject duplicates == PASS")); |
|
4944 |
|
4945 return result; |
|
4946 } |
|
4947 |
|
4948 // ----------------------------------------------------------------------------- |
|
4949 // TestGetValidityPeriodFormat |
|
4950 // Gets the Validity Period Format |
|
4951 // ----------------------------------------------------------------------------- |
|
4952 LOCAL_C TInt TestGetValidityPeriodFormat (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
4953 { |
|
4954 aLog->Log( _L("--------------------------------------------------------")); |
|
4955 aLog->Log( _L("Calling ValidityPeriodFormat()")); |
|
4956 |
|
4957 TInt result = KErrNone; |
|
4958 |
|
4959 // IMPORT_C TSmsFirstOctet::TSmsValidityPeriodFormat ValidityPeriodFormat() const |
|
4960 TSmsFirstOctet::TSmsValidityPeriodFormat pformat = aSmsSub.ValidityPeriodFormat (); |
|
4961 |
|
4962 if(pformat == TSmsFirstOctet::ESmsVPFNone) |
|
4963 { |
|
4964 aLog->Log(_L("ValidityPeriodFormat() completed")); |
|
4965 aLog->Log(_L("Validity period format: %d"),pformat); |
|
4966 aLog->Log(_L("Get validity period format == PASS")); |
|
4967 } |
|
4968 else |
|
4969 aLog->Log( _L("ValidityPeriodFormat() == FAIL")); |
|
4970 |
|
4971 return result; |
|
4972 } |
|
4973 |
|
4974 // ----------------------------------------------------------------------------- |
|
4975 // TestSetValidityPeriodFormat |
|
4976 // Sets the Validity Period Format |
|
4977 // ----------------------------------------------------------------------------- |
|
4978 LOCAL_C TInt TestSetValidityPeriodFormat (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
4979 { |
|
4980 aLog->Log( _L("--------------------------------------------------------")); |
|
4981 aLog->Log( _L("Calling SetValidityPeriodFormat()")); |
|
4982 |
|
4983 TInt result = KErrNone; |
|
4984 |
|
4985 // IMPORT_C void SetValidityPeriodFormat(TSmsFirstOctet::TSmsValidityPeriodFormat aValidityPeriodFormat) |
|
4986 TSmsFirstOctet::TSmsValidityPeriodFormat aValidityPeriodFormat (TSmsFirstOctet::ESmsVPFNone); |
|
4987 |
|
4988 aSmsSub.SetValidityPeriodFormat (aValidityPeriodFormat); |
|
4989 |
|
4990 aLog->Log( _L("SetValidityPeriodFormat() completed")); |
|
4991 aLog->Log( _L("Validity period format stored successfully")); |
|
4992 aLog->Log( _L("Set validity period format == PASS")); |
|
4993 |
|
4994 return result; |
|
4995 } |
|
4996 |
|
4997 |
|
4998 // ----------------------------------------------------------------------------- |
|
4999 // TestGetReplyPath |
|
5000 // Gets Reply Path flag |
|
5001 // If a Reply Path exists, the recipient of the SMS can reply using the same |
|
5002 // service center address |
|
5003 // ----------------------------------------------------------------------------- |
|
5004 LOCAL_C TInt TestGetReplyPath (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5005 { |
|
5006 aLog->Log( _L("--------------------------------------------------------")); |
|
5007 aLog->Log( _L("Calling ReplyPath()")); |
|
5008 |
|
5009 TInt result = KErrNone; |
|
5010 |
|
5011 // IMPORT_C TBool ReplyPath() const |
|
5012 TBool checkres = aSmsSub.ReplyPath (); |
|
5013 |
|
5014 if( checkres ) |
|
5015 { |
|
5016 aLog->Log (_L("ReplyPath() completed")); |
|
5017 aLog->Log (_L("Result data:reply path flag: %d"),checkres); |
|
5018 aLog->Log (_L("Get reply path == PASS")); |
|
5019 } |
|
5020 else |
|
5021 aLog->Log (_L("Get reply path == FAIL")); |
|
5022 |
|
5023 return result; |
|
5024 } |
|
5025 |
|
5026 |
|
5027 // ----------------------------------------------------------------------------- |
|
5028 // TestSetReplyPath |
|
5029 // Sets Reply Path flag |
|
5030 // ----------------------------------------------------------------------------- |
|
5031 LOCAL_C TInt TestSetReplyPath (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5032 { |
|
5033 aLog->Log( _L("--------------------------------------------------------")); |
|
5034 aLog->Log( _L("Calling SetReplyPath()")); |
|
5035 |
|
5036 TInt result = KErrNone; |
|
5037 TBool tempVar = ETrue; |
|
5038 |
|
5039 // IMPORT_C void SetReplyPath (TBool aReplyPath) |
|
5040 aSmsSub.SetReplyPath (tempVar); |
|
5041 |
|
5042 aLog->Log( _L("SetReplyPath() completed")); |
|
5043 aLog->Log( _L("Reply path flag stored successfully")); |
|
5044 aLog->Log( _L("Set reply path == PASS")); |
|
5045 |
|
5046 return result; |
|
5047 } |
|
5048 |
|
5049 |
|
5050 // ----------------------------------------------------------------------------- |
|
5051 // TestGetStatusReportRequest |
|
5052 // Gets Status Report Request flag |
|
5053 // A sender can request STATUS REPORTs for the SUBMIT being sent |
|
5054 // ----------------------------------------------------------------------------- |
|
5055 LOCAL_C TInt TestGetStatusReportRequest (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5056 { |
|
5057 aLog->Log( _L("--------------------------------------------------------")); |
|
5058 aLog->Log( _L("Calling StatusReportRequest()")); |
|
5059 TInt result = KErrNone; |
|
5060 |
|
5061 // IMPORT_C TBool StatusReportRequest() const |
|
5062 TBool checkres = aSmsSub.StatusReportRequest(); |
|
5063 |
|
5064 if( checkres ) |
|
5065 { |
|
5066 aLog->Log(_L("StatusReportRequest() completed")); |
|
5067 aLog->Log (_L("result data:status report request flag: %d"),checkres); |
|
5068 aLog->Log(_L("Get status report request == PASS")); |
|
5069 } |
|
5070 else |
|
5071 aLog->Log( _L("Get status report request == FAIL")); |
|
5072 |
|
5073 return result; |
|
5074 } |
|
5075 |
|
5076 |
|
5077 // ----------------------------------------------------------------------------- |
|
5078 // TestSetStatusReportRequest |
|
5079 // Sets Status Report Request flag |
|
5080 // ----------------------------------------------------------------------------- |
|
5081 LOCAL_C TInt TestSetStatusReportRequest (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5082 { |
|
5083 aLog->Log( _L("--------------------------------------------------------")); |
|
5084 aLog->Log( _L("Calling SetStatusReportRequest()")); |
|
5085 |
|
5086 TInt result = KErrNone; |
|
5087 TBool tempVar = ETrue; |
|
5088 |
|
5089 // IMPORT_C void SetStatusReportRequest(TBool aRequest); |
|
5090 aSmsSub.SetStatusReportRequest (tempVar); |
|
5091 |
|
5092 aLog->Log( _L("SetStatusReportRequest() completed")); |
|
5093 aLog->Log( _L("Status report request flag stored successfully")); |
|
5094 aLog->Log( _L("Set status report request == PASS")); |
|
5095 |
|
5096 return result; |
|
5097 } |
|
5098 |
|
5099 |
|
5100 // ----------------------------------------------------------------------------- |
|
5101 // TestGetMessageReference |
|
5102 // Gets the Message Reference |
|
5103 // ----------------------------------------------------------------------------- |
|
5104 LOCAL_C TInt TestGetMessageReference (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5105 { |
|
5106 aLog->Log( _L("--------------------------------------------------------")); |
|
5107 aLog->Log( _L("Calling MessageReference()")); |
|
5108 |
|
5109 TInt result = KErrNone; |
|
5110 |
|
5111 // IMPORT_C TInt MessageReference() const |
|
5112 TInt checkres = aSmsSub.MessageReference(); |
|
5113 |
|
5114 if(checkres == 10) |
|
5115 { |
|
5116 aLog->Log( _L("MessageReference() completed")); |
|
5117 _LIT(tempStr,"result data:message reference: %d"); |
|
5118 aLog->Log (tempStr,checkres); |
|
5119 aLog->Log( _L("Get message reference == PASS")); |
|
5120 } |
|
5121 else |
|
5122 aLog->Log( _L("Get message reference == FAIL")); |
|
5123 |
|
5124 return result; |
|
5125 } |
|
5126 |
|
5127 |
|
5128 // ----------------------------------------------------------------------------- |
|
5129 // TestSetMessageReference |
|
5130 // Sets the Message Reference |
|
5131 // ----------------------------------------------------------------------------- |
|
5132 LOCAL_C TInt TestSetMessageReference (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5133 { |
|
5134 aLog->Log( _L("--------------------------------------------------------")); |
|
5135 aLog->Log( _L("Calling SetMessageReference()")); |
|
5136 |
|
5137 TInt result = KErrNone; |
|
5138 |
|
5139 // IMPORT_C void SetMessageReference(TInt aMessageReference) |
|
5140 aSmsSub.SetMessageReference (10); |
|
5141 |
|
5142 aLog->Log( _L("SetMessageReference() completed")); |
|
5143 aLog->Log( _L("Message reference stored successfully")); |
|
5144 aLog->Log( _L("Set message reference == PASS")); |
|
5145 |
|
5146 return result; |
|
5147 } |
|
5148 |
|
5149 |
|
5150 // ----------------------------------------------------------------------------- |
|
5151 // TestGetValidityPeriod |
|
5152 // Gets the Validity Period for the SUBMIT |
|
5153 // ----------------------------------------------------------------------------- |
|
5154 LOCAL_C TInt TestGetValidityPeriod (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5155 { |
|
5156 aLog->Log( _L("--------------------------------------------------------")); |
|
5157 aLog->Log( _L("Calling ValidityPeriod()")); |
|
5158 |
|
5159 TInt result = KErrNone; |
|
5160 |
|
5161 // IMPORT_C const TTimeIntervalMinutes &ValidityPeriod() const |
|
5162 TTimeIntervalMinutes timeinterval; |
|
5163 timeinterval = aSmsSub.ValidityPeriod (); |
|
5164 |
|
5165 if(timeinterval.Int() == 1) |
|
5166 { |
|
5167 aLog->Log( _L("ValidityPeriod() completed")); |
|
5168 _LIT(tempVal,"result data:validity period: %d"); |
|
5169 aLog->Log (tempVal,timeinterval.Int() ); |
|
5170 aLog->Log( _L("Get validity period == PASS")); |
|
5171 } |
|
5172 else |
|
5173 aLog->Log( _L("Get validity period == FAIL")); |
|
5174 |
|
5175 return result; |
|
5176 } |
|
5177 |
|
5178 |
|
5179 // ----------------------------------------------------------------------------- |
|
5180 // TestSetValidityPeriod |
|
5181 // Sets the Validity Period for the SUBMIT |
|
5182 // ----------------------------------------------------------------------------- |
|
5183 LOCAL_C TInt TestSetValidityPeriod (CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5184 { |
|
5185 aLog->Log( _L("--------------------------------------------------------")); |
|
5186 aLog->Log( _L("Calling SetValidityPeriod()")); |
|
5187 |
|
5188 TInt result = KErrNone; |
|
5189 |
|
5190 // IMPORT_C void SetValidityPeriod(const TTimeIntervalMinutes |
|
5191 // &aTimeIntervalMinutes) |
|
5192 TTimeIntervalMinutes timeinterval = 1; |
|
5193 aSmsSub.SetValidityPeriod (timeinterval); |
|
5194 |
|
5195 aLog->Log( _L("SetValidityPeriod() completed")); |
|
5196 aLog->Log( _L("Validity period stored successfully")); |
|
5197 aLog->Log( _L("Set validity period == PASS")); |
|
5198 |
|
5199 return result; |
|
5200 } |
|
5201 |
|
5202 // ----------------------------------------------------------------------------- |
|
5203 // TestSmsSubmitDuplicateL |
|
5204 // Creates a copy of the object |
|
5205 // ----------------------------------------------------------------------------- |
|
5206 // |
|
5207 LOCAL_C TInt TestSmsSubmitDuplicateL( CStifLogger* aLog, CSmsSubmit& aSmsSub) |
|
5208 { |
|
5209 aLog->Log(_L("---------------------------------------------")); |
|
5210 aLog->Log(_L("Calling SmsSubmitDuplicateL()")); |
|
5211 |
|
5212 TInt result = KErrNone; |
|
5213 |
|
5214 CSmsSubmit* dupObj = aSmsSub.DuplicateL(); |
|
5215 |
|
5216 if( dupObj ) |
|
5217 { |
|
5218 aLog->Log(_L("TestSmsSubjectDuplicateL() completed")); |
|
5219 aLog->Log(_L("Object successfully created")); |
|
5220 aLog->Log(_L("SmsSubmitDuplicateL == PASS")); |
|
5221 } |
|
5222 else |
|
5223 { |
|
5224 result = KErrGeneral; |
|
5225 aLog->Log(_L("SmsSubmitDuplicateL == FAIL")); |
|
5226 } |
|
5227 return result; |
|
5228 } |
|
5229 |
|
5230 // ----------------------------------------------------------------------------- |
|
5231 // TestGetIsRPError |
|
5232 // Gets the Reply Path Error flag |
|
5233 // ----------------------------------------------------------------------------- |
|
5234 LOCAL_C TInt TestGetIsRPError (CStifLogger* aLog, CSmsSubmitReport& aSmsSubReport) |
|
5235 { |
|
5236 aLog->Log( _L("--------------------------------------------------------")); |
|
5237 aLog->Log( _L("Calling IsRPError()")); |
|
5238 |
|
5239 TInt result = KErrNone; |
|
5240 |
|
5241 // TBool IsRPError() const |
|
5242 TBool checkres = aSmsSubReport.IsRPError(); |
|
5243 |
|
5244 if( checkres ) |
|
5245 { |
|
5246 aLog->Log(_L("IsRPError() completed")); |
|
5247 aLog->Log(_L("Result data:is RP error flag: %d"),checkres); |
|
5248 aLog->Log(_L("Get is RP error == PASS")); |
|
5249 } |
|
5250 else |
|
5251 aLog->Log(_L("Get is RP error == FAIL")); |
|
5252 |
|
5253 return result; |
|
5254 } |
|
5255 |
|
5256 |
|
5257 // ----------------------------------------------------------------------------- |
|
5258 // TestSetIsRPError |
|
5259 // Gets the Reply Path Error flag |
|
5260 // ----------------------------------------------------------------------------- |
|
5261 LOCAL_C TInt TestSetIsRPError (CStifLogger* aLog, CSmsSubmitReport& aSmsSubReport) |
|
5262 { |
|
5263 aLog->Log( _L("--------------------------------------------------------")); |
|
5264 aLog->Log( _L("Calling SetIsRPError()")); |
|
5265 |
|
5266 TInt result = KErrNone; |
|
5267 TBool tempVar = ETrue; |
|
5268 |
|
5269 // inline void SetIsRPError(TBool aIsRPError) |
|
5270 aSmsSubReport.SetIsRPError (tempVar); |
|
5271 |
|
5272 aLog->Log( _L("SetIsRPError() completed")); |
|
5273 aLog->Log( _L("Is RP error flag stored successfully")); |
|
5274 aLog->Log( _L("Set is RP error == PASS")); |
|
5275 |
|
5276 return result; |
|
5277 } |
|
5278 |
|
5279 |
|
5280 // ----------------------------------------------------------------------------- |
|
5281 // TestGetFailureCause |
|
5282 // Gets the Failure Cause |
|
5283 // ----------------------------------------------------------------------------- |
|
5284 LOCAL_C TInt TestGetFailureCause (CStifLogger* aLog, CSmsSubmitReport& aSmsSubReport) |
|
5285 { |
|
5286 aLog->Log( _L("--------------------------------------------------------")); |
|
5287 aLog->Log( _L("Calling FailureCause()")); |
|
5288 |
|
5289 TInt result = KErrNone; |
|
5290 |
|
5291 // IMPORT_C TInt FailureCause() const |
|
5292 TInt checkres = aSmsSubReport.FailureCause (); |
|
5293 |
|
5294 if(checkres == TSmsFailureCause::ESmsPIDErrorCannotReplaceShortMessage) |
|
5295 { |
|
5296 aLog->Log( _L("FailureCause() completed")); |
|
5297 _LIT(tempVal,"result data:failure cause: %d"); |
|
5298 aLog->Log(tempVal,checkres); |
|
5299 aLog->Log( _L("Get failure cause == PASS")); |
|
5300 } |
|
5301 else |
|
5302 aLog->Log( _L("Get failure cause == FAIL")); |
|
5303 |
|
5304 return result; |
|
5305 } |
|
5306 |
|
5307 |
|
5308 // ----------------------------------------------------------------------------- |
|
5309 // TestSetFailureCause |
|
5310 // Sets the Failure Cause |
|
5311 // ----------------------------------------------------------------------------- |
|
5312 LOCAL_C TInt TestSetFailureCause (CStifLogger* aLog, CSmsSubmitReport& aSmsSubReport) |
|
5313 { |
|
5314 aLog->Log( _L("--------------------------------------------------------")); |
|
5315 aLog->Log( _L("Calling SetFailureCause()")); |
|
5316 |
|
5317 TInt result = KErrNone; |
|
5318 TSmsFailureCause::TSmsFailureCauseError aFailureCause = |
|
5319 TSmsFailureCause::ESmsPIDErrorCannotReplaceShortMessage; |
|
5320 |
|
5321 // IMPORT_C void SetFailureCause |
|
5322 // (TSmsFailureCause::TSmsFailureCauseError aFailureCause) |
|
5323 aSmsSubReport.SetFailureCause (aFailureCause); |
|
5324 |
|
5325 aLog->Log( _L("SetFailureCause() completed")); |
|
5326 aLog->Log( _L("Failure cause stored successfully")); |
|
5327 aLog->Log( _L("Set failure cause == PASS")); |
|
5328 |
|
5329 return result; |
|
5330 } |
|
5331 |
|
5332 // ----------------------------------------------------------------------------- |
|
5333 // TestSmsSubmitReportDuplicateL |
|
5334 // Creates a copy of the object |
|
5335 // ----------------------------------------------------------------------------- |
|
5336 // |
|
5337 LOCAL_C TInt TestSmsSubmitReportDuplicateL( CStifLogger* aLog, CSmsSubmitReport& aSmsSubReport) |
|
5338 { |
|
5339 aLog->Log(_L("---------------------------------------------")); |
|
5340 aLog->Log(_L("Calling SmsSubmitReportDuplicateL()")); |
|
5341 |
|
5342 TInt result = KErrNone; |
|
5343 |
|
5344 CSmsSubmitReport* dupObj = aSmsSubReport.DuplicateL(); |
|
5345 |
|
5346 if( dupObj ) |
|
5347 { |
|
5348 aLog->Log(_L("TestSmsSubmitReportDuplicateL() completed")); |
|
5349 aLog->Log(_L("Object successfully created")); |
|
5350 aLog->Log(_L("SmsSubmitReportDuplicateL == PASS")); |
|
5351 |
|
5352 } |
|
5353 else |
|
5354 { |
|
5355 result = KErrGeneral; |
|
5356 aLog->Log(_L("SmsSubmitReportDuplicateL == FAIL")); |
|
5357 } |
|
5358 return result; |
|
5359 } |
|
5360 |
|
5361 // ----------------------------------------------------------------------------- |
|
5362 // TestGetNumberOfInformationElements |
|
5363 // Gets the number of information elements |
|
5364 // ----------------------------------------------------------------------------- |
|
5365 LOCAL_C TInt TestGetNumberOfInformationElements (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5366 { |
|
5367 aLog->Log( _L("--------------------------------------------------------")); |
|
5368 aLog->Log( _L("Calling NumInformationElements()")); |
|
5369 |
|
5370 TInt result = KErrNone; |
|
5371 |
|
5372 // inline TInt NumInformationElements() const |
|
5373 TInt checkres = aSmsUsr.NumInformationElements(); |
|
5374 |
|
5375 if( checkres == 0) |
|
5376 { |
|
5377 aLog->Log( _L("NumInformationElements() completed")); |
|
5378 _LIT(tempVal,"result:number of information elements: %d"); |
|
5379 aLog->Log(tempVal, checkres); |
|
5380 aLog->Log( _L("Get number of information elements == PASS")); |
|
5381 } |
|
5382 else |
|
5383 aLog->Log( _L("Get number of information elements == FAIL")); |
|
5384 |
|
5385 return result; |
|
5386 } |
|
5387 |
|
5388 |
|
5389 // ----------------------------------------------------------------------------- |
|
5390 // TestGetInformationElement |
|
5391 // Gets an information element by index |
|
5392 // ----------------------------------------------------------------------------- |
|
5393 LOCAL_C TInt TestGetInformationElement (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5394 { |
|
5395 aLog->Log( _L("--------------------------------------------------------")); |
|
5396 aLog->Log( _L("Calling InformationElement()")); |
|
5397 |
|
5398 TInt result = KErrNone; |
|
5399 TInt index = 0; |
|
5400 |
|
5401 // IMPORT_C CSmsInformationElement &InformationElement(TInt aIndex) const |
|
5402 CSmsInformationElement& infoElem = aSmsUsr.InformationElement (index); |
|
5403 |
|
5404 aLog->Log( _L("InformationElement() completed")); |
|
5405 aLog->Log(_L("Information element (identifier): %d"), infoElem.Identifier()); |
|
5406 aLog->Log( _L("Get information element == PASS")); |
|
5407 |
|
5408 return result; |
|
5409 } |
|
5410 |
|
5411 |
|
5412 // ----------------------------------------------------------------------------- |
|
5413 // TestGetInformationElementIndex |
|
5414 // Gets the index of an information element |
|
5415 // ----------------------------------------------------------------------------- |
|
5416 LOCAL_C TInt TestGetInformationElementIndex (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5417 { |
|
5418 aLog->Log( _L("--------------------------------------------------------")); |
|
5419 aLog->Log( _L("Calling InformationElementIndex()")); |
|
5420 |
|
5421 TInt result = KErrNone; |
|
5422 TInt index; |
|
5423 CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier |
|
5424 ( CSmsInformationElement::ESmsIEISpecialSMSMessageIndication); |
|
5425 |
|
5426 // IMPORT_C TBool InformationElementIndex( |
|
5427 // CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier, |
|
5428 // TInt &aIndex) const |
|
5429 TBool checkres = aSmsUsr.InformationElementIndex (aIdentifier,index); |
|
5430 |
|
5431 if( checkres ) |
|
5432 { |
|
5433 aLog->Log(_L("InformationElementIndex() completed")); |
|
5434 aLog->Log(_L("Result data:information element index: %d"), checkres); |
|
5435 aLog->Log(_L("Get information element index == PASS")); |
|
5436 } |
|
5437 else |
|
5438 aLog->Log(_L("Get information element index == FAIL")); |
|
5439 |
|
5440 return result; |
|
5441 } |
|
5442 |
|
5443 |
|
5444 // ----------------------------------------------------------------------------- |
|
5445 // TestAddInformationElement |
|
5446 // Adds an information element |
|
5447 // ----------------------------------------------------------------------------- |
|
5448 LOCAL_C TInt TestAddInformationElement (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5449 { |
|
5450 aLog->Log( _L("--------------------------------------------------------")); |
|
5451 aLog->Log( _L("Calling AddInformationElementL()")); |
|
5452 |
|
5453 _LIT8(str,"test string"); |
|
5454 const TBufC8<20> data (str); |
|
5455 TSmsId testObject (CSmsInformationElement::ESmsIEISpecialSMSMessageIndication); |
|
5456 |
|
5457 // IMPORT_C void AddInformationElementL(TSmsId aIdentifier, |
|
5458 // const TDesC8 &aData) |
|
5459 TRAPD( result, aSmsUsr.AddInformationElementL (testObject,data)); |
|
5460 |
|
5461 if(result == KErrNone) |
|
5462 { |
|
5463 aLog->Log( _L("AddInformationElementL() completed")); |
|
5464 aLog->Log( _L("Information element added successfully")); |
|
5465 aLog->Log( _L("Add information element == PASS")); |
|
5466 } |
|
5467 else |
|
5468 aLog->Log( _L("Add information element == FAIL")); |
|
5469 |
|
5470 return result; |
|
5471 } |
|
5472 |
|
5473 |
|
5474 // ----------------------------------------------------------------------------- |
|
5475 // TestRemoveInformationElement |
|
5476 // Removes an information element at the specified index |
|
5477 // ----------------------------------------------------------------------------- |
|
5478 LOCAL_C TInt TestRemoveInformationElement (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5479 { |
|
5480 aLog->Log( _L("--------------------------------------------------------")); |
|
5481 aLog->Log( _L("Calling RemoveInformationElement()")); |
|
5482 |
|
5483 TInt result = KErrNone; |
|
5484 TInt index = 0; |
|
5485 |
|
5486 // IMPORT_C void RemoveInformationElement(TInt aIndex) |
|
5487 aSmsUsr.RemoveInformationElement (index); |
|
5488 |
|
5489 aLog->Log( _L("RemoveInformationElement() completed")); |
|
5490 aLog->Log( _L("Information element removed successfully")); |
|
5491 aLog->Log( _L("Remove information element == PASS")); |
|
5492 |
|
5493 return result; |
|
5494 } |
|
5495 |
|
5496 |
|
5497 // ----------------------------------------------------------------------------- |
|
5498 // TestMaxBodyLengthInChars |
|
5499 // Gets the maximum characters in body length of user data |
|
5500 // ----------------------------------------------------------------------------- |
|
5501 LOCAL_C TInt TestMaxBodyLengthInChars (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5502 { |
|
5503 aLog->Log( _L("--------------------------------------------------------")); |
|
5504 aLog->Log( _L("Calling MaxBodyLengthInChars()")); |
|
5505 |
|
5506 TInt result = KErrNone; |
|
5507 |
|
5508 // IMPORT_C TInt MaxBodyLengthInChars() const |
|
5509 TInt charret = aSmsUsr.MaxBodyLengthInChars (); |
|
5510 |
|
5511 aLog->Log( _L("MaxBodyLengthInChars() completed")); |
|
5512 _LIT(tempVal, "result data:max body length in chars: %d"); |
|
5513 aLog->Log(tempVal,charret); |
|
5514 aLog->Log( _L("Get max body length in chars == PASS")); |
|
5515 |
|
5516 return result; |
|
5517 } |
|
5518 |
|
5519 |
|
5520 // ----------------------------------------------------------------------------- |
|
5521 // TestGetBody |
|
5522 // Gets the unpacked User Data Elements |
|
5523 // ----------------------------------------------------------------------------- |
|
5524 LOCAL_C TInt TestGetBody (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5525 { |
|
5526 aLog->Log( _L("--------------------------------------------------------")); |
|
5527 aLog->Log( _L("Calling Body()")); |
|
5528 |
|
5529 TInt result = KErrNone; |
|
5530 _LIT8 (str,"Test String"); |
|
5531 TBufC8<20> tempVar (str); |
|
5532 |
|
5533 // IMPORT_C TPtrC8 Body() const |
|
5534 TPtrC8 checkres( aSmsUsr.Body() ); |
|
5535 |
|
5536 if(!checkres.Compare (tempVar)) |
|
5537 { |
|
5538 aLog->Log( _L("Body() completed")); |
|
5539 aLog->Log(_L("result data:body: %s"),checkres.Ptr()); |
|
5540 aLog->Log( _L("Get body == PASS")); |
|
5541 } |
|
5542 else |
|
5543 aLog->Log( _L("Get body == FAIL")); |
|
5544 |
|
5545 return result; |
|
5546 } |
|
5547 |
|
5548 // ----------------------------------------------------------------------------- |
|
5549 // TestSetBody |
|
5550 // Sets the unpacked User Data Elements |
|
5551 // ----------------------------------------------------------------------------- |
|
5552 LOCAL_C TInt TestSetBody (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5553 { |
|
5554 aLog->Log( _L("--------------------------------------------------------")); |
|
5555 aLog->Log( _L("Calling SetBodyL()")); |
|
5556 |
|
5557 _LIT8 (str,"Test String"); |
|
5558 TBufC8<20> tempVar (str); |
|
5559 |
|
5560 // IMPORT_C void SetBodyL(const TDesC8 &aBody) |
|
5561 TRAPD( result , aSmsUsr.SetBodyL (tempVar)); |
|
5562 |
|
5563 if(result == KErrNone) |
|
5564 { |
|
5565 aLog->Log( _L("SetBodyL() completed")); |
|
5566 aLog->Log( _L("Body stored successfully")); |
|
5567 aLog->Log( _L("Set body == PASS")); |
|
5568 } |
|
5569 else |
|
5570 aLog->Log(_L("Set body == FAIL")); |
|
5571 |
|
5572 return result; |
|
5573 } |
|
5574 |
|
5575 |
|
5576 // ----------------------------------------------------------------------------- |
|
5577 // TestGetIsSupported |
|
5578 // Tests if the User Data supports a specified character |
|
5579 // ----------------------------------------------------------------------------- |
|
5580 LOCAL_C TInt TestGetIsSupported (CStifLogger* aLog, CSmsUserData& aSmsUsr) |
|
5581 { |
|
5582 aLog->Log( _L("--------------------------------------------------------")); |
|
5583 aLog->Log( _L("Calling IsSupportedL()")); |
|
5584 |
|
5585 TChar testChar ('&'); |
|
5586 // IMPORT_C TBool IsSupportedL(TChar aChar) |
|
5587 TBool checkres; |
|
5588 TRAPD(result, checkres = aSmsUsr.IsSupportedL (testChar)); |
|
5589 |
|
5590 if(result == KErrNone) |
|
5591 { |
|
5592 aLog->Log( _L("IsSupportedL() completed")); |
|
5593 _LIT(tempVal,"result data:is supported flag: %d"); |
|
5594 aLog->Log(tempVal, checkres); |
|
5595 aLog->Log( _L("Get is supported == PASS")); |
|
5596 } |
|
5597 else |
|
5598 aLog->Log( _L("Get is supported == FAIL")); |
|
5599 |
|
5600 return result; |
|
5601 } |
|
5602 |
|
5603 // ----------------------------------------------------------------------------- |
|
5604 // TestGetIsSupported2 |
|
5605 // |
|
5606 // ----------------------------------------------------------------------------- |
|
5607 LOCAL_C TInt TestGetIsSupported2(CStifLogger* aLog,CSmsUserData& aSmsUsr) |
|
5608 { |
|
5609 aLog->Log(_L("---------------------------------------------")); |
|
5610 aLog->Log(_L("Calling IsSupported2L()")); |
|
5611 |
|
5612 |
|
5613 TBufC<50> testBuffer = _L("Nokia$123has*some%employees"); |
|
5614 TInt numUnconvertable; |
|
5615 TInt posFirstUnconvertable; |
|
5616 TInt numDowngradedChars; |
|
5617 TInt numReqAlternativeEncoding; |
|
5618 |
|
5619 TBool res = 0; |
|
5620 TRAPD( result, res = aSmsUsr.IsSupportedL(testBuffer, ESmsEncodingNone, numUnconvertable, numDowngradedChars, numReqAlternativeEncoding, posFirstUnconvertable)); |
|
5621 |
|
5622 if(result != KErrNone) |
|
5623 { |
|
5624 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
5625 } |
|
5626 else |
|
5627 { |
|
5628 aLog->Log(_L("IsSupported2L() completed")); |
|
5629 aLog->Log(_L("result data: is supported: %d"), res); |
|
5630 aLog->Log(_L("Get is supported == PASS")); |
|
5631 } |
|
5632 return result; |
|
5633 } |
|
5634 // ----------------------------------------------------------------------------- |
|
5635 // TestGetIsSupported3 |
|
5636 // |
|
5637 // ----------------------------------------------------------------------------- |
|
5638 |
|
5639 LOCAL_C TInt TestGetIsSupported3(CStifLogger* aLog,CSmsUserData& aSmsUsr) |
|
5640 { |
|
5641 aLog->Log(_L("---------------------------------------------")); |
|
5642 aLog->Log(_L("Calling IsSupported3L()")); |
|
5643 |
|
5644 |
|
5645 TBufC<50> testBuffer = _L("Nokia$123has*some%employees"); |
|
5646 TInt numUnconvertable; |
|
5647 TInt posFirstUnconvertable; |
|
5648 |
|
5649 TBool res = 0; |
|
5650 TRAPD( result, res = aSmsUsr.IsSupportedL(testBuffer, numUnconvertable, posFirstUnconvertable)); |
|
5651 |
|
5652 if(result != KErrNone) |
|
5653 { |
|
5654 aLog->Log(_L("Leave occured: error code: %d"), result); |
|
5655 } |
|
5656 else |
|
5657 { |
|
5658 aLog->Log(_L("IsSupported3L() completed")); |
|
5659 aLog->Log(_L("result data: is supported: %d"), res); |
|
5660 aLog->Log(_L("Get is supported == PASS")); |
|
5661 } |
|
5662 return result; |
|
5663 } |
|
5664 // ----------------------------------------------------------------------------- |
|
5665 // CBCSmsUtilitiesTest::TestSmsAlphabetConverter |
|
5666 // Simple printing to UI test. |
|
5667 // ----------------------------------------------------------------------------- |
|
5668 // |
|
5669 TInt CBCSmsUtilitiesTest::TestSmsAlphabetConverterL( |
|
5670 TTestResult& aResult ) |
|
5671 { |
|
5672 _LIT(KSmsAlphabetConverter, "Calling CSmsAlphabetConverter"); |
|
5673 iLog->Log(KSmsAlphabetConverter); |
|
5674 TInt result = KErrNone; |
|
5675 |
|
5676 CCnvCharacterSetConverter* charSet = CCnvCharacterSetConverter::NewLC(); |
|
5677 TSmsDataCodingScheme::TSmsAlphabet smsAlphabet = TSmsDataCodingScheme::ESmsAlphabet8Bit; |
|
5678 TBool isBinary = EFalse; |
|
5679 |
|
5680 CSmsAlphabetConverter* converter = CSmsAlphabetConverter::NewLC(*charSet, iSession, smsAlphabet, isBinary); |
|
5681 CConsoleBase* console = Create_ConsoleL(_L("CSmsAlphabetConverter")); |
|
5682 //Get alphabet |
|
5683 result = TestGetAlphabet(iLog, *converter); |
|
5684 Print(console, result, _L("Alphabet") ); |
|
5685 |
|
5686 //ConvertFromNative |
|
5687 result = TestConvertFromNative(iLog, *converter); |
|
5688 Print(console, result, _L("ConvertFromNative") ); |
|
5689 |
|
5690 //ConvertToNative |
|
5691 result = TestConvertToNative(iLog, *converter); |
|
5692 Print(console, result, _L("ConvertToNative") ); |
|
5693 |
|
5694 //ConvertFromNative2 |
|
5695 result = TestConvertFromNative2L(iLog, *converter); |
|
5696 Print(console, result, _L("ConvertFromNative2") ); |
|
5697 |
|
5698 //ConvertToNative2 |
|
5699 result = TestConvertToNative2L(iLog, *converter); |
|
5700 Print(console, result, _L("ConvertToNative2") ); |
|
5701 |
|
5702 //UnconvertedNativeCharacters |
|
5703 result = TestUnconvertedNativeCharacters(iLog, *converter); |
|
5704 Print(console, result, _L("UnconvertedUDCharacters") ); |
|
5705 |
|
5706 //UnconvertedUDElements |
|
5707 result = TestUnconvertedUDElements(iLog, *converter); |
|
5708 Print(console, result, _L("ResetUnconvertedUDElements") ); |
|
5709 |
|
5710 //ResetUnconvertedNativeCharacters |
|
5711 result = TestResetUnconvertedNativeCharacters(iLog, *converter); |
|
5712 Print(console, result, _L("ResetUnconvertedNativeCharacters") ); |
|
5713 |
|
5714 //ResetUnconvertedUDElements |
|
5715 result = TestResetUnconvertedUDElements(iLog, *converter); |
|
5716 Print(console, result, _L("ResetUnconvertedUDElements") ); |
|
5717 |
|
5718 Remove_Console(console); |
|
5719 CleanupStack::PopAndDestroy(2); |
|
5720 // Case was executed |
|
5721 return KErrNone; |
|
5722 |
|
5723 } |
|
5724 |
|
5725 // ----------------------------------------------------------------------------- |
|
5726 // CBCSmsUtilitiesTest::TestSmsBuffer |
|
5727 // Simple printing to UI test. |
|
5728 // ----------------------------------------------------------------------------- |
|
5729 // |
|
5730 TInt CBCSmsUtilitiesTest::TestSmsBufferL( |
|
5731 TTestResult& aResult ) |
|
5732 { |
|
5733 _LIT(KSmsBuffer, "Calling CSmsBuffer"); |
|
5734 iLog->Log(KSmsBuffer); |
|
5735 TInt result = KErrNone; |
|
5736 |
|
5737 CSmsBuffer* buffer = CSmsBuffer::NewL(); |
|
5738 CleanupStack::PushL(buffer); |
|
5739 |
|
5740 CConsoleBase* console = Create_ConsoleL(_L("CSmsBuffer")); |
|
5741 //Construction |
|
5742 //Destruction |
|
5743 //Insert |
|
5744 result = TestInsert(iLog, *buffer); |
|
5745 Print(console, result, _L("Insert") ); |
|
5746 |
|
5747 //Delete |
|
5748 result = TestDelete(iLog, *buffer); |
|
5749 Print(console, result, _L("DeleteL") ); |
|
5750 |
|
5751 //Extract |
|
5752 result = TestExtract(iLog, *buffer); |
|
5753 Print(console, result, _L("Extract") ); |
|
5754 |
|
5755 //GetLength |
|
5756 result = TestGetLength(iLog, *buffer); |
|
5757 Print(console, result, _L("Length") ); |
|
5758 |
|
5759 //Externalize |
|
5760 result = TestExternalizeL(iLog, *buffer); |
|
5761 Print(console, result, _L("ExternalizeL") ); |
|
5762 |
|
5763 //Internalize |
|
5764 result = TestInternalizeL(iLog, *buffer); |
|
5765 Print(console, result, _L("InternalizeL") ); |
|
5766 |
|
5767 //Reset |
|
5768 result = TestReset(iLog, *buffer); |
|
5769 Print(console, result, _L("Reset") ); |
|
5770 |
|
5771 Remove_Console(console); |
|
5772 CleanupStack::PopAndDestroy(); |
|
5773 // Case was executed |
|
5774 return KErrNone; |
|
5775 |
|
5776 } |
|
5777 |
|
5778 // ----------------------------------------------------------------------------- |
|
5779 // CBCSmsUtilitiesTest::TestSmsCommand |
|
5780 // Simple printing to UI test. |
|
5781 // ----------------------------------------------------------------------------- |
|
5782 // |
|
5783 TInt CBCSmsUtilitiesTest::TestSmsCommandL( |
|
5784 TTestResult& aResult ) |
|
5785 { |
|
5786 _LIT(KSmsBufferBase, "Calling CSmsBufferBase"); |
|
5787 iLog->Log(KSmsBufferBase); |
|
5788 TInt result = KErrNone; |
|
5789 |
|
5790 RFs rfServer; |
|
5791 User::LeaveIfError(rfServer.Connect()); |
|
5792 |
|
5793 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
5794 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
5795 CSmsMessage* smsMessage = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsCommand, smsBuffer ); |
|
5796 |
|
5797 CSmsCommand& command = STATIC_CAST(CSmsCommand&, smsMessage->SmsPDU() ); |
|
5798 CSmsCommand * ptrCommand = &command; |
|
5799 CleanupStack::PushL(ptrCommand); |
|
5800 |
|
5801 CConsoleBase* console = Create_ConsoleL(_L("CSmsCommand")); |
|
5802 //Construction |
|
5803 //Add information element |
|
5804 result = TestAddInformationElement(iLog, command); |
|
5805 Print(console, result, _L("AddInformationElement") ); |
|
5806 |
|
5807 //Get information element |
|
5808 result = TestInformationElement(iLog, command); |
|
5809 Print(console, result, _L("InformationElement")); |
|
5810 |
|
5811 //Get information element index |
|
5812 result = TestInformationElementIndex(iLog, command); |
|
5813 Print(console, result, _L("InformationElementIndex")); |
|
5814 |
|
5815 //Get number of information elements |
|
5816 result = TestNumInformationElements(iLog, command); |
|
5817 Print(console, result, _L("NumInformationElements")); |
|
5818 |
|
5819 //Remove information element |
|
5820 result = TestRemoveInformationElement(iLog, command); |
|
5821 Print(console, result, _L("RemoveInformationElement") ); |
|
5822 |
|
5823 //Get max command data length |
|
5824 result = TestMaxCommandDataLength(iLog, command); |
|
5825 Print(console, result, _L("MaxCommandDataLength") ); |
|
5826 |
|
5827 //Set command data |
|
5828 result = TestSetCommandData(iLog, command); |
|
5829 Print(console, result, _L("SetCommandData")); |
|
5830 |
|
5831 //Get command data |
|
5832 result = TestGetCommandData(iLog, command); |
|
5833 Print(console, result, _L("CommandData") ); |
|
5834 |
|
5835 //Set Command Type |
|
5836 result = TestSetCommandType(iLog, command); |
|
5837 Print(console, result, _L("SetCommandType") ); |
|
5838 |
|
5839 //Get Command Type |
|
5840 result = TestGetCommandType(iLog, command); |
|
5841 Print(console, result, _L("CommandType") ); |
|
5842 |
|
5843 //Set message number |
|
5844 result = TestSetMessageNumber(iLog, command); |
|
5845 Print(console, result, _L("SetMessageNumber")); |
|
5846 |
|
5847 //Get message number |
|
5848 result = TestGetMessageNumber(iLog, command); |
|
5849 Print(console, result, _L("MessageNumber")); |
|
5850 |
|
5851 //Set Message Reference |
|
5852 result = TestSetMessageReference(iLog, command); |
|
5853 Print(console, result, _L("SetMessageReference")); |
|
5854 |
|
5855 //Get Message Reference |
|
5856 result = TestGetMessageReference(iLog, command); |
|
5857 Print(console, result, _L("MessageReference")); |
|
5858 |
|
5859 //Set status report request |
|
5860 result = TestSetStatusReportRequest(iLog, command); |
|
5861 Print(console, result, _L("SetStatusReportRequest")); |
|
5862 |
|
5863 //Get status report request |
|
5864 result = TestGetStatusReportRequest(iLog, command); |
|
5865 Print(console, result, _L("StatusReportRequest")); |
|
5866 |
|
5867 //DuplicateL |
|
5868 result = TestSmsCommandDuplicateL(iLog, command); |
|
5869 Print(console, result, _L("SmsCommandDuplicateL")); |
|
5870 |
|
5871 Remove_Console(console); |
|
5872 CleanupStack::PopAndDestroy(&command); |
|
5873 rfServer.Close(); |
|
5874 // Case was executed |
|
5875 return KErrNone; |
|
5876 |
|
5877 } |
|
5878 |
|
5879 // ----------------------------------------------------------------------------- |
|
5880 // CBCSmsUtilitiesTest::TestSmsDeliver |
|
5881 // Simple printing to UI test. |
|
5882 // ----------------------------------------------------------------------------- |
|
5883 // |
|
5884 TInt CBCSmsUtilitiesTest::TestSmsDeliverL( |
|
5885 TTestResult& aResult ) |
|
5886 { |
|
5887 _LIT(KSmsDeliver, "Calling CSmsDeliver"); |
|
5888 iLog->Log(KSmsDeliver); |
|
5889 TInt result = KErrNone; |
|
5890 |
|
5891 RFs rfServer; |
|
5892 User::LeaveIfError(rfServer.Connect()); |
|
5893 |
|
5894 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
5895 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
5896 CSmsMessage* smsMessage = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsDeliver, smsBuffer ); |
|
5897 |
|
5898 CSmsDeliver& deliver = STATIC_CAST(CSmsDeliver&, smsMessage->SmsPDU() ); |
|
5899 CSmsDeliver *ptrDeliver = &deliver; |
|
5900 CleanupStack::PushL(ptrDeliver); |
|
5901 |
|
5902 CConsoleBase* console = Create_ConsoleL(_L("CSmsDeliver")); |
|
5903 //Construction |
|
5904 //Set more messages to send |
|
5905 result = TestSetMoreMessagesToSend(iLog, deliver); |
|
5906 Print(console, result, _L("SetMoreMessagesToSend")); |
|
5907 |
|
5908 //Get more messages to send |
|
5909 result = TestGetMoreMessagesToSend(iLog, deliver); |
|
5910 Print(console, result, _L("MoreMessagesToSend")); |
|
5911 |
|
5912 //Set reply path |
|
5913 result = TestSetReplyPath(iLog, deliver); |
|
5914 Print(console, result, _L("SetReplyPath")); |
|
5915 |
|
5916 //Get reply path |
|
5917 result = TestGetReplyPath(iLog, deliver); |
|
5918 Print(console, result, _L("ReplyPath")); |
|
5919 |
|
5920 //Set status report indication |
|
5921 result = TestSetStatusReportIndication(iLog, deliver); |
|
5922 Print(console, result, _L("SetStatusReportIndication")); |
|
5923 |
|
5924 //Get status report indication |
|
5925 result = TestGetStatusReportIndication(iLog, deliver); |
|
5926 Print(console, result, _L("StatusReportIndication")); |
|
5927 |
|
5928 //Set service center time stamp |
|
5929 result = TestSetServiceCenterTimeStamp(iLog, deliver); |
|
5930 Print(console, result, _L("SetServiceCenterTimeStamp")); |
|
5931 |
|
5932 //Get service center time stamp |
|
5933 result = TestGetServiceCenterTimeStampL(iLog, deliver); |
|
5934 Print(console, result, _L("ServiceCenterTimeStamp")); |
|
5935 |
|
5936 //Get protocol identifier |
|
5937 result = TestGetProtocolIdentifier(iLog, deliver); |
|
5938 Print(console, result, _L("ProtocolIdentifier")); |
|
5939 |
|
5940 //DuplicateL |
|
5941 result = TestSmsDeliverDuplicateL(iLog, deliver); |
|
5942 Print(console, result, _L("SmsDeliverDuplicateL")); |
|
5943 |
|
5944 Remove_Console(console); |
|
5945 CleanupStack::PopAndDestroy(&deliver); |
|
5946 rfServer.Close(); |
|
5947 // Case was executed |
|
5948 return KErrNone; |
|
5949 |
|
5950 } |
|
5951 |
|
5952 // ----------------------------------------------------------------------------- |
|
5953 // CBCSmsUtilitiesTest::TestSmsDeliverReport |
|
5954 // Simple printing to UI test. |
|
5955 // ----------------------------------------------------------------------------- |
|
5956 // |
|
5957 TInt CBCSmsUtilitiesTest::TestSmsDeliverReportL( |
|
5958 TTestResult& aResult ) |
|
5959 { |
|
5960 _LIT(KSmsDeliverReport, "Calling CSmsDeliverReport"); |
|
5961 iLog->Log(KSmsDeliverReport); |
|
5962 TInt result = KErrNone; |
|
5963 |
|
5964 RFs rfServer; |
|
5965 User::LeaveIfError(rfServer.Connect()); |
|
5966 |
|
5967 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
5968 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
5969 CSmsMessage* smsMessage = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsDeliverReport, smsBuffer ); |
|
5970 |
|
5971 CSmsDeliverReport& deliverReport = STATIC_CAST(CSmsDeliverReport&, smsMessage->SmsPDU() ); |
|
5972 CSmsDeliverReport* ptrDeliverReport = &deliverReport; |
|
5973 CleanupStack::PushL(ptrDeliverReport); |
|
5974 |
|
5975 CConsoleBase* console = Create_ConsoleL(_L("CSmsDeliverReport")); |
|
5976 //Construction |
|
5977 //Set is RP error |
|
5978 result = TestSetIsRPError(iLog, deliverReport); |
|
5979 Print(console, result, _L("SetIsRPError")); |
|
5980 |
|
5981 //Get is RP error |
|
5982 result = TestGetIsRPError(iLog, deliverReport); |
|
5983 Print(console, result, _L("IsRPError")); |
|
5984 |
|
5985 //Set failure cause |
|
5986 result = TestSetFailureCause(iLog, deliverReport); |
|
5987 Print(console, result, _L("SetFailureCause")); |
|
5988 |
|
5989 //Get failure cause |
|
5990 result = TestGetFailureCause(iLog, deliverReport); |
|
5991 Print(console, result, _L("FailureCause")); |
|
5992 |
|
5993 //DuplicateL |
|
5994 result = TestSmsDeliverReportDuplicateL(iLog, deliverReport); |
|
5995 Print(console, result, _L("SmsDeliverReportDuplicateL")); |
|
5996 |
|
5997 Remove_Console(console); |
|
5998 CleanupStack::PopAndDestroy(&deliverReport); |
|
5999 rfServer.Close(); |
|
6000 return KErrNone; |
|
6001 |
|
6002 } |
|
6003 |
|
6004 // ----------------------------------------------------------------------------- |
|
6005 // CBCSmsUtilitiesTest::TestSmsEditorBuffer |
|
6006 // |
|
6007 // ----------------------------------------------------------------------------- |
|
6008 // |
|
6009 TInt CBCSmsUtilitiesTest::TestSmsEditorBufferL( |
|
6010 TTestResult& aResult ) |
|
6011 { |
|
6012 _LIT(KSmsEditorBuffer, "Calling CSmsEditorBuffer"); |
|
6013 iLog->Log(KSmsEditorBuffer); |
|
6014 TInt result = KErrNone; |
|
6015 |
|
6016 CParaFormatLayer* para = CParaFormatLayer::NewL(); |
|
6017 CCharFormatLayer* charlayer = CCharFormatLayer::NewL(); |
|
6018 |
|
6019 CRichText* text = CRichText::NewL(para, charlayer); |
|
6020 CSmsEditorBuffer* editor = CSmsEditorBuffer::NewL(*text); |
|
6021 CleanupStack::PushL(editor); |
|
6022 |
|
6023 CConsoleBase* console = Create_ConsoleL(_L("CSmsEditorBuffer")); |
|
6024 //Construction |
|
6025 //Destruction |
|
6026 //Insert |
|
6027 result = TestInsert(iLog, *editor); |
|
6028 Print(console, result, _L("Insert") ); |
|
6029 |
|
6030 //Delete |
|
6031 result = TestDelete(iLog, *editor); |
|
6032 Print(console, result, _L("DeleteL") ); |
|
6033 |
|
6034 //Extract |
|
6035 result = TestExtract(iLog, *editor); |
|
6036 Print(console, result, _L("Extract") ); |
|
6037 |
|
6038 //GetLength |
|
6039 result = TestGetLength(iLog, *editor); |
|
6040 Print(console, result, _L("Length") ); |
|
6041 |
|
6042 //Reset |
|
6043 result = TestReset(iLog, *editor); |
|
6044 Print(console, result, _L("Reset") ); |
|
6045 |
|
6046 Remove_Console(console); |
|
6047 CleanupStack::PopAndDestroy(editor); |
|
6048 // Case was executed |
|
6049 return result; |
|
6050 |
|
6051 } |
|
6052 |
|
6053 // ----------------------------------------------------------------------------- |
|
6054 // CBCSmsUtilitiesTest::TestSmsInformationElement |
|
6055 // |
|
6056 // ----------------------------------------------------------------------------- |
|
6057 // |
|
6058 TInt CBCSmsUtilitiesTest::TestSmsInformationElementL( |
|
6059 TTestResult& aResult ) |
|
6060 { |
|
6061 _LIT(KSmsInformationElement, "Calling CSmsInformationElement"); |
|
6062 iLog->Log(KSmsInformationElement); |
|
6063 TInt result = KErrNone; |
|
6064 RFs rfServer; |
|
6065 User::LeaveIfError(rfServer.Connect()); |
|
6066 |
|
6067 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
6068 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
6069 CSmsMessage* smsMessage = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsCommand, smsBuffer ); |
|
6070 CSmsCommand& command = STATIC_CAST(CSmsCommand&, smsMessage->SmsPDU() ); |
|
6071 |
|
6072 CSmsInformationElement::TSmsInformationElementIdentifier identifier = CSmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference; |
|
6073 TBufC8<24> information(KTestInfo8); |
|
6074 command.AddInformationElementL( identifier, information); |
|
6075 |
|
6076 CSmsInformationElement& element = command.InformationElement(0); |
|
6077 CSmsInformationElement *ptrElement = &element; |
|
6078 CleanupStack::PushL(ptrElement); |
|
6079 |
|
6080 CConsoleBase* console = Create_ConsoleL(_L("CSmsInformationElement")); |
|
6081 //Construction |
|
6082 //Get Identifier |
|
6083 result = TestGetIdentifier(iLog, element); |
|
6084 Print(console, result, _L("Identifier") ); |
|
6085 |
|
6086 //Get data (TPtr8) |
|
6087 result = TestGetDataTPtr8(iLog, element); |
|
6088 Print(console, result, _L("TPtr8 Data") ); |
|
6089 |
|
6090 //Get data (TDesC8) |
|
6091 result = TestGetDataTDesC8(iLog, element); |
|
6092 Print(console, result, _L("TDesC8 Data") ); |
|
6093 |
|
6094 Remove_Console(console); |
|
6095 CleanupStack::PopAndDestroy(&element); |
|
6096 rfServer.Close(); |
|
6097 |
|
6098 // Case was executed |
|
6099 return KErrNone; |
|
6100 |
|
6101 } |
|
6102 |
|
6103 // ----------------------------------------------------------------------------- |
|
6104 // CBCSmsUtilitiesTest::TestSmsMessage |
|
6105 // Simple printing to UI test. |
|
6106 // ----------------------------------------------------------------------------- |
|
6107 // |
|
6108 TInt CBCSmsUtilitiesTest::TestSmsMessageL( |
|
6109 TTestResult& aResult ) |
|
6110 { |
|
6111 _LIT(KSmsMessage, "Calling CSmsMessage"); |
|
6112 iLog->Log(KSmsMessage); |
|
6113 TInt result = KErrNone; |
|
6114 |
|
6115 RFs rfServer; |
|
6116 User::LeaveIfError(rfServer.Connect()); |
|
6117 |
|
6118 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
6119 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
6120 |
|
6121 //static CSmsMessage* NewL(RFs& aFs, CSmsPDU::TSmsPDUType aType,CSmsBufferBase* aBuffer |
|
6122 //,TBool aIsRPError=EFalse); |
|
6123 CSmsMessage* message = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsDeliver, smsBuffer ); |
|
6124 CleanupStack::PushL( message ); |
|
6125 |
|
6126 CConsoleBase* console = Create_ConsoleL(_L("CSmsMessage")); |
|
6127 |
|
6128 //Construction (TGsmSms) |
|
6129 result = TestConstructionTGsmSms_MessageL(iLog); |
|
6130 |
|
6131 //Destruction |
|
6132 //Get type |
|
6133 result = TestGetType(iLog, *message); |
|
6134 Print(console, result, _L("Type") ); |
|
6135 |
|
6136 //Get is complete |
|
6137 result = TestGetIsComplete(iLog, *message); |
|
6138 Print(console, result, _L("IsComplete") ); |
|
6139 |
|
6140 //Get is decoded |
|
6141 result = TestIsDecoded(iLog, *message); |
|
6142 Print(console, result, _L("IsDecoded") ); |
|
6143 |
|
6144 //Set storage |
|
6145 result = TestSetStorage(iLog, *message); |
|
6146 Print(console, result, _L("SetStorage") ); |
|
6147 |
|
6148 //Get storage |
|
6149 result = TestGetStorage(iLog, *message); |
|
6150 Print(console, result, _L("Storage") ); |
|
6151 |
|
6152 //Set status |
|
6153 result = TestSetStatus(iLog, *message); |
|
6154 Print(console, result, _L("SetStatus") ); |
|
6155 |
|
6156 //Get status |
|
6157 result = TestGetStatus(iLog, *message); |
|
6158 Print(console, result, _L("Status") ); |
|
6159 |
|
6160 //Set log server id |
|
6161 result = TestSetLogServerId(iLog, *message); |
|
6162 Print(console, result, _L("SetLogServerId") ); |
|
6163 |
|
6164 //Get log server id |
|
6165 result = TestGetLogServerId(iLog, *message); |
|
6166 Print(console, result, _L("LogServerId") ); |
|
6167 |
|
6168 //Set time |
|
6169 result = TestSetTime(iLog, *message); |
|
6170 Print(console, result, _L("SetTime") ); |
|
6171 |
|
6172 //Get time |
|
6173 result = TestGetTimeL(iLog, *message); |
|
6174 Print(console, result, _L("Time") ); |
|
6175 |
|
6176 //Get SMS PDU |
|
6177 result = TestGetSMSPduL(iLog, *message); |
|
6178 Print(console, result, _L("SmsPDU") ); |
|
6179 |
|
6180 //Get SMS PDU const |
|
6181 result = TestGetSMSPDUConst(iLog, *message); |
|
6182 Print(console, result, _L("SmsPDU const") ); |
|
6183 |
|
6184 //Set service center address |
|
6185 result = TestSetServiceCenterAddress(iLog, *message); |
|
6186 Print(console, result, _L("SetSeviceCenterAddress") ); |
|
6187 |
|
6188 //Get service center address |
|
6189 result = TestGetServiceCenterAddress(iLog, *message); |
|
6190 Print(console, result, _L("SeviceCenterAddress") ); |
|
6191 |
|
6192 //Set parsed service center address |
|
6193 result = TestSetParsedServiceCenterAddress(iLog, *message); |
|
6194 Print(console, result, _L("SetParsedServiceCenterAddress") ); |
|
6195 |
|
6196 //Get parsed service center address |
|
6197 result = TestGetParsedServiceCenterAddress(iLog, *message); |
|
6198 Print(console, result, _L("ParsedServiceCenterAddress") ); |
|
6199 |
|
6200 //Set to from address |
|
6201 result = TestSetToFromAddress(iLog, *message); |
|
6202 Print(console, result, _L("SetToFromAddressL") ); |
|
6203 |
|
6204 //Get to from address |
|
6205 result = TestGetToFromAddress(iLog, *message); |
|
6206 Print(console, result, _L("ToFromAddress") ); |
|
6207 |
|
6208 //Set parsed to from address |
|
6209 result = TestSetParsedToFromAddress(iLog, *message); |
|
6210 Print(console, result, _L("SetParsedToFromAddressL") ); |
|
6211 |
|
6212 //Get parsed to from address |
|
6213 result = TestGetParsedToFromAddress(iLog, *message); |
|
6214 Print(console, result, _L("ParsedToFromAddress") ); |
|
6215 |
|
6216 //Externalize without buffer |
|
6217 result = TestExternalizeWithoutBufferL(iLog, *message); |
|
6218 Print(console, result, _L("ExternalizeWithoutBuffer") ); |
|
6219 |
|
6220 //Internalize without buffer |
|
6221 result = TestInternalizeWithoutBufferL(iLog, *message); |
|
6222 Print(console, result, _L("InternalizeWithoutBuffer") ); |
|
6223 |
|
6224 //Externalize |
|
6225 result = TestExternalizeL(iLog, *message); |
|
6226 Print(console, result, _L("Externalize") ); |
|
6227 |
|
6228 //Internalize |
|
6229 result = TestInternalizeL(iLog, *message); |
|
6230 Print(console, result, _L("Internalize") ); |
|
6231 |
|
6232 //Get buffer |
|
6233 result = TestGetBufferL(iLog, *message); |
|
6234 Print(console, result, _L("Buffer") ); |
|
6235 |
|
6236 //Get buffer const |
|
6237 result = TestGetBufferConstL(iLog, *message); |
|
6238 Print(console, result, _L("Buffer const") ); |
|
6239 |
|
6240 //Get text present |
|
6241 result = TestGetTextPresent(iLog, *message); |
|
6242 Print(console, result, _L("TextPresent") ); |
|
6243 |
|
6244 //Get number of message PDUs |
|
6245 result = TestGetNumberOfMessagePduL(iLog, *message); |
|
6246 Print(console, result, _L("NumMessagePDUsL") ); |
|
6247 |
|
6248 //Get max message length |
|
6249 result = TestGetMaxLength(iLog, *message); |
|
6250 Print(console, result, _L("MaxMessagelength") ); |
|
6251 |
|
6252 //Get message length |
|
6253 result = TestGetMessageLength(iLog, *message); |
|
6254 Print(console, result, _L("MessageLengthL") ); |
|
6255 |
|
6256 //Set user data settings |
|
6257 //Get user data settings |
|
6258 //Cannot be executed |
|
6259 |
|
6260 //Optimize settings |
|
6261 result = TestOptimizeSettings(iLog, *message); |
|
6262 Print(console, result, _L("OptimizeSettings") ); |
|
6263 |
|
6264 //Get is supported |
|
6265 result = TestGetIsSupported(iLog, *message); |
|
6266 Print(console, result, _L("IsSupported") ); |
|
6267 |
|
6268 //Encode message PDUs |
|
6269 result = TestEncodeMessagePDUL(iLog, *message); |
|
6270 Print(console, result, _L("EncodeMessagePDUsL") ); |
|
6271 |
|
6272 //Decode message PDUs |
|
6273 result = TestDecodeMessagePDUL(iLog, *message); |
|
6274 Print(console, result, _L("DecodeMessagePDUsL") ); |
|
6275 |
|
6276 //Add EMS information elements |
|
6277 //This currently does not work, changes in build required |
|
6278 /* result = TestAddEMSInformationElements(iLog, *message); |
|
6279 Print(console, result, _L("AddEMSInformationElements") ); |
|
6280 */ |
|
6281 //Copy EMS elements |
|
6282 result = TestCopyEMSElementsL(iLog, *message); |
|
6283 Print(console, result, _L("CopyEMSElements") ); |
|
6284 |
|
6285 //Get EMS information elements |
|
6286 result = TestGetEMSInformationElements(iLog, *message); |
|
6287 Print(console, result, _L("EMSInformationElements") ); |
|
6288 |
|
6289 //Remove EMS information elements |
|
6290 result = TestRemoveEMSInformationElements(iLog, *message); |
|
6291 Print(console, result, _L("RemoveEMSInformationElements") ); |
|
6292 |
|
6293 //Remove EMS information element |
|
6294 result = TestRemoveEMSInformationElement(iLog, *message); |
|
6295 Print(console, result, _L("RemoveEMSInformationElement") ); |
|
6296 |
|
6297 //Reset EMS |
|
6298 result = TestResetEMS(iLog, *message); |
|
6299 Print(console, result, _L("ResetEMS") ); |
|
6300 |
|
6301 //Encode into single PDU |
|
6302 result = TestEncodeIntoSinglePDUL(iLog, *message); |
|
6303 Print(console, result, _L("EncodeIntoSinglePDU") ); |
|
6304 |
|
6305 //Add slot |
|
6306 result = TestAddSlot(iLog, *message); |
|
6307 Print(console, result, _L("AddSlot") ); |
|
6308 |
|
6309 //Match slots |
|
6310 result = TestMatchSlotsL(iLog, *message); |
|
6311 Print(console, result, _L("MatchSlots") ); |
|
6312 |
|
6313 //Add email header |
|
6314 result = TestAddEmailHeader(iLog, *message); |
|
6315 Print(console, result, _L("AddEmailHeader") ); |
|
6316 |
|
6317 //Get is email header |
|
6318 result = TestGetIsEmailHeader(iLog, *message); |
|
6319 Print(console, result, _L("IsEmailHeader") ); |
|
6320 |
|
6321 //Get email header |
|
6322 result = TestGetEmailHeaderL(iLog, *message); |
|
6323 Print(console, result, _L("EmailHeader") ); |
|
6324 |
|
6325 //Set is 16 bit concatenation |
|
6326 result = TestSetIs16BitConcatenation(iLog, *message); |
|
6327 Print(console, result, _L("Is16BitConcatenation") ); |
|
6328 |
|
6329 //Get is 16 bit concatenation |
|
6330 result = TestGetIs16BitConcatenation(iLog, *message); |
|
6331 Print(console, result, _L("Is16BitConcatenation") ); |
|
6332 |
|
6333 //Update slots |
|
6334 result = TestUpdateSlotsL(iLog, *message); |
|
6335 Print(console, result, _L("UpdateSlots") ); |
|
6336 |
|
6337 //GetEncodingInfoL |
|
6338 result = TestGetEncodingInfoL(iLog, *message); |
|
6339 Print(console, result, _L("GetEncodingInfoL") ); |
|
6340 |
|
6341 //SetAlternative7bitEncoding |
|
6342 result = TestSetAlternative7bitEncoding(iLog, *message); |
|
6343 Print(console, result, _L("SetAlternative7bitEncoding") ); |
|
6344 |
|
6345 //Get is supported2 |
|
6346 result = TestGetIsSupported2(iLog, *message); |
|
6347 Print(console, result, _L("IsSupported2") ); |
|
6348 |
|
6349 Remove_Console(console); |
|
6350 CleanupStack::PopAndDestroy(message); |
|
6351 rfServer.Close(); |
|
6352 // Case was executed |
|
6353 return result; |
|
6354 |
|
6355 } |
|
6356 |
|
6357 // ----------------------------------------------------------------------------- |
|
6358 // CBCSmsUtilitiesTest::TestSmsPDU |
|
6359 // Simple printing to UI test. |
|
6360 // ----------------------------------------------------------------------------- |
|
6361 // |
|
6362 TInt CBCSmsUtilitiesTest::TestSmsPDUL( |
|
6363 TTestResult& aResult ) |
|
6364 { |
|
6365 _LIT(KSmsPDU, "Calling CSmsPDU"); |
|
6366 iLog->Log(KSmsPDU); |
|
6367 TInt result = KErrNone; |
|
6368 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
6369 CleanupStack::PushL(characterSetConverter); |
|
6370 |
|
6371 //static CSmsPDU* NewL(TSmsPDUType aType,CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TBool aIsRPError=EFalse); |
|
6372 CSmsPDU* PDU = CSmsPDU::NewL(CSmsPDU::ESmsDeliver, *characterSetConverter, iSession); |
|
6373 CleanupStack::PushL(PDU); |
|
6374 |
|
6375 //static CSmsPDU* NewL(TSmsPDUType aType,CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TBool aIsRPError=EFalse); |
|
6376 CSmsPDU* PDUReport = CSmsPDU::NewL(CSmsPDU::ESmsDeliverReport, *characterSetConverter, iSession); |
|
6377 CleanupStack::PushL(PDUReport); |
|
6378 |
|
6379 CConsoleBase* console = Create_ConsoleL(_L("CSmsPDU")); |
|
6380 //Construction (RReadStream) |
|
6381 result = TestConstructionStreamL(iLog, *PDU); |
|
6382 |
|
6383 //Construction (TGsmSms) |
|
6384 result = TestConstructionTGsmSms_PduL(iLog, *PDU); |
|
6385 |
|
6386 //Get type |
|
6387 result = TestGetType(iLog, *PDU); |
|
6388 Print(console, result, _L("Type") ); |
|
6389 |
|
6390 //Externalize |
|
6391 result = TestExternalizeL(iLog, *PDU); |
|
6392 Print(console, result, _L("Externalize") ); |
|
6393 |
|
6394 //Encode message PDUs |
|
6395 result = TestEncodeMessagePDUs(iLog, *PDU); |
|
6396 Print(console, result, _L("EncodeMessagePDUs") ); |
|
6397 |
|
6398 //Set service center address |
|
6399 result = TestSetServiceCenterAddress(iLog, *PDU); |
|
6400 Print(console, result, _L("SetServiceCenterAddress") ); |
|
6401 |
|
6402 //Get service center address |
|
6403 result = TestGetServiceCenterAddress(iLog, *PDU); |
|
6404 Print(console, result, _L("ServiceCenterAddress") ); |
|
6405 |
|
6406 //Set parsed service center address |
|
6407 result = TestSetParsedServiceCenterAddress(iLog, *PDU); |
|
6408 Print(console, result, _L("SetParsedServiceCenterAddress") ); |
|
6409 |
|
6410 //Get parsed service center address |
|
6411 result = TestGetParsedServiceCenterAddress(iLog, *PDU); |
|
6412 Print(console, result, _L("ParsedServiceCenterAddress") ); |
|
6413 |
|
6414 //Set to from address |
|
6415 result = TestSetToFromAddress(iLog, *PDU); |
|
6416 Print(console, result, _L("SetToFromAddress") ); |
|
6417 |
|
6418 //Get to from address |
|
6419 result = TestGetToFromAddress(iLog, *PDU); |
|
6420 Print(console, result, _L("ToFromAddress") ); |
|
6421 |
|
6422 //Set parsed to from address |
|
6423 result = TestSetParsedToFromAddress(iLog, *PDU); |
|
6424 Print(console, result, _L("SetParsedToFromAddress") ); |
|
6425 |
|
6426 //Get parsed to from address |
|
6427 result = TestGetParsedToFromAddress(iLog, *PDU); |
|
6428 Print(console, result, _L("ParsedToFromAddress") ); |
|
6429 |
|
6430 //Set bits 7 to 4 |
|
6431 result = TestSetBits7To4(iLog, *PDU); |
|
6432 Print(console, result, _L("SetBits7To4") ); |
|
6433 |
|
6434 //Get bits 7 to 4 |
|
6435 result = TestGetBits7To4(iLog, *PDU); |
|
6436 Print(console, result, _L("Bits7To4") ); |
|
6437 |
|
6438 //Set alphabet |
|
6439 result = TestSetAlphabet(iLog, *PDU); |
|
6440 Print(console, result, _L("SetAlphabet") ); |
|
6441 |
|
6442 //Get alphabet |
|
6443 result = TestGetAlphabet(iLog, *PDU); |
|
6444 Print(console, result, _L("Alphabet") ); |
|
6445 |
|
6446 //Set class |
|
6447 result = TestSetClass(iLog, *PDU); |
|
6448 Print(console, result, _L("SetClass") ); |
|
6449 |
|
6450 //Get class |
|
6451 result = TestGetClass(iLog, *PDU); |
|
6452 Print(console, result, _L("Class") ); |
|
6453 |
|
6454 //Set text compressed |
|
6455 result = TestSetTextCompressed(iLog, *PDU); |
|
6456 Print(console, result, _L("SetTextCompressed") ); |
|
6457 |
|
6458 //Get text compressed |
|
6459 result = TestGetTextCompressed(iLog, *PDU); |
|
6460 Print(console, result, _L("TextCompressed") ); |
|
6461 |
|
6462 //Set indication state |
|
6463 result = TestSetIndicationState(iLog, *PDU); |
|
6464 Print(console, result, _L("SetIndicationState") ); |
|
6465 |
|
6466 //Get indication state |
|
6467 result = TestGetIndicationState(iLog, *PDU); |
|
6468 Print(console, result, _L("IndicationState") ); |
|
6469 |
|
6470 //Set indication type |
|
6471 result = TestSetIndicationType(iLog, *PDU); |
|
6472 Print(console, result, _L("SetIndicationType") ); |
|
6473 |
|
6474 //Get indication type |
|
6475 result = TestGetIndicationType(iLog, *PDU); |
|
6476 Print(console, result, _L("IndicationType") ); |
|
6477 |
|
6478 //Set text concatenated |
|
6479 result = TestSetTextConcatenated(iLog, *PDU); |
|
6480 Print(console, result, _L("SetTextConcatenated") ); |
|
6481 |
|
6482 //Get text concatenated |
|
6483 result = TestGetTextConcatenated(iLog, *PDU); |
|
6484 Print(console, result, _L("TextConcatenated") ); |
|
6485 |
|
6486 //Set concatenated message reference |
|
6487 result = TestSetConcatenatedMessageReference(iLog, *PDU); |
|
6488 Print(console, result, _L("SetConcatenatedMessageReference") ); |
|
6489 |
|
6490 //Get concatenated message reference |
|
6491 result = TestGetConcatenatedMessageReference(iLog, *PDU); |
|
6492 Print(console, result, _L("ConcatenatedMessageReference") ); |
|
6493 |
|
6494 //Set number of concatenated message PDUs |
|
6495 result = TestSetNumberOfConcatenatedMessageL(iLog, *PDU); |
|
6496 Print(console, result, _L("SetNumberOfConcatenatedMessage") ); |
|
6497 |
|
6498 //Get number of concatenated message PDUs |
|
6499 result = TestGetNumberOfConcatenatedMessageL(iLog, *PDU); |
|
6500 Print(console, result, _L("NumberOfConcatenatedMessage") ); |
|
6501 |
|
6502 //Set concatenated message PDU index |
|
6503 result = TestSetConcatenatedMessagePDUIndex(iLog, *PDU); |
|
6504 Print(console, result, _L("SetConcatenatedMessagePDUIndex") ); |
|
6505 |
|
6506 //Get concatenated message PDU index |
|
6507 result = TestGetConcatenatedMessagePDUIndex(iLog, *PDU); |
|
6508 Print(console, result, _L("ConcatenatedMessagePDUIndex") ); |
|
6509 |
|
6510 //set application port addressing |
|
6511 result = TestSetApplicationPortAddressing(iLog, *PDU); |
|
6512 Print(console, result, _L("SetApplicationPortAddressing") ); |
|
6513 |
|
6514 //Get application port addressing |
|
6515 result = TestGetApplicationPortAddressing(iLog, *PDU); |
|
6516 Print(console, result, _L("ApplicationPortAddressing") ); |
|
6517 |
|
6518 //set PID type |
|
6519 result = TestSetPIDType(iLog, *PDU); |
|
6520 Print(console, result, _L("SetPIDType") ); |
|
6521 |
|
6522 //Get PID type |
|
6523 result = TestGetPIDType(iLog, *PDU); |
|
6524 Print(console, result, _L("PIDType") ); |
|
6525 |
|
6526 //Set short message type |
|
6527 result = TestSetShortMessageType(iLog, *PDU); |
|
6528 Print(console, result, _L("SetShortMessageType") ); |
|
6529 |
|
6530 //Get short message type |
|
6531 result = TestGetShortMessageType(iLog, *PDU); |
|
6532 Print(console, result, _L("ShortMessageType") ); |
|
6533 |
|
6534 //Set telematic device indicator |
|
6535 result = TestSetTelematicDeviceIndicator(iLog, *PDU); |
|
6536 Print(console, result, _L("SetTelematicDeviceIndicator") ); |
|
6537 |
|
6538 //Get telematic device indicator |
|
6539 result = TestGetTelematicDeviceIndicator(iLog, *PDU); |
|
6540 Print(console, result, _L("TelematicDeviceIndicator") ); |
|
6541 |
|
6542 //Set telematic device type |
|
6543 result = TestSetTelematicDeviceType(iLog, *PDU); |
|
6544 Print(console, result, _L("SetTelematicDeviceType") ); |
|
6545 |
|
6546 //Get telematic device type |
|
6547 result = TestGetTelematicDeviceType(iLog, *PDU); |
|
6548 Print(console, result, _L("TelematicDeviceType") ); |
|
6549 |
|
6550 //Get user data |
|
6551 result = TestGetUserData(iLog, *PDU); |
|
6552 Print(console, result, _L("UserData") ); |
|
6553 |
|
6554 //Get user data const |
|
6555 result = TestGetUserDataConst(iLog, *PDU); |
|
6556 Print(console, result, _L("UserDataConst") ); |
|
6557 |
|
6558 //Set user data present |
|
6559 result = TestSetUserDataPresent(iLog, *PDUReport); |
|
6560 Print(console, result, _L("SetUserDataPresent") ); |
|
6561 |
|
6562 //Get user data present |
|
6563 result = TestGetUserDataPresent(iLog, *PDUReport); |
|
6564 Print(console, result, _L("UserDataPresent") ); |
|
6565 |
|
6566 //Set data coding scheme present |
|
6567 result = TestSetDataCodingSchemePresent(iLog, *PDUReport); |
|
6568 Print(console, result, _L("SetDataCodingSchemePresent") ); |
|
6569 |
|
6570 //Get data coding scheme present |
|
6571 result = TestGetDataCodingSchemePresent(iLog, *PDUReport); |
|
6572 Print(console, result, _L("DataCodingSchemePresent") ); |
|
6573 |
|
6574 //Set protocol identifier present |
|
6575 result = TestSetProtocolIdentifierPresent(iLog, *PDUReport); |
|
6576 Print(console, result, _L("SetProtocolIdentifierPresent") ); |
|
6577 |
|
6578 //Get protocol identifier present |
|
6579 result = TestGetProtocolIdentifierPresent(iLog, *PDUReport); |
|
6580 Print(console, result, _L("ProtocolIdentifierPresent") ); |
|
6581 |
|
6582 //Set national language encoding |
|
6583 result = TestSetNationalLanguageEncodingL(iLog, *PDUReport); |
|
6584 Print(console, result, _L("SetNationalLanguageEncodingL") ); |
|
6585 |
|
6586 //DuplicateL |
|
6587 result = TestSmsPDUDuplicateL(iLog, *PDUReport); |
|
6588 Print(console, result, _L("SmsPDUDuplicateL")); |
|
6589 |
|
6590 Remove_Console(console); |
|
6591 CleanupStack::PopAndDestroy(3); |
|
6592 return KErrNone; |
|
6593 } |
|
6594 |
|
6595 // ----------------------------------------------------------------------------- |
|
6596 // CBCSmsUtilitiesTest::TestSmsStatusReport |
|
6597 // Simple printing to UI test. |
|
6598 // ----------------------------------------------------------------------------- |
|
6599 // |
|
6600 TInt CBCSmsUtilitiesTest::TestSmsStatusReportL( |
|
6601 TTestResult& aResult ) |
|
6602 { |
|
6603 _LIT(KSmsStatusReport, "Calling CSmsStatusReport"); |
|
6604 iLog->Log(KSmsStatusReport); |
|
6605 TInt result = KErrNone; |
|
6606 |
|
6607 RFs rfServer; |
|
6608 User::LeaveIfError(rfServer.Connect()); |
|
6609 |
|
6610 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
6611 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
6612 CSmsMessage* smsMessage = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsStatusReport, smsBuffer ); |
|
6613 |
|
6614 CSmsStatusReport& statusReport = STATIC_CAST(CSmsStatusReport&, smsMessage->SmsPDU() ); |
|
6615 CSmsStatusReport *ptrStatusReport = &statusReport; |
|
6616 CleanupStack::PushL(ptrStatusReport); |
|
6617 |
|
6618 CConsoleBase* console = Create_ConsoleL(_L("CSmsStatusReport")); |
|
6619 //Construction |
|
6620 //Set parameter indicator present |
|
6621 result = TestSetParameterIndicatorPresent(iLog, statusReport); |
|
6622 Print(console, result, _L("SetIsRPError")); |
|
6623 |
|
6624 //Get parameter indicator present |
|
6625 result = TestGetParameterIndicatorPresent(iLog, statusReport); |
|
6626 Print(console, result, _L("IsRPError")); |
|
6627 |
|
6628 //Set more messages to send |
|
6629 result = TestSetMoreMessagesToSend(iLog, statusReport); |
|
6630 Print(console, result, _L("SetFailureCause")); |
|
6631 |
|
6632 //Get more messages to send |
|
6633 result = TestGetMoreMessagesToSend(iLog, statusReport); |
|
6634 Print(console, result, _L("FailureCause")); |
|
6635 |
|
6636 //Set status report qualifier |
|
6637 result = TestSetStatusReportQualifier(iLog, statusReport); |
|
6638 Print(console, result, _L("DataCodingScheme")); |
|
6639 |
|
6640 //Get status report qualifier |
|
6641 result = TestGetStatusReportQualifier(iLog, statusReport); |
|
6642 Print(console, result, _L("ProtocolIdentifier")); |
|
6643 |
|
6644 //Set message reference |
|
6645 result = TestSetMessageReference(iLog, statusReport); |
|
6646 Print(console, result, _L("SetMessageReference")); |
|
6647 |
|
6648 //Get message reference |
|
6649 result = TestGetMessageReference(iLog, statusReport); |
|
6650 Print(console, result, _L("MessageReference")); |
|
6651 |
|
6652 //Set service center time stamp |
|
6653 result = TestSetServiceCenterTimeStamp(iLog, statusReport); |
|
6654 Print(console, result, _L("UserDataPointer")); |
|
6655 |
|
6656 //Get service center time stamp |
|
6657 result = TestGetServiceCenterTimeStampL(iLog, statusReport); |
|
6658 Print(console, result, _L("Encode")); |
|
6659 |
|
6660 //Set discharge time |
|
6661 result = TestSetDischargeTime(iLog, statusReport); |
|
6662 Print(console, result, _L("Decode")); |
|
6663 |
|
6664 //Get discharge time |
|
6665 result = TestGetDischargeTimeL(iLog, statusReport); |
|
6666 Print(console, result, _L("Decode")); |
|
6667 |
|
6668 //Set status |
|
6669 result = TestSetStatus(iLog, statusReport); |
|
6670 Print(console, result, _L("SetStatus")); |
|
6671 |
|
6672 //Get status |
|
6673 result = TestGetStatus(iLog, statusReport); |
|
6674 Print(console, result, _L("Status")); |
|
6675 |
|
6676 //DuplicateL |
|
6677 result = TestSmsStatusReportDuplicateL(iLog, statusReport); |
|
6678 Print(console, result, _L("SmsStatusReportDuplicateL")); |
|
6679 |
|
6680 Remove_Console(console); |
|
6681 CleanupStack::PopAndDestroy(&statusReport); |
|
6682 rfServer.Close(); |
|
6683 return KErrNone; |
|
6684 |
|
6685 } |
|
6686 |
|
6687 // ----------------------------------------------------------------------------- |
|
6688 // CBCSmsUtilitiesTest::TestSmsSubmit |
|
6689 // Simple printing to UI test. |
|
6690 // ----------------------------------------------------------------------------- |
|
6691 // |
|
6692 TInt CBCSmsUtilitiesTest::TestSmsSubmitL( |
|
6693 TTestResult& aResult ) |
|
6694 { |
|
6695 _LIT(KSmsSubmit, "Calling CSmsSubmit"); |
|
6696 iLog->Log(KSmsSubmit); |
|
6697 TInt result = KErrNone; |
|
6698 |
|
6699 RFs rfServer; |
|
6700 User::LeaveIfError(rfServer.Connect()); |
|
6701 |
|
6702 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
6703 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
6704 CSmsMessage* smsMessage = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsSubmit, smsBuffer ); |
|
6705 |
|
6706 CSmsSubmit& submit = STATIC_CAST(CSmsSubmit&, smsMessage->SmsPDU() ); |
|
6707 CSmsSubmit *ptrSubmit = &submit; |
|
6708 CleanupStack::PushL(ptrSubmit); |
|
6709 |
|
6710 CConsoleBase* console = Create_ConsoleL(_L("CSmsSubmit")); |
|
6711 //Construction |
|
6712 //Set reject duplicates |
|
6713 result = TestSetRejectDuplicates(iLog, submit); |
|
6714 Print(console, result, _L("SetRejectDuplicates")); |
|
6715 |
|
6716 //Get reject duplicates |
|
6717 result = TestGetRejectDuplicates(iLog, submit); |
|
6718 Print(console, result, _L("RejectDuplicates")); |
|
6719 |
|
6720 //Set validity period format |
|
6721 result = TestSetValidityPeriodFormat(iLog, submit); |
|
6722 Print(console, result, _L("SetValidityPeriodFormat")); |
|
6723 |
|
6724 //Get validity period format |
|
6725 result = TestGetValidityPeriodFormat(iLog, submit); |
|
6726 Print(console, result, _L("ValidityPeriodFormat")); |
|
6727 |
|
6728 //Set reply path |
|
6729 result = TestSetReplyPath(iLog, submit); |
|
6730 Print(console, result, _L("SetReplyPath")); |
|
6731 |
|
6732 //Get reply path |
|
6733 result = TestGetReplyPath(iLog, submit); |
|
6734 Print(console, result, _L("ReplyPath")); |
|
6735 |
|
6736 //Set status report request |
|
6737 result = TestSetStatusReportRequest(iLog, submit); |
|
6738 Print(console, result, _L("SetStatusReportRequest")); |
|
6739 |
|
6740 //Get status report request |
|
6741 result = TestGetStatusReportRequest(iLog, submit); |
|
6742 Print(console, result, _L("StatusReportRequest")); |
|
6743 |
|
6744 //Set message reference |
|
6745 result = TestSetMessageReference(iLog, submit); |
|
6746 Print(console, result, _L("SetMessageReferenc")); |
|
6747 |
|
6748 //Get message reference |
|
6749 result = TestGetMessageReference(iLog, submit); |
|
6750 Print(console, result, _L("MessageReference")); |
|
6751 |
|
6752 //Set validity period |
|
6753 result = TestSetValidityPeriod(iLog, submit); |
|
6754 Print(console, result, _L("SetValidityPeriod")); |
|
6755 |
|
6756 //Get validity period |
|
6757 result = TestGetValidityPeriod(iLog, submit); |
|
6758 Print(console, result, _L("ValidityPeriod")); |
|
6759 |
|
6760 //DuplicateL |
|
6761 result = TestSmsSubmitDuplicateL(iLog, submit); |
|
6762 Print(console, result, _L("SmsSubmitDuplicateL")); |
|
6763 |
|
6764 Remove_Console(console); |
|
6765 CleanupStack::PopAndDestroy(&submit); |
|
6766 rfServer.Close(); |
|
6767 // Case was executed |
|
6768 return KErrNone; |
|
6769 |
|
6770 } |
|
6771 |
|
6772 // ----------------------------------------------------------------------------- |
|
6773 // CBCSmsUtilitiesTest::TestSmsSubmitReport |
|
6774 // Simple printing to UI test. |
|
6775 // ----------------------------------------------------------------------------- |
|
6776 // |
|
6777 TInt CBCSmsUtilitiesTest::TestSmsSubmitReportL( |
|
6778 TTestResult& aResult ) |
|
6779 { |
|
6780 _LIT(KSmsSubmitReport, "Calling CSmsSubmitReport"); |
|
6781 iLog->Log(KSmsSubmitReport); |
|
6782 TInt result = KErrNone; |
|
6783 |
|
6784 RFs rfServer; |
|
6785 User::LeaveIfError(rfServer.Connect()); |
|
6786 |
|
6787 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
6788 CSmsBuffer* smsBuffer = CSmsBuffer::NewL(); |
|
6789 CSmsMessage* smsMessage = CSmsMessage::NewL(rfServer, CSmsPDU::ESmsSubmitReport, smsBuffer ); |
|
6790 |
|
6791 CSmsSubmitReport& submitReport = STATIC_CAST(CSmsSubmitReport&, smsMessage->SmsPDU() ); |
|
6792 CSmsSubmitReport *ptrSubmitReport = &submitReport; |
|
6793 CleanupStack::PushL(ptrSubmitReport); |
|
6794 |
|
6795 CConsoleBase* console = Create_ConsoleL(_L("CSmsSubmitReport")); |
|
6796 //Construction |
|
6797 //Set is RP error |
|
6798 result = TestSetIsRPError(iLog, submitReport); |
|
6799 Print(console, result, _L("SetIsRPError")); |
|
6800 |
|
6801 //Get is RP error |
|
6802 result = TestGetIsRPError(iLog, submitReport); |
|
6803 Print(console, result, _L("IsRPError")); |
|
6804 |
|
6805 //Set failure cause |
|
6806 result = TestSetFailureCause(iLog, submitReport); |
|
6807 Print(console, result, _L("SetFailureCause")); |
|
6808 |
|
6809 //Get failure cause |
|
6810 result = TestGetFailureCause(iLog, submitReport); |
|
6811 Print(console, result, _L("FailureCause")); |
|
6812 |
|
6813 //DuplicateL |
|
6814 result = TestSmsSubmitReportDuplicateL(iLog, submitReport); |
|
6815 Print(console, result, _L("SmsSubmitReportDuplicateL")); |
|
6816 |
|
6817 Remove_Console(console); |
|
6818 CleanupStack::PopAndDestroy(&submitReport); |
|
6819 rfServer.Close(); |
|
6820 return KErrNone; |
|
6821 } |
|
6822 |
|
6823 // ----------------------------------------------------------------------------- |
|
6824 // CBCSmsUtilitiesTest::TestSmsUserData |
|
6825 // Simple printing to UI test. |
|
6826 // ----------------------------------------------------------------------------- |
|
6827 // |
|
6828 TInt CBCSmsUtilitiesTest::TestSmsUserDataL( |
|
6829 TTestResult& aResult ) |
|
6830 { |
|
6831 _LIT(KSmsUserData, "Calling CSmsUserData"); |
|
6832 iLog->Log(KSmsUserData); |
|
6833 TInt result = KErrNone; |
|
6834 |
|
6835 CCnvCharacterSetConverter* characterSetConverter = CCnvCharacterSetConverter::NewL(); |
|
6836 //static CSmsPDU* NewL(TSmsPDUType aType,CCnvCharacterSetConverter& aCharacterSetConverter,RFs& aFs,TBool aIsRPError=EFalse); |
|
6837 CSmsPDU* PDU = CSmsPDU::NewL(CSmsPDU::ESmsDeliver, *characterSetConverter, iSession); |
|
6838 |
|
6839 CSmsUserData& userData = STATIC_CAST(CSmsUserData&, PDU->UserData() ); |
|
6840 CSmsUserData *ptrUserData = &userData; |
|
6841 CleanupStack::PushL(ptrUserData); |
|
6842 |
|
6843 CConsoleBase* console = Create_ConsoleL(_L("CSmsUserData")); |
|
6844 |
|
6845 //Add information element |
|
6846 result = TestAddInformationElement(iLog, userData); |
|
6847 Print(console, result, _L("AddInformationElement")); |
|
6848 |
|
6849 //Get number of information elements |
|
6850 result = TestGetNumberOfInformationElements(iLog, userData); |
|
6851 Print(console, result, _L("NumInformationElement")); |
|
6852 |
|
6853 //Get information element |
|
6854 result = TestGetInformationElement(iLog, userData); |
|
6855 Print(console, result, _L("InformationElement")); |
|
6856 |
|
6857 //Get information element index |
|
6858 result = TestGetInformationElementIndex(iLog, userData); |
|
6859 Print(console, result, _L("InformationElementIndex")); |
|
6860 |
|
6861 |
|
6862 //Remove information element |
|
6863 result = TestRemoveInformationElement(iLog, userData); |
|
6864 Print(console, result, _L("RemoveInformationElement")); |
|
6865 |
|
6866 //Get max body length in chars |
|
6867 result = TestMaxBodyLengthInChars(iLog, userData); |
|
6868 Print(console, result, _L("MaxBodyLengthInChars")); |
|
6869 |
|
6870 //Set body |
|
6871 result = TestSetBody(iLog, userData); |
|
6872 Print(console, result, _L("SetBody")); |
|
6873 |
|
6874 //Get is supported |
|
6875 result = TestGetIsSupported(iLog, userData); |
|
6876 Print(console, result, _L("IsSupported")); |
|
6877 |
|
6878 //Get is supported2 |
|
6879 result = TestGetIsSupported2(iLog, userData); |
|
6880 Print(console, result, _L("IsSupported2")); |
|
6881 |
|
6882 //Get is supported3 |
|
6883 result = TestGetIsSupported3(iLog, userData); |
|
6884 Print(console, result, _L("IsSupported3")); |
|
6885 |
|
6886 //Get body |
|
6887 result = TestGetBody(iLog, userData); |
|
6888 Print(console, result, _L("GetBody")); |
|
6889 |
|
6890 Remove_Console(console); |
|
6891 CleanupStack::PopAndDestroy(&userData); |
|
6892 // Case was executed |
|
6893 return KErrNone; |
|
6894 |
|
6895 } |
|
6896 |
|
6897 // End of File |