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