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 |
|
|
18 |
#include <e32svr.h>
|
|
19 |
#include "tloggingservicetest.h"
|
|
20 |
#include <logcli.h>
|
|
21 |
#include <logwrap.h>
|
|
22 |
|
|
23 |
#include "loggingasyncservice.h"
|
|
24 |
#include "loggingsyncservice.h"
|
|
25 |
#include "loggingfilter.h"
|
|
26 |
#include "loggingservice.h"
|
|
27 |
#include "loggingevent.h"
|
|
28 |
#include "tlogcallback.h"
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
#include "logiter.h"
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
_LIT(KOwnEventSubject, "RandomLogiLogsEvent");
|
|
38 |
_LIT(KOwnEventRemoteParty, "OwnContact");
|
|
39 |
|
|
40 |
|
|
41 |
//getlist1()
|
|
42 |
|
|
43 |
|
|
44 |
TInt getlist1(void )
|
|
45 |
{
|
|
46 |
|
|
47 |
CLoggingService *iLoggingService = CLoggingService :: NewL() ;
|
|
48 |
MLogCallback icallback ;
|
|
49 |
|
|
50 |
CLogsFilter *iLogsFilter = CLogsFilter :: NewL() ;
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
iLogsFilter->SetRequestType(EReadEvents) ;
|
|
55 |
|
|
56 |
iLoggingService->GetListL(1 , iLogsFilter , &icallback) ;
|
|
57 |
|
|
58 |
icallback.Start() ;
|
|
59 |
|
|
60 |
delete iLogsFilter ;
|
|
61 |
delete iLoggingService ;
|
|
62 |
return KErrNone;
|
|
63 |
}
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
//getlist2()
|
|
68 |
|
|
69 |
|
|
70 |
TInt getlist2(void )
|
|
71 |
{
|
|
72 |
|
|
73 |
CLoggingService *iLoggingService = CLoggingService :: NewL() ;
|
|
74 |
MLogCallback icallback ;
|
|
75 |
|
|
76 |
CLogsFilter *iLogsFilter = CLogsFilter :: NewL() ;
|
|
77 |
CLogsEvent* iLogsEvent = CLogsEvent::NewL();
|
|
78 |
|
|
79 |
|
|
80 |
iLogsFilter->SetRequestType(EReadEvents) ;
|
|
81 |
//iLoggingService->SetFilterL(iLogsFilter);
|
|
82 |
|
|
83 |
TUid tuid = KLogCallEventTypeUid;
|
|
84 |
iLogsEvent->SetEventType(tuid);
|
|
85 |
|
|
86 |
// TLogId id= iLoggingService->AddEventL(iLogsEvent) ;
|
|
87 |
|
|
88 |
// iLogsEvent->SetId(id) ;
|
|
89 |
|
|
90 |
// CLogsFilter *filter = CLogsFilter :: NewL() ;
|
|
91 |
|
|
92 |
// filter->SetRequestType(EGetEvent) ;
|
|
93 |
iLogsFilter->SetEventL(iLogsEvent) ;
|
|
94 |
// CLogIter *iter;
|
|
95 |
|
|
96 |
iLoggingService->GetListL(1 ,iLogsFilter , &icallback) ;
|
|
97 |
|
|
98 |
|
|
99 |
icallback.Start() ;
|
|
100 |
//iter->DoCancel();
|
|
101 |
//delete iter;
|
|
102 |
delete iLogsEvent;
|
|
103 |
delete iLogsFilter ;
|
|
104 |
delete iLoggingService ;
|
|
105 |
return KErrNone;
|
|
106 |
}
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
//getlist3()
|
|
117 |
|
|
118 |
|
|
119 |
TInt getlist4(void )
|
|
120 |
{
|
|
121 |
|
|
122 |
CLoggingService *iLoggingService = CLoggingService :: NewL() ;
|
|
123 |
|
|
124 |
TUint iTransid = 0;
|
|
125 |
// iLoggingService->CancelServiceL(iTransid);
|
|
126 |
delete iLoggingService;
|
|
127 |
return KErrNone;
|
|
128 |
|
|
129 |
|
|
130 |
}
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
TInt getevent1(void )
|
|
138 |
{
|
|
139 |
|
|
140 |
|
|
141 |
CLoggingService *iLoggingService = CLoggingService :: NewL() ;
|
|
142 |
|
|
143 |
CLogsEvent* iLogsEvent = CLogsEvent::NewL();
|
|
144 |
//CLogSyncService *iLoggingsyncservice = CLogSyncService::NewL();
|
|
145 |
|
|
146 |
iLogsEvent->SetDuration(301);
|
|
147 |
|
|
148 |
TBuf<KLogMaxDirectionLength> direction;
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
TUid eventTypeID = KLogCallEventTypeUid;
|
|
153 |
iLogsEvent->SetEventType(eventTypeID);
|
|
154 |
iLogsEvent->SetSubject(KOwnEventSubject);
|
|
155 |
TTime time; // creation time from the device clock
|
|
156 |
time.HomeTime();
|
|
157 |
iLogsEvent->SetTime(time);
|
|
158 |
|
|
159 |
TBuf<KLogMaxNumberLength> number; // Randomize number
|
|
160 |
number.AppendNum(7000008);
|
|
161 |
iLogsEvent->SetNumber(number);
|
|
162 |
iLogsEvent->SetRemoteParty(KOwnEventRemoteParty);
|
|
163 |
|
|
164 |
TLogId id= iLoggingService->AddEventL(iLogsEvent) ;
|
|
165 |
|
|
166 |
iLogsEvent->SetId(id) ;
|
|
167 |
|
|
168 |
CLogsFilter *filter = CLogsFilter :: NewL() ;
|
|
169 |
|
|
170 |
filter->SetRequestType(EGetEvent) ;
|
|
171 |
filter->SetEventL(iLogsEvent) ;
|
|
172 |
|
|
173 |
|
|
174 |
CLogIter *iter;// = CLogIter::NewL();
|
|
175 |
iter = iLoggingService->GetListL(filter) ;
|
|
176 |
CLogsEvent *iterevents ;
|
|
177 |
|
|
178 |
while (iterevents = iter->NextL())
|
|
179 |
{
|
|
180 |
iLoggingService->DeleteEventL(iterevents->Id()) ;
|
|
181 |
delete iterevents ;
|
|
182 |
}
|
|
183 |
|
|
184 |
iter->DoCancel();
|
|
185 |
delete iter ;
|
|
186 |
|
|
187 |
delete filter ;
|
|
188 |
delete iLogsEvent ;
|
|
189 |
delete iLoggingService ;
|
|
190 |
return KErrNone ;
|
|
191 |
}
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
//getlist1()
|
|
202 |
|
|
203 |
|
|
204 |
TInt getevent2(void )
|
|
205 |
{
|
|
206 |
|
|
207 |
CLoggingService *iLoggingService = CLoggingService :: NewL() ;
|
|
208 |
MLogCallback icallback ;
|
|
209 |
|
|
210 |
CLogsFilter *iLogsFilter = CLogsFilter :: NewL() ;
|
|
211 |
CLogsEvent* iLogsEvent = CLogsEvent::NewL();
|
|
212 |
|
|
213 |
TUid eventTypeID = KLogCallEventTypeUid;
|
|
214 |
iLogsEvent->SetEventType(eventTypeID);
|
|
215 |
iLogsEvent->SetStatus(R_LOG_DEL_NONE);
|
|
216 |
iLogsFilter->SetRequestType(EGetEvent) ;
|
|
217 |
iLogsFilter->SetStatus(R_LOG_DEL_NONE);
|
|
218 |
|
|
219 |
TLogId id= iLoggingService->AddEventL(iLogsEvent) ;
|
|
220 |
|
|
221 |
iLogsEvent->SetId(id) ;
|
|
222 |
iLogsFilter->SetEventL(iLogsEvent) ;
|
|
223 |
//if(iLogsEvent)
|
|
224 |
iLoggingService->GetListL(1 , iLogsFilter , &icallback) ;
|
|
225 |
|
|
226 |
icallback.Start() ;
|
|
227 |
|
|
228 |
delete iLogsEvent;
|
|
229 |
delete iLogsFilter ;
|
|
230 |
delete iLoggingService ;
|
|
231 |
return KErrNone;
|
|
232 |
}
|
|
233 |
|
|
234 |
|
|
235 |
TInt getevent3(void )
|
|
236 |
{
|
|
237 |
|
|
238 |
|
|
239 |
CLoggingService *iLoggingService = CLoggingService :: NewL() ;
|
|
240 |
|
|
241 |
CLogsEvent* iLogsEvent = CLogsEvent::NewL();
|
|
242 |
//CLogSyncService *iLoggingsyncservice = CLogSyncService::NewL();
|
|
243 |
|
|
244 |
iLogsEvent->SetDuration(301);
|
|
245 |
|
|
246 |
TBuf<KLogMaxDirectionLength> direction;
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
TUid eventTypeID = KLogCallEventTypeUid;
|
|
251 |
iLogsEvent->SetEventType(eventTypeID);
|
|
252 |
iLogsEvent->SetSubject(KOwnEventSubject);
|
|
253 |
TTime time; // creation time from the device clock
|
|
254 |
time.HomeTime();
|
|
255 |
iLogsEvent->SetTime(time);
|
|
256 |
|
|
257 |
TBuf<KLogMaxNumberLength> number; // Randomize number
|
|
258 |
number.AppendNum(7000008);
|
|
259 |
iLogsEvent->SetNumber(number);
|
|
260 |
iLogsEvent->SetRemoteParty(KOwnEventRemoteParty);
|
|
261 |
|
|
262 |
TLogId id= iLoggingService->AddEventL(iLogsEvent) ;
|
|
263 |
|
|
264 |
iLogsEvent->SetId(id) ;
|
|
265 |
|
|
266 |
CLogsFilter *filter = CLogsFilter :: NewL() ;
|
|
267 |
|
|
268 |
filter->SetRequestType(EReadEvents) ;
|
|
269 |
filter->SetEventL(iLogsEvent) ;
|
|
270 |
|
|
271 |
|
|
272 |
CLogIter *iter;// = CLogIter::NewL();
|
|
273 |
iter = iLoggingService->GetListL(filter) ;
|
|
274 |
//CLogsEvent *iterevents ;
|
|
275 |
|
|
276 |
// while (iterevents = iter->NextL())
|
|
277 |
// {
|
|
278 |
//iLoggingService->DeleteEventL(iterevents->Id()) ;
|
|
279 |
// delete iterevents ;
|
|
280 |
//}
|
|
281 |
|
|
282 |
//iter->DoCancel();
|
|
283 |
delete iter ;
|
|
284 |
|
|
285 |
delete filter ;
|
|
286 |
delete iLogsEvent ;
|
|
287 |
delete iLoggingService ;
|
|
288 |
return KErrNone ;
|
|
289 |
}
|
|
290 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
TInt getevent4(void )
|
|
295 |
{
|
|
296 |
|
|
297 |
|
|
298 |
CLoggingService *iLoggingService = CLoggingService :: NewL() ;
|
|
299 |
|
|
300 |
CLogsEvent* iLogsEvent = CLogsEvent::NewL();
|
|
301 |
//CLogSyncService *iLoggingsyncservice = CLogSyncService::NewL();
|
|
302 |
|
|
303 |
iLogsEvent->SetDuration(301);
|
|
304 |
|
|
305 |
TBuf<KLogMaxDirectionLength> direction;
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
TUid eventTypeID = KLogCallEventTypeUid;
|
|
310 |
iLogsEvent->SetEventType(eventTypeID);
|
|
311 |
iLogsEvent->SetSubject(KOwnEventSubject);
|
|
312 |
TTime time; // creation time from the device clock
|
|
313 |
time.HomeTime();
|
|
314 |
iLogsEvent->SetTime(time);
|
|
315 |
|
|
316 |
TBuf<KLogMaxNumberLength> number; // Randomize number
|
|
317 |
number.AppendNum(7000008);
|
|
318 |
iLogsEvent->SetNumber(number);
|
|
319 |
iLogsEvent->SetRemoteParty(KOwnEventRemoteParty);
|
|
320 |
|
|
321 |
TLogId id= iLoggingService->AddEventL(iLogsEvent) ;
|
|
322 |
|
|
323 |
iLogsEvent->SetId(id) ;
|
|
324 |
|
|
325 |
CLogsFilter *filter = CLogsFilter :: NewL() ;
|
|
326 |
|
|
327 |
filter->SetRequestType(EGetRecent) ;
|
|
328 |
filter->SetRecentList(KLogNullRecentList) ;
|
|
329 |
filter->SetEventL(iLogsEvent) ;
|
|
330 |
|
|
331 |
|
|
332 |
CLogIter *iter;// = CLogIter::NewL();
|
|
333 |
iter = iLoggingService->GetListL(filter) ;
|
|
334 |
CLogsEvent *iterevents = CLogsEvent::NewL() ;
|
|
335 |
|
|
336 |
//while (iterevents = iter->NextL())
|
|
337 |
//{
|
|
338 |
//iLoggingService->DeleteEventL(iterevents->Id()) ;
|
|
339 |
delete iterevents ;
|
|
340 |
//}
|
|
341 |
|
|
342 |
iter->DoCancel();
|
|
343 |
delete iter ;
|
|
344 |
|
|
345 |
delete filter ;
|
|
346 |
delete iLogsEvent ;
|
|
347 |
delete iLoggingService ;
|
|
348 |
return KErrNone ;
|
|
349 |
}
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
|
|
355 |
|
|
356 |
|
|
357 |
TInt getevent5(void )
|
|
358 |
{
|
|
359 |
|
|
360 |
|
|
361 |
CLoggingService *iLoggingService = CLoggingService :: NewL() ;
|
|
362 |
|
|
363 |
CLogsEvent* iLogsEvent = CLogsEvent::NewL();
|
|
364 |
//CLogSyncService *iLoggingsyncservice = CLogSyncService::NewL();
|
|
365 |
|
|
366 |
iLogsEvent->SetDuration(301);
|
|
367 |
|
|
368 |
TBuf<KLogMaxDirectionLength> direction;
|
|
369 |
|
|
370 |
|
|
371 |
|
|
372 |
TUid eventTypeID = KLogCallEventTypeUid;
|
|
373 |
iLogsEvent->SetEventType(eventTypeID);
|
|
374 |
iLogsEvent->SetSubject(KOwnEventSubject);
|
|
375 |
TTime time; // creation time from the device clock
|
|
376 |
time.HomeTime();
|
|
377 |
iLogsEvent->SetTime(time);
|
|
378 |
|
|
379 |
TBuf<KLogMaxNumberLength> number; // Randomize number
|
|
380 |
number.AppendNum(7000008);
|
|
381 |
iLogsEvent->SetNumber(number);
|
|
382 |
iLogsEvent->SetRemoteParty(KOwnEventRemoteParty);
|
|
383 |
|
|
384 |
TLogId id= iLoggingService->AddEventL(iLogsEvent) ;
|
|
385 |
|
|
386 |
iLogsEvent->SetId(id) ;
|
|
387 |
|
|
388 |
CLogsFilter *filter = CLogsFilter :: NewL() ;
|
|
389 |
|
|
390 |
filter->SetRequestType(ENotification) ;
|
|
391 |
filter->SetEventL(iLogsEvent) ;
|
|
392 |
|
|
393 |
|
|
394 |
//CLogIter *iter;// = CLogIter::NewL();
|
|
395 |
//iter = iLoggingService->GetListL(filter) ;
|
|
396 |
TRAPD(iter,iLoggingService->GetListL(filter));
|
|
397 |
|
|
398 |
//iter->DoCancel();
|
|
399 |
//delete iter ;
|
|
400 |
|
|
401 |
delete filter ;
|
|
402 |
delete iLogsEvent ;
|
|
403 |
delete iLoggingService ;
|
|
404 |
if(iter == -6)
|
|
405 |
return KErrNone ;
|
|
406 |
return iter;
|
|
407 |
}
|
|
408 |
|
|
409 |
|