author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
child 58 | ea43c23d28d2 |
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 |
||
26 |
//#include "teventdetails.h" |
|
27 |
#include "tconstants.h" |
|
28 |
#include "tfilterdetails.h" |
|
29 |
//#include <liwlogiter.h> |
|
30 |
||
31 |
||
32 |
||
33 |
||
34 |
_LIT8(KEventIdKey , "EventId"); |
|
35 |
||
36 |
||
37 |
||
38 |
||
39 |
||
40 |
||
41 |
//sms macros |
|
42 |
||
43 |
||
44 |
||
45 |
TInt getlist1L(CFilterDetails *aDetails) |
|
46 |
{ |
|
47 |
||
48 |
||
49 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
50 |
// Input and output parameter list |
|
51 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
52 |
||
53 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
54 |
||
55 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDsInterfaceName , KLoggingContents) ; |
|
56 |
||
57 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
58 |
||
59 |
RCriteriaArray a; |
|
60 |
||
61 |
a.AppendL(crit); |
|
62 |
||
63 |
ServiceHandler->AttachL(a) ; |
|
64 |
||
65 |
||
66 |
ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
67 |
||
68 |
TInt pos = 0; |
|
69 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos , KDsInterfaceName); |
|
70 |
||
71 |
if(!genericparm) |
|
72 |
{ |
|
73 |
||
74 |
||
75 |
User :: Leave(KErrArgument) ; |
|
76 |
} |
|
77 |
||
78 |
MLiwInterface* LogInterface = (genericparm->Value()).AsInterface(); |
|
79 |
||
80 |
||
81 |
||
82 |
||
83 |
TBufC8<20>CmdBufSet(KCmdGetList) ; |
|
84 |
||
85 |
outputlist->Reset() ; |
|
86 |
||
87 |
inputlist->Reset() ; |
|
88 |
||
89 |
CLiwDefaultMap *EventFilter = CLiwDefaultMap :: NewL() ; |
|
90 |
||
91 |
EventFilter->InsertL(KEventIdKey , TLiwVariant(aDetails->GetEventId()) ); |
|
92 |
||
93 |
EventFilter->InsertL(KEventTypeKey , TLiwVariant(aDetails->GetEventType()) ); |
|
94 |
||
95 |
if(aDetails->GetContactType()!=0) |
|
96 |
{ |
|
97 |
EventFilter->InsertL(KContactidKey , TLiwVariant(aDetails->GetContactType()) ); |
|
98 |
} |
|
99 |
||
100 |
||
101 |
if((long)aDetails->GetTimer()!=0) |
|
102 |
{ |
|
103 |
EventFilter->InsertL(KEndTimeKey , TLiwVariant((long)aDetails->GetTimer())) ; |
|
104 |
} |
|
105 |
||
106 |
TBuf<6> EmptyDes ; |
|
107 |
||
108 |
if(aDetails->GetNumberType() != EmptyDes) |
|
109 |
{ |
|
110 |
EventFilter->InsertL(KPhoneNumberKey , TLiwVariant(aDetails->GetNumberType())) ; |
|
111 |
} |
|
112 |
||
113 |
if(aDetails->GetRemotePartyType() != EmptyDes) |
|
114 |
{ |
|
115 |
EventFilter->InsertL(KRemotePartyKey , TLiwVariant(aDetails->GetRemotePartyType())) ; |
|
116 |
} |
|
117 |
||
118 |
||
119 |
if(aDetails->GetDirectionType() >= 0) |
|
120 |
{ |
|
121 |
EventFilter->InsertL(KDirectionKey , TLiwVariant(aDetails->GetDirectionType())) ; |
|
122 |
} |
|
123 |
||
124 |
if(aDetails->GetStatusType() >= 0) |
|
125 |
{ |
|
126 |
EventFilter->InsertL(KDeliveryStatusKey , TLiwVariant(aDetails->GetStatusType())) ; |
|
127 |
} |
|
128 |
||
129 |
if(aDetails->GetRecentList() != 0) |
|
130 |
{ |
|
131 |
EventFilter->InsertL(KRecentListKey , TLiwVariant(aDetails->GetRecentList())) ; |
|
132 |
} |
|
133 |
if(aDetails->GetAllEvent()!=0) |
|
134 |
{ |
|
135 |
EventFilter->InsertL(KAllEvents , TLiwVariant(aDetails->GetAllEvent())) ; |
|
136 |
} |
|
137 |
||
138 |
||
139 |
TBufC<10> contentType(KContentType) ; |
|
140 |
||
141 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(contentType))) ; |
|
142 |
||
143 |
||
144 |
inputlist->AppendL(TLiwGenericParam(KFilter , TLiwVariant(EventFilter))) ; |
|
145 |
EventFilter->DecRef() ; |
|
146 |
||
147 |
||
148 |
||
149 |
/* TInt Index = 0 ; |
|
150 |
const TLiwGenericParam *contentType1 = inputlist->FindFirst(Index , KContentTypeKey) ; |
|
151 |
||
152 |
if(Index == KErrNotFound) |
|
153 |
{ |
|
154 |
||
155 |
//contentType1 = inputlist->Value().AsTInt32() ; |
|
156 |
// contentType1 = &(inputlist[0]) ; |
|
157 |
||
158 |
} |
|
159 |
||
160 |
TPtrC content = (contentType1->Value()).AsDes() ; |
|
161 |
||
162 |
if(content.CompareF(KContentType)) |
|
163 |
{ |
|
164 |
User :: Leave(KErrArgument) ; |
|
165 |
} |
|
166 |
*/ |
|
167 |
||
168 |
LogInterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist ); |
|
169 |
||
170 |
||
171 |
||
172 |
TInt index = 0 ; |
|
173 |
||
174 |
const TLiwGenericParam *ErrCode = outputlist->FindFirst(index , KErrCode) ; |
|
175 |
||
176 |
if(!ErrCode ) |
|
177 |
{ |
|
178 |
||
179 |
User :: Leave(KErrArgument) ; |
|
180 |
} |
|
181 |
||
182 |
TInt retval = ErrCode->Value().AsTInt32() ; |
|
183 |
||
184 |
if(retval != SErrNone ) |
|
185 |
{ |
|
186 |
||
187 |
User :: Leave(KErrArgument) ; |
|
188 |
} |
|
189 |
||
190 |
||
191 |
||
192 |
pos = 0 ; |
|
193 |
||
194 |
const TLiwGenericParam *LogIterParam = outputlist->FindFirst(pos , KResponse) ; |
|
195 |
||
196 |
||
197 |
||
198 |
CLiwIterable *LogIter = (LogIterParam->Value()).AsIterable() ; |
|
199 |
||
200 |
if(!LogIter) |
|
201 |
{ |
|
202 |
||
203 |
User :: Leave (KErrGeneral) ; |
|
204 |
} |
|
205 |
||
206 |
//TLiwVariant Events ; |
|
207 |
//TLiwVariant EventDetails ; |
|
208 |
||
209 |
// CLiwLogIter *x = NULL; |
|
210 |
||
211 |
// x->CountL(); |
|
212 |
||
213 |
// CountL(); |
|
214 |
||
215 |
||
216 |
||
217 |
||
218 |
// TRAPD(ret,LogIter->NextL(EventDetails)); |
|
219 |
||
220 |
/*while(LogIter->NextL(EventDetails)) |
|
221 |
{ |
|
222 |
const CLiwMap *eventDetails = EventDetails.AsMap() ; |
|
223 |
||
224 |
if(eventDetails->FindL(KLogId , Events) == KErrNotFound) |
|
225 |
{ |
|
226 |
||
227 |
User :: Leave(KErrArgument) ; |
|
228 |
} |
|
229 |
||
230 |
||
231 |
||
232 |
TInt32 eventid = Events.AsTInt32() ; |
|
233 |
||
234 |
inputlist->Reset() ; |
|
235 |
||
236 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(KContentType))) ; |
|
237 |
inputlist->AppendL(TLiwGenericParam(KLogId , TLiwVariant(eventid))) ; |
|
238 |
||
239 |
||
240 |
LogInterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist ) ; |
|
241 |
||
242 |
(const_cast<CLiwMap *>(eventDetails))->DecRef() ; |
|
243 |
delete eventDetails; |
|
244 |
}*/ |
|
245 |
||
246 |
||
247 |
||
248 |
inputlist->Reset() ; outputlist->Reset() ; |
|
249 |
||
250 |
||
251 |
//Insert the contenttype to inputlist |
|
252 |
// inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(contentType))) ; |
|
253 |
||
254 |
||
255 |
//inputlist->AppendL(TLiwGenericParam(KLogId , TLiwVariant((TInt32)item))) ; |
|
256 |
||
257 |
// CmdBuf = KCmdDelete ; |
|
258 |
||
259 |
// LogInterface->ExecuteCmdL(_L8("Delete") , *inputlist , *outputlist) ; |
|
260 |
||
261 |
||
262 |
||
263 |
||
264 |
// TInt itemid = (outparm1->Value()).AsTInt32() ; |
|
265 |
||
266 |
||
267 |
||
268 |
// LogIter->Reset(); |
|
269 |
||
270 |
// delete eventDetails; |
|
271 |
||
272 |
// delete LogIter; |
|
273 |
//delete eventDetails; |
|
274 |
||
275 |
||
276 |
LogInterface->Close() ; |
|
277 |
delete ServiceHandler ; |
|
278 |
a.ResetAndDestroy() ; |
|
279 |
a.Close() ; |
|
280 |
||
281 |
||
282 |
} |
|
283 |
||
284 |
||
285 |
||
286 |
||
287 |
||
288 |
||
289 |
||
290 |
||
291 |
||
292 |
||
293 |
||
294 |
||
295 |
||
296 |
||
297 |
||
298 |
||
299 |
||
300 |
||
301 |
TInt getlist2L(CFilterDetails *aDetails) |
|
302 |
{ |
|
303 |
tcallback icallback; |
|
304 |
||
305 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
306 |
// Input and output parameter list |
|
307 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
308 |
||
309 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
310 |
||
311 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDsInterfaceName , KLoggingContents) ; |
|
312 |
||
313 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
314 |
||
315 |
RCriteriaArray a; |
|
316 |
||
317 |
a.AppendL(crit); |
|
318 |
||
319 |
ServiceHandler->AttachL(a) ; |
|
320 |
||
321 |
||
322 |
ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
323 |
||
324 |
TInt pos = 0; |
|
325 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos , KDsInterfaceName); |
|
326 |
||
327 |
if(!genericparm) |
|
328 |
{ |
|
329 |
||
330 |
||
331 |
User :: Leave(KErrArgument) ; |
|
332 |
} |
|
333 |
||
334 |
MLiwInterface* LogInterface = (genericparm->Value()).AsInterface(); |
|
335 |
||
336 |
||
337 |
||
338 |
||
339 |
TBufC8<20>CmdBufSet(KCmdGetList) ; |
|
340 |
||
341 |
outputlist->Reset() ; |
|
342 |
||
343 |
inputlist->Reset() ; |
|
344 |
||
345 |
CLiwDefaultMap *EventFilter = CLiwDefaultMap :: NewL() ; |
|
346 |
||
347 |
EventFilter->InsertL(KEventIdKey , TLiwVariant(aDetails->GetEventId()) ); |
|
348 |
||
349 |
EventFilter->InsertL(KEventTypeKey , TLiwVariant(aDetails->GetEventType()) ); |
|
350 |
||
351 |
if(aDetails->GetContactType()!=0) |
|
352 |
{ |
|
353 |
EventFilter->InsertL(KContactidKey , TLiwVariant(aDetails->GetContactType()) ); |
|
354 |
} |
|
355 |
||
356 |
||
357 |
if((long)aDetails->GetTimer()!=0) |
|
358 |
{ |
|
359 |
EventFilter->InsertL(KEndTimeKey , TLiwVariant((long)aDetails->GetTimer())) ; |
|
360 |
} |
|
361 |
||
362 |
TBuf<6> EmptyDes ; |
|
363 |
||
364 |
if(aDetails->GetNumberType() != EmptyDes) |
|
365 |
{ |
|
366 |
EventFilter->InsertL(KPhoneNumberKey , TLiwVariant(aDetails->GetNumberType())) ; |
|
367 |
} |
|
368 |
||
369 |
if(aDetails->GetRemotePartyType() != EmptyDes) |
|
370 |
{ |
|
371 |
EventFilter->InsertL(KRemotePartyKey , TLiwVariant(aDetails->GetRemotePartyType())) ; |
|
372 |
} |
|
373 |
||
374 |
||
375 |
if(aDetails->GetDirectionType() >= 0) |
|
376 |
{ |
|
377 |
EventFilter->InsertL(KDirectionKey , TLiwVariant(aDetails->GetDirectionType())) ; |
|
378 |
} |
|
379 |
||
380 |
if(aDetails->GetStatusType() >= 0) |
|
381 |
{ |
|
382 |
EventFilter->InsertL(KDeliveryStatusKey , TLiwVariant(aDetails->GetStatusType())) ; |
|
383 |
} |
|
384 |
||
385 |
if(aDetails->GetRecentList() != 0) |
|
386 |
{ |
|
387 |
EventFilter->InsertL(KRecentListKey , TLiwVariant(aDetails->GetRecentList())) ; |
|
388 |
} |
|
389 |
// EventFilter->InsertL(KRecentListKey , TLiwVariant(aDetails->GetAllEvent())) ; |
|
390 |
||
391 |
||
392 |
TBufC<10> contentType(KContentType) ; |
|
393 |
||
394 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(contentType))) ; |
|
395 |
||
396 |
||
397 |
inputlist->AppendL(TLiwGenericParam(KFilter , TLiwVariant(EventFilter))) ; |
|
398 |
EventFilter->DecRef() ; |
|
399 |
||
400 |
||
401 |
||
402 |
/* TInt Index = 0 ; |
|
403 |
const TLiwGenericParam *contentType1 = inputlist->FindFirst(Index , KContentTypeKey) ; |
|
404 |
||
405 |
if(Index == KErrNotFound) |
|
406 |
{ |
|
407 |
||
408 |
//contentType1 = inputlist->Value().AsTInt32() ; |
|
409 |
// contentType1 = &(inputlist[0]) ; |
|
410 |
||
411 |
} |
|
412 |
||
413 |
TPtrC content = (contentType1->Value()).AsDes() ; |
|
414 |
||
415 |
if(content.CompareF(KContentType)) |
|
416 |
{ |
|
417 |
User :: Leave(KErrArgument) ; |
|
418 |
} |
|
419 |
*/ |
|
420 |
||
421 |
LogInterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist,KLiwOptASyncronous,&icallback ); |
|
422 |
||
423 |
||
424 |
||
425 |
||
426 |
TInt index = 0 ; |
|
427 |
||
428 |
const TLiwGenericParam *ErrCode = outputlist->FindFirst(index , KErrCode) ; |
|
429 |
||
430 |
if(!ErrCode ) |
|
431 |
{ |
|
432 |
||
433 |
User :: Leave(KErrArgument) ; |
|
434 |
} |
|
435 |
||
436 |
TInt retval = ErrCode->Value().AsTInt32() ; |
|
437 |
||
438 |
if(retval != SErrNone ) |
|
439 |
{ |
|
440 |
||
441 |
User :: Leave(KErrArgument) ; |
|
442 |
} |
|
443 |
||
444 |
icallback.Start(); |
|
445 |
||
446 |
/* pos = 0 ; |
|
447 |
||
448 |
const TLiwGenericParam *LogIterParam = outputlist->FindFirst(pos , KLogIter) ; |
|
449 |
||
450 |
||
451 |
||
452 |
CLiwIterable *LogIter = (LogIterParam->Value()).AsIterable() ; |
|
453 |
||
454 |
||
455 |
TLiwVariant Events ; |
|
456 |
TLiwVariant EventDetails ; |
|
457 |
||
458 |
// CLiwLogIter *x = NULL; |
|
459 |
||
460 |
// x->CountL(); |
|
461 |
||
462 |
// CountL(); |
|
463 |
// CmdBufSet = KCmdDelete ; |
|
464 |
||
465 |
while(LogIter->NextL(EventDetails)) |
|
466 |
{ |
|
467 |
const CLiwMap *eventDetails = EventDetails.AsMap() ; |
|
468 |
||
469 |
if(eventDetails->FindL(KLogId , Events) == KErrNotFound) |
|
470 |
{ |
|
471 |
||
472 |
User :: Leave(KErrArgument) ; |
|
473 |
} |
|
474 |
||
475 |
||
476 |
/* if(eventDetails->FindL(KContactidKey , Events) == KErrNotFound) |
|
477 |
{ |
|
478 |
||
479 |
User :: Leave(KErrArgument) ; |
|
480 |
} |
|
481 |
||
482 |
delete eventDetails; |
|
483 |
||
484 |
||
485 |
} |
|
486 |
||
487 |
TInt32 item = Events.AsTInt32(); |
|
488 |
||
489 |
||
490 |
||
491 |
||
492 |
||
493 |
||
494 |
||
495 |
LogIter->Reset();*/ |
|
496 |
||
497 |
// delete eventDetails; |
|
498 |
||
499 |
// delete LogIter; |
|
500 |
//delete eventDetails; |
|
501 |
||
502 |
||
503 |
LogInterface->Close() ; |
|
504 |
delete ServiceHandler ; |
|
505 |
a.ResetAndDestroy() ; |
|
506 |
a.Close() ; |
|
507 |
||
508 |
||
509 |
} |
|
510 |
||
511 |
||
512 |
||
513 |
||
514 |
||
515 |
||
516 |
||
517 |
||
518 |
||
519 |
||
520 |
||
521 |
||
522 |
||
523 |
||
524 |
||
525 |
||
526 |
||
527 |
||
528 |
||
529 |
||
530 |
||
531 |
||
532 |