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