sl@0
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef __LOGWRAP_H__
|
sl@0
|
17 |
#define __LOGWRAP_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32base.h>
|
sl@0
|
20 |
#include <f32file.h>
|
sl@0
|
21 |
#include <barsc2.h> // For CResourceFile
|
sl@0
|
22 |
#include <d32dbms.h>
|
sl@0
|
23 |
#include <logwrapconst.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
26 |
#include <logwraplimits.h>
|
sl@0
|
27 |
#include "logcntdef.h"
|
sl@0
|
28 |
#endif
|
sl@0
|
29 |
|
sl@0
|
30 |
#ifndef __WINC__
|
sl@0
|
31 |
#include <logwrap.rsg>
|
sl@0
|
32 |
#endif
|
sl@0
|
33 |
|
sl@0
|
34 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
35 |
/**
|
sl@0
|
36 |
Contact item ID. These are used to uniquely identify contact items within a contacts database.
|
sl@0
|
37 |
@publishedAll
|
sl@0
|
38 |
@released
|
sl@0
|
39 |
*/
|
sl@0
|
40 |
typedef TInt32 TLogContactItemId;
|
sl@0
|
41 |
|
sl@0
|
42 |
#endif
|
sl@0
|
43 |
|
sl@0
|
44 |
/**
|
sl@0
|
45 |
@publishedAll
|
sl@0
|
46 |
@released
|
sl@0
|
47 |
*/
|
sl@0
|
48 |
typedef TUint32 TLogViewId;
|
sl@0
|
49 |
|
sl@0
|
50 |
|
sl@0
|
51 |
const TLogFlags KLogNullFlags = 0;
|
sl@0
|
52 |
const TLogFlags KLogFlagsMask = 0xF;
|
sl@0
|
53 |
|
sl@0
|
54 |
|
sl@0
|
55 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
56 |
/**
|
sl@0
|
57 |
@internalAll
|
sl@0
|
58 |
*/
|
sl@0
|
59 |
const TInt KLogActiveDoNotCompleteIfActive = KMaxTInt-1;
|
sl@0
|
60 |
#endif
|
sl@0
|
61 |
|
sl@0
|
62 |
//SimId typedef. Probably the final version will import it from different header.
|
sl@0
|
63 |
typedef TUint32 TSimId;
|
sl@0
|
64 |
//"Null" SimId value.
|
sl@0
|
65 |
const TSimId KLogNullSimId = 0;
|
sl@0
|
66 |
|
sl@0
|
67 |
//**********************************
|
sl@0
|
68 |
// CLogActive
|
sl@0
|
69 |
//**********************************
|
sl@0
|
70 |
|
sl@0
|
71 |
/**
|
sl@0
|
72 |
Common active object behaviour.
|
sl@0
|
73 |
|
sl@0
|
74 |
This is an abstract class that defines common active object behaviour for
|
sl@0
|
75 |
the log engine classes.
|
sl@0
|
76 |
@publishedAll
|
sl@0
|
77 |
@released
|
sl@0
|
78 |
*/
|
sl@0
|
79 |
class CLogActive : public CActive
|
sl@0
|
80 |
{
|
sl@0
|
81 |
public:
|
sl@0
|
82 |
IMPORT_C ~CLogActive();
|
sl@0
|
83 |
//
|
sl@0
|
84 |
protected:
|
sl@0
|
85 |
IMPORT_C CLogActive(TInt aPriority);
|
sl@0
|
86 |
IMPORT_C void Queue(TRequestStatus& aStatus);
|
sl@0
|
87 |
IMPORT_C void Complete(TInt aStatus);
|
sl@0
|
88 |
IMPORT_C void DoCancel();
|
sl@0
|
89 |
//
|
sl@0
|
90 |
private:
|
sl@0
|
91 |
//
|
sl@0
|
92 |
IMPORT_C void RunL();
|
sl@0
|
93 |
virtual void DoRunL()=0;
|
sl@0
|
94 |
IMPORT_C virtual void DoComplete(TInt&);
|
sl@0
|
95 |
//
|
sl@0
|
96 |
private:
|
sl@0
|
97 |
TRequestStatus* iReport;
|
sl@0
|
98 |
};
|
sl@0
|
99 |
|
sl@0
|
100 |
//**********************************
|
sl@0
|
101 |
// CLogEvent
|
sl@0
|
102 |
//**********************************
|
sl@0
|
103 |
|
sl@0
|
104 |
/**
|
sl@0
|
105 |
Encapsulates the details of an event.
|
sl@0
|
106 |
|
sl@0
|
107 |
Where time is used, it must be specified as UTC rather than local time.
|
sl@0
|
108 |
|
sl@0
|
109 |
@publishedAll
|
sl@0
|
110 |
@released
|
sl@0
|
111 |
*/
|
sl@0
|
112 |
class CLogEvent : public CBase
|
sl@0
|
113 |
{
|
sl@0
|
114 |
public:
|
sl@0
|
115 |
IMPORT_C static CLogEvent* NewL();
|
sl@0
|
116 |
IMPORT_C ~CLogEvent();
|
sl@0
|
117 |
//
|
sl@0
|
118 |
public:
|
sl@0
|
119 |
inline TLogId Id() const;
|
sl@0
|
120 |
inline void SetId(TLogId aId);
|
sl@0
|
121 |
//
|
sl@0
|
122 |
inline TUid EventType() const;
|
sl@0
|
123 |
inline void SetEventType(TUid aId);
|
sl@0
|
124 |
//
|
sl@0
|
125 |
inline const TDesC& RemoteParty() const;
|
sl@0
|
126 |
inline void SetRemoteParty(const TDesC& aRemote);
|
sl@0
|
127 |
//
|
sl@0
|
128 |
inline const TDesC& Direction() const;
|
sl@0
|
129 |
inline void SetDirection(const TDesC& aDirection);
|
sl@0
|
130 |
//
|
sl@0
|
131 |
inline const TTime& Time() const;
|
sl@0
|
132 |
inline void SetTime(const TTime& aTime);
|
sl@0
|
133 |
//
|
sl@0
|
134 |
inline TLogDurationType DurationType() const;
|
sl@0
|
135 |
inline void SetDurationType(TLogDurationType aDurationType);
|
sl@0
|
136 |
//
|
sl@0
|
137 |
inline TLogDuration Duration() const;
|
sl@0
|
138 |
inline void SetDuration(TLogDuration aDuration);
|
sl@0
|
139 |
//
|
sl@0
|
140 |
inline const TDesC& Status() const;
|
sl@0
|
141 |
inline void SetStatus(const TDesC& aStatus);
|
sl@0
|
142 |
//
|
sl@0
|
143 |
inline const TDesC& Subject() const;
|
sl@0
|
144 |
inline void SetSubject(const TDesC& aSubject);
|
sl@0
|
145 |
//
|
sl@0
|
146 |
inline const TDesC& Number() const;
|
sl@0
|
147 |
inline void SetNumber(const TDesC& aNumber);
|
sl@0
|
148 |
//
|
sl@0
|
149 |
inline TLogContactItemId Contact() const;
|
sl@0
|
150 |
inline void SetContact(TLogContactItemId aContact);
|
sl@0
|
151 |
//
|
sl@0
|
152 |
inline TLogLink Link() const;
|
sl@0
|
153 |
inline void SetLink(TLogLink aLink);
|
sl@0
|
154 |
//
|
sl@0
|
155 |
inline const TDesC& Description() const;
|
sl@0
|
156 |
inline void SetDescription(const TDesC& aDescription);
|
sl@0
|
157 |
//
|
sl@0
|
158 |
inline TLogFlags Flags() const;
|
sl@0
|
159 |
inline void SetFlags(TLogFlags aFlags);
|
sl@0
|
160 |
inline void ClearFlags(TLogFlags aFlags);
|
sl@0
|
161 |
//
|
sl@0
|
162 |
inline const TDesC8& Data() const;
|
sl@0
|
163 |
IMPORT_C void SetDataL(RReadStream& aStream, TInt aLen);
|
sl@0
|
164 |
IMPORT_C void SetDataL(const TDesC8& aData);
|
sl@0
|
165 |
//
|
sl@0
|
166 |
IMPORT_C void CopyL(const CLogEvent& aEvent);
|
sl@0
|
167 |
|
sl@0
|
168 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
sl@0
|
169 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
sl@0
|
170 |
//
|
sl@0
|
171 |
IMPORT_C void SetSimId(TSimId aSimId);
|
sl@0
|
172 |
IMPORT_C TSimId SimId() const;
|
sl@0
|
173 |
//
|
sl@0
|
174 |
private:
|
sl@0
|
175 |
CLogEvent();
|
sl@0
|
176 |
void ConstructL();
|
sl@0
|
177 |
void InternalizeBufL(RReadStream& aStream, HBufC*& aDes);
|
sl@0
|
178 |
//
|
sl@0
|
179 |
private:
|
sl@0
|
180 |
TLogId iId;
|
sl@0
|
181 |
TUid iEventType;
|
sl@0
|
182 |
TTime iTime;
|
sl@0
|
183 |
TLogDurationType iDurationType;
|
sl@0
|
184 |
TLogDuration iDuration;
|
sl@0
|
185 |
TLogContactItemId iContact;
|
sl@0
|
186 |
TLogLink iLink;
|
sl@0
|
187 |
TLogFlags iFlags;
|
sl@0
|
188 |
HBufC* iDescription;
|
sl@0
|
189 |
HBufC* iRemoteParty;
|
sl@0
|
190 |
HBufC* iDirection;
|
sl@0
|
191 |
HBufC* iStatus;
|
sl@0
|
192 |
HBufC* iSubject;
|
sl@0
|
193 |
HBufC* iNumber;
|
sl@0
|
194 |
HBufC8* iData;
|
sl@0
|
195 |
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM
|
sl@0
|
196 |
TSimId iSimId;
|
sl@0
|
197 |
#endif
|
sl@0
|
198 |
};
|
sl@0
|
199 |
|
sl@0
|
200 |
//**********************************
|
sl@0
|
201 |
// CLogBase
|
sl@0
|
202 |
//**********************************
|
sl@0
|
203 |
|
sl@0
|
204 |
/**
|
sl@0
|
205 |
Base class for the log engine implementation.
|
sl@0
|
206 |
|
sl@0
|
207 |
This class defines the interface that client code uses to perform simple actions
|
sl@0
|
208 |
on the log database.
|
sl@0
|
209 |
|
sl@0
|
210 |
The class provides default implementations for the event handling functions.
|
sl@0
|
211 |
The Log Engine, i.e. an instance of CLogClient, is derived from this class
|
sl@0
|
212 |
and provides implementations for the event handling functions.
|
sl@0
|
213 |
|
sl@0
|
214 |
The class also deals with some aspects of resource file handling.
|
sl@0
|
215 |
|
sl@0
|
216 |
An instance of this class is constructed by the log wrapper, CLogWrapper,
|
sl@0
|
217 |
if the phone does not implement logging.
|
sl@0
|
218 |
|
sl@0
|
219 |
An instance of this class is never constructed by clients.
|
sl@0
|
220 |
|
sl@0
|
221 |
@see CLogClient
|
sl@0
|
222 |
@see CLogWrapper
|
sl@0
|
223 |
@publishedAll
|
sl@0
|
224 |
@released
|
sl@0
|
225 |
*/
|
sl@0
|
226 |
class CLogBase : public CLogActive
|
sl@0
|
227 |
{
|
sl@0
|
228 |
public:
|
sl@0
|
229 |
IMPORT_C CLogBase(TInt aPriority);
|
sl@0
|
230 |
IMPORT_C ~CLogBase();
|
sl@0
|
231 |
//
|
sl@0
|
232 |
IMPORT_C virtual void GetEvent(CLogEvent& aEvent, TRequestStatus& aStatus);
|
sl@0
|
233 |
IMPORT_C virtual void AddEvent(CLogEvent& aEvent, TRequestStatus& aStatus);
|
sl@0
|
234 |
IMPORT_C virtual void ChangeEvent(const CLogEvent& aEvent, TRequestStatus& aStatus);
|
sl@0
|
235 |
IMPORT_C virtual void DeleteEvent(TLogId aId, TRequestStatus& aStatus);
|
sl@0
|
236 |
//
|
sl@0
|
237 |
IMPORT_C virtual TInt GetString(TDes& aString, TInt aId) const;
|
sl@0
|
238 |
//
|
sl@0
|
239 |
protected:
|
sl@0
|
240 |
IMPORT_C void LoadResourcesL(RFs& aFs);
|
sl@0
|
241 |
inline const CResourceFile* ResourceFile() const;
|
sl@0
|
242 |
//
|
sl@0
|
243 |
private:
|
sl@0
|
244 |
void DoRunL();
|
sl@0
|
245 |
//
|
sl@0
|
246 |
private:
|
sl@0
|
247 |
CResourceFile* iResourceFile;
|
sl@0
|
248 |
|
sl@0
|
249 |
//
|
sl@0
|
250 |
private:
|
sl@0
|
251 |
IMPORT_C virtual void CLogBase_Reserved1();
|
sl@0
|
252 |
TAny* CLogBase_Reserved;
|
sl@0
|
253 |
};
|
sl@0
|
254 |
|
sl@0
|
255 |
//**********************************
|
sl@0
|
256 |
// CLogWrapper
|
sl@0
|
257 |
//**********************************
|
sl@0
|
258 |
|
sl@0
|
259 |
/**
|
sl@0
|
260 |
The log wrapper.
|
sl@0
|
261 |
|
sl@0
|
262 |
As some UI variants do not use a Log Engine, the log wrapper provides a consistent
|
sl@0
|
263 |
interface to clients that need to work, without being changed, with multiple
|
sl@0
|
264 |
UI variants.
|
sl@0
|
265 |
|
sl@0
|
266 |
The log wrapper is provided in its own DLL, the logwrap.dll.
|
sl@0
|
267 |
|
sl@0
|
268 |
If a Log Engine is not installed on a phone, the log wrapper creates an instance
|
sl@0
|
269 |
of the CLogBase class, whose event handling requests complete with KErrNotSupported
|
sl@0
|
270 |
and whose functions return KErrNotSupported.
|
sl@0
|
271 |
|
sl@0
|
272 |
If a Log Engine is installed on a phone, the log wrapper creates an instance
|
sl@0
|
273 |
of the CLogClient class, provided in a separate DLL, the logcli.dll . The
|
sl@0
|
274 |
CLogClient class derives from CLogBase and provides implementations for the
|
sl@0
|
275 |
event handling requests and functions.
|
sl@0
|
276 |
|
sl@0
|
277 |
@see CLogBase
|
sl@0
|
278 |
@see CLogClient
|
sl@0
|
279 |
@publishedAll
|
sl@0
|
280 |
@released
|
sl@0
|
281 |
*/
|
sl@0
|
282 |
class CLogWrapper : public CBase
|
sl@0
|
283 |
{
|
sl@0
|
284 |
public:
|
sl@0
|
285 |
IMPORT_C static CLogWrapper* NewL(RFs& aFs, TInt aPriority = CActive::EPriorityStandard);
|
sl@0
|
286 |
IMPORT_C ~CLogWrapper();
|
sl@0
|
287 |
//
|
sl@0
|
288 |
inline CLogBase& Log();
|
sl@0
|
289 |
IMPORT_C TBool ClientAvailable() const;
|
sl@0
|
290 |
//
|
sl@0
|
291 |
private:
|
sl@0
|
292 |
CLogWrapper();
|
sl@0
|
293 |
void ConstructL(RFs& aFs, TInt aPriority);
|
sl@0
|
294 |
//
|
sl@0
|
295 |
private:
|
sl@0
|
296 |
CLogBase* iBase;
|
sl@0
|
297 |
};
|
sl@0
|
298 |
|
sl@0
|
299 |
#include <logwrap.inl>
|
sl@0
|
300 |
#include <logeng.h>
|
sl@0
|
301 |
|
sl@0
|
302 |
#endif
|