|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 |
|
19 // [INCLUDE FILES] - do not remove |
|
20 #include <e32svr.h> |
|
21 #include <StifParser.h> |
|
22 #include <Stiftestinterface.h> |
|
23 #include "tmsgget_async.h" |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 //extern ?external_data; |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 //extern ?external_function( ?arg_type,?arg_type ); |
|
30 |
|
31 // CONSTANTS |
|
32 //const ?type ?constant_var = ?constant; |
|
33 |
|
34 // MACROS |
|
35 //#define ?macro ?macro_def |
|
36 |
|
37 // LOCAL CONSTANTS AND MACROS |
|
38 //const ?type ?constant_var = ?constant; |
|
39 //#define ?macro_name ?macro_def |
|
40 |
|
41 // MODULE DATA STRUCTURES |
|
42 //enum ?declaration |
|
43 //typedef ?declaration |
|
44 |
|
45 _LIT8(KService, "Service.Messaging"); |
|
46 _LIT8(KIDataSource,"IMessaging"); |
|
47 _LIT(KMessageTypeSMS,"SMS"); |
|
48 _LIT8(KErrCode,"ErrorCode"); |
|
49 _LIT(KMessageTypeMMS,"MMS"); |
|
50 |
|
51 |
|
52 // LOCAL FUNCTION PROTOTYPES |
|
53 //?type ?function_name( ?arg_type, ?arg_type ); |
|
54 |
|
55 // FORWARD DECLARATIONS |
|
56 //class ?FORWARD_CLASSNAME; |
|
57 |
|
58 // ============================= LOCAL FUNCTIONS =============================== |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // ?function_name ?description. |
|
62 // ?description |
|
63 // Returns: ?value_1: ?description |
|
64 // ?value_n: ?description_line1 |
|
65 // ?description_line2 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 /* |
|
69 ?type ?function_name( |
|
70 ?arg_type arg, // ?description |
|
71 ?arg_type arg) // ?description |
|
72 { |
|
73 |
|
74 ?code // ?comment |
|
75 |
|
76 // ?comment |
|
77 ?code |
|
78 } |
|
79 */ |
|
80 |
|
81 // ============================ MEMBER FUNCTIONS =============================== |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // Ctmsgget_async::Delete |
|
85 // Delete here all resources allocated and opened from test methods. |
|
86 // Called from destructor. |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void Ctmsgget_async::Delete() |
|
90 { |
|
91 |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // Ctmsgget_async::RunMethodL |
|
96 // Run specified method. Contains also table of test mothods and their names. |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 TInt Ctmsgget_async::RunMethodL( |
|
100 CStifItemParser& aItem ) |
|
101 { |
|
102 |
|
103 static TStifFunctionInfo const KFunctions[] = |
|
104 { |
|
105 // Copy this line for every implemented function. |
|
106 // First string is the function name used in TestScripter script file. |
|
107 // Second is the actual implementation member function. |
|
108 ENTRY( "Example", Ctmsgget_async::ExampleL ), |
|
109 ENTRY( "getlist_asyncsms", Ctmsgget_async::getlist_asyncsmsL ), |
|
110 ENTRY( "getlist_asyncmms", Ctmsgget_async::getlist_asyncmmsL ), |
|
111 ENTRY( "getlist_asyncstress", Ctmsgget_async::getlist_asyncstressL ) |
|
112 //ADD NEW ENTRY HERE |
|
113 // [test cases entries] - Do not remove |
|
114 |
|
115 }; |
|
116 |
|
117 const TInt count = sizeof( KFunctions ) / |
|
118 sizeof( TStifFunctionInfo ); |
|
119 |
|
120 return RunInternalL( KFunctions, count, aItem ); |
|
121 |
|
122 } |
|
123 |
|
124 TInt Ctmsgget_async::HandleNotifyL(TInt aCmdId, |
|
125 TInt aEventId, |
|
126 CLiwGenericParamList& aEventParamList, |
|
127 const CLiwGenericParamList& aInParamList) |
|
128 { |
|
129 TInt pos = 0; |
|
130 const TLiwGenericParam* output = aEventParamList.FindFirst( pos,_L8("ReturnValue")); |
|
131 |
|
132 TInt val=0; |
|
133 if(output) |
|
134 { |
|
135 //RFile fs; |
|
136 //RFs rFs; |
|
137 //rFs.Connect(); |
|
138 //rFs.Delete(_L("c:\\getheaderiter3_1.txt")); |
|
139 //fs.Create(r//fs, _L("c:\\getheaderiter3_1.txt"), EFileShareExclusive|EFileWrite) ; |
|
140 |
|
141 CLiwIterable* iterlist = output->Value().AsIterable(); |
|
142 |
|
143 TLiwVariant data; |
|
144 |
|
145 while( iterlist->NextL(data)) |
|
146 { |
|
147 |
|
148 const CLiwMap* Map = data.AsMap(); |
|
149 |
|
150 TLiwVariant mtmtype; |
|
151 Map->FindL(_L8("MessageType"),mtmtype); |
|
152 TPtrC mtm = mtmtype.AsDes(); |
|
153 if(iTestid==ESMS) |
|
154 { |
|
155 if(mtm.FindF(_L("SMS")) == KErrNotFound ) |
|
156 val++; |
|
157 } |
|
158 |
|
159 if(iTestid==EMMS) |
|
160 { |
|
161 if(mtm.FindF(_L("MMS")) == KErrNotFound ) |
|
162 val++; |
|
163 } |
|
164 |
|
165 |
|
166 TBuf8<50> buf; |
|
167 buf.Copy(mtm) ; |
|
168 //fs.Write(_L8("Mtm Id :")); |
|
169 //fs.Write(buf); |
|
170 //fs.Write(_L8("\n")); /// writing mtm type |
|
171 mtmtype.Reset(); |
|
172 |
|
173 TLiwVariant sender; |
|
174 Map->FindL(_L8("Sender"),sender); |
|
175 TPtrC send = sender.AsDes(); |
|
176 |
|
177 //if(send.FindF(_L("9008032761")) == KErrNotFound) |
|
178 // val++; |
|
179 |
|
180 |
|
181 buf.Copy(send) ; |
|
182 //fs.Write(_L8("Sender :")); |
|
183 //fs.Write(buf); |
|
184 //fs.Write(_L8("\n")); /// writing sender |
|
185 sender.Reset(); |
|
186 TLiwVariant messageid; |
|
187 Map->FindL(_L8("MessageId"),messageid); |
|
188 TInt id = (TInt)messageid.AsTInt32(); |
|
189 |
|
190 |
|
191 |
|
192 buf.Num(id) ; |
|
193 //fs.Write(_L8("Message id :")); |
|
194 //fs.Write(buf); |
|
195 //fs.Write(_L8("\n")); /// writing messageid |
|
196 messageid.Reset(); |
|
197 |
|
198 TLiwVariant date; |
|
199 Map->FindL(_L8("Time"),date); |
|
200 |
|
201 |
|
202 TTime date1 =(TTime) date.AsTTime(); |
|
203 |
|
204 |
|
205 TDateTime date2 = date1.DateTime(); |
|
206 |
|
207 buf.Num(date2.Day()); |
|
208 //fs.Write(_L8("Day:")); |
|
209 //fs.Write(buf); |
|
210 //fs.Write(_L8("\t")); /// writing day |
|
211 |
|
212 buf.Num(date2.Month()); |
|
213 //fs.Write(_L8("Month:")); |
|
214 //fs.Write(buf); |
|
215 //fs.Write(_L8("\t")); /// writing month |
|
216 |
|
217 buf.Num(date2.Year()); |
|
218 //fs.Write(_L8("Year:")); |
|
219 //fs.Write(buf); |
|
220 //fs.Write(_L8("\n")); /// writing year |
|
221 date.Reset(); |
|
222 |
|
223 TLiwVariant unreadflag; |
|
224 Map->FindL(_L8("Unread"),unreadflag); |
|
225 TBool unread = (TBool)unreadflag.AsTBool(); |
|
226 |
|
227 |
|
228 |
|
229 buf.Num(unread) ; |
|
230 //fs.Write(_L8("Unread flag :")); |
|
231 //fs.Write(buf); |
|
232 //fs.Write(_L8("\n")); /// writing unread |
|
233 unreadflag.Reset(); |
|
234 TLiwVariant priorityflag; |
|
235 Map->FindL(_L8("Priority"),priorityflag); |
|
236 TPtrC priority = priorityflag.AsDes(); |
|
237 |
|
238 |
|
239 TLiwVariant bodytext; |
|
240 Map->FindL(_L8("BodyText"),bodytext); |
|
241 TPtrC bodytxt = bodytext.AsDes(); |
|
242 bodytext.Reset(); |
|
243 |
|
244 buf.Copy(priority) ; |
|
245 //fs.Write(_L8("Priority Flag :")); |
|
246 //fs.Write(buf); |
|
247 //fs.Write(_L8("\n")); /// writing priority |
|
248 priorityflag.Reset(); |
|
249 data.Reset(); /// upto here we get map by iterable list |
|
250 |
|
251 } |
|
252 //fs.Close(); |
|
253 //rfs.Close(); |
|
254 |
|
255 } |
|
256 |
|
257 CActiveScheduler::Stop(); |
|
258 if(0==val) |
|
259 iResult= KErrNone; |
|
260 else |
|
261 iResult= KErrGeneral; |
|
262 |
|
263 |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // Ctmsgget_async::ExampleL |
|
268 // Example test method function. |
|
269 // (other items were commented in a header). |
|
270 // ----------------------------------------------------------------------------- |
|
271 // |
|
272 TInt Ctmsgget_async::ExampleL( CStifItemParser& aItem ) |
|
273 { |
|
274 |
|
275 // Print to UI |
|
276 _LIT( Ktmsgget_async, "tmsgget_async" ); |
|
277 _LIT( KExample, "In Example" ); |
|
278 TestModuleIf().Printf( 0, Ktmsgget_async, KExample ); |
|
279 // Print to log file |
|
280 iLog->Log( KExample ); |
|
281 |
|
282 TInt i = 0; |
|
283 TPtrC string; |
|
284 _LIT( KParam, "Param[%i]: %S" ); |
|
285 while ( aItem.GetNextString ( string ) == KErrNone ) |
|
286 { |
|
287 TestModuleIf().Printf( i, Ktmsgget_async, |
|
288 KParam, i, &string ); |
|
289 i++; |
|
290 } |
|
291 |
|
292 return KErrNone; |
|
293 |
|
294 } |
|
295 |
|
296 |
|
297 TInt Ctmsgget_async::getlist_asyncsmsL(CStifItemParser& aItem ) |
|
298 { |
|
299 iTestid = ESMS; |
|
300 __UHEAP_MARK; |
|
301 // Iter-3 test work |
|
302 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
303 |
|
304 CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
305 CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
306 |
|
307 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
308 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
309 |
|
310 RCriteriaArray a; |
|
311 |
|
312 a.AppendL(crit); |
|
313 |
|
314 iServiceHandler->AttachL(a); |
|
315 |
|
316 iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
317 |
|
318 delete crit; |
|
319 crit = NULL; |
|
320 a.Reset(); |
|
321 |
|
322 TInt pos = 0; |
|
323 MLiwInterface* interface = NULL; |
|
324 _LIT8(KDataSource, "IMessaging"); |
|
325 outParamList->FindFirst(pos,KDataSource ); |
|
326 if(pos != KErrNotFound) |
|
327 { |
|
328 interface = (*outParamList)[pos].Value().AsInterface(); |
|
329 } |
|
330 |
|
331 outParamList->Reset(); |
|
332 // Iter-2 same |
|
333 inParamList->Reset(); |
|
334 |
|
335 |
|
336 _LIT8(KCmd,"GetList"); |
|
337 |
|
338 // Newly added code |
|
339 TLiwVariant content(_L("Inbox")); |
|
340 TLiwGenericParam element1 ; |
|
341 element1.SetNameAndValueL(_L8("Type"),content); |
|
342 inParamList->AppendL(element1); |
|
343 content.Reset(); |
|
344 element1.Reset(); |
|
345 |
|
346 CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
347 CleanupStack::PushL(map); |
|
348 |
|
349 CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
350 CleanupStack::PushL(mtmtypelist); |
|
351 |
|
352 |
|
353 TLiwVariant smsmtm(KMessageTypeSMS); // how the user wud gv this param |
|
354 mtmtypelist->AppendL(smsmtm); |
|
355 smsmtm.Reset(); |
|
356 TLiwVariant mmsmtm(KMessageTypeMMS);// how the user wud gv this param |
|
357 //mtmtypelist->AppendL(mmsmtm); |
|
358 mmsmtm.Reset(); |
|
359 |
|
360 TLiwVariant add1(mtmtypelist); |
|
361 |
|
362 map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
363 mtmtypelist->DecRef(); |
|
364 CleanupStack::Pop(mtmtypelist); |
|
365 add1.Reset(); |
|
366 |
|
367 CLiwDefaultList* senderlist = CLiwDefaultList::NewL(); |
|
368 CleanupStack::PushL(senderlist); |
|
369 |
|
370 HBufC* address1 = HBufC::NewL(20) ; |
|
371 CleanupStack::PushL(address1); |
|
372 address1->Des().Copy(_L("9008032761")); |
|
373 TLiwVariant addres1(address1); |
|
374 //senderlist->AppendL(addres1); |
|
375 addres1.Reset(); |
|
376 CleanupStack::PopAndDestroy(address1); |
|
377 |
|
378 TLiwVariant from(senderlist); |
|
379 map->InsertL(_L8("SenderList"),from); // Sender list |
|
380 from.Reset(); |
|
381 |
|
382 CleanupStack::Pop(senderlist); |
|
383 senderlist->DecRef(); |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 TDateTime start(2009,EJanuary,22,0,0,0,0); |
|
389 TTime startdate(start); |
|
390 TLiwVariant date1(startdate); |
|
391 map->InsertL(_L8("StartDate"),date1); |
|
392 date1.Reset(); |
|
393 |
|
394 TDateTime end(2010,EDecember,23,0,0,0,0); |
|
395 TTime enddate(end) ; |
|
396 TLiwVariant date2(enddate); |
|
397 map->InsertL(_L8("EndDate"),date2); |
|
398 date2.Reset(); |
|
399 TLiwVariant filterparam(map); |
|
400 TLiwGenericParam element ; |
|
401 element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
402 filterparam.Reset(); |
|
403 |
|
404 |
|
405 inParamList->AppendL(element); |
|
406 element.Reset(); |
|
407 map->DecRef(); |
|
408 CleanupStack::Pop(map); |
|
409 |
|
410 CLiwDefaultMap* sortmap = CLiwDefaultMap::NewL(); |
|
411 CleanupStack::PushL(sortmap); |
|
412 |
|
413 HBufC* sort1 = HBufC::NewL(20) ; |
|
414 CleanupStack::PushL(sort1); |
|
415 sort1->Des().Copy(_L("Date")); |
|
416 TLiwVariant sort(sort1); |
|
417 sortmap->InsertL(_L8("Key"), sort); |
|
418 sort.Reset(); |
|
419 CleanupStack::PopAndDestroy(sort1); |
|
420 |
|
421 |
|
422 HBufC* order1 = HBufC::NewL(20) ; |
|
423 CleanupStack::PushL(order1); |
|
424 order1->Des().Copy(_L("Ascending")); |
|
425 TLiwVariant order(order1); |
|
426 sortmap->InsertL(_L8("Order"), order); |
|
427 order.Reset(); |
|
428 CleanupStack::PopAndDestroy(order1); |
|
429 |
|
430 |
|
431 TLiwVariant sortordermap(sortmap); |
|
432 TLiwGenericParam element2 ; |
|
433 element2.SetNameAndValueL(_L8("SortOrder"),sortordermap); |
|
434 sortordermap.Reset(); |
|
435 |
|
436 |
|
437 inParamList->AppendL(element2); |
|
438 element2.Reset(); |
|
439 |
|
440 |
|
441 sortmap->DecRef(); |
|
442 CleanupStack::Pop(sortmap); |
|
443 |
|
444 |
|
445 interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,KLiwOptASyncronous,this); |
|
446 pos = 0 ; |
|
447 const TLiwGenericParam* errcode=outParamList->FindFirst(pos,KErrCode); |
|
448 TInt err = errcode->Value().AsTInt32(); |
|
449 if(!err) |
|
450 CActiveScheduler::Start(); |
|
451 else |
|
452 iResult = KErrGeneral; |
|
453 |
|
454 TInt index=0; |
|
455 |
|
456 interface->Close(); |
|
457 iServiceHandler->Reset(); |
|
458 delete iServiceHandler; |
|
459 |
|
460 __UHEAP_MARKEND; |
|
461 |
|
462 if(0 == iResult) |
|
463 return KErrNone; |
|
464 else |
|
465 return KErrGeneral; |
|
466 |
|
467 |
|
468 } |
|
469 |
|
470 TInt Ctmsgget_async::getlist_asyncmmsL(CStifItemParser& aItem ) |
|
471 { |
|
472 iTestid = EMMS; |
|
473 __UHEAP_MARK; |
|
474 // Iter-3 test work |
|
475 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
476 |
|
477 CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
478 CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
479 |
|
480 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
481 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
482 |
|
483 RCriteriaArray a; |
|
484 |
|
485 a.AppendL(crit); |
|
486 |
|
487 iServiceHandler->AttachL(a); |
|
488 |
|
489 iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
490 |
|
491 delete crit; |
|
492 crit = NULL; |
|
493 a.Reset(); |
|
494 |
|
495 TInt pos = 0; |
|
496 MLiwInterface* interface = NULL; |
|
497 _LIT8(KDataSource, "IMessaging"); |
|
498 outParamList->FindFirst(pos,KDataSource ); |
|
499 if(pos != KErrNotFound) |
|
500 { |
|
501 interface = (*outParamList)[pos].Value().AsInterface(); |
|
502 } |
|
503 |
|
504 outParamList->Reset(); |
|
505 // Iter-2 same |
|
506 inParamList->Reset(); |
|
507 |
|
508 |
|
509 _LIT8(KCmd,"GetList"); |
|
510 |
|
511 // Newly added code |
|
512 TLiwVariant content(_L("Inbox")); |
|
513 TLiwGenericParam element1 ; |
|
514 element1.SetNameAndValueL(_L8("Type"),content); |
|
515 inParamList->AppendL(element1); |
|
516 content.Reset(); |
|
517 element1.Reset(); |
|
518 |
|
519 CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
520 CleanupStack::PushL(map); |
|
521 |
|
522 CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
523 CleanupStack::PushL(mtmtypelist); |
|
524 |
|
525 TLiwVariant mmsmtm(KMessageTypeMMS);// how the user wud gv this param |
|
526 mtmtypelist->AppendL(mmsmtm); |
|
527 mmsmtm.Reset(); |
|
528 |
|
529 TLiwVariant add1(mtmtypelist); |
|
530 |
|
531 map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
532 mtmtypelist->DecRef(); |
|
533 CleanupStack::Pop(mtmtypelist); |
|
534 add1.Reset(); |
|
535 |
|
536 CLiwDefaultList* senderlist = CLiwDefaultList::NewL(); |
|
537 CleanupStack::PushL(senderlist); |
|
538 |
|
539 HBufC* address1 = HBufC::NewL(20) ; |
|
540 CleanupStack::PushL(address1); |
|
541 address1->Des().Copy(_L("9008032761")); |
|
542 TLiwVariant addres1(address1); |
|
543 //senderlist->AppendL(addres1); |
|
544 addres1.Reset(); |
|
545 CleanupStack::PopAndDestroy(address1); |
|
546 |
|
547 TLiwVariant from(senderlist); |
|
548 map->InsertL(_L8("SenderList"),from); // Sender list |
|
549 from.Reset(); |
|
550 |
|
551 CleanupStack::Pop(senderlist); |
|
552 senderlist->DecRef(); |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 TDateTime start(2009,EJanuary,22,0,0,0,0); |
|
558 TTime startdate(start); |
|
559 TLiwVariant date1(startdate); |
|
560 map->InsertL(_L8("StartDate"),date1); |
|
561 date1.Reset(); |
|
562 |
|
563 TDateTime end(2010,EDecember,23,0,0,0,0); |
|
564 TTime enddate(end) ; |
|
565 TLiwVariant date2(enddate); |
|
566 map->InsertL(_L8("EndDate"),date2); |
|
567 date2.Reset(); |
|
568 TLiwVariant filterparam(map); |
|
569 TLiwGenericParam element ; |
|
570 element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
571 filterparam.Reset(); |
|
572 |
|
573 |
|
574 inParamList->AppendL(element); |
|
575 element.Reset(); |
|
576 map->DecRef(); |
|
577 CleanupStack::Pop(map); |
|
578 |
|
579 CLiwDefaultMap* sortmap = CLiwDefaultMap::NewL(); |
|
580 CleanupStack::PushL(sortmap); |
|
581 |
|
582 HBufC* sort1 = HBufC::NewL(20) ; |
|
583 CleanupStack::PushL(sort1); |
|
584 sort1->Des().Copy(_L("Date")); |
|
585 TLiwVariant sort(sort1); |
|
586 sortmap->InsertL(_L8("Key"), sort); |
|
587 sort.Reset(); |
|
588 CleanupStack::PopAndDestroy(sort1); |
|
589 |
|
590 |
|
591 HBufC* order1 = HBufC::NewL(20) ; |
|
592 CleanupStack::PushL(order1); |
|
593 order1->Des().Copy(_L("Ascending")); |
|
594 TLiwVariant order(order1); |
|
595 sortmap->InsertL(_L8("Order"), order); |
|
596 order.Reset(); |
|
597 CleanupStack::PopAndDestroy(order1); |
|
598 |
|
599 |
|
600 TLiwVariant sortordermap(sortmap); |
|
601 TLiwGenericParam element2 ; |
|
602 element2.SetNameAndValueL(_L8("SortOrder"),sortordermap); |
|
603 sortordermap.Reset(); |
|
604 |
|
605 |
|
606 inParamList->AppendL(element2); |
|
607 element2.Reset(); |
|
608 |
|
609 |
|
610 sortmap->DecRef(); |
|
611 CleanupStack::Pop(sortmap); |
|
612 |
|
613 interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,KLiwOptASyncronous,this); |
|
614 pos = 0 ; |
|
615 const TLiwGenericParam* errcode=outParamList->FindFirst(pos,KErrCode); |
|
616 TInt err = errcode->Value().AsTInt32(); |
|
617 if(!err) |
|
618 CActiveScheduler::Start(); |
|
619 else |
|
620 iResult = KErrGeneral; |
|
621 |
|
622 TInt index=0; |
|
623 |
|
624 interface->Close(); |
|
625 iServiceHandler->Reset(); |
|
626 delete iServiceHandler; |
|
627 |
|
628 __UHEAP_MARKEND; |
|
629 |
|
630 if(0 == iResult) |
|
631 return KErrNone; |
|
632 else |
|
633 return KErrGeneral; |
|
634 |
|
635 |
|
636 } |
|
637 |
|
638 |
|
639 TInt Ctmsgget_async::getlist_asyncstressL(CStifItemParser& aItem ) |
|
640 { |
|
641 iTestid = ESMS; |
|
642 __UHEAP_MARK; |
|
643 // Iter-3 test work |
|
644 CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
645 |
|
646 CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
647 CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
648 |
|
649 CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
650 crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
651 |
|
652 RCriteriaArray a; |
|
653 |
|
654 a.AppendL(crit); |
|
655 |
|
656 iServiceHandler->AttachL(a); |
|
657 |
|
658 iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
659 |
|
660 delete crit; |
|
661 crit = NULL; |
|
662 a.Reset(); |
|
663 |
|
664 TInt pos = 0; |
|
665 MLiwInterface* interface = NULL; |
|
666 _LIT8(KDataSource, "IMessaging"); |
|
667 outParamList->FindFirst(pos,KDataSource ); |
|
668 if(pos != KErrNotFound) |
|
669 { |
|
670 interface = (*outParamList)[pos].Value().AsInterface(); |
|
671 } |
|
672 |
|
673 outParamList->Reset(); |
|
674 // Iter-2 same |
|
675 inParamList->Reset(); |
|
676 |
|
677 |
|
678 _LIT8(KCmd,"GetList"); |
|
679 |
|
680 // Newly added code |
|
681 TLiwVariant content(_L("Inbox")); |
|
682 TLiwGenericParam element1 ; |
|
683 element1.SetNameAndValueL(_L8("Type"),content); |
|
684 inParamList->AppendL(element1); |
|
685 content.Reset(); |
|
686 element1.Reset(); |
|
687 |
|
688 CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
689 CleanupStack::PushL(map); |
|
690 |
|
691 CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
692 CleanupStack::PushL(mtmtypelist); |
|
693 |
|
694 |
|
695 TLiwVariant smsmtm(KMessageTypeSMS); // how the user wud gv this param |
|
696 mtmtypelist->AppendL(smsmtm); |
|
697 smsmtm.Reset(); |
|
698 TLiwVariant mmsmtm(KMessageTypeMMS);// how the user wud gv this param |
|
699 //mtmtypelist->AppendL(mmsmtm); |
|
700 mmsmtm.Reset(); |
|
701 |
|
702 TLiwVariant add1(mtmtypelist); |
|
703 |
|
704 map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
705 mtmtypelist->DecRef(); |
|
706 CleanupStack::Pop(mtmtypelist); |
|
707 add1.Reset(); |
|
708 |
|
709 CLiwDefaultList* senderlist = CLiwDefaultList::NewL(); |
|
710 CleanupStack::PushL(senderlist); |
|
711 |
|
712 HBufC* address1 = HBufC::NewL(20) ; |
|
713 CleanupStack::PushL(address1); |
|
714 address1->Des().Copy(_L("9008032761")); |
|
715 TLiwVariant addres1(address1); |
|
716 //senderlist->AppendL(addres1); |
|
717 addres1.Reset(); |
|
718 CleanupStack::PopAndDestroy(address1); |
|
719 |
|
720 TLiwVariant from(senderlist); |
|
721 map->InsertL(_L8("SenderList"),from); // Sender list |
|
722 from.Reset(); |
|
723 |
|
724 CleanupStack::Pop(senderlist); |
|
725 senderlist->DecRef(); |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 TDateTime start(2009,EJanuary,22,0,0,0,0); |
|
731 TTime startdate(start); |
|
732 TLiwVariant date1(startdate); |
|
733 map->InsertL(_L8("StartDate"),date1); |
|
734 date1.Reset(); |
|
735 |
|
736 TDateTime end(2010,EDecember,23,0,0,0,0); |
|
737 TTime enddate(end) ; |
|
738 TLiwVariant date2(enddate); |
|
739 map->InsertL(_L8("EndDate"),date2); |
|
740 date2.Reset(); |
|
741 TLiwVariant filterparam(map); |
|
742 TLiwGenericParam element ; |
|
743 element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
744 filterparam.Reset(); |
|
745 |
|
746 |
|
747 inParamList->AppendL(element); |
|
748 element.Reset(); |
|
749 map->DecRef(); |
|
750 CleanupStack::Pop(map); |
|
751 |
|
752 CLiwDefaultMap* sortmap = CLiwDefaultMap::NewL(); |
|
753 CleanupStack::PushL(sortmap); |
|
754 |
|
755 HBufC* sort1 = HBufC::NewL(20) ; |
|
756 CleanupStack::PushL(sort1); |
|
757 sort1->Des().Copy(_L("Date")); |
|
758 TLiwVariant sort(sort1); |
|
759 sortmap->InsertL(_L8("Key"), sort); |
|
760 sort.Reset(); |
|
761 CleanupStack::PopAndDestroy(sort1); |
|
762 |
|
763 |
|
764 HBufC* order1 = HBufC::NewL(20) ; |
|
765 CleanupStack::PushL(order1); |
|
766 order1->Des().Copy(_L("Ascending")); |
|
767 TLiwVariant order(order1); |
|
768 sortmap->InsertL(_L8("Order"), order); |
|
769 order.Reset(); |
|
770 CleanupStack::PopAndDestroy(order1); |
|
771 |
|
772 |
|
773 TLiwVariant sortordermap(sortmap); |
|
774 TLiwGenericParam element2 ; |
|
775 element2.SetNameAndValueL(_L8("SortOrder"),sortordermap); |
|
776 sortordermap.Reset(); |
|
777 |
|
778 |
|
779 inParamList->AppendL(element2); |
|
780 element2.Reset(); |
|
781 |
|
782 |
|
783 sortmap->DecRef(); |
|
784 CleanupStack::Pop(sortmap); |
|
785 TInt i=0; |
|
786 pos = 0 ; |
|
787 for(i=0;i<20;i++) |
|
788 { |
|
789 interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,KLiwOptASyncronous,this); |
|
790 |
|
791 const TLiwGenericParam* errcode=outParamList->FindFirst(pos,KErrCode); |
|
792 TInt err = errcode->Value().AsTInt32(); |
|
793 if(!err) |
|
794 CActiveScheduler::Start(); |
|
795 else |
|
796 iResult = KErrGeneral; |
|
797 } |
|
798 |
|
799 TInt index=0; |
|
800 |
|
801 interface->Close(); |
|
802 iServiceHandler->Reset(); |
|
803 delete iServiceHandler; |
|
804 |
|
805 __UHEAP_MARKEND; |
|
806 |
|
807 if(0 == iResult) |
|
808 return KErrNone; |
|
809 else |
|
810 return KErrGeneral; |
|
811 |
|
812 |
|
813 } |
|
814 |
|
815 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
816 // None |
|
817 |
|
818 // [End of File] - Do not remove |