author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 18 Jan 2010 21:02:57 +0200 | |
changeset 27 | 02682e02e51f |
parent 16 | 44bb89c96acb |
permissions | -rw-r--r-- |
5 | 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: Implements logging service handler (This will be part of |
|
15 |
* Ecom plugin. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
||
16
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
20 |
#include <liwvariant.h> |
5 | 21 |
#include <logwrap.h> |
16
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
22 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
5 | 23 |
#include <logwrap.hrh> |
16
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
24 |
#else |
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
25 |
#include <logwrap.hrh> |
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
26 |
#include <logengevents.h> |
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
27 |
#include <logfilterandeventconstants.hrh> |
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
28 |
#endif |
44bb89c96acb
Revision: 200941
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
29 |
#include <logclientchangeobserver.h> |
5 | 30 |
|
31 |
#include "logiter.h" |
|
32 |
#include "logginginterface.h" |
|
33 |
#include "loggingasyncservice.h" |
|
34 |
#include "loggingevent.h" |
|
35 |
#include <utf.h> |
|
36 |
#include "liwlogiter.h" |
|
37 |
||
38 |
/** |
|
39 |
* Two phase constructor implementation of the |
|
40 |
* log iterator |
|
41 |
*/ |
|
42 |
CLiwLogIter * CLiwLogIter :: NewL( CLogIter *aIter ) |
|
43 |
{ |
|
44 |
CLiwLogIter* self = CLiwLogIter :: NewLC( aIter ) ; |
|
45 |
CleanupStack :: Pop( self ) ; |
|
46 |
return self ; |
|
47 |
} |
|
48 |
||
49 |
/** |
|
50 |
* Two phase constructor implementation of the |
|
51 |
* log iterator |
|
52 |
*/ |
|
53 |
CLiwLogIter * CLiwLogIter :: NewLC( CLogIter *aIter ) |
|
54 |
{ |
|
55 |
CLiwLogIter *self = new ( ELeave ) CLiwLogIter() ; |
|
56 |
CleanupStack :: PushL( self ) ; |
|
57 |
self->ConstructL( aIter ) ; |
|
58 |
return self ; |
|
59 |
} |
|
60 |
||
61 |
/** |
|
62 |
* ConstructL , function to construct the members of the CLiwLogIter |
|
63 |
*/ |
|
64 |
void CLiwLogIter :: ConstructL( CLogIter *aIter ) |
|
65 |
{ |
|
66 |
iLogIter = aIter ; |
|
67 |
} |
|
68 |
||
69 |
/** |
|
70 |
* Default constructor |
|
71 |
*/ |
|
72 |
||
73 |
CLiwLogIter :: CLiwLogIter() |
|
74 |
{ |
|
75 |
} |
|
76 |
||
77 |
/** |
|
78 |
* Default Desturctor |
|
79 |
*/ |
|
80 |
CLiwLogIter :: ~CLiwLogIter() |
|
81 |
{ |
|
82 |
delete iLogIter ; |
|
83 |
} |
|
84 |
||
85 |
/** |
|
86 |
* Resets the iterator. The service provider should provide a concrete |
|
87 |
* implementation to reset the iterator. |
|
88 |
* |
|
89 |
*/ |
|
90 |
EXPORT_C void CLiwLogIter :: Reset() |
|
91 |
{ |
|
92 |
if( iLogIter ) |
|
93 |
{ |
|
94 |
iLogIter->Reset(); |
|
95 |
} |
|
96 |
} |
|
97 |
||
98 |
/** |
|
99 |
* Iterates over the collection entries to fetch the next data element. |
|
100 |
* The service provider should provide a concrete implementation |
|
101 |
* for this method. |
|
102 |
* |
|
103 |
* @param aEntry contains the next data element and its corresponding data type |
|
104 |
* |
|
105 |
* @return false if there are no more data elements to be fetched; |
|
106 |
* true otherwise |
|
107 |
*/ |
|
108 |
EXPORT_C TBool CLiwLogIter :: NextL(TLiwVariant& aEntry) |
|
109 |
{ |
|
110 |
||
111 |
/** |
|
112 |
* In case of empty iterator return false |
|
113 |
*/ |
|
114 |
||
115 |
if( !iLogIter ) |
|
116 |
{ |
|
117 |
return EFalse ; |
|
118 |
} |
|
119 |
||
120 |
CLogsEvent *event = iLogIter->NextL() ; |
|
121 |
||
122 |
if( !event ) |
|
123 |
{ |
|
124 |
return EFalse ; |
|
125 |
} |
|
126 |
||
127 |
CleanupStack::PushL(event); |
|
128 |
||
129 |
CLiwDefaultMap *evntmap = CLiwDefaultMap :: NewL() ; |
|
130 |
||
131 |
CleanupClosePushL( *evntmap ); |
|
132 |
||
133 |
/** |
|
134 |
* Extract all the event details form CLogsEvent object |
|
135 |
* and push it to the aEntry |
|
136 |
*/ |
|
137 |
||
138 |
TInt32 val = 0 ; |
|
139 |
||
140 |
switch( (event->getEventType()).iUid ) |
|
141 |
{ |
|
142 |
case KLogCallEventType : |
|
143 |
{ |
|
144 |
val = CLoggingInterface :: EKLogCallEventType ; |
|
145 |
break ; |
|
146 |
} |
|
147 |
||
148 |
case KLogDataEventType : |
|
149 |
{ |
|
150 |
val = CLoggingInterface :: EKLogDataEventType ; |
|
151 |
break ; |
|
152 |
} |
|
153 |
||
154 |
case KLogFaxEventType : |
|
155 |
{ |
|
156 |
val = CLoggingInterface :: EKLogFaxEventType ; |
|
157 |
break ; |
|
158 |
} |
|
159 |
||
160 |
case KLogShortMessageEventType : |
|
161 |
{ |
|
162 |
val = CLoggingInterface :: EKLogShortMessageEventType ; |
|
163 |
break ; |
|
164 |
} |
|
165 |
||
166 |
case KLogPacketDataEventType : |
|
167 |
{ |
|
168 |
val = CLoggingInterface :: EKLogPacketDataEventType ; |
|
169 |
break ; |
|
170 |
} |
|
171 |
||
172 |
default : |
|
173 |
{ |
|
174 |
break ; |
|
175 |
} |
|
176 |
} |
|
177 |
||
178 |
evntmap->InsertL(KEventTypeKey , TLiwVariant((TInt32)val)); |
|
179 |
||
180 |
evntmap->InsertL(KRemotePartyKey , TLiwVariant(event->getRemoteParty())) ; |
|
181 |
||
182 |
evntmap->InsertL(KEventDurationKey ,TLiwVariant((TInt32)event->getDuration())) ; |
|
183 |
||
184 |
evntmap->InsertL(KEventTimeKey , TLiwVariant(event->getTime())) ; |
|
185 |
||
186 |
val = 0 ; |
|
187 |
||
188 |
/** |
|
189 |
* Need to convert status to int value |
|
190 |
*/ |
|
191 |
if( ( ( event->getStatus() ).Compare( KStatusPending ) ) == KErrNone ) |
|
192 |
{ |
|
193 |
val = CLoggingInterface :: EStatusPending ; |
|
194 |
} |
|
195 |
else if( ( ( event->getStatus() ).Compare( KStatusSent ) ) == KErrNone ) |
|
196 |
{ |
|
197 |
val =CLoggingInterface :: EStatusSent ; |
|
198 |
} |
|
199 |
else if( ( ( event->getStatus() ).Compare( KStatusFalied ) ) == KErrNone ) |
|
200 |
{ |
|
201 |
val = CLoggingInterface :: EStatusFalied ; |
|
202 |
} |
|
203 |
else if( ( ( event->getStatus() ).Compare( KStatusNone ) ) == KErrNone ) |
|
204 |
{ |
|
205 |
val = CLoggingInterface :: EStatusNone; |
|
206 |
} |
|
207 |
else if( ( ( event->getStatus() ).Compare( KStatusDone ) ) == KErrNone ) |
|
208 |
{ |
|
209 |
val = CLoggingInterface :: EStatusDone; |
|
210 |
} |
|
211 |
else if( ( ( event->getStatus() ).Compare( KStatusNotSent ) ) == KErrNone ) |
|
212 |
{ |
|
213 |
val = CLoggingInterface :: EStatusNotSent; |
|
214 |
} |
|
215 |
else if( ( ( event->getStatus() ).Compare( KStatusScheduled ) ) == KErrNone ) |
|
216 |
{ |
|
217 |
val = CLoggingInterface :: EStatusScheduled; |
|
218 |
} |
|
219 |
else |
|
220 |
{ |
|
221 |
val = CLoggingInterface :: EStatusNotPresent; |
|
222 |
} |
|
223 |
||
224 |
if( val != -1 ) |
|
225 |
{ |
|
226 |
evntmap->InsertL(KDeliveryStatusKey , TLiwVariant((TInt32)val)) ; |
|
227 |
} |
|
228 |
||
229 |
evntmap->InsertL(KSubjectKey , TLiwVariant(event->getSubject())) ; |
|
230 |
||
231 |
evntmap->InsertL(KPhoneNumberKey , TLiwVariant(event->getNumber())) ; |
|
232 |
||
233 |
evntmap->InsertL(KDescriptionKey , TLiwVariant (event->getDescription())) ; |
|
234 |
||
235 |
evntmap->InsertL(KLinkKey , TLiwVariant((TInt32)event->getLink())) ; |
|
236 |
||
237 |
val = 0 ; |
|
238 |
||
239 |
if( event->Flags() & KLogEventContactSearched ) |
|
240 |
{ |
|
241 |
val = CLoggingInterface :: EKLogEventContactSearched ; |
|
242 |
} |
|
243 |
else if( event->Flags() & KLogEventRead ) |
|
244 |
{ |
|
245 |
val = CLoggingInterface :: EKLogEventRead ; |
|
246 |
} |
|
247 |
||
248 |
else |
|
249 |
{ |
|
250 |
val = CLoggingInterface :: EFlagNotPresent; |
|
251 |
} |
|
252 |
||
253 |
if( val != -1 ) |
|
254 |
{ |
|
255 |
evntmap->InsertL(KFlagsKey , TLiwVariant((TInt32)val) ); |
|
256 |
} |
|
257 |
||
258 |
TInt32 ret = event->Id(); |
|
259 |
TBuf<8> des; |
|
260 |
des.Num(ret); |
|
261 |
evntmap->InsertL(KLogId , TLiwVariant( des)) ; |
|
262 |
||
263 |
val = 0 ; |
|
264 |
||
265 |
if( ( ( event->getDirection() ).Compare( KIncomingEvent ) ) == KErrNone ) |
|
266 |
{ |
|
267 |
val = CLoggingInterface :: EIncomingEvent ; |
|
268 |
} |
|
269 |
else if( ( ( event->getDirection() ).Compare( KOutgoingEvent ) ) == KErrNone ) |
|
270 |
{ |
|
271 |
val = CLoggingInterface :: EOutgoingEvent ; |
|
272 |
} |
|
273 |
else if( ( ( event->getDirection() ).Compare( KIncomingEventAlternateline ) ) == KErrNone ) |
|
274 |
{ |
|
275 |
val = CLoggingInterface :: EIncomingEventAlternateline ; |
|
276 |
} |
|
277 |
else if( ( ( event->getDirection() ).Compare( KOutgoingEventAlternateline ) ) == KErrNone ) |
|
278 |
{ |
|
279 |
val = CLoggingInterface :: EOutgoingEventAlternateline; |
|
280 |
} |
|
281 |
else if( ( ( event->getDirection() ).Compare( KFetchedEvent ) ) == KErrNone ) |
|
282 |
{ |
|
283 |
val = CLoggingInterface :: EFetchedEvent; |
|
284 |
} |
|
285 |
else if( ( ( event->getDirection() ).Compare( KMissedEvent ) ) == KErrNone ) |
|
286 |
{ |
|
287 |
val = CLoggingInterface :: EMissedEvent; |
|
288 |
} |
|
289 |
else if( ( ( event->getDirection() ).Compare( KMissedEventAlternateline ) ) == KErrNone ) |
|
290 |
{ |
|
291 |
val = CLoggingInterface :: EMissedEventAlternateline; |
|
292 |
} |
|
293 |
else |
|
294 |
{ |
|
295 |
val = CLoggingInterface :: EDirectionNotPresent; |
|
296 |
} |
|
297 |
||
298 |
if( val != -1 ) |
|
299 |
{ |
|
300 |
evntmap->InsertL(KDirectionKey , TLiwVariant((TInt32)val)) ; |
|
301 |
} |
|
302 |
||
303 |
evntmap->InsertL(KEventDataKey , TLiwVariant(event->getDataL())); |
|
304 |
||
305 |
aEntry.SetL( evntmap ) ; |
|
306 |
CleanupStack :: Pop( evntmap ) ; |
|
307 |
evntmap->DecRef(); |
|
308 |
CleanupStack::Pop( event ); |
|
309 |
delete event; |
|
310 |
return true ; |
|
311 |
} |
|
312 |
||
313 |
/** |
|
314 |
* Default equality operator implementation |
|
315 |
* |
|
316 |
* @param aIterable the iterator instance to be compared |
|
317 |
* |
|
318 |
*/ |
|
319 |
||
320 |
EXPORT_C TBool CLiwLogIter :: operator==(CLiwIterable&/* aIterable*/) |
|
321 |
{ |
|
322 |
/** |
|
323 |
* Currently Not Implemented |
|
324 |
*/ |
|
325 |
return true ; |
|
326 |
} |
|
327 |
||
328 |
//End of File |