author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 15 Mar 2010 12:43:25 +0200 | |
branch | RCL_3 |
changeset 50 | 5dae2c62e9b6 |
parent 37 | 5d0ec8b709be |
child 56 | c210248fa89d |
permissions | -rw-r--r-- |
19 | 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 ; |
|
37
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
196 |
CLogViewEvent* iLogViewEvent; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
197 |
CLogFilter* iFilter; |
19 | 198 |
|
199 |
}; |
|
200 |
||
201 |
/** |
|
202 |
* Notify Callback class, used to get notifications for async events |
|
203 |
*/ |
|
204 |
||
205 |
class MLoggingCallback |
|
206 |
{ |
|
207 |
||
208 |
public : |
|
209 |
||
210 |
/** |
|
211 |
* HandleNotifyL , generic method to get updates on the async |
|
212 |
* methods |
|
213 |
* @param aTransId , Transaction id |
|
214 |
* @param aStatus |
|
215 |
* @param iter , Logging iterator |
|
216 |
*/ |
|
217 |
virtual void HandleNotifyL(TUint aTransid ,TUint aStatus , CLogIter *iter ) = 0 ; |
|
37
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
218 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
219 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
220 |
* HandleReqeustL , method to get output on notification |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
221 |
* methods |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
222 |
* @param aTransId , Transaction id |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
223 |
* @param aStatus |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
224 |
* @param aLogEvent , event containing the output |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
225 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
226 |
virtual void HandleReqeustL(TUint aTransid, TUint aStatus, CLogsEvent *aLogEvent) = 0; |
19 | 227 |
|
228 |
/** |
|
229 |
* CancelNotifyL , generic method to get updates on the async |
|
230 |
* methods |
|
231 |
* |
|
232 |
* @param aTransId , Transaction id |
|
233 |
*/ |
|
234 |
||
235 |
virtual void CancelNotifyL(TUint aTransid) = 0 ; |
|
236 |
||
237 |
/** |
|
238 |
* Default Desturctor |
|
239 |
*/ |
|
240 |
||
241 |
virtual ~MLoggingCallback() |
|
242 |
{ |
|
243 |
; |
|
244 |
} |
|
245 |
||
246 |
} ; |
|
247 |
||
37
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
248 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
249 |
* Utility class for waiting for asychronous requests |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
250 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
251 |
class CAsyncWaiter : public CActive |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
252 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
253 |
public: |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
254 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
255 |
* Two-phased constructor. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
256 |
* @param aPriority set aPriority to EPriorityStandard |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
257 |
* @return CAsyncWaiter object |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
258 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
259 |
static CAsyncWaiter* NewL( TInt aPriority = EPriorityStandard ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
260 |
static CAsyncWaiter* NewLC( TInt aPriority = EPriorityStandard ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
261 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
262 |
* Destructor. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
263 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
264 |
~CAsyncWaiter(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
265 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
266 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
267 |
* Starts the active scheduler. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
268 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
269 |
void StartAndWait(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
270 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
271 |
* Starts the active scheduler. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
272 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
273 |
TInt Result() const; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
274 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
275 |
private: |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
276 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
277 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
278 |
* Constructor. |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
279 |
* @param aPriority |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
280 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
281 |
CAsyncWaiter( TInt aPriority ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
282 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
283 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
284 |
* Inherited from CActive class |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
285 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
286 |
void RunL(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
287 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
288 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
289 |
* Inherited from CActive class |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
290 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
291 |
void DoCancel(); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
292 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
293 |
private: |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
294 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
295 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
296 |
* wait scheduler |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
297 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
298 |
CActiveSchedulerWait iWait; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
299 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
300 |
/** |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
301 |
* error |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
302 |
*/ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
303 |
TInt iError; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
304 |
}; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
305 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
306 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
307 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
308 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
309 |
|
19 | 310 |
#endif |