author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:06:03 +0300 | |
branch | RCL_3 |
changeset 65 | 0b68a1b0c15e |
parent 58 | ea43c23d28d2 |
child 66 | a9c0808a1095 |
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 |
||
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
18 |
#include <liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
19 |
#include <liwcommon.h> |
19 | 20 |
#include <logcli.h> |
21 |
#include <logwrap.h> |
|
22 |
#include "tlogprovidertest.h" |
|
23 |
#include "serviceerrno.h" |
|
24 |
#include "tcallback.h" |
|
25 |
#include "teventdetails.h" |
|
26 |
#include "tconstants.h" |
|
27 |
||
28 |
||
29 |
||
30 |
||
31 |
TInt cancel1_0L(CEventDetails *aDetails) |
|
32 |
{ |
|
33 |
tcallback iCallback; |
|
34 |
||
35 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
36 |
// Input and output parameter list |
|
37 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
38 |
CLiwGenericParamList* inputlist1 = &(ServiceHandler->InParamListL()); |
|
39 |
||
40 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
41 |
CLiwGenericParamList* outputlist1 = &(ServiceHandler->OutParamListL()); |
|
42 |
||
43 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDsInterfaceName , KLoggingContents) ; |
|
44 |
||
45 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
46 |
||
47 |
RCriteriaArray a; |
|
48 |
||
49 |
||
50 |
a.AppendL(crit); |
|
51 |
||
52 |
ServiceHandler->AttachL(a) ; |
|
53 |
||
54 |
||
55 |
ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
56 |
||
57 |
||
58 |
||
59 |
||
60 |
TInt pos = 0; |
|
61 |
||
62 |
||
63 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos , KDsInterfaceName); |
|
64 |
||
65 |
if(!genericparm) |
|
66 |
{ |
|
67 |
||
68 |
||
69 |
User :: Leave(KErrArgument) ; |
|
70 |
} |
|
71 |
||
72 |
MLiwInterface* LogInterface = (genericparm->Value()).AsInterface(); |
|
73 |
||
74 |
||
75 |
TBufC8<20>CmdBufSet(KCmdAdd) ; |
|
76 |
||
77 |
outputlist->Reset() ; |
|
78 |
||
79 |
inputlist->Reset() ; |
|
80 |
||
81 |
CLiwDefaultMap *EventDetails = CLiwDefaultMap :: NewL() ; |
|
82 |
||
83 |
||
84 |
||
85 |
EventDetails->InsertL(KEventTypeKey , TLiwVariant(aDetails->GetEventType()) ); |
|
86 |
||
87 |
||
88 |
if(((unsigned int)aDetails->GetDurationType()!=0)) |
|
89 |
{ |
|
90 |
EventDetails->InsertL(KEventDurationKey ,TLiwVariant((unsigned int)aDetails->GetDurationType()) ); |
|
91 |
} |
|
92 |
||
93 |
if(aDetails->GetContactType() !=0 ) |
|
94 |
{ |
|
95 |
EventDetails->InsertL(KContactidKey , TLiwVariant(aDetails->GetContactType()) ); |
|
96 |
} |
|
97 |
||
98 |
if((unsigned int)aDetails->GetLinkType()!=0) |
|
99 |
{ |
|
100 |
EventDetails->InsertL(KLinkKey , TLiwVariant((unsigned int)aDetails->GetLinkType()) ); |
|
101 |
} |
|
102 |
||
103 |
if(aDetails->GetTimer() !=0 ) |
|
104 |
{ |
|
105 |
EventDetails->InsertL(KEventTimeKey , TLiwVariant(aDetails->GetTimer())) ; |
|
106 |
} |
|
107 |
||
108 |
||
109 |
TBuf<10> EmptyDes ; |
|
110 |
||
111 |
||
112 |
if(aDetails->GetSubjectType() != EmptyDes) |
|
113 |
{ |
|
114 |
EventDetails->InsertL(KSubjectKey , TLiwVariant(aDetails->GetSubjectType())) ; |
|
115 |
} |
|
116 |
||
117 |
||
118 |
||
119 |
||
120 |
if(aDetails->GetNumberType()!= EmptyDes) |
|
121 |
{ |
|
122 |
EventDetails->InsertL(KPhoneNumberKey , TLiwVariant(aDetails->GetNumberType())) ; |
|
123 |
} |
|
124 |
||
125 |
if(aDetails->GetRemotePartyType() != EmptyDes) |
|
126 |
{ |
|
127 |
EventDetails->InsertL(KRemotePartyKey , TLiwVariant(aDetails->GetRemotePartyType())) ; |
|
128 |
} |
|
129 |
||
130 |
if(aDetails->GetDirectionType() >= 0 ) |
|
131 |
{ |
|
132 |
EventDetails->InsertL(KDirectionKey , TLiwVariant(aDetails->GetDirectionType())) ; |
|
133 |
} |
|
134 |
||
135 |
if(aDetails->GetDescriptionType() != EmptyDes) |
|
136 |
{ |
|
137 |
EventDetails->InsertL(KDescriptionKey , TLiwVariant(aDetails->GetDescriptionType())) ; |
|
138 |
} |
|
139 |
||
140 |
if(aDetails->GetStatusType() >= 0 ) |
|
141 |
{ |
|
142 |
EventDetails->InsertL(KDeliveryStatusKey , TLiwVariant(aDetails->GetStatusType())) ; |
|
143 |
} |
|
144 |
||
145 |
||
146 |
||
147 |
TBuf16 <10> Contents(KContentType) ; |
|
148 |
||
149 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(Contents))) ; |
|
150 |
||
151 |
inputlist->AppendL(TLiwGenericParam(KEventDetails , TLiwVariant(EventDetails))) ; |
|
152 |
||
153 |
EventDetails->DecRef(); |
|
154 |
||
155 |
LogInterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist ); |
|
156 |
||
157 |
||
158 |
||
159 |
||
160 |
TInt index = 0 ; |
|
161 |
||
162 |
const TLiwGenericParam *ErrCode = outputlist->FindFirst(index , KErrCode) ; |
|
163 |
||
164 |
if(!ErrCode ) |
|
165 |
{ |
|
166 |
||
167 |
User :: Leave(KErrArgument) ; |
|
168 |
} |
|
169 |
||
170 |
TInt retval = ErrCode->Value().AsTInt32() ; |
|
171 |
||
172 |
if(retval != SErrNone ) |
|
173 |
{ |
|
174 |
||
175 |
LogInterface->Close() ; |
|
176 |
delete ServiceHandler; |
|
177 |
a.ResetAndDestroy(); |
|
178 |
a.Close(); |
|
179 |
||
180 |
||
181 |
||
182 |
User :: Leave(KErrArgument) ; |
|
183 |
} |
|
184 |
||
185 |
||
186 |
||
187 |
||
188 |
index = 0 ; |
|
189 |
const TLiwGenericParam *genparm = outputlist->FindFirst(index , KResponse) ; |
|
190 |
||
191 |
if(!genparm) |
|
192 |
{ |
|
193 |
||
194 |
User :: Leave(KErrArgument) ; |
|
195 |
} |
|
196 |
||
197 |
||
198 |
||
199 |
||
200 |
||
201 |
TBufC<20> itemid = (genparm->Value()).AsDes() ; |
|
202 |
||
203 |
||
204 |
//delete async |
|
205 |
||
206 |
||
207 |
inputlist->Reset() ; outputlist->Reset() ; |
|
208 |
||
209 |
||
210 |
//Insert the contenttype to inputlist |
|
211 |
CLiwDefaultMap *Idmap = CLiwDefaultMap :: NewL() ; |
|
212 |
Idmap->InsertL(KLogId ,TLiwVariant(itemid)) ; |
|
213 |
||
214 |
TBufC16<10> contentType(KContentType) ; |
|
215 |
//Insert the contenttype to inputlist |
|
216 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(contentType))) ; |
|
217 |
||
218 |
||
219 |
// inputlist->AppendL(TLiwGenericParam(KLogId , TLiwVariant((TInt32)itemid))) ; |
|
220 |
inputlist->AppendL(TLiwGenericParam(KData , TLiwVariant(Idmap))) ; |
|
221 |
Idmap->DecRef(); |
|
222 |
// CmdBuf = KCmdDelete ; |
|
223 |
||
224 |
||
225 |
TBufC8<20>CmdBuf(KCmdDelete) ; |
|
226 |
LogInterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist ,KLiwOptASyncronous, &iCallback) ; |
|
227 |
||
228 |
pos = 0 ; |
|
229 |
const TLiwGenericParam *Errprm = outputlist->FindFirst(pos , KErrCode ) ; |
|
230 |
||
231 |
if(!Errprm) |
|
232 |
{ |
|
233 |
||
234 |
User :: Leave(KErrArgument) ; |
|
235 |
} |
|
236 |
||
237 |
||
238 |
||
239 |
||
240 |
||
241 |
const TLiwGenericParam *transid = outputlist->FindFirst(index , KTransactionId) ; |
|
242 |
||
243 |
if(!transid) |
|
244 |
{ |
|
245 |
||
246 |
User :: Leave(KErrArgument) ; |
|
247 |
} |
|
248 |
||
249 |
||
250 |
||
251 |
//cancel async |
|
252 |
// inputlist->Reset(); |
|
253 |
//outputlist->Reset(); |
|
254 |
||
255 |
||
256 |
||
257 |
TInt transid1 = (transid->Value()).AsTInt32() ; |
|
258 |
||
259 |
inputlist1->AppendL(TLiwGenericParam(KTransactionId , TLiwVariant((TInt32)transid1))) ; |
|
260 |
||
261 |
||
262 |
||
263 |
||
264 |
TBufC8<20>CmdBuf1(KCmdCancel) ; |
|
265 |
||
266 |
LogInterface->ExecuteCmdL(CmdBuf1 , *inputlist1 , *outputlist1 ,KLiwOptCancel); |
|
267 |
||
268 |
pos =0; |
|
269 |
const TLiwGenericParam *Errprm1 = outputlist1->FindFirst(pos , KErrCode ) ; |
|
270 |
||
271 |
if(!Errprm1) |
|
272 |
{ |
|
273 |
||
274 |
User :: Leave(KErrArgument) ; |
|
275 |
} |
|
276 |
||
277 |
||
278 |
||
279 |
||
280 |
||
281 |
//deleting again |
|
282 |
||
283 |
||
284 |
LogInterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist) ; |
|
285 |
||
286 |
pos = 0 ; |
|
287 |
const TLiwGenericParam *Errprm3 = outputlist->FindFirst(pos , KErrCode ) ; |
|
288 |
||
289 |
if(!Errprm3) |
|
290 |
{ |
|
291 |
||
292 |
User :: Leave(KErrArgument) ; |
|
293 |
} |
|
294 |
||
295 |
||
296 |
LogInterface->Close() ; |
|
297 |
delete ServiceHandler; |
|
298 |
// delete crit; |
|
299 |
||
300 |
a.ResetAndDestroy(); |
|
301 |
a.Close(); |
|
302 |
||
65
0b68a1b0c15e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
303 |
|
19 | 304 |
} |
305 |
||
306 |
||
307 |
||
308 |
||
309 |
||
310 |
||
311 |
||
312 |
TInt cancel1_1L(CEventDetails *aDetails) |
|
313 |
{ |
|
314 |
tcallback iCallback; |
|
315 |
||
316 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
317 |
// Input and output parameter list |
|
318 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
319 |
CLiwGenericParamList* inputlist1 = &(ServiceHandler->InParamListL()); |
|
320 |
||
321 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
322 |
CLiwGenericParamList* outputlist1 = &(ServiceHandler->OutParamListL()); |
|
323 |
||
324 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDsInterfaceName , KLoggingContents) ; |
|
325 |
||
326 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
327 |
||
328 |
RCriteriaArray a; |
|
329 |
||
330 |
||
331 |
a.AppendL(crit); |
|
332 |
||
333 |
ServiceHandler->AttachL(a) ; |
|
334 |
||
335 |
||
336 |
ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
337 |
||
338 |
||
339 |
||
340 |
||
341 |
TInt pos = 0; |
|
342 |
||
343 |
||
344 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos , KDsInterfaceName); |
|
345 |
||
346 |
if(!genericparm) |
|
347 |
{ |
|
348 |
||
349 |
||
350 |
User :: Leave(KErrArgument) ; |
|
351 |
} |
|
352 |
||
353 |
MLiwInterface* LogInterface = (genericparm->Value()).AsInterface(); |
|
354 |
||
355 |
||
356 |
TBufC8<20>CmdBufSet(KCmdAdd) ; |
|
357 |
||
358 |
outputlist->Reset() ; |
|
359 |
||
360 |
inputlist->Reset() ; |
|
361 |
||
362 |
CLiwDefaultMap *EventDetails = CLiwDefaultMap :: NewL() ; |
|
363 |
||
364 |
||
365 |
||
366 |
EventDetails->InsertL(KEventTypeKey , TLiwVariant(aDetails->GetEventType()) ); |
|
367 |
||
368 |
||
369 |
if(((unsigned int)aDetails->GetDurationType()!=0)) |
|
370 |
{ |
|
371 |
EventDetails->InsertL(KEventDurationKey ,TLiwVariant((unsigned int)aDetails->GetDurationType()) ); |
|
372 |
} |
|
373 |
||
374 |
if(aDetails->GetContactType() !=0 ) |
|
375 |
{ |
|
376 |
EventDetails->InsertL(KContactidKey , TLiwVariant(aDetails->GetContactType()) ); |
|
377 |
} |
|
378 |
||
379 |
if((unsigned int)aDetails->GetLinkType()!=0) |
|
380 |
{ |
|
381 |
EventDetails->InsertL(KLinkKey , TLiwVariant((unsigned int)aDetails->GetLinkType()) ); |
|
382 |
} |
|
383 |
||
384 |
if(aDetails->GetTimer() !=0 ) |
|
385 |
{ |
|
386 |
EventDetails->InsertL(KEventTimeKey , TLiwVariant(aDetails->GetTimer())) ; |
|
387 |
} |
|
388 |
||
389 |
||
390 |
TBuf<10> EmptyDes ; |
|
391 |
||
392 |
||
393 |
if(aDetails->GetSubjectType() != EmptyDes) |
|
394 |
{ |
|
395 |
EventDetails->InsertL(KSubjectKey , TLiwVariant(aDetails->GetSubjectType())) ; |
|
396 |
} |
|
397 |
||
398 |
||
399 |
||
400 |
||
401 |
if(aDetails->GetNumberType()!= EmptyDes) |
|
402 |
{ |
|
403 |
EventDetails->InsertL(KPhoneNumberKey , TLiwVariant(aDetails->GetNumberType())) ; |
|
404 |
} |
|
405 |
||
406 |
if(aDetails->GetRemotePartyType() != EmptyDes) |
|
407 |
{ |
|
408 |
EventDetails->InsertL(KRemotePartyKey , TLiwVariant(aDetails->GetRemotePartyType())) ; |
|
409 |
} |
|
410 |
||
411 |
if(aDetails->GetDirectionType() >= 0 ) |
|
412 |
{ |
|
413 |
EventDetails->InsertL(KDirectionKey , TLiwVariant(aDetails->GetDirectionType())) ; |
|
414 |
} |
|
415 |
||
416 |
if(aDetails->GetDescriptionType() != EmptyDes) |
|
417 |
{ |
|
418 |
EventDetails->InsertL(KDescriptionKey , TLiwVariant(aDetails->GetDescriptionType())) ; |
|
419 |
} |
|
420 |
||
421 |
if(aDetails->GetStatusType() >= 0 ) |
|
422 |
{ |
|
423 |
EventDetails->InsertL(KDeliveryStatusKey , TLiwVariant(aDetails->GetStatusType())) ; |
|
424 |
} |
|
425 |
||
426 |
||
427 |
||
428 |
TBuf16 <10> Contents(KContentType) ; |
|
429 |
||
430 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(Contents))) ; |
|
431 |
||
432 |
inputlist->AppendL(TLiwGenericParam(KEventDetails , TLiwVariant(EventDetails))) ; |
|
433 |
||
434 |
EventDetails->DecRef(); |
|
435 |
||
436 |
LogInterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist ); |
|
437 |
||
438 |
||
439 |
||
440 |
||
441 |
TInt index = 0 ; |
|
442 |
||
443 |
const TLiwGenericParam *ErrCode = outputlist->FindFirst(index , KErrCode) ; |
|
444 |
||
445 |
if(!ErrCode ) |
|
446 |
{ |
|
447 |
||
448 |
User :: Leave(KErrArgument) ; |
|
449 |
} |
|
450 |
||
451 |
TInt retval = ErrCode->Value().AsTInt32() ; |
|
452 |
||
453 |
if(retval != SErrNone ) |
|
454 |
{ |
|
455 |
||
456 |
LogInterface->Close() ; |
|
457 |
delete ServiceHandler; |
|
458 |
a.ResetAndDestroy(); |
|
459 |
a.Close(); |
|
460 |
||
461 |
||
462 |
||
463 |
User :: Leave(KErrArgument) ; |
|
464 |
} |
|
465 |
||
466 |
||
467 |
||
468 |
||
469 |
index = 0 ; |
|
470 |
const TLiwGenericParam *genparm = outputlist->FindFirst(index , KResponse) ; |
|
471 |
||
472 |
if(!genparm) |
|
473 |
{ |
|
474 |
||
475 |
User :: Leave(KErrArgument) ; |
|
476 |
} |
|
477 |
||
478 |
||
479 |
||
480 |
||
481 |
||
482 |
TBufC<20> itemid = (genparm->Value()).AsDes() ; |
|
483 |
||
484 |
||
485 |
//delete async |
|
486 |
||
487 |
||
488 |
inputlist->Reset() ; outputlist->Reset() ; |
|
489 |
||
490 |
||
491 |
//Insert the contenttype to inputlist |
|
492 |
CLiwDefaultMap *Idmap = CLiwDefaultMap :: NewL() ; |
|
493 |
Idmap->InsertL(KLogId ,TLiwVariant(itemid)) ; |
|
494 |
||
495 |
TBufC16<10> contentType(KContentType) ; |
|
496 |
//Insert the contenttype to inputlist |
|
497 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(contentType))) ; |
|
498 |
||
499 |
||
500 |
// inputlist->AppendL(TLiwGenericParam(KLogId , TLiwVariant((TInt32)itemid))) ; |
|
501 |
inputlist->AppendL(TLiwGenericParam(KData , TLiwVariant(Idmap))) ; |
|
502 |
Idmap->DecRef(); |
|
503 |
// CmdBuf = KCmdDelete ; |
|
504 |
||
505 |
||
506 |
TBufC8<20>CmdBuf(KCmdDelete) ; |
|
507 |
LogInterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist ,KLiwOptASyncronous, &iCallback) ; |
|
508 |
||
509 |
pos = 0 ; |
|
510 |
const TLiwGenericParam *Errprm = outputlist->FindFirst(pos , KErrCode ) ; |
|
511 |
||
512 |
if(!Errprm) |
|
513 |
{ |
|
514 |
||
515 |
User :: Leave(KErrArgument) ; |
|
516 |
} |
|
517 |
||
518 |
||
519 |
||
520 |
||
521 |
||
522 |
const TLiwGenericParam *transid = outputlist->FindFirst(index , KTransactionId) ; |
|
523 |
||
524 |
if(!transid) |
|
525 |
{ |
|
526 |
||
527 |
User :: Leave(KErrArgument) ; |
|
528 |
} |
|
529 |
||
530 |
||
531 |
||
532 |
//cancel async |
|
533 |
// inputlist->Reset(); |
|
534 |
//outputlist->Reset(); |
|
535 |
||
536 |
||
537 |
||
538 |
// TInt transid1 = (transid->Value()).AsTInt32() ; |
|
539 |
TInt transid1 = -1; |
|
540 |
||
541 |
inputlist1->AppendL(TLiwGenericParam(KTransactionId , TLiwVariant((TInt32)transid1))) ; |
|
542 |
||
543 |
||
544 |
||
545 |
||
546 |
TBufC8<20>CmdBuf1(KCmdCancel) ; |
|
547 |
||
548 |
TRAPD(retur, LogInterface->ExecuteCmdL(CmdBuf1 , *inputlist1 , *outputlist1 ,KLiwOptCancel)); |
|
549 |
||
550 |
pos =0; |
|
551 |
const TLiwGenericParam *Errprm1 = outputlist1->FindFirst(pos , KErrCode ) ; |
|
552 |
||
553 |
if(!Errprm1) |
|
554 |
{ |
|
555 |
||
556 |
User :: Leave(KErrArgument) ; |
|
557 |
} |
|
558 |
||
559 |
||
560 |
||
561 |
||
562 |
||
563 |
||
564 |
LogInterface->Close() ; |
|
565 |
delete ServiceHandler; |
|
566 |
// delete crit; |
|
567 |
||
568 |
a.ResetAndDestroy(); |
|
569 |
a.Close(); |
|
570 |
||
65
0b68a1b0c15e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
571 |
|
19 | 572 |
} |
573 |
||
574 |
||
575 |
||
576 |
||
577 |
||
578 |