author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 27 Aug 2009 07:43:07 +0300 | |
changeset 22 | fc9cf246af83 |
parent 19 | 989d2f495d90 |
child 33 | 50974a8b132e |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2009 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// STLport regression testsuite component. |
|
20 |
// To compile as a separate example, please #define MAIN. |
|
21 |
||
22 |
#include <e32base.h> |
|
23 |
////#include <senduiconsts.h> |
|
24 |
#include "messaginginterface.h" |
|
25 |
#include <BADESCA.H> |
|
26 |
#include "sendmessage.h" |
|
27 |
#include <f32file.h> |
|
28 |
#include "messageheader.h" |
|
29 |
#include<LiwServiceHandler.h> |
|
30 |
#ifdef MAIN |
|
31 |
#define sendmessage_test1 main |
|
32 |
#endif |
|
33 |
||
34 |
TInt32 GetTemplateId(MLiwInterface *aObj ,CLiwGenericParamList* aInputlist, CLiwGenericParamList* aOutputlist, TBool aSMS ); |
|
35 |
||
36 |
_LIT8(KService, "Service.Messaging"); |
|
37 |
_LIT8(KIDataSource, "IMessaging"); |
|
38 |
_LIT8(KCmd, "Send"); |
|
39 |
_LIT8(KTo, "To"); |
|
40 |
_LIT8(KBodyText, "BodyText"); |
|
41 |
_LIT8(KAttachmentname, "Attachment"); |
|
42 |
_LIT8(KMimeType, "MimeType"); |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
43 |
_LIT8(KMessageParam, "MessageParam"); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
44 |
_LIT8(KType, "MessageType"); |
19 | 45 |
_LIT8(KErrCode,"ErrorCode"); |
46 |
||
47 |
// Positive test case with Type, Number and BodyText |
|
48 |
int sendmessage_test1(int, char**) |
|
49 |
{ |
|
50 |
__UHEAP_MARK; |
|
51 |
||
52 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
53 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
54 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
55 |
||
56 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
57 |
||
58 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
59 |
||
60 |
RCriteriaArray a; |
|
61 |
a.AppendL(crit); |
|
62 |
||
63 |
iServiceHandler->AttachL(a); |
|
64 |
||
65 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
66 |
||
67 |
TInt pos = 0; |
|
68 |
MLiwInterface* interface = NULL; |
|
69 |
_LIT8(KDataSource, "IMessaging"); |
|
70 |
outParamList->FindFirst(pos,KDataSource ); |
|
71 |
if(pos != KErrNotFound) |
|
72 |
{ |
|
73 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
74 |
} |
|
75 |
||
76 |
inParamList->Reset(); |
|
77 |
outParamList->Reset(); |
|
78 |
delete crit; |
|
79 |
crit = NULL; |
|
80 |
a.Reset(); |
|
81 |
||
82 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
83 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
84 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText for Positional Param") ))); |
|
85 |
||
86 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
87 |
CleanupStack::PushL(map); |
|
88 |
||
89 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
90 |
CleanupStack::PushL(reclist); |
|
91 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
92 |
||
93 |
TLiwVariant recps(reclist); |
|
94 |
map->InsertL(_L8("To"),recps); |
|
95 |
recps.Reset(); |
|
96 |
reclist->DecRef(); |
|
97 |
CleanupStack::Pop(reclist); |
|
98 |
||
99 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
100 |
map->DecRef(); |
|
101 |
CleanupStack::Pop(map); |
|
102 |
||
103 |
TRAPD(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
104 |
||
105 |
if(err == KErrNone) |
|
106 |
{ |
|
107 |
TInt index = 0; |
|
108 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
109 |
err = err1->Value().AsTInt32(); |
|
110 |
} |
|
111 |
||
112 |
inParamList->Reset(); |
|
113 |
outParamList->Reset(); |
|
114 |
||
115 |
interface->Close(); |
|
116 |
iServiceHandler->Reset(); |
|
117 |
delete iServiceHandler; |
|
118 |
||
119 |
__UHEAP_MARKEND; |
|
120 |
||
121 |
return err; |
|
122 |
||
123 |
} |
|
124 |
||
125 |
// Negative test case with Type, Number and BodyText + Subject(NotSuported for SMS) |
|
126 |
int sendmessage_test2(int, char**) |
|
127 |
{ |
|
128 |
__UHEAP_MARK; |
|
129 |
||
130 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
131 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
132 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
133 |
||
134 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
135 |
||
136 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
137 |
||
138 |
RCriteriaArray a; |
|
139 |
a.AppendL(crit); |
|
140 |
||
141 |
iServiceHandler->AttachL(a); |
|
142 |
||
143 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
144 |
||
145 |
TInt pos = 0; |
|
146 |
MLiwInterface* interface = NULL; |
|
147 |
_LIT8(KDataSource, "IMessaging"); |
|
148 |
outParamList->FindFirst(pos,KDataSource ); |
|
149 |
if(pos != KErrNotFound) |
|
150 |
{ |
|
151 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
152 |
} |
|
153 |
||
154 |
inParamList->Reset(); |
|
155 |
outParamList->Reset(); |
|
156 |
delete crit; |
|
157 |
crit = NULL; |
|
158 |
a.Reset(); |
|
159 |
||
160 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
161 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
162 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText for Positional Param") ))); |
|
163 |
inParamList->AppendL(TLiwGenericParam( _L8("Subject"), TLiwVariant( _L("SMS Subject") ))); |
|
164 |
||
165 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
166 |
CleanupStack::PushL(map); |
|
167 |
||
168 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
169 |
CleanupStack::PushL(reclist); |
|
170 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
171 |
||
172 |
TLiwVariant recps(reclist); |
|
173 |
map->InsertL(_L8("To"),recps); |
|
174 |
recps.Reset(); |
|
175 |
reclist->DecRef(); |
|
176 |
CleanupStack::Pop(reclist); |
|
177 |
||
178 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
179 |
map->DecRef(); |
|
180 |
CleanupStack::Pop(map); |
|
181 |
||
182 |
TRAPD(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
183 |
||
184 |
if(err == KErrNone) |
|
185 |
{ |
|
186 |
TInt index = 0; |
|
187 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
188 |
err = err1->Value().AsTInt32(); |
|
189 |
} |
|
190 |
||
191 |
if( err == 1004 ) |
|
192 |
err = KErrNone; |
|
193 |
else |
|
194 |
err = KErrGeneral; |
|
195 |
||
196 |
inParamList->Reset(); |
|
197 |
outParamList->Reset(); |
|
198 |
||
199 |
interface->Close(); |
|
200 |
iServiceHandler->Reset(); |
|
201 |
delete iServiceHandler; |
|
202 |
||
203 |
__UHEAP_MARKEND; |
|
204 |
||
205 |
return err; |
|
206 |
||
207 |
} |
|
208 |
||
209 |
// Negative test case with Type, Number and BodyText + Attachment(NotSuported for SMS) |
|
210 |
int sendmessage_test3(int, char**) |
|
211 |
{ |
|
212 |
__UHEAP_MARK; |
|
213 |
||
214 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
215 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
216 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
217 |
||
218 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
219 |
||
220 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
221 |
||
222 |
RCriteriaArray a; |
|
223 |
a.AppendL(crit); |
|
224 |
||
225 |
iServiceHandler->AttachL(a); |
|
226 |
||
227 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
228 |
||
229 |
TInt pos = 0; |
|
230 |
MLiwInterface* interface = NULL; |
|
231 |
_LIT8(KDataSource, "IMessaging"); |
|
232 |
outParamList->FindFirst(pos,KDataSource ); |
|
233 |
if(pos != KErrNotFound) |
|
234 |
{ |
|
235 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
236 |
} |
|
237 |
||
238 |
inParamList->Reset(); |
|
239 |
outParamList->Reset(); |
|
240 |
delete crit; |
|
241 |
crit = NULL; |
|
242 |
a.Reset(); |
|
243 |
||
244 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
245 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
246 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText for Positional Param") ))); |
|
247 |
inParamList->AppendL(TLiwGenericParam( _L8("Subject"), TLiwVariant( _L("") )));// Null Subject |
|
248 |
inParamList->AppendL(TLiwGenericParam( _L8("Attachment"), TLiwVariant( _L("C:\\Data\\Images\\test1.jpg") )));// Null Subject |
|
249 |
inParamList->AppendL(TLiwGenericParam( _L8("MimeType"), TLiwVariant( _L("image/jpg") )));// Null Subject |
|
250 |
||
251 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
252 |
CleanupStack::PushL(map); |
|
253 |
||
254 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
255 |
CleanupStack::PushL(reclist); |
|
256 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
257 |
||
258 |
TLiwVariant recps(reclist); |
|
259 |
map->InsertL(_L8("To"),recps); |
|
260 |
recps.Reset(); |
|
261 |
reclist->DecRef(); |
|
262 |
CleanupStack::Pop(reclist); |
|
263 |
||
264 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
265 |
map->DecRef(); |
|
266 |
CleanupStack::Pop(map); |
|
267 |
||
268 |
TRAPD(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
269 |
||
270 |
if(err == KErrNone) |
|
271 |
{ |
|
272 |
TInt index = 0; |
|
273 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
274 |
err = err1->Value().AsTInt32(); |
|
275 |
} |
|
276 |
||
277 |
inParamList->Reset(); |
|
278 |
outParamList->Reset(); |
|
279 |
||
280 |
interface->Close(); |
|
281 |
iServiceHandler->Reset(); |
|
282 |
delete iServiceHandler; |
|
283 |
||
284 |
__UHEAP_MARKEND; |
|
285 |
||
286 |
return err; |
|
287 |
||
288 |
} |
|
289 |
||
290 |
// Positive test case with Type, Number and BodyText + TemplateId |
|
291 |
int sendmessage_test4(int, char**) |
|
292 |
{ |
|
293 |
__UHEAP_MARK; |
|
294 |
||
295 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
296 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
297 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
298 |
||
299 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
300 |
||
301 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
302 |
||
303 |
RCriteriaArray a; |
|
304 |
a.AppendL(crit); |
|
305 |
||
306 |
iServiceHandler->AttachL(a); |
|
307 |
||
308 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
309 |
||
310 |
TInt pos = 0; |
|
311 |
MLiwInterface* interface = NULL; |
|
312 |
_LIT8(KDataSource, "IMessaging"); |
|
313 |
outParamList->FindFirst(pos,KDataSource ); |
|
314 |
if(pos != KErrNotFound) |
|
315 |
{ |
|
316 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
317 |
} |
|
318 |
||
319 |
inParamList->Reset(); |
|
320 |
outParamList->Reset(); |
|
321 |
delete crit; |
|
322 |
crit = NULL; |
|
323 |
a.Reset(); |
|
324 |
||
325 |
TInt32 tmplateId = GetTemplateId(interface, inParamList, outParamList, ETrue ); |
|
326 |
||
327 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
328 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
329 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText for Positional Param") ))); |
|
330 |
inParamList->AppendL(TLiwGenericParam( _L8("Subject"), TLiwVariant( _L("") )));// Null Subject |
|
331 |
inParamList->AppendL(TLiwGenericParam( _L8("Attachment"), TLiwVariant( _L("") )));// Null attachment name |
|
332 |
inParamList->AppendL(TLiwGenericParam( _L8("MimeType"), TLiwVariant( _L("") )));// Null mimetype |
|
333 |
||
334 |
if(tmplateId > 0) |
|
335 |
{ |
|
336 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
337 |
CleanupStack::PushL(map); |
|
338 |
||
339 |
TLiwVariant liwmessageid(tmplateId); |
|
340 |
map->InsertL(_L8("TemplateId"),liwmessageid); |
|
341 |
liwmessageid.Reset(); |
|
342 |
||
343 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
344 |
CleanupStack::PushL(reclist); |
|
345 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
346 |
||
347 |
TLiwVariant recps(reclist); |
|
348 |
map->InsertL(_L8("To"),recps); |
|
349 |
recps.Reset(); |
|
350 |
reclist->DecRef(); |
|
351 |
CleanupStack::Pop(reclist); |
|
352 |
||
353 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map )));// Null mimetype |
|
354 |
map->DecRef(); |
|
355 |
CleanupStack::Pop(map); |
|
356 |
} |
|
357 |
||
358 |
TRAPD(err,interface->ExecuteCmdL( KCmd, *inParamList ,*outParamList,0,NULL )); |
|
359 |
||
360 |
if(err == KErrNone) |
|
361 |
{ |
|
362 |
TInt index = 0; |
|
363 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
364 |
err = err1->Value().AsTInt32(); |
|
365 |
} |
|
366 |
||
367 |
inParamList->Reset(); |
|
368 |
outParamList->Reset(); |
|
369 |
||
370 |
interface->Close(); |
|
371 |
iServiceHandler->Reset(); |
|
372 |
delete iServiceHandler; |
|
373 |
||
374 |
__UHEAP_MARKEND; |
|
375 |
||
376 |
return err; |
|
377 |
||
378 |
} |
|
379 |
||
380 |
// Positive test case with Type, Number and BodyText + TemplateId of MMS |
|
381 |
int sendmessage_test5(int, char**) |
|
382 |
{ |
|
383 |
__UHEAP_MARK; |
|
384 |
||
385 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
386 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
387 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
388 |
||
389 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
390 |
||
391 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
392 |
||
393 |
RCriteriaArray a; |
|
394 |
a.AppendL(crit); |
|
395 |
||
396 |
iServiceHandler->AttachL(a); |
|
397 |
||
398 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
399 |
||
400 |
TInt pos = 0; |
|
401 |
MLiwInterface* interface = NULL; |
|
402 |
_LIT8(KDataSource, "IMessaging"); |
|
403 |
outParamList->FindFirst(pos,KDataSource ); |
|
404 |
if(pos != KErrNotFound) |
|
405 |
{ |
|
406 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
407 |
} |
|
408 |
||
409 |
inParamList->Reset(); |
|
410 |
outParamList->Reset(); |
|
411 |
delete crit; |
|
412 |
crit = NULL; |
|
413 |
a.Reset(); |
|
414 |
||
415 |
TInt32 tmplateId = GetTemplateId( interface, inParamList, outParamList, EFalse ); |
|
416 |
||
417 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("SMS") ))); |
|
418 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
419 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("BodyText for Positional Param") ))); |
|
420 |
inParamList->AppendL(TLiwGenericParam( _L8("Subject"), TLiwVariant( _L("Subject") )));// Null Subject |
|
421 |
inParamList->AppendL(TLiwGenericParam( _L8("Attachment"), TLiwVariant( _L("") )));// Null attachment name |
|
422 |
inParamList->AppendL(TLiwGenericParam( _L8("MimeType"), TLiwVariant( _L("") )));// Null mimetype |
|
423 |
||
424 |
if(tmplateId > 0) |
|
425 |
{ |
|
426 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
427 |
CleanupStack::PushL(map); |
|
428 |
||
429 |
TLiwVariant liwmessageid(tmplateId); |
|
430 |
map->InsertL(_L8("TemplateId"),liwmessageid); |
|
431 |
liwmessageid.Reset(); |
|
432 |
||
433 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
434 |
CleanupStack::PushL(reclist); |
|
435 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
436 |
||
437 |
TLiwVariant recps(reclist); |
|
438 |
map->InsertL(_L8("To"),recps); |
|
439 |
recps.Reset(); |
|
440 |
reclist->DecRef(); |
|
441 |
CleanupStack::Pop(reclist); |
|
442 |
||
443 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map )));// Null mimetype |
|
444 |
map->DecRef(); |
|
445 |
CleanupStack::Pop(map); |
|
446 |
} |
|
447 |
||
448 |
TRAPD(err,interface->ExecuteCmdL( KCmd, *inParamList ,*outParamList,0,NULL )); |
|
449 |
||
450 |
if(err == KErrNone) |
|
451 |
{ |
|
452 |
TInt index = 0; |
|
453 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
454 |
err = err1->Value().AsTInt32(); |
|
455 |
} |
|
456 |
||
457 |
if(err == 1004) |
|
458 |
err = KErrNone; |
|
459 |
||
460 |
inParamList->Reset(); |
|
461 |
outParamList->Reset(); |
|
462 |
||
463 |
interface->Close(); |
|
464 |
iServiceHandler->Reset(); |
|
465 |
delete iServiceHandler; |
|
466 |
||
467 |
__UHEAP_MARKEND; |
|
468 |
||
469 |
return err; |
|
470 |
||
471 |
} |
|
472 |
||
473 |
// Positive test case with Type, Number, BodyText and Subject |
|
474 |
int sendmessage_test6(int, char**) |
|
475 |
{ |
|
476 |
__UHEAP_MARK; |
|
477 |
||
478 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
479 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
480 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
481 |
||
482 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
483 |
||
484 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
485 |
||
486 |
RCriteriaArray a; |
|
487 |
a.AppendL(crit); |
|
488 |
||
489 |
iServiceHandler->AttachL(a); |
|
490 |
||
491 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
492 |
||
493 |
TInt pos = 0; |
|
494 |
MLiwInterface* interface = NULL; |
|
495 |
_LIT8(KDataSource, "IMessaging"); |
|
496 |
outParamList->FindFirst(pos,KDataSource ); |
|
497 |
if(pos != KErrNotFound) |
|
498 |
{ |
|
499 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
500 |
} |
|
501 |
||
502 |
inParamList->Reset(); |
|
503 |
outParamList->Reset(); |
|
504 |
delete crit; |
|
505 |
crit = NULL; |
|
506 |
a.Reset(); |
|
507 |
||
508 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("MMS") ))); |
|
509 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
510 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L(" BodyText for MMS ") ))); |
|
511 |
inParamList->AppendL(TLiwGenericParam( _L8("Subject"), TLiwVariant( _L("MMS Subject") ))); |
|
512 |
||
513 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
514 |
CleanupStack::PushL(map); |
|
515 |
||
516 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
517 |
CleanupStack::PushL(reclist); |
|
518 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
519 |
||
520 |
TLiwVariant recps(reclist); |
|
521 |
map->InsertL(_L8("To"),recps); |
|
522 |
recps.Reset(); |
|
523 |
reclist->DecRef(); |
|
524 |
CleanupStack::Pop(reclist); |
|
525 |
||
526 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
527 |
map->DecRef(); |
|
528 |
CleanupStack::Pop(map); |
|
529 |
||
530 |
TRAPD(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
531 |
||
532 |
if(err == KErrNone) |
|
533 |
{ |
|
534 |
TInt index = 0; |
|
535 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
536 |
err = err1->Value().AsTInt32(); |
|
537 |
} |
|
538 |
||
539 |
inParamList->Reset(); |
|
540 |
outParamList->Reset(); |
|
541 |
||
542 |
interface->Close(); |
|
543 |
iServiceHandler->Reset(); |
|
544 |
delete iServiceHandler; |
|
545 |
||
546 |
__UHEAP_MARKEND; |
|
547 |
||
548 |
return err; |
|
549 |
||
550 |
} |
|
551 |
||
552 |
// Negative test case with Type, Number and BodyText + Subject with one attachment on root level |
|
553 |
int sendmessage_test7(int, char**) |
|
554 |
{ |
|
555 |
__UHEAP_MARK; |
|
556 |
||
557 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
558 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
559 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
560 |
||
561 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
562 |
||
563 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
564 |
||
565 |
RCriteriaArray a; |
|
566 |
a.AppendL(crit); |
|
567 |
||
568 |
iServiceHandler->AttachL(a); |
|
569 |
||
570 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
571 |
||
572 |
TInt pos = 0; |
|
573 |
MLiwInterface* interface = NULL; |
|
574 |
_LIT8(KDataSource, "IMessaging"); |
|
575 |
outParamList->FindFirst(pos,KDataSource ); |
|
576 |
if(pos != KErrNotFound) |
|
577 |
{ |
|
578 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
579 |
} |
|
580 |
||
581 |
inParamList->Reset(); |
|
582 |
outParamList->Reset(); |
|
583 |
delete crit; |
|
584 |
crit = NULL; |
|
585 |
a.Reset(); |
|
586 |
||
587 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageType"), TLiwVariant( _L("MMS") ))); |
|
588 |
inParamList->AppendL(TLiwGenericParam( _L8("To"), TLiwVariant( _L("9008032761") ))); |
|
589 |
inParamList->AppendL(TLiwGenericParam( _L8("BodyText"), TLiwVariant( _L("MMS with one attachment on root level") ))); |
|
590 |
inParamList->AppendL(TLiwGenericParam( _L8("Subject"), TLiwVariant( _L("MMS Subject") ))); |
|
591 |
inParamList->AppendL(TLiwGenericParam( _L8("Attachment"), TLiwVariant( _L("C:\\Data\\Images\\test1.jpg") )));// Null Subject |
|
592 |
inParamList->AppendL(TLiwGenericParam( _L8("MimeType"), TLiwVariant( _L("image/jpg") )));// Null Subject |
|
593 |
||
594 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
595 |
CleanupStack::PushL(map); |
|
596 |
||
597 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
598 |
CleanupStack::PushL(reclist); |
|
599 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
600 |
||
601 |
TLiwVariant recps(reclist); |
|
602 |
map->InsertL(_L8("To"),recps); |
|
603 |
recps.Reset(); |
|
604 |
reclist->DecRef(); |
|
605 |
CleanupStack::Pop(reclist); |
|
606 |
||
607 |
inParamList->AppendL(TLiwGenericParam( _L8("MessageParam"), TLiwVariant( map ))); |
|
608 |
map->DecRef(); |
|
609 |
CleanupStack::Pop(map); |
|
610 |
||
611 |
TRAPD(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
612 |
||
613 |
if(err == KErrNone) |
|
614 |
{ |
|
615 |
TInt index = 0; |
|
616 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
617 |
err = err1->Value().AsTInt32(); |
|
618 |
} |
|
619 |
||
620 |
inParamList->Reset(); |
|
621 |
outParamList->Reset(); |
|
622 |
||
623 |
interface->Close(); |
|
624 |
iServiceHandler->Reset(); |
|
625 |
delete iServiceHandler; |
|
626 |
||
627 |
__UHEAP_MARKEND; |
|
628 |
||
629 |
return err; |
|
630 |
||
631 |
} |
|
632 |
||
633 |
// Positive test case with Type, Number and BodyText + Attachment with one attachment on root level and one in MessageParam |
|
634 |
int sendmessage_test8(int, char**) |
|
635 |
{ |
|
636 |
__UHEAP_MARK; |
|
637 |
||
638 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
639 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
640 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
641 |
||
642 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
643 |
||
644 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
645 |
||
646 |
RCriteriaArray a; |
|
647 |
a.AppendL(crit); |
|
648 |
||
649 |
iServiceHandler->AttachL(a); |
|
650 |
||
651 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
652 |
||
653 |
TInt pos = 0; |
|
654 |
MLiwInterface* interface = NULL; |
|
655 |
_LIT8(KDataSource, "IMessaging"); |
|
656 |
outParamList->FindFirst(pos,KDataSource ); |
|
657 |
if(pos != KErrNotFound) |
|
658 |
{ |
|
659 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
660 |
} |
|
661 |
||
662 |
inParamList->Reset(); |
|
663 |
outParamList->Reset(); |
|
664 |
delete crit; |
|
665 |
crit = NULL; |
|
666 |
a.Reset(); |
|
667 |
||
668 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("MMS") ))); |
|
669 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("9008032761") ))); |
|
670 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("MMS with 2 attach. One at root level and one inside MessageParam") ))); |
|
671 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("MMS Subject") )));// Null Subject |
|
672 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("C:\\Data\\Images\\test1.jpg") )));// Null Subject |
|
673 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("image/jpg") )));// Null Subject |
|
674 |
||
675 |
{ |
|
676 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
677 |
CleanupStack::PushL(map); |
|
678 |
||
679 |
CLiwDefaultMap* attachmentmap1 = CLiwDefaultMap::NewL(); |
|
680 |
CleanupStack::PushL(attachmentmap1); |
|
681 |
||
682 |
HBufC* filename1 = HBufC::NewL(80) ; |
|
683 |
CleanupStack::PushL(filename1); |
|
684 |
filename1->Des().Copy(_L("c:\\data\\images\\Test2.jpg")); |
|
685 |
TLiwVariant file1(filename1); |
|
686 |
attachmentmap1->InsertL(_L8("FileName"),file1); |
|
687 |
file1.Reset(); |
|
688 |
CleanupStack::PopAndDestroy(filename1); |
|
689 |
||
690 |
HBufC* mimetype1 = HBufC::NewL(20) ; |
|
691 |
CleanupStack::PushL(mimetype1); |
|
692 |
mimetype1->Des().Copy(_L("image/jpeg")); |
|
693 |
TLiwVariant mime1(mimetype1); |
|
694 |
attachmentmap1->InsertL(_L8("MimeType"),mime1); |
|
695 |
mime1.Reset(); |
|
696 |
CleanupStack::PopAndDestroy(mimetype1); |
|
697 |
||
698 |
||
699 |
CLiwDefaultList* attachmentlist = CLiwDefaultList::NewL(); |
|
700 |
CleanupStack::PushL(attachmentlist); |
|
701 |
TLiwVariant attachment1(attachmentmap1); |
|
702 |
attachmentlist->AppendL(attachment1); |
|
703 |
attachment1.Reset(); |
|
704 |
||
705 |
TLiwVariant attachments(attachmentlist); |
|
706 |
//attachment list added to message info ,map |
|
707 |
map->InsertL(_L8("AttachmentList"),attachments); |
|
708 |
attachments.Reset(); |
|
709 |
attachmentlist->DecRef(); |
|
710 |
CleanupStack::Pop(attachmentlist); |
|
711 |
attachmentmap1->DecRef(); |
|
712 |
CleanupStack::Pop(attachmentmap1); |
|
713 |
||
714 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
715 |
CleanupStack::PushL(reclist); |
|
716 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
717 |
||
718 |
TLiwVariant recps(reclist); |
|
719 |
map->InsertL(_L8("To"),recps); |
|
720 |
recps.Reset(); |
|
721 |
reclist->DecRef(); |
|
722 |
CleanupStack::Pop(reclist); |
|
723 |
||
724 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( map )));// Null mimetype |
|
725 |
map->DecRef(); |
|
726 |
CleanupStack::Pop(map); |
|
727 |
} |
|
728 |
||
729 |
TRAPD(err,interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,0,NULL )); |
|
730 |
||
731 |
if(err == KErrNone) |
|
732 |
{ |
|
733 |
TInt index = 0; |
|
734 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
735 |
err = err1->Value().AsTInt32(); |
|
736 |
} |
|
737 |
||
738 |
inParamList->Reset(); |
|
739 |
outParamList->Reset(); |
|
740 |
||
741 |
interface->Close(); |
|
742 |
iServiceHandler->Reset(); |
|
743 |
delete iServiceHandler; |
|
744 |
||
745 |
__UHEAP_MARKEND; |
|
746 |
||
747 |
return err; |
|
748 |
||
749 |
} |
|
750 |
||
751 |
// Positive test case with Type, Number and BodyText + TemplateId |
|
752 |
int sendmessage_test9(int, char**) |
|
753 |
{ |
|
754 |
__UHEAP_MARK; |
|
755 |
||
756 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
757 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
758 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
759 |
||
760 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
761 |
||
762 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
763 |
||
764 |
RCriteriaArray a; |
|
765 |
a.AppendL(crit); |
|
766 |
||
767 |
iServiceHandler->AttachL(a); |
|
768 |
||
769 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
770 |
||
771 |
TInt pos = 0; |
|
772 |
MLiwInterface* interface = NULL; |
|
773 |
_LIT8(KDataSource, "IMessaging"); |
|
774 |
outParamList->FindFirst(pos,KDataSource ); |
|
775 |
if(pos != KErrNotFound) |
|
776 |
{ |
|
777 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
778 |
} |
|
779 |
||
780 |
inParamList->Reset(); |
|
781 |
outParamList->Reset(); |
|
782 |
delete crit; |
|
783 |
crit = NULL; |
|
784 |
a.Reset(); |
|
785 |
||
786 |
TInt32 tmplateId = GetTemplateId(interface, inParamList, outParamList, ETrue ); |
|
787 |
||
788 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("MMS") ))); |
|
789 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("9008032761") ))); |
|
790 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("MMS with SMS template id ") ))); |
|
791 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("MMS Subject") )));// Null Subject |
|
792 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("") )));// Null attachment name |
|
793 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("") )));// Null mimetype |
|
794 |
||
795 |
if(tmplateId > 0) |
|
796 |
{ |
|
797 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
798 |
CleanupStack::PushL(map); |
|
799 |
||
800 |
TLiwVariant liwmessageid(tmplateId); |
|
801 |
map->InsertL(_L8("TemplateId"),liwmessageid); |
|
802 |
liwmessageid.Reset(); |
|
803 |
||
804 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
805 |
CleanupStack::PushL(reclist); |
|
806 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
807 |
||
808 |
TLiwVariant recps(reclist); |
|
809 |
map->InsertL(_L8("To"),recps); |
|
810 |
recps.Reset(); |
|
811 |
reclist->DecRef(); |
|
812 |
CleanupStack::Pop(reclist); |
|
813 |
||
814 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( map )));// Null mimetype |
|
815 |
map->DecRef(); |
|
816 |
CleanupStack::Pop(map); |
|
817 |
} |
|
818 |
||
819 |
TRAPD(err,interface->ExecuteCmdL( KCmd, *inParamList ,*outParamList,0,NULL )); |
|
820 |
||
821 |
if(err == KErrNone) |
|
822 |
{ |
|
823 |
TInt index = 0; |
|
824 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
825 |
err = err1->Value().AsTInt32(); |
|
826 |
} |
|
827 |
||
828 |
inParamList->Reset(); |
|
829 |
outParamList->Reset(); |
|
830 |
||
831 |
interface->Close(); |
|
832 |
iServiceHandler->Reset(); |
|
833 |
delete iServiceHandler; |
|
834 |
||
835 |
__UHEAP_MARKEND; |
|
836 |
||
837 |
return err; |
|
838 |
||
839 |
} |
|
840 |
||
841 |
// Positive test case with Type, Number and BodyText + TemplateId of MMS |
|
842 |
int sendmessage_test10(int, char**) |
|
843 |
{ |
|
844 |
__UHEAP_MARK; |
|
845 |
||
846 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
|
847 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
|
848 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
|
849 |
||
850 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
|
851 |
||
852 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
853 |
||
854 |
RCriteriaArray a; |
|
855 |
a.AppendL(crit); |
|
856 |
||
857 |
iServiceHandler->AttachL(a); |
|
858 |
||
859 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
|
860 |
||
861 |
TInt pos = 0; |
|
862 |
MLiwInterface* interface = NULL; |
|
863 |
_LIT8(KDataSource, "IMessaging"); |
|
864 |
outParamList->FindFirst(pos,KDataSource ); |
|
865 |
if(pos != KErrNotFound) |
|
866 |
{ |
|
867 |
interface = (*outParamList)[pos].Value().AsInterface(); |
|
868 |
} |
|
869 |
||
870 |
inParamList->Reset(); |
|
871 |
outParamList->Reset(); |
|
872 |
delete crit; |
|
873 |
crit = NULL; |
|
874 |
a.Reset(); |
|
875 |
||
876 |
TInt32 tmplateId = GetTemplateId( interface, inParamList, outParamList, EFalse ); |
|
877 |
||
878 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("MMS") ))); |
|
879 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("9008032761") ))); |
|
880 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("MMS with MMS template ID ") ))); |
|
881 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("Subject") )));// Null Subject |
|
882 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("") )));// Null attachment name |
|
883 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( _L("") )));// Null mimetype |
|
884 |
||
885 |
if(tmplateId > 0) |
|
886 |
{ |
|
887 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
888 |
CleanupStack::PushL(map); |
|
889 |
||
890 |
TLiwVariant liwmessageid(tmplateId); |
|
891 |
map->InsertL(_L8("TemplateId"),liwmessageid); |
|
892 |
liwmessageid.Reset(); |
|
893 |
||
894 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
|
895 |
CleanupStack::PushL(reclist); |
|
896 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
|
897 |
||
898 |
TLiwVariant recps(reclist); |
|
899 |
map->InsertL(_L8("To"),recps); |
|
900 |
recps.Reset(); |
|
901 |
reclist->DecRef(); |
|
902 |
CleanupStack::Pop(reclist); |
|
903 |
||
904 |
inParamList->AppendL(TLiwGenericParam( KNullDesC8, TLiwVariant( map )));// Null mimetype |
|
905 |
map->DecRef(); |
|
906 |
CleanupStack::Pop(map); |
|
907 |
} |
|
908 |
||
909 |
TRAPD(err,interface->ExecuteCmdL( KCmd, *inParamList ,*outParamList,0,NULL )); |
|
910 |
||
911 |
if(err == KErrNone) |
|
912 |
{ |
|
913 |
TInt index = 0; |
|
914 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
|
915 |
err = err1->Value().AsTInt32(); |
|
916 |
} |
|
917 |
||
918 |
||
919 |
inParamList->Reset(); |
|
920 |
outParamList->Reset(); |
|
921 |
||
922 |
interface->Close(); |
|
923 |
iServiceHandler->Reset(); |
|
924 |
delete iServiceHandler; |
|
925 |
||
926 |
__UHEAP_MARKEND; |
|
927 |
||
928 |
return err; |
|
929 |
||
930 |
} |
|
931 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
932 |
int sendmessage_test11(int, char**) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
933 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
934 |
__UHEAP_MARK; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
935 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
936 |
CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
937 |
CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
938 |
CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
939 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
940 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
941 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
942 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
943 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
944 |
RCriteriaArray a; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
945 |
a.AppendL(crit); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
946 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
947 |
iServiceHandler->AttachL(a); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
948 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
949 |
iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
950 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
951 |
TInt pos = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
952 |
MLiwInterface* interface = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
953 |
_LIT8(KDataSource, "IMessaging"); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
954 |
outParamList->FindFirst(pos,KDataSource ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
955 |
if(pos != KErrNotFound) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
956 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
957 |
interface = (*outParamList)[pos].Value().AsInterface(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
958 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
959 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
960 |
inParamList->Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
961 |
outParamList->Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
962 |
delete crit; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
963 |
crit = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
964 |
a.Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
965 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
966 |
TInt32 tmplateId = GetTemplateId( interface, inParamList, outParamList, EFalse ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
967 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
968 |
inParamList->AppendL(TLiwGenericParam( KType, TLiwVariant( _L("SMS") ))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
969 |
inParamList->AppendL(TLiwGenericParam( KTo, TLiwVariant( _L("9008032761") ))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
970 |
inParamList->AppendL(TLiwGenericParam( KBodyText, TLiwVariant( _L("SMS with MMS template ID ") ))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
971 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
972 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
973 |
if(tmplateId > 0) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
974 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
975 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
976 |
CleanupStack::PushL(map); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
977 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
978 |
TLiwVariant liwmessageid(tmplateId); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
979 |
map->InsertL(_L8("TemplateId"),liwmessageid); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
980 |
liwmessageid.Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
981 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
982 |
CLiwDefaultList* reclist = CLiwDefaultList::NewL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
983 |
CleanupStack::PushL(reclist); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
984 |
reclist->AppendL(TLiwVariant(_L("9008032762"))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
985 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
986 |
TLiwVariant recps(reclist); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
987 |
map->InsertL(_L8("To"),recps); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
988 |
recps.Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
989 |
reclist->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
990 |
CleanupStack::Pop(reclist); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
991 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
992 |
inParamList->AppendL(TLiwGenericParam( KMessageParam, TLiwVariant( map )));// Null mimetype |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
993 |
map->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
994 |
CleanupStack::Pop(map); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
995 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
996 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
997 |
TRAPD(err,interface->ExecuteCmdL( KCmd, *inParamList ,*outParamList,0,NULL )); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
998 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
999 |
if(err == KErrNone) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1000 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1001 |
TInt index = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1002 |
const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1003 |
err = err1->Value().AsTInt32(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1004 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1005 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1006 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1007 |
inParamList->Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1008 |
outParamList->Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1009 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1010 |
interface->Close(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1011 |
iServiceHandler->Reset(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1012 |
delete iServiceHandler; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1013 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1014 |
__UHEAP_MARKEND; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1015 |
if(tmplateId) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1016 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1017 |
if( err==1004 ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1018 |
return KErrNone; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1019 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1020 |
return KErrGeneral; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1021 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1022 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1023 |
return err; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1024 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1025 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1026 |
|
19 | 1027 |
TInt32 GetTemplateId(MLiwInterface *aObj ,CLiwGenericParamList* aInputlist, CLiwGenericParamList* aOutputlist, TBool aSMS ) |
1028 |
{ |
|
1029 |
_LIT8(KCmd,"GetList"); |
|
1030 |
aInputlist->Reset(); |
|
1031 |
aOutputlist->Reset(); |
|
1032 |
||
1033 |
CLiwDefaultMap* map = CLiwDefaultMap::NewL(); |
|
1034 |
CleanupStack::PushL(map); |
|
1035 |
||
1036 |
CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); |
|
1037 |
CleanupStack::PushL(mtmtypelist); |
|
1038 |
||
1039 |
TLiwVariant content(_L("Inbox")); |
|
1040 |
TLiwGenericParam elem ; |
|
1041 |
elem.SetNameAndValueL(_L8("Type"),content); |
|
1042 |
aInputlist->AppendL(elem); |
|
1043 |
content.Reset(); |
|
1044 |
elem.Reset(); |
|
1045 |
||
1046 |
if(aSMS) |
|
1047 |
{ |
|
1048 |
TLiwVariant mmsmtm(KMessageTypeSMS);// how the user wud gv this param |
|
1049 |
mtmtypelist->AppendL(mmsmtm); |
|
1050 |
mmsmtm.Reset(); |
|
1051 |
} |
|
1052 |
else |
|
1053 |
{ |
|
1054 |
TLiwVariant mmsmtm(KMessageTypeMMS);// how the user wud gv this param |
|
1055 |
mtmtypelist->AppendL(mmsmtm); |
|
1056 |
mmsmtm.Reset(); |
|
1057 |
} |
|
1058 |
||
1059 |
TLiwVariant add1(mtmtypelist); |
|
1060 |
||
1061 |
map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added |
|
1062 |
add1.Reset(); |
|
1063 |
CleanupStack::Pop(mtmtypelist); |
|
1064 |
mtmtypelist->DecRef(); |
|
1065 |
||
1066 |
||
1067 |
TLiwVariant filterparam(map); |
|
1068 |
TLiwGenericParam element ; |
|
1069 |
element.SetNameAndValueL(_L8("Filter"),filterparam); |
|
1070 |
filterparam.Reset(); |
|
1071 |
||
1072 |
||
1073 |
aInputlist->AppendL(element); |
|
1074 |
element.Reset(); |
|
1075 |
||
1076 |
map->DecRef(); |
|
1077 |
CleanupStack::Pop(map); |
|
1078 |
||
1079 |
||
1080 |
TInt err ; |
|
1081 |
TRAP(err,aObj->ExecuteCmdL( KCmd ,*aInputlist ,*aOutputlist,0,NULL )); |
|
1082 |
TInt pos=0; |
|
1083 |
TInt32 id = 0; |
|
1084 |
const TLiwGenericParam* output = aOutputlist->FindFirst( pos,_L8("ReturnValue")); |
|
1085 |
if(output) |
|
1086 |
{ |
|
1087 |
CLiwIterable* iterlist = output->Value().AsIterable(); |
|
1088 |
if(iterlist) |
|
1089 |
{ |
|
1090 |
TLiwVariant data1; |
|
1091 |
iterlist->NextL(data1); |
|
1092 |
||
1093 |
const CLiwMap* map1 = data1.AsMap(); |
|
1094 |
if (map1) |
|
1095 |
{ |
|
1096 |
TLiwVariant messageidinput; |
|
1097 |
if(map1->FindL(_L8("MessageId"),messageidinput)) |
|
1098 |
{ |
|
1099 |
id = messageidinput.AsTInt32(); |
|
1100 |
messageidinput.Reset(); |
|
1101 |
data1.Reset(); |
|
1102 |
} |
|
1103 |
messageidinput.Reset(); |
|
1104 |
} |
|
1105 |
data1.Reset(); |
|
1106 |
} |
|
1107 |
} |
|
1108 |
||
1109 |
aInputlist->Reset(); |
|
1110 |
aOutputlist->Reset(); |
|
1111 |
return id; |
|
1112 |
} |