|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Includes logging asynchronous core class methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef LOGGINGASYNCSERVICE_H |
|
19 #define LOGGINGASYNCSERVICE_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <logcli.h> |
|
23 #include <logview.h> |
|
24 #include <f32file.h> |
|
25 #include <logwrap.h> |
|
26 |
|
27 enum |
|
28 { |
|
29 EAddEvent , |
|
30 EAddEventType, |
|
31 EDeleteEvent , |
|
32 EReadEvents , |
|
33 ESleep , |
|
34 EGetRecent , |
|
35 ENotification , |
|
36 EGetEvent, |
|
37 EErrorEvent, |
|
38 }; |
|
39 |
|
40 /** |
|
41 * Forward Declaration |
|
42 */ |
|
43 |
|
44 class MLoggingCallback ; |
|
45 class CLogsEvent ; |
|
46 class CLogsFilter ; |
|
47 class CLogIter ; |
|
48 |
|
49 /** |
|
50 * Core class which deals with all the async methods |
|
51 */ |
|
52 |
|
53 class CLogAsyncService : public CActive |
|
54 { |
|
55 public: |
|
56 |
|
57 /** |
|
58 * NewL: Two phased construction |
|
59 */ |
|
60 |
|
61 IMPORT_C static CLogAsyncService* NewL( MLoggingCallback* aCallback = NULL ) ; |
|
62 |
|
63 /** |
|
64 * NewLC: Creates an instance of CLogSyncServiceClass |
|
65 * Two Phased constructor |
|
66 * returns newly allocated object. |
|
67 */ |
|
68 |
|
69 static CLogAsyncService* NewLC( MLoggingCallback* aCallback ) ; |
|
70 |
|
71 /** |
|
72 * Async AddEvent function. adds an Event asynchronously |
|
73 * do event database |
|
74 * @param aEvent, details of the event to be added to the |
|
75 * event database |
|
76 */ |
|
77 |
|
78 IMPORT_C void AddL( TUint aTransId ,CLogEvent* aEvent ) ; |
|
79 |
|
80 /** |
|
81 * Deletes a event from the event database |
|
82 * @param aLogId Event id of the event in the database |
|
83 * @param aFilter, search criteria for this event in event database |
|
84 */ |
|
85 |
|
86 IMPORT_C void Delete( TUint aTransId , TLogId aLogId ) ; |
|
87 |
|
88 /** |
|
89 * Gets the Events list asynchronously |
|
90 * @param aFilter: Query Criteria |
|
91 * @param aCallback: callback address |
|
92 */ |
|
93 |
|
94 IMPORT_C void GetListL( TUint aTransId , CLogFilter *aFilter ) ; |
|
95 |
|
96 /** |
|
97 * Read recent Events from the database |
|
98 * |
|
99 * @param Transaction id of the async event |
|
100 * @param RecentList |
|
101 * @param Filter for events to appear in the view. |
|
102 */ |
|
103 |
|
104 TBool ReadRecentEventsL( TUint aTransId , |
|
105 TLogRecentList aRecentList , |
|
106 const CLogFilter *aFilter = NULL ) ; |
|
107 |
|
108 /** |
|
109 * Notify Update: Notifies the updates happening to |
|
110 * logdatabase. |
|
111 * |
|
112 * @param aDelay, minium duration for reciving the updates |
|
113 */ |
|
114 |
|
115 IMPORT_C void NotifyUpdates( TUint aTransId ,TTimeIntervalMicroSeconds32 aDelay ) ; |
|
116 |
|
117 /** |
|
118 * Gets the details of the event, as specified by the input |
|
119 * paramater |
|
120 * |
|
121 * @param, Transactoin id of the asynchronous event |
|
122 * @param, details of the event to be fetched from the database |
|
123 */ |
|
124 |
|
125 IMPORT_C void GetEventL( TUint aTransId , CLogEvent* aEvent ) ; |
|
126 |
|
127 /** |
|
128 * SetInterval function |
|
129 */ |
|
130 |
|
131 inline void SetInterval( TTimeIntervalMicroSeconds32 aInterval ) |
|
132 { |
|
133 iInterval = aInterval ; |
|
134 } |
|
135 |
|
136 /** |
|
137 * Default Desturctor |
|
138 */ |
|
139 |
|
140 ~CLogAsyncService() ; |
|
141 |
|
142 |
|
143 protected : |
|
144 |
|
145 /** |
|
146 * Protected constructor |
|
147 */ |
|
148 |
|
149 CLogAsyncService() ; |
|
150 |
|
151 /** |
|
152 * ConstructL Method to construct the class members |
|
153 */ |
|
154 |
|
155 void ConstructL(MLoggingCallback* aCallback) ; |
|
156 |
|
157 /** |
|
158 * DoInitalise Method to intalise the class members |
|
159 */ |
|
160 |
|
161 void DoInitialiseL() ; |
|
162 |
|
163 /** |
|
164 * From CActive |
|
165 */ |
|
166 |
|
167 void DoCancel() ; |
|
168 |
|
169 /** |
|
170 * From CActive |
|
171 */ |
|
172 |
|
173 void RunL() ; |
|
174 |
|
175 /** |
|
176 * RunCmL method |
|
177 */ |
|
178 |
|
179 void RunCmdL() ; |
|
180 |
|
181 |
|
182 private : |
|
183 |
|
184 /** |
|
185 * Members of AsyncService Class |
|
186 */ |
|
187 |
|
188 CLogClient* iLogClient ; |
|
189 MLoggingCallback* iCallback ; |
|
190 TUint iTransId ; |
|
191 CLogsEvent *iUpdatedEvent ; |
|
192 CLogIter* iIter ; |
|
193 TInt iTask ; |
|
194 RFs iFs ; |
|
195 TTimeIntervalMicroSeconds32 iInterval ; |
|
196 |
|
197 }; |
|
198 |
|
199 /** |
|
200 * Notify Callback class, used to get notifications for async events |
|
201 */ |
|
202 |
|
203 class MLoggingCallback |
|
204 { |
|
205 |
|
206 public : |
|
207 |
|
208 /** |
|
209 * HandleNotifyL , generic method to get updates on the async |
|
210 * methods |
|
211 * @param aTransId , Transaction id |
|
212 * @param aStatus |
|
213 * @param iter , Logging iterator |
|
214 */ |
|
215 virtual void HandleNotifyL(TUint aTransid ,TUint aStatus , CLogIter *iter ) = 0 ; |
|
216 |
|
217 /** |
|
218 * CancelNotifyL , generic method to get updates on the async |
|
219 * methods |
|
220 * |
|
221 * @param aTransId , Transaction id |
|
222 */ |
|
223 |
|
224 virtual void CancelNotifyL(TUint aTransid) = 0 ; |
|
225 |
|
226 /** |
|
227 * Default Desturctor |
|
228 */ |
|
229 |
|
230 virtual ~MLoggingCallback() |
|
231 { |
|
232 ; |
|
233 } |
|
234 |
|
235 } ; |
|
236 |
|
237 #endif |