author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:06:03 +0300 | |
branch | RCL_3 |
changeset 44 | 0b68a1b0c15e |
parent 38 | ea43c23d28d2 |
child 45 | a9c0808a1095 |
permissions | -rw-r--r-- |
5 | 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 |
||
23
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
18 |
#include <liwservicehandler.h> |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
19 |
#include <liwcommon.h> |
5 | 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 |
||
32 |
TInt addtest1L(CEventDetails *aDetails) |
|
33 |
{ |
|
34 |
||
35 |
||
36 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
37 |
// Input and output parameter list |
|
38 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
39 |
||
40 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
41 |
||
42 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDsInterfaceName , KLoggingContents) ; |
|
43 |
||
44 |
||
45 |
||
46 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
47 |
||
48 |
RCriteriaArray a; |
|
49 |
||
50 |
||
51 |
a.AppendL(crit); |
|
52 |
||
53 |
||
54 |
||
55 |
||
56 |
ServiceHandler->AttachL(a) ; |
|
57 |
||
58 |
||
59 |
ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
60 |
||
61 |
||
62 |
||
63 |
||
64 |
TInt pos = 0; |
|
65 |
||
66 |
||
67 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos , KDsInterfaceName); |
|
68 |
||
69 |
if(!genericparm) |
|
70 |
{ |
|
71 |
||
72 |
||
73 |
User :: Leave(KErrArgument) ; |
|
74 |
} |
|
75 |
||
76 |
MLiwInterface* LogInterface = (genericparm->Value()).AsInterface(); |
|
77 |
||
78 |
||
79 |
TBufC8<20>CmdBufSet(KCmdAdd) ; |
|
80 |
||
81 |
outputlist->Reset() ; |
|
82 |
||
83 |
inputlist->Reset() ; |
|
84 |
||
85 |
CLiwDefaultMap *EventDetails = CLiwDefaultMap :: NewL() ; |
|
86 |
||
87 |
||
88 |
||
89 |
EventDetails->InsertL(KEventTypeKey , TLiwVariant(aDetails->GetEventType()) ); |
|
90 |
||
91 |
||
92 |
if(((unsigned int)aDetails->GetDurationType()!=0)) |
|
93 |
{ |
|
94 |
EventDetails->InsertL(KEventDurationKey ,TLiwVariant((unsigned int)aDetails->GetDurationType()) ); |
|
95 |
} |
|
96 |
||
97 |
if(aDetails->GetContactType() !=0 ) |
|
98 |
{ |
|
99 |
EventDetails->InsertL(KContactidKey , TLiwVariant(aDetails->GetContactType()) ); |
|
100 |
} |
|
101 |
||
102 |
if((unsigned int)aDetails->GetLinkType()!=0) |
|
103 |
{ |
|
104 |
EventDetails->InsertL(KLinkKey , TLiwVariant((unsigned int)aDetails->GetLinkType()) ); |
|
105 |
} |
|
106 |
||
107 |
if(aDetails->GetTimer() !=0 ) |
|
108 |
{ |
|
109 |
EventDetails->InsertL(KEventTimeKey , TLiwVariant(aDetails->GetTimer())) ; |
|
110 |
} |
|
111 |
||
112 |
||
113 |
TBuf<10> EmptyDes ; |
|
114 |
||
115 |
||
116 |
if(aDetails->GetSubjectType() != EmptyDes) |
|
117 |
{ |
|
118 |
EventDetails->InsertL(KSubjectKey , TLiwVariant(aDetails->GetSubjectType())) ; |
|
119 |
} |
|
120 |
||
121 |
||
122 |
||
123 |
||
124 |
if(aDetails->GetNumberType()!= EmptyDes) |
|
125 |
{ |
|
126 |
EventDetails->InsertL(KPhoneNumberKey , TLiwVariant(aDetails->GetNumberType())) ; |
|
127 |
} |
|
128 |
||
129 |
if(aDetails->GetRemotePartyType() != EmptyDes) |
|
130 |
{ |
|
131 |
EventDetails->InsertL(KRemotePartyKey , TLiwVariant(aDetails->GetRemotePartyType())) ; |
|
132 |
} |
|
133 |
||
134 |
if(aDetails->GetDirectionType() >= 0 ) |
|
135 |
{ |
|
136 |
EventDetails->InsertL(KDirectionKey , TLiwVariant(aDetails->GetDirectionType())) ; |
|
137 |
} |
|
138 |
||
139 |
if(aDetails->GetDescriptionType() != EmptyDes) |
|
140 |
{ |
|
141 |
EventDetails->InsertL(KDescriptionKey , TLiwVariant(aDetails->GetDescriptionType())) ; |
|
142 |
} |
|
143 |
||
144 |
if(aDetails->GetStatusType() >= 0 ) |
|
145 |
{ |
|
146 |
EventDetails->InsertL(KDeliveryStatusKey , TLiwVariant(aDetails->GetStatusType())) ; |
|
147 |
} |
|
148 |
||
149 |
||
150 |
||
151 |
TBuf16 <10> Contents(KContentType) ; |
|
152 |
||
153 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(Contents))) ; |
|
154 |
||
155 |
inputlist->AppendL(TLiwGenericParam(KEventDetails , TLiwVariant(EventDetails))) ; |
|
156 |
EventDetails->DecRef(); |
|
157 |
||
158 |
LogInterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist ); |
|
159 |
||
160 |
||
161 |
||
162 |
||
163 |
TInt index = 0 ; |
|
164 |
||
165 |
const TLiwGenericParam *ErrCode = outputlist->FindFirst(index , KErrCode) ; |
|
166 |
||
167 |
if(!ErrCode ) |
|
168 |
{ |
|
169 |
||
170 |
User :: Leave(KErrArgument) ; |
|
171 |
} |
|
172 |
||
173 |
TInt retval = ErrCode->Value().AsTInt32() ; |
|
174 |
||
175 |
if(retval != SErrNone ) |
|
176 |
{ |
|
177 |
||
178 |
LogInterface->Close() ; |
|
179 |
delete ServiceHandler; |
|
180 |
a.ResetAndDestroy(); |
|
181 |
a.Close(); |
|
182 |
||
183 |
||
184 |
||
185 |
User :: Leave(KErrArgument) ; |
|
186 |
} |
|
187 |
||
188 |
||
189 |
||
190 |
||
191 |
index = 0 ; |
|
192 |
const TLiwGenericParam *genparm = outputlist->FindFirst(index , KResponse) ; |
|
193 |
||
194 |
if(!genparm) |
|
195 |
{ |
|
196 |
||
197 |
User :: Leave(KErrArgument) ; |
|
198 |
} |
|
199 |
||
200 |
||
201 |
||
202 |
||
203 |
||
204 |
LogInterface->Close() ; |
|
205 |
delete ServiceHandler; |
|
206 |
// delete crit; |
|
207 |
||
208 |
a.ResetAndDestroy(); |
|
209 |
a.Close(); |
|
210 |
||
44
0b68a1b0c15e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
211 |
|
5 | 212 |
} |
213 |
||
214 |
||
215 |
||
216 |
||
217 |
||
218 |
||
219 |
||
220 |
||
221 |
TInt addtest2L(CEventDetails *aDetails) |
|
222 |
{ |
|
223 |
||
224 |
||
225 |
tcallback icallback; |
|
226 |
CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); |
|
227 |
||
228 |
CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); |
|
229 |
||
230 |
CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); |
|
231 |
||
232 |
CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDsInterfaceName , KLoggingContents) ; |
|
233 |
||
234 |
||
235 |
||
236 |
crit->SetServiceClass(TUid::Uid(KLiwClassBase)); |
|
237 |
||
238 |
RCriteriaArray a; |
|
239 |
||
240 |
||
241 |
a.AppendL(crit); |
|
242 |
||
243 |
||
244 |
||
245 |
||
246 |
ServiceHandler->AttachL(a) ; |
|
247 |
||
248 |
||
249 |
ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); |
|
250 |
||
251 |
||
252 |
||
253 |
||
254 |
TInt pos = 0; |
|
255 |
||
256 |
||
257 |
const TLiwGenericParam *genericparm = outputlist->FindFirst(pos , KDsInterfaceName); |
|
258 |
||
259 |
if(!genericparm) |
|
260 |
{ |
|
261 |
||
262 |
||
263 |
User :: Leave(KErrArgument) ; |
|
264 |
} |
|
265 |
||
266 |
MLiwInterface* LogInterface = (genericparm->Value()).AsInterface(); |
|
267 |
||
268 |
||
269 |
||
270 |
TBufC8<20>CmdBufSet(KCmdAdd) ; |
|
271 |
||
272 |
outputlist->Reset() ; |
|
273 |
||
274 |
inputlist->Reset() ; |
|
275 |
||
276 |
CLiwDefaultMap *EventDetails = CLiwDefaultMap :: NewL() ; |
|
277 |
||
278 |
||
279 |
||
280 |
EventDetails->InsertL(KEventTypeKey , TLiwVariant(aDetails->GetEventType()) ); |
|
281 |
||
282 |
||
283 |
if(((unsigned int)aDetails->GetDurationType()!=0)) |
|
284 |
{ |
|
285 |
EventDetails->InsertL(KEventDurationKey ,TLiwVariant((unsigned int)aDetails->GetDurationType()) ); |
|
286 |
} |
|
287 |
||
288 |
if(aDetails->GetContactType() !=0 ) |
|
289 |
{ |
|
290 |
EventDetails->InsertL(KContactidKey , TLiwVariant(aDetails->GetContactType()) ); |
|
291 |
} |
|
292 |
||
293 |
if((unsigned int)aDetails->GetLinkType()!=0) |
|
294 |
{ |
|
295 |
EventDetails->InsertL(KLinkKey , TLiwVariant((unsigned int)aDetails->GetLinkType()) ); |
|
296 |
} |
|
297 |
||
298 |
if(aDetails->GetTimer() !=0 ) |
|
299 |
{ |
|
300 |
EventDetails->InsertL(KEventTimeKey , TLiwVariant(aDetails->GetTimer())) ; |
|
301 |
} |
|
302 |
||
303 |
||
304 |
TBuf<10> EmptyDes ; |
|
305 |
||
306 |
||
307 |
||
308 |
if(aDetails->GetSubjectType() != EmptyDes) |
|
309 |
{ |
|
310 |
EventDetails->InsertL(KSubjectKey , TLiwVariant(aDetails->GetSubjectType())) ; |
|
311 |
} |
|
312 |
||
313 |
||
314 |
||
315 |
||
316 |
if(aDetails->GetNumberType()!= EmptyDes) |
|
317 |
{ |
|
318 |
EventDetails->InsertL(KPhoneNumberKey , TLiwVariant(aDetails->GetNumberType())) ; |
|
319 |
} |
|
320 |
||
321 |
if(aDetails->GetRemotePartyType() != EmptyDes) |
|
322 |
{ |
|
323 |
EventDetails->InsertL(KRemotePartyKey , TLiwVariant(aDetails->GetRemotePartyType())) ; |
|
324 |
} |
|
325 |
||
326 |
if(aDetails->GetDirectionType() >= 0 ) |
|
327 |
{ |
|
328 |
EventDetails->InsertL(KDirectionKey , TLiwVariant(aDetails->GetDirectionType())) ; |
|
329 |
} |
|
330 |
||
331 |
if(aDetails->GetDescriptionType() != EmptyDes) |
|
332 |
{ |
|
333 |
EventDetails->InsertL(KDescriptionKey , TLiwVariant(aDetails->GetDescriptionType())) ; |
|
334 |
} |
|
335 |
||
336 |
if(aDetails->GetStatusType() >= 0 ) |
|
337 |
{ |
|
338 |
EventDetails->InsertL(KDeliveryStatusKey , TLiwVariant(aDetails->GetStatusType())) ; |
|
339 |
} |
|
340 |
||
341 |
||
342 |
||
343 |
TBuf16 <10> Contents(KContentType) ; |
|
344 |
||
345 |
inputlist->AppendL(TLiwGenericParam(KContentTypeKey , TLiwVariant(Contents))) ; |
|
346 |
||
347 |
inputlist->AppendL(TLiwGenericParam(KEventDetails , TLiwVariant(EventDetails))) ; |
|
348 |
EventDetails->DecRef(); |
|
349 |
||
350 |
// LogInterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist ); |
|
351 |
||
352 |
||
353 |
LogInterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist ,KLiwOptASyncronous, &icallback); |
|
354 |
||
355 |
TInt index = 0 ; |
|
356 |
||
357 |
const TLiwGenericParam *ErrCode = outputlist->FindFirst(index , KErrCode) ; |
|
358 |
||
359 |
if(!ErrCode ) |
|
360 |
{ |
|
361 |
||
362 |
User :: Leave(KErrArgument) ; |
|
363 |
} |
|
364 |
||
365 |
||
366 |
||
367 |
||
368 |
TInt retval = ErrCode->Value().AsTInt32() ; |
|
369 |
||
370 |
||
371 |
if(retval != SErrNone ) |
|
372 |
{ |
|
373 |
||
374 |
LogInterface->Close() ; |
|
375 |
delete ServiceHandler; |
|
376 |
a.ResetAndDestroy(); |
|
377 |
a.Close(); |
|
378 |
||
379 |
||
380 |
User :: Leave(KErrArgument) ; |
|
381 |
} |
|
382 |
||
383 |
||
384 |
||
385 |
||
386 |
||
387 |
||
388 |
||
389 |
icallback.Start(); |
|
390 |
||
391 |
||
392 |
||
393 |
||
394 |
LogInterface->Close() ; |
|
395 |
delete ServiceHandler; |
|
396 |
// delete crit; |
|
397 |
||
398 |
a.ResetAndDestroy(); |
|
399 |
a.Close(); |
|
400 |
||
401 |
||
402 |
||
403 |
||
44
0b68a1b0c15e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
404 |
|
5 | 405 |
} |
406 |
||
407 |
||
408 |
||
409 |
||
410 |
||
411 |
||
412 |
||
413 |
||
414 |
||
415 |
||
416 |
||
417 |
||
418 |
||
419 |
||
420 |
||
421 |
||
422 |
||
423 |