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