author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:28:47 +0100 | |
branch | RCL_3 |
changeset 66 | a9c0808a1095 |
parent 65 | 0b68a1b0c15e |
permissions | -rw-r--r-- |
19 | 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 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include "getheader.h" |
26 |
||
27 |
#include <e32base.h> |
|
28 |
////#include <senduiconsts.h> |
|
29 |
#include "messaginginterface.h" |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
30 |
#include <badesca.h> |
19 | 31 |
#include <f32file.h> |
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
32 |
#include<liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
33 |
#include<msvstd.h> |
19 | 34 |
#include "messageheader.h" |
35 |
||
36 |
||
37 |
// EXTERNAL DATA STRUCTURES |
|
38 |
//extern ?external_data; |
|
39 |
||
40 |
// EXTERNAL FUNCTION PROTOTYPES |
|
41 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
42 |
||
43 |
// CONSTANTS |
|
44 |
//const ?type ?constant_var = ?constant; |
|
45 |
||
46 |
// MACROS |
|
47 |
//#define ?macro ?macro_def |
|
48 |
||
49 |
// LOCAL CONSTANTS AND MACROS |
|
50 |
//const ?type ?constant_var = ?constant; |
|
51 |
//#define ?macro_name ?macro_def |
|
52 |
||
53 |
// MODULE DATA STRUCTURES |
|
54 |
//enum ?declaration |
|
55 |
//typedef ?declaration |
|
56 |
||
57 |
// LOCAL FUNCTION PROTOTYPES |
|
58 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
59 |
||
60 |
// FORWARD DECLARATIONS |
|
61 |
//class ?FORWARD_CLASSNAME; |
|
62 |
||
63 |
// ============================= LOCAL FUNCTIONS =============================== |
|
64 |
||
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// ?function_name ?description. |
|
67 |
// ?description |
|
68 |
// Returns: ?value_1: ?description |
|
69 |
// ?value_n: ?description_line1 |
|
70 |
// ?description_line2 |
|
71 |
// ----------------------------------------------------------------------------- |
|
72 |
// |
|
73 |
/* |
|
74 |
?type ?function_name( |
|
75 |
?arg_type arg, // ?description |
|
76 |
?arg_type arg) // ?description |
|
77 |
{ |
|
78 |
||
79 |
?code // ?comment |
|
80 |
||
81 |
// ?comment |
|
82 |
?code |
|
83 |
} |
|
84 |
*/ |
|
85 |
||
86 |
// ============================ MEMBER FUNCTIONS =============================== |
|
87 |
||
88 |
// ----------------------------------------------------------------------------- |
|
89 |
// Csapi_getheader::Delete |
|
90 |
// Delete here all resources allocated and opened from test methods. |
|
91 |
// Called from destructor. |
|
92 |
// ----------------------------------------------------------------------------- |
|
93 |
// |
|
94 |
void Csapi_getheader::Delete() |
|
95 |
{ |
|
96 |
||
97 |
} |
|
98 |
||
99 |
// ----------------------------------------------------------------------------- |
|
100 |
// Csapi_getheader::RunMethodL |
|
101 |
// Run specified method. Contains also table of test mothods and their names. |
|
102 |
// ----------------------------------------------------------------------------- |
|
103 |
// |
|
104 |
TInt Csapi_getheader::RunMethodL( |
|
105 |
CStifItemParser& aItem ) |
|
106 |
{ |
|
107 |
||
108 |
static TStifFunctionInfo const KFunctions[] = |
|
109 |
{ |
|
110 |
// Copy this line for every implemented function. |
|
111 |
// First string is the function name used in TestScripter script file. |
|
112 |
// Second is the actual implementation member function. |
|
113 |
||
114 |
ENTRY( "t5to10asynccallsandunloadL", Csapi_getheader::t5to10asynccallsandunloadL ), |
|
115 |
ENTRY( "whilerandomlooprandomswitchL", Csapi_getheader::whilerandomlooprandomswitchL ), |
|
116 |
ENTRY( "getlistsenderlistnumberofnumbersL", Csapi_getheader::getlistsenderlistnumberofnumbersL ), |
|
117 |
ENTRY( "sendtolistnumberofnumbersL", Csapi_getheader::sendtolistnumberofnumbersL ), |
|
118 |
ENTRY( "sendcclistnumberofnumbersL", Csapi_getheader::sendcclistnumberofnumbersL ), |
|
119 |
ENTRY( "sendattachmentsnumberofattachments", Csapi_getheader::sendattachmentsnumberofattachments ), |
|
120 |
}; |
|
121 |
||
122 |
const TInt count = sizeof( KFunctions ) / |
|
123 |
sizeof( TStifFunctionInfo ); |
|
124 |
||
125 |
return RunInternalL( KFunctions, count, aItem ); |
|
126 |
||
127 |
} |
|
128 |
||
129 |
class CSendLiwNotify: public MLiwNotifyCallback |
|
130 |
{ |
|
131 |
TInt HandleNotifyL( |
|
132 |
TInt aCmdId, |
|
133 |
TInt aEventId, |
|
134 |
CLiwGenericParamList& aEventParamList, |
|
135 |
const CLiwGenericParamList& aInParamList) |
|
136 |
{ |
|
137 |
int i; |
|
138 |
i =10+ 100; |
|
139 |
++i; |
|
140 |
i++; |
|
141 |
//CActiveScheduler::Stop(); |
|
66 | 142 |
return 0; |
19 | 143 |
} |
144 |
}; |
|
145 |
||
146 |
_LIT8(KService, "Service.Messaging"); |
|
147 |
_LIT8(KIDataSource,"IMessaging"); |
|
148 |
||
149 |
TInt Csapi_getheader::t5to10asynccallsandunloadL( CStifItemParser& aItem ) |
|
150 |
{ |
|
151 |
__UHEAP_MARK; |
|
152 |
||
153 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
154 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
155 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
156 |
||
157 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
158 |
||
159 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
160 |
||
161 |
RCriteriaArray a; |
|
162 |
a.AppendL(crit); |
|
163 |
||
164 |
iServiceHandler->AttachL(a); |
|
165 |
||
166 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
167 |
||
168 |
TInt pos = 0; |
|
169 |
MLiwInterface* interface = NULL; |
|
170 |
_LIT8(KDataSource, "IMessaging"); |
|
171 |
outParamList->FindFirst(pos,KDataSource ); |
|
172 |
if(pos != KErrNotFound) |
|
173 |
{ |
|
174 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
175 |
} |
|
176 |
||
177 |
inParamList->Reset(); |
|
178 |
outParamList->Reset(); |
|
179 |
delete crit; |
|
180 |
crit = NULL; |
|
181 |
a.Reset(); |
|
182 |
_LIT8( KCmd, "Send" ); |
|
183 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
184 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
185 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText SMS async") ))); |
|
186 |
||
187 |
CSendLiwNotify* cobject = new CSendLiwNotify(); |
|
188 |
int err = KErrNone; |
|
189 |
||
190 |
for( int i=0; i<5; ++i) |
|
191 |
{ |
|
192 |
TRAP(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,1,cobject )); |
|
193 |
//CActiveScheduler::Start(); |
|
194 |
outParamList->Reset(); |
|
195 |
} |
|
196 |
inParamList->Reset(); |
|
197 |
interface->Close(); |
|
198 |
iServiceHandler->Reset(); |
|
199 |
delete iServiceHandler; |
|
200 |
||
201 |
delete cobject; |
|
202 |
||
203 |
||
204 |
__UHEAP_MARKEND; |
|
205 |
||
206 |
return err; |
|
207 |
} |
|
208 |
||
209 |
#include <e32math.h> |
|
210 |
||
211 |
TInt Csapi_getheader::whilerandomlooprandomswitchL( CStifItemParser& aItem ) |
|
212 |
{ |
|
213 |
/* |
|
214 |
_LIT8( KSendCmd, "Send" ); |
|
215 |
TInt err = KErrNone; |
|
216 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
217 |
||
218 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
219 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
220 |
||
221 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
222 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
223 |
||
224 |
RCriteriaArray a; |
|
225 |
||
226 |
a.AppendL(crit); |
|
227 |
||
228 |
iServiceHandler->AttachL(a); |
|
229 |
||
230 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
231 |
||
232 |
delete crit; |
|
233 |
crit = NULL; |
|
234 |
a.Reset(); |
|
235 |
||
236 |
TInt pos = 0; |
|
237 |
MLiwInterface* interface = NULL; |
|
238 |
_LIT8(KDataSource, "IMessaging"); |
|
239 |
outParamList->FindFirst(pos,KDataSource ); |
|
240 |
if(pos != KErrNotFound) |
|
241 |
{ |
|
242 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
243 |
} |
|
244 |
||
245 |
outParamList->Reset(); |
|
246 |
||
247 |
CLiwDefaultMap* map; |
|
248 |
CLiwDefaultList* reclist; |
|
249 |
TInt loop = 100; |
|
250 |
||
251 |
||
252 |
TInt divisor = 100; |
|
253 |
aItem.GetNextInt( divisor ); |
|
254 |
Math m; |
|
255 |
TUint whilecount = ( m.Random()%divisor ) /2; |
|
256 |
while( whilecount-- ) |
|
257 |
{ |
|
258 |
TUint switchchoice = m.Random()%10; |
|
259 |
switch( switchchoice ) |
|
260 |
{ |
|
261 |
case 0: //send 100 sms |
|
262 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
263 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
264 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText SMS Performance test") ))); |
|
265 |
||
266 |
map = CLiwDefaultMap::NewL(); |
|
267 |
CleanupStack::PushL(map); |
|
268 |
reclist = CLiwDefaultList::NewL(); |
|
269 |
CleanupStack::PushL(reclist); |
|
270 |
||
271 |
TUint64 num = 9008032761; |
|
272 |
TBuf<10> ccnum; |
|
273 |
for( int i=0; i<loop; ++i, ++num ) |
|
274 |
{ |
|
275 |
ccnum.Num( num ); |
|
276 |
reclist->AppendL(TLiwVariant( ccnum )); |
|
277 |
} |
|
278 |
||
279 |
TLiwVariant recps(reclist); |
|
280 |
map->InsertL(_L8("To"),recps); |
|
281 |
recps.Reset(); |
|
282 |
reclist->DecRef(); |
|
283 |
CleanupStack::Pop(reclist); |
|
284 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
285 |
map->DecRef(); |
|
286 |
CleanupStack::Pop(map); |
|
287 |
||
288 |
TRAP(err,interface->ExecuteCmdL( KSendCmd ,*inParamList ,*outParamList,0,NULL )); |
|
289 |
||
290 |
outParamList->Reset(); |
|
291 |
inParamList->Reset(); |
|
292 |
break; |
|
293 |
||
294 |
case 1: //send 100 mms |
|
295 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("MMS") ))); |
|
296 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
297 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText MMS Performance test") ))); |
|
298 |
||
299 |
map = CLiwDefaultMap::NewL(); |
|
300 |
CleanupStack::PushL(map); |
|
301 |
reclist = CLiwDefaultList::NewL(); |
|
302 |
CleanupStack::PushL(reclist); |
|
303 |
||
304 |
TUint64 num1 = 9008032761; |
|
305 |
TBuf<10> ccnum2; |
|
306 |
for( int i=0; i<loop; ++i, ++num1 ) |
|
307 |
{ |
|
308 |
ccnum2.Num( num1 ); |
|
309 |
reclist->AppendL(TLiwVariant( ccnum2 )); |
|
310 |
} |
|
311 |
||
312 |
TLiwVariant recps1(reclist); |
|
313 |
map->InsertL(_L8("To"),recps); |
|
314 |
recps.Reset(); |
|
315 |
reclist->DecRef(); |
|
316 |
CleanupStack::Pop(reclist); |
|
317 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
318 |
map->DecRef(); |
|
319 |
CleanupStack::Pop(map); |
|
320 |
||
321 |
TRAP(err,interface->ExecuteCmdL( KSendCmd ,*inParamList ,*outParamList,0,NULL )); |
|
322 |
||
323 |
outParamList->Reset(); |
|
324 |
inParamList->Reset(); |
|
325 |
break; |
|
326 |
||
327 |
case 2: //get messages |
|
328 |
||
329 |
break; |
|
330 |
||
331 |
case 3: //change messagestatus |
|
332 |
||
333 |
break; |
|
334 |
||
335 |
case 4: //delete message |
|
336 |
||
337 |
||
338 |
case 5: //register notification |
|
339 |
||
340 |
break; |
|
341 |
||
342 |
case 6: //cancel notification |
|
343 |
||
344 |
break; |
|
345 |
||
346 |
case 7: //get messages with options |
|
347 |
||
348 |
break; |
|
349 |
||
350 |
case 8: //send message with 100 attachments |
|
351 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("MMS") ))); |
|
352 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
353 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText of MMS bulk Attachments Performance") ))); |
|
354 |
||
355 |
map = CLiwDefaultMap::NewL(); |
|
356 |
CleanupStack::PushL(map); |
|
357 |
||
358 |
||
359 |
CLiwDefaultMap* attachmentmap1 = CLiwDefaultMap::NewL(); |
|
360 |
CleanupStack::PushL(attachmentmap1); |
|
361 |
HBufC* filename1 = HBufC::NewL(80) ; |
|
362 |
CleanupStack::PushL(filename1); |
|
363 |
filename1->Des().Copy(_L("c:\\data\\images\\Test2.jpg")); |
|
364 |
TLiwVariant file1(filename1); |
|
365 |
attachmentmap1->InsertL(_L8("FileName"),file1); |
|
366 |
file1.Reset(); |
|
367 |
CleanupStack::PopAndDestroy(filename1); |
|
368 |
||
369 |
HBufC* mimetype1 = HBufC::NewL(20) ; |
|
370 |
CleanupStack::PushL(mimetype1); |
|
371 |
mimetype1->Des().Copy(_L("image/jpeg")); |
|
372 |
TLiwVariant mime1(mimetype1); |
|
373 |
attachmentmap1->InsertL(_L8("MimeType"),mime1); |
|
374 |
mime1.Reset(); |
|
375 |
CleanupStack::PopAndDestroy(mimetype1); |
|
376 |
||
377 |
||
378 |
CLiwDefaultList* attachmentlist = CLiwDefaultList::NewL(); |
|
379 |
CleanupStack::PushL(attachmentlist); |
|
380 |
TLiwVariant attachment1(attachmentmap1); |
|
381 |
||
382 |
TInt loop = 1000; |
|
383 |
aItem.GetNextInt(loop); |
|
384 |
||
385 |
for( int i=0; i<loop ; ++i ) |
|
386 |
{ |
|
387 |
attachmentlist->AppendL(attachment1); |
|
388 |
} |
|
389 |
attachment1.Reset(); |
|
390 |
||
391 |
TLiwVariant attachments(attachmentlist); |
|
392 |
//attachment list added to message info ,map |
|
393 |
map->InsertL(_L8("AttachmentList"),attachments); |
|
394 |
attachments.Reset(); |
|
395 |
attachmentlist->DecRef(); |
|
396 |
CleanupStack::Pop(attachmentlist); |
|
397 |
attachmentmap1->DecRef(); |
|
398 |
CleanupStack::Pop(attachmentmap1); |
|
399 |
||
400 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
401 |
map->DecRef(); |
|
402 |
CleanupStack::Pop(map); |
|
403 |
int err = KErrNone; |
|
404 |
TRAP(err,interface->ExecuteCmdL( KSendCmd ,*inParamList ,*outParamList,0,NULL )); |
|
405 |
||
406 |
outParamList->Reset(); |
|
407 |
inParamList->Reset(); |
|
408 |
break; |
|
409 |
||
410 |
case 9: //get messages with options |
|
411 |
||
412 |
default: |
|
413 |
break; |
|
414 |
} |
|
415 |
} |
|
416 |
||
417 |
outParamList->Reset(); |
|
418 |
inParamList->Reset(); |
|
419 |
||
420 |
interface->Close(); |
|
421 |
iServiceHandler->Reset(); |
|
422 |
delete iServiceHandler; |
|
423 |
||
424 |
||
425 |
__UHEAP_MARKEND; |
|
426 |
||
427 |
return err;*/ return KErrNone; |
|
428 |
} |
|
429 |
||
430 |
TInt Csapi_getheader::getlistsenderlistnumberofnumbersL( CStifItemParser& aItem ) |
|
431 |
{ |
|
432 |
__UHEAP_MARK; |
|
433 |
// Iter-3 test work |
|
434 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
435 |
||
436 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
437 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
438 |
||
439 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
440 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
441 |
||
442 |
RCriteriaArray a; |
|
443 |
||
444 |
a.AppendL(crit); |
|
445 |
||
446 |
iServiceHandler->AttachL(a); |
|
447 |
||
448 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
449 |
||
450 |
delete crit; |
|
451 |
crit = NULL; |
|
452 |
a.Reset(); |
|
453 |
||
454 |
TInt pos = 0; |
|
455 |
MLiwInterface* interface = NULL; |
|
456 |
_LIT8(KDataSource, "IMessaging"); |
|
457 |
outParamList->FindFirst(pos,KDataSource ); |
|
458 |
if(pos != KErrNotFound) |
|
459 |
{ |
|
460 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
461 |
} |
|
462 |
||
463 |
outParamList->Reset(); |
|
464 |
// Iter-2 same |
|
465 |
||
466 |
||
467 |
||
468 |
_LIT8(KCmd,"GetList"); |
|
469 |
||
470 |
// Newly added code |
|
471 |
TLiwVariant content(_L("Inbox")); |
|
472 |
TLiwGenericParam element1 ; |
|
473 |
element1.SetNameAndValueL(_L8("Type"),content); |
|
474 |
inParamList->AppendL(element1); |
|
475 |
content.Reset(); |
|
476 |
element1.Reset(); |
|
477 |
||
478 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
479 |
CleanupStack::PushL(map); |
|
480 |
||
481 |
||
482 |
||
483 |
||
484 |
||
485 |
||
486 |
CLiwDefaultList* senderlist = CLiwDefaultList::NewL(); |
|
487 |
CleanupStack::PushL(senderlist); |
|
488 |
||
489 |
TInt num = 100; |
|
490 |
aItem.GetNextInt(num); |
|
491 |
||
492 |
HBufC* address1 = HBufC::NewL(20); |
|
493 |
CleanupStack::PushL(address1); |
|
494 |
address1->Des().Copy(_L("9008032761")); |
|
495 |
TLiwVariant addres1(address1); |
|
496 |
for( int i = 0; i<num; ++i ) |
|
497 |
{ |
|
498 |
senderlist->AppendL(addres1); |
|
499 |
} |
|
500 |
addres1.Reset(); |
|
501 |
CleanupStack::PopAndDestroy(address1); |
|
502 |
||
503 |
TLiwVariant from(senderlist); |
|
504 |
map->InsertL(_L8("SenderList"),from); // Sender list |
|
505 |
from.Reset(); |
|
506 |
||
507 |
CleanupStack::Pop(senderlist); |
|
508 |
senderlist->DecRef(); |
|
509 |
||
510 |
||
511 |
TLiwVariant filterparam(map); |
|
512 |
TLiwGenericParam element ; |
|
513 |
element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
514 |
filterparam.Reset(); |
|
515 |
||
516 |
||
517 |
inParamList->AppendL(element); |
|
518 |
element.Reset(); |
|
519 |
||
520 |
map->DecRef(); |
|
521 |
CleanupStack::Pop(map); |
|
522 |
||
523 |
TInt err = 0; |
|
524 |
TRAP(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList)); |
|
525 |
pos = 0 ; |
|
526 |
||
527 |
const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("ReturnValue")); |
|
528 |
||
529 |
TInt val=0; |
|
530 |
if(output) |
|
531 |
{ |
|
532 |
//RFile //fs; |
|
533 |
//R//fs r//fs; |
|
534 |
//r//fs.Connect(); |
|
535 |
//r//fs.Delete(_L("c:\\getheaderiter3_1.txt")); |
|
536 |
//fs.Create(r//fs, _L("c:\\getheaderiter3_1.txt"), EFileShareExclusive|EFileWrite) ; |
|
537 |
||
538 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
539 |
||
540 |
TLiwVariant data; |
|
541 |
||
542 |
while( iterlist->NextL(data)) |
|
543 |
{ |
|
544 |
||
545 |
const CLiwMap* Map = data.AsMap(); |
|
546 |
||
547 |
TLiwVariant mtmtype; |
|
548 |
Map->FindL(_L8("MessageType"),mtmtype); |
|
549 |
TPtrC mtm = mtmtype.AsDes(); |
|
550 |
||
551 |
if(mtm.FindF(_L("SMS")) == KErrNotFound ) |
|
552 |
val++; |
|
553 |
||
554 |
||
555 |
TBuf8<50> buf; |
|
556 |
buf.Copy(mtm) ; |
|
557 |
//fs.Write(_L8("Mtm Id :")); |
|
558 |
//fs.Write(buf); |
|
559 |
//fs.Write(_L8("\n")); /// writing mtm type |
|
560 |
mtmtype.Reset(); |
|
561 |
||
562 |
TLiwVariant sender; |
|
563 |
Map->FindL(_L8("Sender"),sender); |
|
564 |
TPtrC send = sender.AsDes(); |
|
565 |
||
566 |
//if(send.FindF(_L("9008032761")) == KErrNotFound) |
|
567 |
// val++; |
|
568 |
||
569 |
||
570 |
buf.Copy(send) ; |
|
571 |
//fs.Write(_L8("Sender :")); |
|
572 |
//fs.Write(buf); |
|
573 |
//fs.Write(_L8("\n")); /// writing sender |
|
574 |
sender.Reset(); |
|
575 |
TLiwVariant messageid; |
|
576 |
Map->FindL(_L8("MessageId"),messageid); |
|
577 |
TInt id = (TInt)messageid.AsTInt32(); |
|
578 |
||
579 |
||
580 |
||
581 |
buf.Num(id) ; |
|
582 |
//fs.Write(_L8("Message id :")); |
|
583 |
//fs.Write(buf); |
|
584 |
//fs.Write(_L8("\n")); /// writing messageid |
|
585 |
messageid.Reset(); |
|
586 |
||
587 |
TLiwVariant date; |
|
588 |
Map->FindL(_L8("Time"),date); |
|
589 |
||
590 |
||
591 |
TTime date1 =(TTime) date.AsTTime(); |
|
592 |
||
593 |
||
594 |
TDateTime date2 = date1.DateTime(); |
|
595 |
||
596 |
buf.Num(date2.Day()); |
|
597 |
//fs.Write(_L8("Day:")); |
|
598 |
//fs.Write(buf); |
|
599 |
//fs.Write(_L8("\t")); /// writing day |
|
600 |
||
601 |
buf.Num(date2.Month()); |
|
602 |
//fs.Write(_L8("Month:")); |
|
603 |
//fs.Write(buf); |
|
604 |
//fs.Write(_L8("\t")); /// writing month |
|
605 |
||
606 |
buf.Num(date2.Year()); |
|
607 |
//fs.Write(_L8("Year:")); |
|
608 |
//fs.Write(buf); |
|
609 |
//fs.Write(_L8("\n")); /// writing year |
|
610 |
date.Reset(); |
|
611 |
||
612 |
TLiwVariant unreadflag; |
|
613 |
Map->FindL(_L8("Unread"),unreadflag); |
|
614 |
TBool unread = (TBool)unreadflag.AsTBool(); |
|
615 |
||
616 |
||
617 |
||
618 |
buf.Num(unread) ; |
|
619 |
//fs.Write(_L8("Unread flag :")); |
|
620 |
//fs.Write(buf); |
|
621 |
//fs.Write(_L8("\n")); /// writing unread |
|
622 |
unreadflag.Reset(); |
|
623 |
TLiwVariant priorityflag; |
|
624 |
Map->FindL(_L8("Priority"),priorityflag); |
|
625 |
TPtrC priority = priorityflag.AsDes(); |
|
626 |
||
627 |
||
628 |
TLiwVariant bodytext; |
|
629 |
Map->FindL(_L8("BodyText"),bodytext); |
|
630 |
TPtrC bodytxt = bodytext.AsDes(); |
|
631 |
bodytext.Reset(); |
|
632 |
||
633 |
buf.Copy(priority) ; |
|
634 |
//fs.Write(_L8("Priority Flag :")); |
|
635 |
//fs.Write(buf); |
|
636 |
//fs.Write(_L8("\n")); /// writing priority |
|
637 |
priorityflag.Reset(); |
|
638 |
data.Reset(); /// upto here we get map by iterable list |
|
639 |
||
640 |
} |
|
641 |
//fs.Close(); |
|
642 |
//r//fs.Close(); |
|
643 |
||
644 |
} |
|
645 |
||
646 |
TInt index=0; |
|
647 |
||
648 |
interface->Close(); |
|
649 |
iServiceHandler->Reset(); |
|
650 |
delete iServiceHandler; |
|
651 |
||
652 |
__UHEAP_MARKEND; |
|
653 |
||
654 |
if(0 == val) |
|
655 |
return KErrNone; |
|
656 |
else |
|
657 |
return KErrGeneral; |
|
658 |
||
659 |
} |
|
660 |
||
661 |
TInt Csapi_getheader::sendtolistnumberofnumbersL( CStifItemParser& aItem ) |
|
662 |
{ |
|
663 |
__UHEAP_MARK; |
|
664 |
||
665 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
666 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
667 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
668 |
||
669 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
670 |
||
671 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
672 |
||
673 |
RCriteriaArray a; |
|
674 |
a.AppendL(crit); |
|
675 |
||
676 |
iServiceHandler->AttachL(a); |
|
677 |
||
678 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
679 |
||
680 |
TInt pos = 0; |
|
681 |
MLiwInterface* interface = NULL; |
|
682 |
_LIT8(KDataSource, "IMessaging"); |
|
683 |
outParamList->FindFirst(pos,KDataSource ); |
|
684 |
if(pos != KErrNotFound) |
|
685 |
{ |
|
686 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
687 |
} |
|
688 |
||
689 |
inParamList->Reset(); |
|
690 |
outParamList->Reset(); |
|
691 |
delete crit; |
|
692 |
crit = NULL; |
|
693 |
a.Reset(); |
|
694 |
_LIT8( KCmd, "Send" ); |
|
695 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
696 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
697 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText SMS async") ))); |
|
698 |
||
699 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
700 |
CleanupStack::PushL(map); |
|
701 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
702 |
CleanupStack::PushL(reclist); |
|
703 |
||
704 |
TInt loop = 1000; |
|
705 |
aItem.GetNextInt(loop); |
|
706 |
||
707 |
TUint64 num = 9008032762; |
|
708 |
TBuf<10> ccnum; |
|
709 |
for( int i=0; i<loop; ++i, ++num ) |
|
710 |
{ |
|
711 |
ccnum.Num( num ); |
|
712 |
reclist->AppendL(TLiwVariant( ccnum )); |
|
713 |
} |
|
714 |
||
715 |
TLiwVariant recps(reclist); |
|
716 |
map->InsertL(_L8("To"),recps); |
|
717 |
recps.Reset(); |
|
718 |
reclist->DecRef(); |
|
719 |
CleanupStack::Pop(reclist); |
|
720 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
721 |
map->DecRef(); |
|
722 |
CleanupStack::Pop(map); |
|
723 |
int err = KErrNone; |
|
724 |
TRAP(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
725 |
||
726 |
outParamList->Reset(); |
|
727 |
inParamList->Reset(); |
|
728 |
||
729 |
interface->Close(); |
|
730 |
iServiceHandler->Reset(); |
|
731 |
delete iServiceHandler; |
|
732 |
||
733 |
||
734 |
__UHEAP_MARKEND; |
|
735 |
||
736 |
return err; |
|
737 |
} |
|
738 |
||
739 |
TInt Csapi_getheader::sendcclistnumberofnumbersL( CStifItemParser& aItem ) |
|
740 |
{ |
|
741 |
__UHEAP_MARK; |
|
742 |
||
743 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
744 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
745 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
746 |
||
747 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
748 |
||
749 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
750 |
||
751 |
RCriteriaArray a; |
|
752 |
a.AppendL(crit); |
|
753 |
||
754 |
iServiceHandler->AttachL(a); |
|
755 |
||
756 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
757 |
||
758 |
TInt pos = 0; |
|
759 |
MLiwInterface* interface = NULL; |
|
760 |
_LIT8(KDataSource, "IMessaging"); |
|
761 |
outParamList->FindFirst(pos,KDataSource ); |
|
762 |
if(pos != KErrNotFound) |
|
763 |
{ |
|
764 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
765 |
} |
|
766 |
||
767 |
inParamList->Reset(); |
|
768 |
outParamList->Reset(); |
|
769 |
delete crit; |
|
770 |
crit = NULL; |
|
771 |
a.Reset(); |
|
772 |
_LIT8( KCmd, "Send" ); |
|
773 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
774 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
775 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText SMS async") ))); |
|
776 |
||
777 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
778 |
CleanupStack::PushL(map); |
|
779 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
780 |
CleanupStack::PushL(reclist); |
|
781 |
||
782 |
TInt loop = 1000; |
|
783 |
aItem.GetNextInt(loop); |
|
784 |
||
785 |
TUint64 num = 9008032762; |
|
786 |
TBuf<10> ccnum; |
|
787 |
for( int i=0; i<loop; ++i, ++num ) |
|
788 |
{ |
|
789 |
ccnum.Num( num ); |
|
790 |
reclist->AppendL(TLiwVariant( ccnum )); |
|
791 |
} |
|
792 |
||
793 |
TLiwVariant recps(reclist); |
|
794 |
map->InsertL(_L8("Cc"),recps); |
|
795 |
recps.Reset(); |
|
796 |
reclist->DecRef(); |
|
797 |
CleanupStack::Pop(reclist); |
|
798 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
799 |
map->DecRef(); |
|
800 |
CleanupStack::Pop(map); |
|
801 |
int err = KErrNone; |
|
802 |
TRAP(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
803 |
||
804 |
outParamList->Reset(); |
|
805 |
inParamList->Reset(); |
|
806 |
||
807 |
interface->Close(); |
|
808 |
iServiceHandler->Reset(); |
|
809 |
delete iServiceHandler; |
|
810 |
||
811 |
||
812 |
__UHEAP_MARKEND; |
|
813 |
||
814 |
return err; |
|
815 |
} |
|
816 |
||
817 |
TInt Csapi_getheader::sendattachmentsnumberofattachments( CStifItemParser& aItem ) |
|
818 |
{ |
|
819 |
__UHEAP_MARK; |
|
820 |
||
821 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
822 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
823 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
824 |
||
825 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
826 |
||
827 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
828 |
||
829 |
RCriteriaArray a; |
|
830 |
a.AppendL(crit); |
|
831 |
||
832 |
iServiceHandler->AttachL(a); |
|
833 |
||
834 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
835 |
||
836 |
TInt pos = 0; |
|
837 |
MLiwInterface* interface = NULL; |
|
838 |
_LIT8(KDataSource, "IMessaging"); |
|
839 |
outParamList->FindFirst(pos,KDataSource ); |
|
840 |
if(pos != KErrNotFound) |
|
841 |
{ |
|
842 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
843 |
} |
|
844 |
||
845 |
inParamList->Reset(); |
|
846 |
outParamList->Reset(); |
|
847 |
delete crit; |
|
848 |
crit = NULL; |
|
849 |
a.Reset(); |
|
850 |
_LIT8( KCmd, "Send" ); |
|
851 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("MMS") ))); |
|
852 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
853 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText SMS async") ))); |
|
854 |
||
855 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
856 |
CleanupStack::PushL(map); |
|
857 |
||
858 |
||
859 |
CLiwDefaultMap* attachmentmap1 = CLiwDefaultMap::NewL(); |
|
860 |
CleanupStack::PushL(attachmentmap1); |
|
861 |
HBufC* filename1 = HBufC::NewL(80) ; |
|
862 |
CleanupStack::PushL(filename1); |
|
863 |
filename1->Des().Copy(_L("c:\\data\\images\\Test2.jpg")); |
|
864 |
TLiwVariant file1(filename1); |
|
865 |
attachmentmap1->InsertL(_L8("FileName"),file1); |
|
866 |
file1.Reset(); |
|
867 |
CleanupStack::PopAndDestroy(filename1); |
|
868 |
||
869 |
HBufC* mimetype1 = HBufC::NewL(20) ; |
|
870 |
CleanupStack::PushL(mimetype1); |
|
871 |
mimetype1->Des().Copy(_L("image/jpeg")); |
|
872 |
TLiwVariant mime1(mimetype1); |
|
873 |
attachmentmap1->InsertL(_L8("MimeType"),mime1); |
|
874 |
mime1.Reset(); |
|
875 |
CleanupStack::PopAndDestroy(mimetype1); |
|
876 |
||
877 |
||
878 |
CLiwDefaultList* attachmentlist = CLiwDefaultList::NewL(); |
|
879 |
CleanupStack::PushL(attachmentlist); |
|
880 |
TLiwVariant attachment1(attachmentmap1); |
|
881 |
||
882 |
TInt loop = 1000; |
|
883 |
aItem.GetNextInt(loop); |
|
884 |
||
885 |
for( int i=0; i<loop ; ++i ) |
|
886 |
{ |
|
887 |
attachmentlist->AppendL(attachment1); |
|
888 |
} |
|
889 |
attachment1.Reset(); |
|
890 |
||
891 |
TLiwVariant attachments(attachmentlist); |
|
892 |
//attachment list added to message info ,map |
|
893 |
map->InsertL(_L8("AttachmentList"),attachments); |
|
894 |
attachments.Reset(); |
|
895 |
attachmentlist->DecRef(); |
|
896 |
CleanupStack::Pop(attachmentlist); |
|
897 |
attachmentmap1->DecRef(); |
|
898 |
CleanupStack::Pop(attachmentmap1); |
|
899 |
||
900 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
901 |
map->DecRef(); |
|
902 |
CleanupStack::Pop(map); |
|
903 |
int err = KErrNone; |
|
904 |
TRAP(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
905 |
||
906 |
outParamList->Reset(); |
|
907 |
inParamList->Reset(); |
|
908 |
||
909 |
interface->Close(); |
|
910 |
iServiceHandler->Reset(); |
|
911 |
delete iServiceHandler; |
|
912 |
||
913 |
||
914 |
__UHEAP_MARKEND; |
|
915 |
||
916 |
return err; |
|
917 |
} |
|
918 |