|
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 #include <LiwServiceHandler.h> |
|
19 #include <LiwCommon.h> |
|
20 #include <e32std.h> |
|
21 #include "tprovidertest.h" |
|
22 #include "tconstants.h" |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 /** |
|
28 * Internal utility function for logging the results |
|
29 */ |
|
30 |
|
31 |
|
32 void Ctprovidertest :: taddresultsL(const TLiwGenericParam *aGenericParam ) |
|
33 { |
|
34 |
|
35 _LIT(KLogMsg , "Logging the add results ") ; |
|
36 iLog->Log(KLogMsg) ; |
|
37 |
|
38 TBuf<20> LogId = aGenericParam->Value().AsDes() ; |
|
39 //char Buff[10] ; |
|
40 |
|
41 // sprintf(Buff , "%d" , (int)LogId) ; |
|
42 |
|
43 TBuf8<30> bufid; |
|
44 bufid.Append(LogId); |
|
45 |
|
46 |
|
47 // TBuf8<20> buf((TUint8*) Buff) ; |
|
48 |
|
49 iLog->Log(bufid) ; |
|
50 |
|
51 } |
|
52 |
|
53 |
|
54 /** |
|
55 * Internal utility function for logging the results |
|
56 */ |
|
57 |
|
58 |
|
59 void Ctprovidertest :: tlogGetListL(const TLiwGenericParam *aGenericParam ) |
|
60 { |
|
61 |
|
62 _LIT(KLogMsg , "Logging the GetList results ") ; |
|
63 iLog->Log(KLogMsg) ; |
|
64 |
|
65 |
|
66 CLiwIterable *LogIter = (aGenericParam->Value()).AsIterable() ; |
|
67 TLiwVariant mapvar ; |
|
68 |
|
69 TLiwVariant eventVars ; |
|
70 // LogIter->NextL(mapvar); |
|
71 |
|
72 //TInt K =0; |
|
73 |
|
74 LogIter->Reset(); |
|
75 |
|
76 while(LogIter->NextL(mapvar)) |
|
77 { |
|
78 _LIT(KLogMsg , "Logging the EventType results ") ; |
|
79 iLog->Log(KLogMsg) ; |
|
80 const CLiwMap *eventDetails = mapvar.AsMap() ; |
|
81 |
|
82 if(eventDetails->FindL(KEventTypeKey , eventVars)) |
|
83 { |
|
84 TInt32 eventtype = eventVars.AsTInt32() ; |
|
85 // TInt32 val = eventtype.iUid ; |
|
86 |
|
87 //char Buff[20] ; |
|
88 |
|
89 TBuf8<256> buf; |
|
90 buf.Num(eventtype); |
|
91 |
|
92 |
|
93 // sprintf(Buff , "Event id %d" , (int)val) ; |
|
94 //TBuf8<20> buf((TUint8 *) Buff) ; |
|
95 iLog->Log(buf) ; |
|
96 eventVars.Reset(); |
|
97 |
|
98 } |
|
99 if(eventDetails->FindL(KRemotePartyKey , eventVars)) |
|
100 { |
|
101 TBufC<256> remoteparty=(eventVars.AsDes()) ; |
|
102 //remoteparty.Copy (eventVars.AsDes()) ; |
|
103 TBuf8<256> buf; |
|
104 buf.Copy(remoteparty); |
|
105 |
|
106 |
|
107 iLog->Log(buf) ; |
|
108 eventVars.Reset(); |
|
109 |
|
110 } |
|
111 |
|
112 if(eventDetails->FindL(KEventDurationKey , eventVars)) |
|
113 { |
|
114 _LIT(KLogMsg , "Logging the duration results ") ; |
|
115 iLog->Log(KLogMsg) ; |
|
116 TInt32 duration = eventVars.AsTInt32() ; |
|
117 // char Buff[20] ; |
|
118 TBuf8<256> buf; |
|
119 buf.Num(duration); |
|
120 // sprintf(Buff , "duration %u" ,duration ) ; |
|
121 //TBuf8<20> buf((TUint8 *) Buff) ; |
|
122 iLog->Log(buf) ; |
|
123 eventVars.Reset(); |
|
124 |
|
125 } |
|
126 |
|
127 /* if(eventDetails->FindL(KEventTimeKey , eventVars)) |
|
128 { |
|
129 |
|
130 char Buff[20] ; |
|
131 TTime t1=eventVars.AsTTime(); |
|
132 TBuf16<10> time; |
|
133 t1.FormatL(time,_L("%*C6")); |
|
134 sprintf(Buff , "Event id %s" , time) ; |
|
135 TBuf8<20> buf((TUint8 *) Buff) ; |
|
136 iLog->Log(buf) ; |
|
137 |
|
138 |
|
139 } |
|
140 |
|
141 if(eventDetails->FindL(KDeliveryStatusKey , eventVars)) |
|
142 { |
|
143 TBufC<20> status(eventVars.AsDes()) ; |
|
144 |
|
145 char Buff[20] ; |
|
146 |
|
147 |
|
148 sprintf(Buff , "status %d" , status) ; |
|
149 TBuf8<20> buf((TUint8 *) Buff) ; |
|
150 iLog->Log(buf) ; |
|
151 |
|
152 |
|
153 }*/ |
|
154 |
|
155 if(eventDetails->FindL(KSubjectKey , eventVars)) |
|
156 { |
|
157 _LIT(KLogMsg , "Logging the subject results ") ; |
|
158 iLog->Log(KLogMsg) ; |
|
159 TBufC<256> subject=(eventVars.AsDes()) ; |
|
160 TBuf8<256> buf; |
|
161 buf.Copy(subject); |
|
162 |
|
163 iLog->Log(buf) ; |
|
164 eventVars.Reset(); |
|
165 |
|
166 } |
|
167 |
|
168 if(eventDetails->FindL(KPhoneNumberKey , eventVars)) |
|
169 { |
|
170 TBufC<256> number=(eventVars.AsDes()) ; |
|
171 |
|
172 |
|
173 //sprintf(Buff , "number %d" ,number) ; |
|
174 TBuf8<256> buf; |
|
175 buf.Copy(number); |
|
176 iLog->Log(buf) ; |
|
177 eventVars.Reset(); |
|
178 |
|
179 } |
|
180 |
|
181 if(eventDetails->FindL(KContactidKey , eventVars)) |
|
182 { |
|
183 _LIT(KLogMsg , "Logging the contact results ") ; |
|
184 iLog->Log(KLogMsg) ; |
|
185 TInt32 contactid = eventVars.AsTInt32() ; |
|
186 |
|
187 //char Buff[20] ; |
|
188 TBuf8<256> buf; |
|
189 buf.Num(contactid); |
|
190 |
|
191 |
|
192 // sprintf(Buff , "contact id %d" , contactid) ; |
|
193 //TBuf8<20> buf((TUint8 *) Buff) ; |
|
194 iLog->Log(buf) ; |
|
195 eventVars.Reset(); |
|
196 |
|
197 } |
|
198 |
|
199 if(eventDetails->FindL(KDescriptionKey , eventVars)) |
|
200 { |
|
201 TBufC<256> description=(eventVars.AsDes()) ; |
|
202 |
|
203 |
|
204 |
|
205 TBuf8<256> buf ; |
|
206 buf.Copy(description); |
|
207 iLog->Log(buf) ; |
|
208 eventVars.Reset(); |
|
209 |
|
210 } |
|
211 |
|
212 if(eventDetails->FindL(KLinkKey , eventVars)) |
|
213 { |
|
214 TInt32 link = eventVars.AsTInt32() ; |
|
215 |
|
216 //char Buff[20] ; |
|
217 |
|
218 TBuf8<256> buf; |
|
219 buf.Num(link); |
|
220 |
|
221 |
|
222 // sprintf(Buff , "link %u" ,link) ; |
|
223 //TBuf8<20> buf((TUint8 *) Buff) ; |
|
224 iLog->Log(buf) ; |
|
225 eventVars.Reset(); |
|
226 |
|
227 } |
|
228 if(eventDetails->FindL(KDirectionKey , eventVars)) |
|
229 { |
|
230 TInt32 direction = eventVars.AsTInt32() ; |
|
231 |
|
232 //char Buff[20] ; |
|
233 |
|
234 TBuf8<256> buf; |
|
235 buf.Num(direction); |
|
236 |
|
237 |
|
238 // sprintf(Buff , "link %u" ,link) ; |
|
239 //TBuf8<20> buf((TUint8 *) Buff) ; |
|
240 iLog->Log(buf) ; |
|
241 eventVars.Reset(); |
|
242 |
|
243 } |
|
244 if(eventDetails->FindL(KDeliveryStatusKey , eventVars)) |
|
245 { |
|
246 TInt32 status = eventVars.AsTInt32() ; |
|
247 |
|
248 //char Buff[20] ; |
|
249 |
|
250 TBuf8<256> buf; |
|
251 buf.Num(status); |
|
252 |
|
253 |
|
254 // sprintf(Buff , "link %u" ,link) ; |
|
255 //TBuf8<20> buf((TUint8 *) Buff) ; |
|
256 iLog->Log(buf) ; |
|
257 eventVars.Reset(); |
|
258 |
|
259 } |
|
260 if(eventDetails->FindL(KLogId , eventVars)) |
|
261 { |
|
262 // TInt32 id = eventVars.AsTInt32() ; |
|
263 TBuf<20> id = eventVars.AsDes() ; |
|
264 //char Buff[20] ; |
|
265 |
|
266 TBuf8<256> buf; |
|
267 buf.Append(id); |
|
268 |
|
269 |
|
270 // sprintf(Buff , "link %u" ,link) ; |
|
271 //TBuf8<20> buf((TUint8 *) Buff) ; |
|
272 iLog->Log(buf) ; |
|
273 eventVars.Reset(); |
|
274 |
|
275 } |
|
276 |
|
277 if(eventDetails->FindL(KEventDataKey , eventVars)) |
|
278 { |
|
279 TBufC8<256> data=(eventVars.AsData()) ; |
|
280 |
|
281 TBuf8<256> buf ; |
|
282 buf.Copy(data); |
|
283 iLog->Log(buf) ; |
|
284 eventVars.Reset(); |
|
285 |
|
286 } |
|
287 |
|
288 (const_cast<CLiwMap *>(eventDetails))->DecRef() ; |
|
289 |
|
290 mapvar.Reset(); |
|
291 } |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 // eventVars.Reset(); |
|
297 // mapvar.Reset(); |
|
298 // LogIter->Reset(); |
|
299 //LogIter->DecRef(); |
|
300 |
|
301 } |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 /** |
|
307 * Internal utility function for logging the results |
|
308 */ |
|
309 |
|
310 |
|
311 void Ctprovidertest :: tlogresultsL(const TLiwGenericParam *aGenericParam , TInt aRequestType) |
|
312 { |
|
313 |
|
314 switch (aRequestType) |
|
315 { |
|
316 case EAddEvent : |
|
317 { |
|
318 taddresultsL(aGenericParam) ; |
|
319 } |
|
320 break ; |
|
321 |
|
322 case EGetList : |
|
323 { |
|
324 tlogGetListL(aGenericParam) ; |
|
325 } |
|
326 break ; |
|
327 } |
|
328 |
|
329 } |
|
330 |