|
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 #include "logiter.h" |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 //addevents1() |
|
40 |
|
41 |
|
42 TInt addevents1(void ) |
|
43 { |
|
44 |
|
45 CLoggingService *iLoggingService = CLoggingService::NewL(); |
|
46 CLogsEvent *iLogsEvent = CLogsEvent::NewL(); |
|
47 MLogCallback icallback; |
|
48 |
|
49 |
|
50 TInt error1 = iLoggingService->AddEventL(iLogsEvent); |
|
51 iLogsEvent->SetDuration(300); |
|
52 TRAPD(ret2, iLoggingService->AddEventL(iLogsEvent)); |
|
53 TUid tuid = KLogCallEventTypeUid; |
|
54 iLogsEvent->SetEventType(tuid); |
|
55 TInt error2= iLoggingService->AddEventL(iLogsEvent); |
|
56 iLogsEvent->SetSubject(_L("Testing")); |
|
57 TRAPD(ret4, iLoggingService->AddEventL(iLogsEvent)); |
|
58 TTime itime; |
|
59 itime.HomeTime(); |
|
60 iLogsEvent->SetTime(itime); |
|
61 TRAPD(ret5, iLoggingService->AddEventL(iLogsEvent)); |
|
62 |
|
63 TBuf<KLogMaxNumberLength> number; // Randomize number |
|
64 number.AppendNum(9886665142); |
|
65 iLogsEvent->SetNumber(number); |
|
66 iLogsEvent->SetDirection(R_LOG_DIR_IN); |
|
67 iLogsEvent->SetRemoteParty(_L("contact")); |
|
68 |
|
69 TRAPD(ret6, iLoggingService->AddEventL(iLogsEvent)); |
|
70 |
|
71 |
|
72 |
|
73 // TRAPD(ret7, iLoggingService->AddEventL(iLogsEvent)); |
|
74 |
|
75 TInt iint = 0; |
|
76 |
|
77 |
|
78 //TLogId ret8= iLoggingService->AddEventL(iLogsEvent); |
|
79 // iLoggingService->DeleteEventL(1 , ret8 ,&icallback); |
|
80 // icallback.Start() ; |
|
81 |
|
82 CLogsEvent *DeletedEvent = CLogsEvent :: NewL() ; |
|
83 // DeletedEvent->SetId(ret8) ; |
|
84 |
|
85 delete iLogsEvent; |
|
86 delete iLoggingService; |
|
87 delete DeletedEvent; |
|
88 |
|
89 if(error1<0) |
|
90 if(error2>0) |
|
91 if(ret2==0) |
|
92 if(ret4==0) |
|
93 if(ret5==0) |
|
94 if(ret6==0) |
|
95 // if(ret7==0) |
|
96 // if(ret8>0) |
|
97 |
|
98 |
|
99 return KErrNone; |
|
100 return KErrGeneral; |
|
101 |
|
102 } |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 //addevents2() |
|
112 |
|
113 |
|
114 TInt addevents2(void ) |
|
115 { |
|
116 |
|
117 CLoggingService *iLoggingService = CLoggingService::NewL(); |
|
118 CLogsEvent *iLogsEvent = CLogsEvent::NewL(); |
|
119 MLogCallback icallback; |
|
120 const TUid KLogtestEventTypeUid = {0x1000550C}; |
|
121 |
|
122 iLogsEvent->SetDuration(300); |
|
123 TUid tuid = KLogtestEventTypeUid; |
|
124 // iLogsEvent->SetEventType(tuid); |
|
125 iLogsEvent->SetSubject(_L("Testing")); |
|
126 TTime itime; |
|
127 itime.HomeTime(); |
|
128 iLogsEvent->SetTime(itime); |
|
129 |
|
130 TBuf<KLogMaxNumberLength> number; // Randomize number |
|
131 number.AppendNum(919886665142); |
|
132 iLogsEvent->SetNumber(number); |
|
133 |
|
134 iLogsEvent->SetRemoteParty(_L("contact")); |
|
135 iLogsEvent->SetDirection(1); |
|
136 |
|
137 TInt error2= iLoggingService->AddEventL(iLogsEvent); |
|
138 |
|
139 // TUid tuid1 = -1; |
|
140 |
|
141 // TInt error3 = iLoggingService->AddEventL(iLogsEvent,tuid1); |
|
142 |
|
143 delete iLoggingService; |
|
144 delete iLogsEvent; |
|
145 |
|
146 if(error2<0) |
|
147 |
|
148 |
|
149 return KErrNone; |
|
150 return KErrGeneral; |
|
151 |
|
152 } |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |