|
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 <e32std.h> |
|
20 #include <StifParser.h> |
|
21 #include <Stiftestinterface.h> |
|
22 #include <logcli.h> |
|
23 #include <logwrap.h> |
|
24 |
|
25 #include "loggingasyncservice.h" |
|
26 #include "loggingservice.h" |
|
27 #include "loggingfilter.h" |
|
28 #include "logiter.h" |
|
29 |
|
30 #include "loggingevent.h" |
|
31 |
|
32 #include "tlogging.h" |
|
33 |
|
34 _LIT(KOwnEventSubject, "RandomLogEvent"); |
|
35 _LIT(KOwnEventRemoteParty, "OwnContact"); |
|
36 |
|
37 |
|
38 TInt DeleteEventsync(void) |
|
39 { |
|
40 |
|
41 |
|
42 |
|
43 CLoggingService *LogService = CLoggingService :: NewL() ; |
|
44 |
|
45 CLogsEvent* event = CLogsEvent::NewL(); |
|
46 |
|
47 // Sets the duration of the event in seconds. |
|
48 // Randomize something between 0-299 |
|
49 |
|
50 event->SetDuration(300); |
|
51 |
|
52 TBuf<KLogMaxDirectionLength> direction; |
|
53 |
|
54 // Direction of the event is randomized |
|
55 |
|
56 TInt dirID = R_LOG_DIR_IN; |
|
57 TUid eventTypeID = KLogCallEventTypeUid; |
|
58 event->SetEventType(eventTypeID); |
|
59 event->SetSubject(KOwnEventSubject); |
|
60 TTime time; // creation time from the device clock |
|
61 time.HomeTime(); |
|
62 event->SetTime(time); |
|
63 |
|
64 TBuf<KLogMaxNumberLength> number; // Randomize number |
|
65 number.AppendNum(7000000); |
|
66 event->SetNumber(number); |
|
67 event->SetRemoteParty(KOwnEventRemoteParty); |
|
68 |
|
69 CLogIter *iter ; |
|
70 CLogsFilter *filter = CLogsFilter :: NewL() ; |
|
71 |
|
72 filter->SetRequestType(EReadEvents) ; |
|
73 |
|
74 CLogsEvent *aEvent ; |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 iter = LogService->GetListL(filter) ; |
|
80 |
|
81 |
|
82 while (aEvent = iter->NextL()) |
|
83 { |
|
84 LogService->DeleteEventL(aEvent->Id()) ; |
|
85 delete aEvent ; |
|
86 } |
|
87 |
|
88 delete iter ; |
|
89 //TLogId ret=LogService->AddEventL(event) ; |
|
90 //TInt ret1 = LogService->DeleteEventL(ret); |
|
91 |
|
92 //CLogsEvent *DeletedEvent = CLogsEvent :: NewL() ; |
|
93 |
|
94 //DeletedEvent->SetId(ret) ; |
|
95 |
|
96 // ret = LogService->GetEvent(DeletedEvent); |
|
97 delete filter ; |
|
98 |
|
99 TInt count = 0 ; |
|
100 // delete DeletedEvent; |
|
101 delete event ; |
|
102 delete LogService ; |
|
103 |
|
104 return KErrNone ; |
|
105 } |