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 interface class for logging sapi
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <e32base.h>
|
|
20 |
#include <e32def.h>
|
|
21 |
#include <f32file.h>
|
|
22 |
#include <cntdef.h>
|
|
23 |
#include <logwrap.h>
|
|
24 |
#include <logwrap.hrh>
|
|
25 |
#include <liwserviceifbase.h>
|
|
26 |
#include <LiwCommon.h>
|
|
27 |
#include <ecom/ImplementationProxy.h>
|
|
28 |
#include <utf.h>
|
|
29 |
#include "loggingasyncservice.h"
|
|
30 |
|
|
31 |
|
|
32 |
#include "LOGCLIENTCHANGEOBSERVER.H"
|
|
33 |
#include "logiter.h"
|
|
34 |
#include "loggingservice.h"
|
|
35 |
#include "loggingasyncservice.h"
|
|
36 |
#include "loggingsyncservice.h"
|
|
37 |
#include "loggingevent.h"
|
|
38 |
#include "loggingfilter.h"
|
|
39 |
#include "loggingcallbackslot.h"
|
|
40 |
#include "logobserver.h"
|
|
41 |
#include "logginginterface.h"
|
|
42 |
#include "liwlogiter.h"
|
|
43 |
#include "loggingcallback.h"
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Default Constructor Method
|
|
49 |
*/
|
|
50 |
CLoggingInterface :: CLoggingInterface()
|
|
51 |
{
|
|
52 |
}
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Default Destructor
|
|
56 |
*/
|
|
57 |
CLoggingInterface :: ~CLoggingInterface()
|
|
58 |
{
|
|
59 |
delete iErrorString;
|
|
60 |
delete iLogService;
|
|
61 |
}
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Two phased constructor implementation
|
|
65 |
*/
|
|
66 |
CLoggingInterface* CLoggingInterface :: NewL()
|
|
67 |
{
|
|
68 |
CLoggingInterface* self = CLoggingInterface::NewLC();
|
|
69 |
CleanupStack::Pop( self );
|
|
70 |
return self;
|
|
71 |
}
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Two phased constructor implementation
|
|
75 |
*/
|
|
76 |
CLoggingInterface* CLoggingInterface :: NewLC()
|
|
77 |
{
|
|
78 |
CLoggingInterface* self = new ( ELeave ) CLoggingInterface();
|
|
79 |
CleanupStack::PushL( self );
|
|
80 |
self->ConstructL();
|
|
81 |
return self;
|
|
82 |
}
|
|
83 |
|
|
84 |
/**
|
|
85 |
* This function constructs the member elements of CLoggingInterface Class
|
|
86 |
*/
|
|
87 |
void CLoggingInterface :: ConstructL()
|
|
88 |
{
|
|
89 |
iLogService = CLoggingService::NewL();
|
|
90 |
}
|
|
91 |
|
|
92 |
/**
|
|
93 |
* closes the interface
|
|
94 |
*/
|
|
95 |
void CLoggingInterface::Close()
|
|
96 |
{
|
|
97 |
delete this;
|
|
98 |
}
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Convert to sapiError Function
|
|
102 |
*/
|
|
103 |
TInt CLoggingInterface::ConvertToSapiError( TInt aSymbianErr )
|
|
104 |
{
|
|
105 |
TInt sapiErr( SErrGeneralError );
|
|
106 |
|
|
107 |
switch ( aSymbianErr )
|
|
108 |
{
|
|
109 |
case KErrArgument:
|
|
110 |
{
|
|
111 |
sapiErr = SErrBadArgumentType;
|
|
112 |
break;
|
|
113 |
}
|
|
114 |
case KErrNotSupported:
|
|
115 |
{
|
|
116 |
sapiErr = SErrServiceNotSupported;
|
|
117 |
break;
|
|
118 |
}
|
|
119 |
case KErrServerBusy:
|
|
120 |
{
|
|
121 |
sapiErr = SErrServerBusy;
|
|
122 |
break;
|
|
123 |
}
|
|
124 |
case KErrGeneral:
|
|
125 |
{
|
|
126 |
sapiErr = SErrGeneralError;
|
|
127 |
break;
|
|
128 |
}
|
|
129 |
case KErrCancel:
|
|
130 |
{
|
|
131 |
sapiErr = SErrCancelSuccess;
|
|
132 |
break;
|
|
133 |
}
|
|
134 |
case KErrNone:
|
|
135 |
{
|
|
136 |
sapiErr= SErrNone;
|
|
137 |
break;
|
|
138 |
}
|
|
139 |
case KErrNotFound:
|
|
140 |
{
|
|
141 |
sapiErr= SErrNotFound;
|
|
142 |
break;
|
|
143 |
}
|
|
144 |
case KErrNoMemory:
|
|
145 |
{
|
|
146 |
sapiErr = SErrNoMemory;
|
|
147 |
break;
|
|
148 |
}
|
|
149 |
case KErrInUse:
|
|
150 |
{
|
|
151 |
sapiErr = SErrServiceInUse;
|
|
152 |
break;
|
|
153 |
}
|
|
154 |
case KErrNotReady:
|
|
155 |
{
|
|
156 |
sapiErr = SErrServiceNotReady;
|
|
157 |
break;
|
|
158 |
}
|
|
159 |
case SErrMissingArgument:
|
|
160 |
{
|
|
161 |
sapiErr = SErrMissingArgument;
|
|
162 |
break;
|
|
163 |
}
|
|
164 |
case SErrInvalidServiceArgument :
|
|
165 |
{
|
|
166 |
sapiErr = SErrInvalidServiceArgument;
|
|
167 |
break;
|
|
168 |
}
|
|
169 |
}
|
|
170 |
return sapiErr;
|
|
171 |
}
|
|
172 |
|
|
173 |
void CLoggingInterface::CheckInputTypeL( const TLiwVariant* aSource, LIW::TVariantTypeId aExpectedtype, const TDesC8* aErrorArgument )
|
|
174 |
{
|
|
175 |
if( aSource->TypeId() != aExpectedtype )
|
|
176 |
{
|
|
177 |
iErrorString = HBufC::NewL(KMaxMsgSize);
|
|
178 |
TPtr ptr(iErrorString->Des());
|
|
179 |
TBuf<KMaxKeySize> buf;
|
|
180 |
buf.Copy( *aErrorArgument );
|
|
181 |
ptr.Append(buf);
|
|
182 |
ptr.Append( KInvalid.operator()());
|
|
183 |
((TLiwVariant*)aSource)->Reset();
|
|
184 |
User::Leave( KErrArgument );
|
|
185 |
}
|
|
186 |
}
|
|
187 |
|
|
188 |
void CLoggingInterface::IncorrectValueL( const TDesC8* aErrorArgument )
|
|
189 |
{
|
|
190 |
iErrorString = HBufC::NewL(KMaxMsgSize);
|
|
191 |
TPtr ptr(iErrorString->Des());
|
|
192 |
TBuf<KMaxKeySize> buf;
|
|
193 |
buf.Copy( *aErrorArgument );
|
|
194 |
ptr.Append(buf);
|
|
195 |
ptr.Append( KInvalid.operator()());
|
|
196 |
}
|
|
197 |
|
|
198 |
void CLoggingInterface::MissingValueL( const TDesC8* aErrorArgument )
|
|
199 |
{
|
|
200 |
iErrorString = HBufC::NewL(KMaxMsgSize);
|
|
201 |
TPtr ptr(iErrorString->Des());
|
|
202 |
TBuf<KMaxKeySize> buf;
|
|
203 |
buf.Copy( *aErrorArgument );
|
|
204 |
ptr.Append(buf);
|
|
205 |
ptr.Append( KMissing.operator()());
|
|
206 |
User::Leave( SErrMissingArgument );
|
|
207 |
}
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Function : ExecuteCmdL , called directly by consumer, parses the input parameters and
|
|
211 |
* then calls appropriate method on iLocationService object
|
|
212 |
*/
|
|
213 |
void CLoggingInterface :: ExecuteCmdL( const TDesC8& aCmdName,
|
|
214 |
const CLiwGenericParamList& aInParamList,
|
|
215 |
CLiwGenericParamList& aOutParamList,
|
|
216 |
TUint aCmdOptions,
|
|
217 |
MLiwNotifyCallback* aCallback )
|
|
218 |
{
|
|
219 |
TRAPD( error , CmdExecuteL( aCmdName , aInParamList , aOutParamList , aCmdOptions , aCallback ) ) ;
|
|
220 |
if( error != KErrNone )
|
|
221 |
{
|
|
222 |
if( iErrorString )
|
|
223 |
{
|
|
224 |
TBuf<150> errorMessage;
|
|
225 |
errorMessage.Append( KMsgErr.operator()() );
|
|
226 |
TBuf<40> commandName;
|
|
227 |
commandName.Copy( aCmdName );
|
|
228 |
errorMessage.Append( commandName );
|
|
229 |
errorMessage.Append( KColon.operator()());
|
|
230 |
|
|
231 |
errorMessage.Append( iErrorString->Des() );
|
|
232 |
|
|
233 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMessage,
|
|
234 |
TLiwVariant( errorMessage )));
|
|
235 |
delete iErrorString;
|
|
236 |
iErrorString = NULL;
|
|
237 |
}
|
|
238 |
}
|
|
239 |
TInt sapierror = ConvertToSapiError( error );
|
|
240 |
aOutParamList.AppendL(TLiwGenericParam(KErrorCode , TLiwVariant((TInt32)sapierror))) ;
|
|
241 |
}
|
|
242 |
|
|
243 |
/**
|
|
244 |
* CLoggingInterface::CmdExecuteL, this method is called by CLoggingInterface::HandleCmdL()
|
|
245 |
* to catch any leaves that might occur during execution of a LiwCommand.
|
|
246 |
*
|
|
247 |
* @param aCmdName the name of the service command which the consumer wants to invoke
|
|
248 |
* @param aInParamList the input parameter list, can be empty list
|
|
249 |
* @param [in,out] aOutParamList the output parameter list, can be empty lis. The
|
|
250 |
* service provider can use the output parameter list to fill in necessary return values
|
|
251 |
* @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
|
|
252 |
* @param aCallback callback to be registered by consumer application
|
|
253 |
* @see TLiwServiceCmdOptions
|
|
254 |
* @see CLiwGenericParamList
|
|
255 |
* @see MLiwNotifyCallback
|
|
256 |
*/
|
|
257 |
void CLoggingInterface :: CmdExecuteL( const TDesC8& aCmdName,
|
|
258 |
const CLiwGenericParamList& aInParamList,
|
|
259 |
CLiwGenericParamList& aOutParamList,
|
|
260 |
TUint aCmdOptions,
|
|
261 |
MLiwNotifyCallback* aCallback )
|
|
262 |
{
|
|
263 |
aOutParamList.Reset() ;
|
|
264 |
|
|
265 |
if(!aCmdName.CompareF( KCmdCancel ))
|
|
266 |
{
|
|
267 |
if( aCmdOptions & KLiwOptCancel )
|
|
268 |
{
|
|
269 |
TInt ret = 0 ;
|
|
270 |
|
|
271 |
const TLiwGenericParam *transidparam = aInParamList.FindFirst( ret , KTransactionId ) ;
|
|
272 |
|
|
273 |
if(!transidparam && ( aInParamList.Count() > 0 ) )
|
|
274 |
{
|
|
275 |
transidparam = &(aInParamList[EIndex0]) ;
|
|
276 |
|
|
277 |
if( transidparam->Name().Compare( KNullDesC8 ) )
|
|
278 |
{
|
|
279 |
MissingValueL( KTransactionId.operator&() );
|
|
280 |
}
|
|
281 |
}
|
|
282 |
|
|
283 |
if( !transidparam )
|
|
284 |
{
|
|
285 |
MissingValueL( KTransactionId.operator&() );
|
|
286 |
}
|
|
287 |
|
|
288 |
CheckInputTypeL( &transidparam->Value(), LIW::EVariantTypeTInt32, KTransactionId.operator&() );
|
|
289 |
TInt32 transid = (transidparam->Value()).AsTInt32() ;
|
|
290 |
|
|
291 |
if( transid<0 )
|
|
292 |
{
|
|
293 |
IncorrectValueL( KTransactionId.operator&() );
|
|
294 |
User::Leave( KErrNotFound );
|
|
295 |
}
|
|
296 |
|
|
297 |
ret = iLogService->CancelServiceL( transid ) ;
|
|
298 |
|
|
299 |
if( ret == KErrNotFound )
|
|
300 |
{
|
|
301 |
IncorrectValueL( KTransactionId.operator&() );
|
|
302 |
User::Leave( KErrNotFound );
|
|
303 |
}
|
|
304 |
|
|
305 |
return ;
|
|
306 |
}
|
|
307 |
}
|
|
308 |
|
|
309 |
else if(!aCmdName.CompareF( KCmdAdd ))
|
|
310 |
{
|
|
311 |
TBool indexBaseInp = ETrue;
|
|
312 |
TInt Index = 0 ;
|
|
313 |
|
|
314 |
const TLiwGenericParam *contentType = aInParamList.FindFirst( Index , KContentTypeKey ) ;
|
|
315 |
|
|
316 |
if( !contentType && ( aInParamList.Count() > 0 ) )
|
|
317 |
{
|
|
318 |
contentType = &(aInParamList[EIndex0]) ;
|
|
319 |
|
|
320 |
if( contentType->Name().Compare( KNullDesC8 ) )
|
|
321 |
{
|
|
322 |
MissingValueL( KContentTypeKey.operator&() );
|
|
323 |
}
|
|
324 |
}
|
|
325 |
else
|
|
326 |
{
|
|
327 |
indexBaseInp = EFalse ;
|
|
328 |
}
|
|
329 |
|
|
330 |
if( !contentType )
|
|
331 |
{
|
|
332 |
MissingValueL( KContentTypeKey.operator&() );
|
|
333 |
}
|
|
334 |
|
|
335 |
CheckInputTypeL( &contentType->Value(), LIW::EVariantTypeDesC, KContentTypeKey.operator&() );
|
|
336 |
TPtrC content = (contentType->Value()).AsDes() ;
|
|
337 |
|
|
338 |
if(content.CompareF( KContentType ))
|
|
339 |
{
|
|
340 |
IncorrectValueL( KContentTypeKey.operator&() );
|
|
341 |
User::Leave( SErrInvalidServiceArgument );
|
|
342 |
}
|
|
343 |
|
|
344 |
TInt index = 0 ;
|
|
345 |
const TLiwGenericParam *eventdetails = NULL ;
|
|
346 |
TUint transid ;
|
|
347 |
|
|
348 |
if ( indexBaseInp )
|
|
349 |
{
|
|
350 |
if( aInParamList.Count() > 1 )
|
|
351 |
{
|
|
352 |
eventdetails = &(aInParamList[EIndex1]) ;
|
|
353 |
}
|
|
354 |
}
|
|
355 |
else
|
|
356 |
{
|
|
357 |
eventdetails = aInParamList.FindFirst( index , KEventDetails );
|
|
358 |
}
|
|
359 |
|
|
360 |
if( !eventdetails )
|
|
361 |
{
|
|
362 |
MissingValueL( KEventDetails.operator&() );
|
|
363 |
}
|
|
364 |
|
|
365 |
TInt32 ret = AddEventL( eventdetails, transid, aCmdOptions, aCallback ) ;
|
|
366 |
|
|
367 |
if( aCallback )
|
|
368 |
{
|
|
369 |
aOutParamList.AppendL( TLiwGenericParam( KTransactionId , TLiwVariant ( ( TInt32 )transid ) ) ) ;
|
|
370 |
}
|
|
371 |
else
|
|
372 |
{
|
|
373 |
TBuf<8> des;
|
|
374 |
des.Num( ret );
|
|
375 |
aOutParamList.AppendL( TLiwGenericParam( KResponse , TLiwVariant( des ) ) ) ;
|
|
376 |
}
|
|
377 |
}
|
|
378 |
|
|
379 |
else if(!aCmdName.CompareF( KCmdGetList ))
|
|
380 |
{
|
|
381 |
TBool indexBaseInp = ETrue;
|
|
382 |
TInt Index = 0 ;
|
|
383 |
|
|
384 |
const TLiwGenericParam *contentType = aInParamList.FindFirst(Index , KContentTypeKey) ;
|
|
385 |
|
|
386 |
if( !contentType && ( aInParamList.Count() > 0 ) )
|
|
387 |
{
|
|
388 |
contentType = &(aInParamList[EIndex0]) ;
|
|
389 |
|
|
390 |
if( contentType->Name().Compare( KNullDesC8 ) )
|
|
391 |
{
|
|
392 |
MissingValueL( KContentTypeKey.operator&() );
|
|
393 |
}
|
|
394 |
}
|
|
395 |
else
|
|
396 |
{
|
|
397 |
indexBaseInp = EFalse ;
|
|
398 |
}
|
|
399 |
|
|
400 |
if( !contentType )
|
|
401 |
{
|
|
402 |
MissingValueL( KContentTypeKey.operator&() );
|
|
403 |
}
|
|
404 |
|
|
405 |
CheckInputTypeL( &contentType->Value(), LIW::EVariantTypeDesC ,KContentTypeKey.operator&() );
|
|
406 |
TPtrC content = (contentType->Value()).AsDes() ;
|
|
407 |
|
|
408 |
if( content.CompareF( KContentType ) )
|
|
409 |
{
|
|
410 |
IncorrectValueL( KContentTypeKey.operator&() );
|
|
411 |
User::Leave( SErrInvalidServiceArgument );
|
|
412 |
}
|
|
413 |
|
|
414 |
TInt index = 0 ;
|
|
415 |
const TLiwGenericParam *flrParam = NULL ;
|
|
416 |
TUint transid ;
|
|
417 |
|
|
418 |
if ( indexBaseInp )
|
|
419 |
{
|
|
420 |
if( aInParamList.Count() > 1 )
|
|
421 |
{
|
|
422 |
flrParam = &aInParamList[EIndex1] ;
|
|
423 |
}
|
|
424 |
}
|
|
425 |
else
|
|
426 |
{
|
|
427 |
flrParam = aInParamList.FindFirst( index , KFilter ) ;
|
|
428 |
}
|
|
429 |
|
|
430 |
|
|
431 |
CLogIter *iter = this->GetListL(flrParam , transid ,aCmdOptions, aCallback) ;
|
|
432 |
|
|
433 |
/*Ownership of logiter will be with the consumer*/
|
|
434 |
if( aCallback )
|
|
435 |
{
|
|
436 |
aOutParamList.AppendL( TLiwGenericParam( KTransactionId , TLiwVariant( ( TInt32 )transid ) ) ) ;
|
|
437 |
}
|
|
438 |
else
|
|
439 |
{
|
|
440 |
CLiwLogIter *logiter = CLiwLogIter :: NewL( iter ) ;
|
|
441 |
CleanupClosePushL( *logiter );
|
|
442 |
aOutParamList.AppendL( TLiwGenericParam( KResponse , TLiwVariant( logiter ) ) ) ;
|
|
443 |
CleanupStack :: Pop( logiter ) ;
|
|
444 |
logiter->DecRef() ;
|
|
445 |
}
|
|
446 |
}
|
|
447 |
|
|
448 |
else if(!aCmdName.CompareF( KCmdRequestNotification ))
|
|
449 |
{
|
|
450 |
TBool indexBaseInp = ETrue;
|
|
451 |
TInt Index = 0 ;
|
|
452 |
|
|
453 |
const TLiwGenericParam *contentType = aInParamList.FindFirst( Index , KContentTypeKey ) ;
|
|
454 |
|
|
455 |
if( !contentType && ( aInParamList.Count() > 0 ) )
|
|
456 |
{
|
|
457 |
contentType = &(aInParamList[EIndex0]) ;
|
|
458 |
|
|
459 |
if( contentType->Name().Compare( KNullDesC8 ) )
|
|
460 |
{
|
|
461 |
MissingValueL( KContentTypeKey.operator&() );
|
|
462 |
}
|
|
463 |
}
|
|
464 |
else
|
|
465 |
{
|
|
466 |
indexBaseInp = EFalse ;
|
|
467 |
}
|
|
468 |
|
|
469 |
if( !contentType )
|
|
470 |
{
|
|
471 |
MissingValueL( KContentTypeKey.operator&() );
|
|
472 |
}
|
|
473 |
|
|
474 |
CheckInputTypeL( &contentType->Value(), LIW::EVariantTypeDesC, KContentTypeKey.operator&() );
|
|
475 |
|
|
476 |
TPtrC content = (contentType->Value()).AsDes() ;
|
|
477 |
|
|
478 |
if(content.CompareF( KContentType ))
|
|
479 |
{
|
|
480 |
IncorrectValueL( KContentTypeKey.operator&() );
|
|
481 |
User::Leave( SErrInvalidServiceArgument );
|
|
482 |
}
|
|
483 |
|
|
484 |
TInt index = 0 ;
|
|
485 |
TUint transid ;
|
|
486 |
const TLiwGenericParam *interval = NULL ;
|
|
487 |
|
|
488 |
if ( indexBaseInp )
|
|
489 |
{
|
|
490 |
if( aInParamList.Count() > 1 )
|
|
491 |
{
|
|
492 |
interval = &(aInParamList[EIndex1]) ;
|
|
493 |
}
|
|
494 |
}
|
|
495 |
else
|
|
496 |
{
|
|
497 |
interval = aInParamList.FindFirst( index , KFilter ) ;
|
|
498 |
}
|
|
499 |
|
|
500 |
if( !interval )
|
|
501 |
{
|
|
502 |
MissingValueL( KFilter.operator&() );
|
|
503 |
}
|
|
504 |
|
|
505 |
this->RequestNotificationsL( interval, aCallback, transid, aCmdOptions ) ;
|
|
506 |
|
|
507 |
aOutParamList.AppendL( TLiwGenericParam( KTransactionId , TLiwVariant( ( TInt32 )transid ) ) ) ;
|
|
508 |
}
|
|
509 |
|
|
510 |
else if(!aCmdName.CompareF( KCmdDelete ))
|
|
511 |
{
|
|
512 |
TBool indexBaseInp = ETrue;
|
|
513 |
TInt Index = 0 ;
|
|
514 |
|
|
515 |
const TLiwGenericParam *contentType = aInParamList.FindFirst( Index , KContentTypeKey ) ;
|
|
516 |
|
|
517 |
if( !contentType && ( aInParamList.Count() > 0 ))
|
|
518 |
{
|
|
519 |
contentType = &(aInParamList[EIndex0]) ;
|
|
520 |
|
|
521 |
if( contentType->Name().Compare( KNullDesC8 ) )
|
|
522 |
{
|
|
523 |
MissingValueL( KContentTypeKey.operator&() );
|
|
524 |
}
|
|
525 |
}
|
|
526 |
else
|
|
527 |
{
|
|
528 |
indexBaseInp = EFalse ;
|
|
529 |
}
|
|
530 |
|
|
531 |
if( !contentType )
|
|
532 |
{
|
|
533 |
MissingValueL( KContentTypeKey.operator&() );
|
|
534 |
}
|
|
535 |
|
|
536 |
CheckInputTypeL( &contentType->Value(), LIW::EVariantTypeDesC ,KContentTypeKey.operator&() );
|
|
537 |
|
|
538 |
TPtrC content = (contentType->Value()).AsDes() ;
|
|
539 |
|
|
540 |
if(content.CompareF(KContentType))
|
|
541 |
{
|
|
542 |
IncorrectValueL( KContentTypeKey.operator&() );
|
|
543 |
User::Leave( SErrInvalidServiceArgument );
|
|
544 |
}
|
|
545 |
|
|
546 |
TInt index = 0;
|
|
547 |
TUint transid;
|
|
548 |
const TLiwGenericParam *logid = NULL ;
|
|
549 |
|
|
550 |
if ( indexBaseInp )
|
|
551 |
{
|
|
552 |
if( aInParamList.Count() > 1 )
|
|
553 |
{
|
|
554 |
logid = &aInParamList[EIndex1] ;
|
|
555 |
}
|
|
556 |
}
|
|
557 |
else
|
|
558 |
{
|
|
559 |
logid = aInParamList.FindFirst( index , KData ) ;
|
|
560 |
}
|
|
561 |
|
|
562 |
if( !logid )
|
|
563 |
{
|
|
564 |
MissingValueL( KData.operator&() );
|
|
565 |
}
|
|
566 |
|
|
567 |
TInt ret = DeleteEventL( logid, transid, aCmdOptions, aCallback );
|
|
568 |
|
|
569 |
if( ret != KErrNone )
|
|
570 |
{
|
|
571 |
IncorrectValueL( KLogId.operator&() );
|
|
572 |
User::Leave( KErrNotFound );
|
|
573 |
}
|
|
574 |
|
|
575 |
if( aCallback )
|
|
576 |
{
|
|
577 |
aOutParamList.AppendL(TLiwGenericParam( KTransactionId , TLiwVariant( ( TInt32 )transid ) ) ) ;
|
|
578 |
}
|
|
579 |
}
|
|
580 |
|
|
581 |
else
|
|
582 |
{
|
|
583 |
iErrorString = KErrLogCmdName.operator()().Alloc();
|
|
584 |
User :: Leave( KErrNotSupported ) ;
|
|
585 |
}
|
|
586 |
}
|
|
587 |
|
|
588 |
/**
|
|
589 |
* Internal utility method, used to Add from the core class
|
|
590 |
*
|
|
591 |
* @param aeventdetails,
|
|
592 |
* @param aTransId,
|
|
593 |
* @param aCallback, callback method for async events
|
|
594 |
*/
|
|
595 |
TInt32 CLoggingInterface::AddEventL( const TLiwGenericParam *eventdetails ,
|
|
596 |
TUint& aTansId ,
|
|
597 |
TUint aCmdOptions,
|
|
598 |
MLiwNotifyCallback* aCallback )
|
|
599 |
{
|
|
600 |
CheckInputTypeL( &eventdetails->Value(), LIW::EVariantTypeMap, KEventDetails.operator&() );
|
|
601 |
|
|
602 |
CLogsEvent *event = CLogsEvent :: NewL() ;
|
|
603 |
|
|
604 |
CleanupStack :: PushL( event ) ;
|
|
605 |
|
|
606 |
const CLiwMap *evtmap = (eventdetails->Value()).AsMap() ;
|
|
607 |
|
|
608 |
if( !evtmap )
|
|
609 |
{
|
|
610 |
MissingValueL( KEventDetails.operator&() );
|
|
611 |
}
|
|
612 |
|
|
613 |
TLiwVariant mapVar;
|
|
614 |
|
|
615 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &mapVar) );
|
|
616 |
|
|
617 |
/**
|
|
618 |
* Extract the contents of Add Event Details
|
|
619 |
* and issue request to the core class accordingly
|
|
620 |
*/
|
|
621 |
if( evtmap->FindL( KEventTypeKey , mapVar ) )
|
|
622 |
{
|
|
623 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeTInt32, KEventTypeKey.operator&() );
|
|
624 |
TUid val = TUid::Null() ;
|
|
625 |
|
|
626 |
switch( mapVar.AsTInt32() )
|
|
627 |
{
|
|
628 |
case EKLogCallEventType :
|
|
629 |
{
|
|
630 |
val = TUid :: Uid( KLogCallEventType );
|
|
631 |
break ;
|
|
632 |
}
|
|
633 |
|
|
634 |
case EKLogDataEventType :
|
|
635 |
{
|
|
636 |
val = TUid :: Uid ( KLogDataEventType );
|
|
637 |
break ;
|
|
638 |
}
|
|
639 |
|
|
640 |
case EKLogFaxEventType :
|
|
641 |
{
|
|
642 |
val = TUid :: Uid ( KLogFaxEventType );
|
|
643 |
break ;
|
|
644 |
}
|
|
645 |
|
|
646 |
case EKLogShortMessageEventType :
|
|
647 |
{
|
|
648 |
val = TUid :: Uid ( KLogShortMessageEventType );
|
|
649 |
break ;
|
|
650 |
}
|
|
651 |
|
|
652 |
case EKLogPacketDataEventType :
|
|
653 |
{
|
|
654 |
val = TUid :: Uid ( KLogPacketDataEventType ) ;
|
|
655 |
break ;
|
|
656 |
}
|
|
657 |
|
|
658 |
default :
|
|
659 |
{
|
|
660 |
mapVar.Reset();
|
|
661 |
IncorrectValueL( KEventTypeKey.operator&() );
|
|
662 |
User::Leave( SErrInvalidServiceArgument );
|
|
663 |
}
|
|
664 |
}
|
|
665 |
event->SetEventType( val ) ;
|
|
666 |
}
|
|
667 |
else
|
|
668 |
{
|
|
669 |
mapVar.Reset();
|
|
670 |
MissingValueL( KEventTypeKey.operator&() );
|
|
671 |
}
|
|
672 |
|
|
673 |
if( evtmap->FindL( KRemotePartyKey , mapVar ) )
|
|
674 |
{
|
|
675 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeDesC, KRemotePartyKey.operator&() );
|
|
676 |
event->SetRemoteParty(mapVar.AsDes()) ;
|
|
677 |
}
|
|
678 |
|
|
679 |
if(evtmap->FindL( KDirectionKey , mapVar ))
|
|
680 |
{
|
|
681 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeTInt32, KDirectionKey.operator&() );
|
|
682 |
TInt val = 0 ;
|
|
683 |
|
|
684 |
switch(mapVar.AsTInt32())
|
|
685 |
{
|
|
686 |
case EIncomingEvent :
|
|
687 |
{
|
|
688 |
val = R_LOG_DIR_IN ;
|
|
689 |
break ;
|
|
690 |
}
|
|
691 |
|
|
692 |
case EOutgoingEvent :
|
|
693 |
{
|
|
694 |
val = R_LOG_DIR_OUT ;
|
|
695 |
break ;
|
|
696 |
}
|
|
697 |
|
|
698 |
case EIncomingEventAlternateline :
|
|
699 |
{
|
|
700 |
val = R_LOG_DIR_IN_ALT ;
|
|
701 |
break ;
|
|
702 |
}
|
|
703 |
|
|
704 |
case EOutgoingEventAlternateline :
|
|
705 |
{
|
|
706 |
val = R_LOG_DIR_OUT_ALT ;
|
|
707 |
break ;
|
|
708 |
}
|
|
709 |
|
|
710 |
case EFetchedEvent :
|
|
711 |
{
|
|
712 |
val = R_LOG_DIR_FETCHED ;
|
|
713 |
break ;
|
|
714 |
}
|
|
715 |
|
|
716 |
case EMissedEvent :
|
|
717 |
{
|
|
718 |
val = R_LOG_DIR_MISSED ;
|
|
719 |
break ;
|
|
720 |
}
|
|
721 |
|
|
722 |
case EMissedEventAlternateline :
|
|
723 |
{
|
|
724 |
val = R_LOG_DIR_MISSED_ALT ;
|
|
725 |
break ;
|
|
726 |
}
|
|
727 |
|
|
728 |
default :
|
|
729 |
{
|
|
730 |
mapVar.Reset();
|
|
731 |
IncorrectValueL( KDirectionKey.operator&() );
|
|
732 |
User::Leave( SErrInvalidServiceArgument );
|
|
733 |
}
|
|
734 |
}
|
|
735 |
|
|
736 |
if( val )
|
|
737 |
{
|
|
738 |
event->SetDirection( val ) ;
|
|
739 |
}
|
|
740 |
}
|
|
741 |
|
|
742 |
|
|
743 |
if(evtmap->FindL(KEventDurationKey , mapVar))
|
|
744 |
{
|
|
745 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeTInt32, KEventDurationKey.operator&() );
|
|
746 |
|
|
747 |
if( mapVar.AsTInt32()<0 )
|
|
748 |
{
|
|
749 |
mapVar.Reset();
|
|
750 |
IncorrectValueL( KEventDurationKey.operator&() );
|
|
751 |
User::Leave( SErrInvalidServiceArgument );
|
|
752 |
}
|
|
753 |
event->SetDurationType( KLogDurationValid ) ;
|
|
754 |
event->SetDuration( mapVar.AsTInt32() ) ;
|
|
755 |
}
|
|
756 |
|
|
757 |
if(evtmap->FindL( KDeliveryStatusKey , mapVar ))
|
|
758 |
{
|
|
759 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeTInt32, KDeliveryStatusKey.operator&() );
|
|
760 |
TInt val = 0 ;
|
|
761 |
|
|
762 |
switch( mapVar.AsTInt32() )
|
|
763 |
{
|
|
764 |
case EStatusPending :
|
|
765 |
{
|
|
766 |
val = R_LOG_DEL_PENDING ;
|
|
767 |
break ;
|
|
768 |
}
|
|
769 |
|
|
770 |
case EStatusSent :
|
|
771 |
{
|
|
772 |
val = R_LOG_DEL_SENT ;
|
|
773 |
break ;
|
|
774 |
}
|
|
775 |
|
|
776 |
case EStatusFalied :
|
|
777 |
{
|
|
778 |
val = R_LOG_DEL_FAILED ;
|
|
779 |
break ;
|
|
780 |
}
|
|
781 |
|
|
782 |
case EStatusNone :
|
|
783 |
{
|
|
784 |
val = R_LOG_DEL_NONE ;
|
|
785 |
break ;
|
|
786 |
}
|
|
787 |
|
|
788 |
case EStatusDone :
|
|
789 |
{
|
|
790 |
val = R_LOG_DEL_DONE ;
|
|
791 |
break ;
|
|
792 |
}
|
|
793 |
|
|
794 |
case EStatusNotSent :
|
|
795 |
{
|
|
796 |
val = R_LOG_DEL_NOT_SENT ;
|
|
797 |
break ;
|
|
798 |
}
|
|
799 |
|
|
800 |
case EStatusScheduled :
|
|
801 |
{
|
|
802 |
val = R_LOG_DEL_SCHEDULED ;
|
|
803 |
break ;
|
|
804 |
}
|
|
805 |
|
|
806 |
default :
|
|
807 |
{
|
|
808 |
mapVar.Reset();
|
|
809 |
IncorrectValueL( KDeliveryStatusKey.operator&() );
|
|
810 |
User::Leave( SErrInvalidServiceArgument );
|
|
811 |
}
|
|
812 |
}
|
|
813 |
|
|
814 |
if( val )
|
|
815 |
{
|
|
816 |
event->SetStatus( val ) ;
|
|
817 |
}
|
|
818 |
}
|
|
819 |
|
|
820 |
if(evtmap->FindL(KFlagsKey , mapVar))
|
|
821 |
{
|
|
822 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeTInt32, KFlagsKey.operator&() );
|
|
823 |
TUint8 val = 0 ;
|
|
824 |
|
|
825 |
switch(mapVar.AsTInt32())
|
|
826 |
{
|
|
827 |
case EKLogEventContactSearched :
|
|
828 |
{
|
|
829 |
val = KLogEventContactSearched ;
|
|
830 |
break ;
|
|
831 |
}
|
|
832 |
|
|
833 |
case EKLogEventRead :
|
|
834 |
{
|
|
835 |
val = KLogEventRead ;
|
|
836 |
break ;
|
|
837 |
}
|
|
838 |
|
|
839 |
default :
|
|
840 |
{
|
|
841 |
mapVar.Reset();
|
|
842 |
IncorrectValueL( KFlagsKey.operator&() );
|
|
843 |
User::Leave( SErrInvalidServiceArgument );
|
|
844 |
}
|
|
845 |
}
|
|
846 |
|
|
847 |
if( val )
|
|
848 |
{
|
|
849 |
event->SetFlags( val ) ;
|
|
850 |
}
|
|
851 |
}
|
|
852 |
|
|
853 |
if(evtmap->FindL( KSubjectKey , mapVar ))
|
|
854 |
{
|
|
855 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeDesC, KSubjectKey.operator&() );
|
|
856 |
event->SetSubject( mapVar.AsDes() ) ;
|
|
857 |
}
|
|
858 |
|
|
859 |
if(evtmap->FindL( KPhoneNumberKey , mapVar ))
|
|
860 |
{
|
|
861 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeDesC, KPhoneNumberKey.operator&() );
|
|
862 |
event->SetNumber( mapVar.AsDes() ) ;
|
|
863 |
}
|
|
864 |
|
|
865 |
if(evtmap->FindL( KEventDataKey , mapVar ))
|
|
866 |
{
|
|
867 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeDesC8, KEventDataKey.operator&() );
|
|
868 |
event->SetDataL( mapVar.AsData() ) ;
|
|
869 |
}
|
|
870 |
|
|
871 |
if(evtmap->FindL( KLinkKey , mapVar ))
|
|
872 |
{
|
|
873 |
CheckInputTypeL( &mapVar, LIW::EVariantTypeTInt32, KLinkKey.operator&() );
|
|
874 |
|
|
875 |
if( mapVar.AsTInt32()<0 )
|
|
876 |
{
|
|
877 |
mapVar.Reset();
|
|
878 |
IncorrectValueL( KLinkKey.operator&() );
|
|
879 |
User::Leave( SErrInvalidServiceArgument );
|
|
880 |
}
|
|
881 |
event->SetLink( mapVar.AsTInt32() ) ;
|
|
882 |
}
|
|
883 |
|
|
884 |
CleanupStack::Pop( &mapVar );
|
|
885 |
|
|
886 |
mapVar.Reset();
|
|
887 |
|
|
888 |
if( KLiwOptASyncronous & aCmdOptions )
|
|
889 |
{
|
|
890 |
if( aCallback!=NULL )
|
|
891 |
{
|
|
892 |
aTansId = MLiwNotifyCallback :: GetTransactionID() ;
|
|
893 |
LoggingInterfaceCB *cb = LoggingInterfaceCB :: NewL( aCallback ) ;
|
|
894 |
CleanupStack :: PushL( cb ) ;
|
|
895 |
cb->SetRequestType( EAddEvent ) ;
|
|
896 |
iLogService->AddEventL( aTansId, event, cb );
|
|
897 |
CleanupStack::Pop( cb );
|
|
898 |
CleanupStack::Pop( event );
|
|
899 |
delete event ;
|
|
900 |
return 0;
|
|
901 |
}
|
|
902 |
else
|
|
903 |
{
|
|
904 |
iErrorString = KErrMissingCallback.operator()().Alloc();
|
|
905 |
User::Leave( SErrInvalidServiceArgument );
|
|
906 |
}
|
|
907 |
}
|
|
908 |
else
|
|
909 |
{
|
|
910 |
TInt32 logid = iLogService->AddEventL(event) ;
|
|
911 |
|
|
912 |
if(logid<0)
|
|
913 |
{
|
|
914 |
IncorrectValueL( KLogId.operator&() );
|
|
915 |
User::Leave( SErrInvalidServiceArgument );
|
|
916 |
}
|
|
917 |
|
|
918 |
CleanupStack::Pop(event);
|
|
919 |
delete event ;
|
|
920 |
return logid ;
|
|
921 |
}
|
|
922 |
|
|
923 |
return 0;
|
|
924 |
}
|
|
925 |
|
|
926 |
/**
|
|
927 |
* Internal utility method, used to getlist from the core class
|
|
928 |
*
|
|
929 |
* @param aFilter, filter for getlist on core class
|
|
930 |
* @param aTransid , value/result argument(TransactionId
|
|
931 |
* @param aCallback, callback method for async events
|
|
932 |
*/
|
|
933 |
CLogIter* CLoggingInterface :: GetListL( const TLiwGenericParam *aFilter,
|
|
934 |
TUint& aTansId,
|
|
935 |
TUint aCmdOptions,
|
|
936 |
MLiwNotifyCallback *aCallback )
|
|
937 |
{
|
|
938 |
if( aFilter && (aFilter->Value().TypeId() != LIW::EVariantTypeNull) )
|
|
939 |
{
|
|
940 |
CheckInputTypeL( &aFilter->Value(), LIW::EVariantTypeMap ,KFilter.operator&() );
|
|
941 |
|
|
942 |
CLogsFilter *filter = CLogsFilter :: NewL() ;
|
|
943 |
|
|
944 |
filter->SetRequestType( EReadEvents ) ;
|
|
945 |
|
|
946 |
CleanupStack :: PushL( filter ) ;
|
|
947 |
|
|
948 |
const CLiwMap *mapParam = (aFilter->Value()).AsMap() ;
|
|
949 |
|
|
950 |
TLiwVariant var ;
|
|
951 |
|
|
952 |
CleanupStack::PushL( TCleanupItem( TLiwVariant::VariantCleanup , &var) );
|
|
953 |
|
|
954 |
/**
|
|
955 |
* Extract the contents of getlist filter
|
|
956 |
* and issue request to the core class accordingly
|
|
957 |
*/
|
|
958 |
|
|
959 |
if( mapParam->FindL( KLogId ,var ) )
|
|
960 |
{
|
|
961 |
TInt32 logid;
|
|
962 |
CheckInputTypeL( &var, LIW::EVariantTypeDesC, KLogId.operator&() );
|
|
963 |
if( var.AsDes()!=KNullDesC16 )
|
|
964 |
{
|
|
965 |
if( var.AsDes().Length() < 256 )
|
|
966 |
{
|
|
967 |
TBuf<256> Val2 = var.AsDes();
|
|
968 |
TLex lex(Val2);
|
|
969 |
TInt32 error = lex.Val( logid );
|
|
970 |
if( error!=KErrNone )
|
|
971 |
{
|
|
972 |
var.Reset();
|
|
973 |
IncorrectValueL( KLogId.operator&() );
|
|
974 |
User::Leave( SErrInvalidServiceArgument );
|
|
975 |
}
|
|
976 |
}
|
|
977 |
else
|
|
978 |
{
|
|
979 |
var.Reset();
|
|
980 |
IncorrectValueL( KLogId.operator&() );
|
|
981 |
User::Leave( SErrInvalidServiceArgument );
|
|
982 |
}
|
|
983 |
|
|
984 |
if( logid>-1 )
|
|
985 |
{
|
|
986 |
CleanupStack::Pop( &var );
|
|
987 |
var.Reset();
|
|
988 |
CLogsEvent *event = CLogsEvent :: NewL();
|
|
989 |
CleanupStack :: PushL( event ) ;
|
|
990 |
event->SetId( logid );
|
|
991 |
filter->SetEventL( event ) ;
|
|
992 |
CleanupStack :: Pop( event ) ;
|
|
993 |
delete event ;
|
|
994 |
filter->SetRequestType( EGetEvent ) ;
|
|
995 |
|
|
996 |
if( KLiwOptASyncronous & aCmdOptions )
|
|
997 |
{
|
|
998 |
if( aCallback!=NULL )
|
|
999 |
{
|
|
1000 |
aTansId = MLiwNotifyCallback :: GetTransactionID() ;
|
|
1001 |
LoggingInterfaceCB *cb = LoggingInterfaceCB :: NewL(aCallback) ;
|
|
1002 |
CleanupStack :: PushL( cb ) ;
|
|
1003 |
cb->SetRequestType( EGetEvent ) ;
|
|
1004 |
iLogService->GetListL( aTansId, filter, cb) ;
|
|
1005 |
CleanupStack :: Pop( cb ) ;
|
|
1006 |
CleanupStack :: Pop( filter ) ;
|
|
1007 |
delete filter ;
|
|
1008 |
return NULL;
|
|
1009 |
}
|
|
1010 |
else
|
|
1011 |
{
|
|
1012 |
iErrorString = KErrMissingCallback.operator()().Alloc();
|
|
1013 |
User::Leave( SErrInvalidServiceArgument );
|
|
1014 |
}
|
|
1015 |
}
|
|
1016 |
else
|
|
1017 |
{
|
|
1018 |
CLogIter *Iter = iLogService->GetListL( filter ) ;
|
|
1019 |
CleanupStack :: Pop( filter ) ;
|
|
1020 |
delete filter;
|
|
1021 |
return Iter ;
|
|
1022 |
}
|
|
1023 |
}
|
|
1024 |
else
|
|
1025 |
{
|
|
1026 |
var.Reset();
|
|
1027 |
User::Leave( SErrInvalidServiceArgument );
|
|
1028 |
}
|
|
1029 |
}
|
|
1030 |
}
|
|
1031 |
|
|
1032 |
if( mapParam->FindL(KRecentListKey , var) )
|
|
1033 |
{
|
|
1034 |
CheckInputTypeL( &var, LIW::EVariantTypeTInt32, KRecentListKey.operator&() );
|
|
1035 |
|
|
1036 |
TInt Val3 = var.AsTInt32();
|
|
1037 |
|
|
1038 |
switch( Val3 )
|
|
1039 |
{
|
|
1040 |
case EKLogNullRecentList :
|
|
1041 |
{
|
|
1042 |
filter->SetRecentList( KLogNullRecentList ) ;
|
|
1043 |
break;
|
|
1044 |
}
|
|
1045 |
|
|
1046 |
case EKLogRecentIncomingCalls :
|
|
1047 |
{
|
|
1048 |
filter->SetRecentList( KLogRecentIncomingCalls );
|
|
1049 |
break;
|
|
1050 |
}
|
|
1051 |
|
|
1052 |
case EKLogRecentOutgoingCalls :
|
|
1053 |
{
|
|
1054 |
filter->SetRecentList( KLogRecentOutgoingCalls );
|
|
1055 |
break;
|
|
1056 |
}
|
|
1057 |
|
|
1058 |
case EKLogRecentMissedCalls :
|
|
1059 |
{
|
|
1060 |
filter->SetRecentList( KLogRecentMissedCalls );
|
|
1061 |
break;
|
|
1062 |
}
|
|
1063 |
|
|
1064 |
default :
|
|
1065 |
{
|
|
1066 |
var.Reset();
|
|
1067 |
IncorrectValueL( KRecentListKey.operator&() );
|
|
1068 |
User::Leave( SErrInvalidServiceArgument );
|
|
1069 |
break ;
|
|
1070 |
}
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
|
|
1074 |
CleanupStack::Pop( &var );
|
|
1075 |
var.Reset();
|
|
1076 |
|
|
1077 |
filter->SetRequestType(EGetRecent) ;
|
|
1078 |
|
|
1079 |
if ( KLiwOptASyncronous & aCmdOptions )
|
|
1080 |
{
|
|
1081 |
if( aCallback!=NULL )
|
|
1082 |
{
|
|
1083 |
aTansId = MLiwNotifyCallback :: GetTransactionID() ;
|
|
1084 |
LoggingInterfaceCB *cb = LoggingInterfaceCB :: NewL( aCallback ) ;
|
|
1085 |
CleanupStack :: PushL( cb ) ;
|
|
1086 |
cb->SetRequestType( EGetRecent ) ;
|
|
1087 |
iLogService->GetListL( aTansId, filter, cb) ;
|
|
1088 |
CleanupStack :: Pop( cb ) ;
|
|
1089 |
CleanupStack :: Pop( filter ) ;
|
|
1090 |
delete filter ;
|
|
1091 |
return NULL;
|
|
1092 |
}
|
|
1093 |
else
|
|
1094 |
{
|
|
1095 |
iErrorString = KErrMissingCallback.operator()().Alloc();
|
|
1096 |
User::Leave( SErrInvalidServiceArgument );
|
|
1097 |
}
|
|
1098 |
}
|
|
1099 |
else
|
|
1100 |
{
|
|
1101 |
CLogIter *Iter = iLogService->GetListL( filter ) ;
|
|
1102 |
CleanupStack :: Pop( filter ) ;
|
|
1103 |
delete filter;
|
|
1104 |
return Iter;
|
|
1105 |
}
|
|
1106 |
|
|
1107 |
}
|
|
1108 |
|
|
1109 |
if( mapParam->FindL( KPhoneNumberKey ,var ) )
|
|
1110 |
{
|
|
1111 |
CheckInputTypeL( &var, LIW::EVariantTypeDesC, KPhoneNumberKey.operator&() );
|
|
1112 |
filter->SetNumber( var.AsDes() ) ;
|
|
1113 |
}
|
|
1114 |
|
|
1115 |
if( mapParam->FindL( KDirectionKey ,var ) )
|
|
1116 |
{
|
|
1117 |
CheckInputTypeL( &var, LIW::EVariantTypeTInt32, KDirectionKey.operator&() );
|
|
1118 |
TInt val = 0 ;
|
|
1119 |
|
|
1120 |
switch( var.AsTInt32() )
|
|
1121 |
{
|
|
1122 |
case EIncomingEvent:
|
|
1123 |
{
|
|
1124 |
val = R_LOG_DIR_IN ;
|
|
1125 |
break ;
|
|
1126 |
}
|
|
1127 |
|
|
1128 |
case EOutgoingEvent :
|
|
1129 |
{
|
|
1130 |
val = R_LOG_DIR_OUT ;
|
|
1131 |
break ;
|
|
1132 |
}
|
|
1133 |
|
|
1134 |
case EIncomingEventAlternateline :
|
|
1135 |
{
|
|
1136 |
val = R_LOG_DIR_IN_ALT ;
|
|
1137 |
break ;
|
|
1138 |
}
|
|
1139 |
|
|
1140 |
case EOutgoingEventAlternateline :
|
|
1141 |
{
|
|
1142 |
val = R_LOG_DIR_OUT_ALT ;
|
|
1143 |
break ;
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
case EFetchedEvent :
|
|
1147 |
{
|
|
1148 |
val = R_LOG_DIR_FETCHED ;
|
|
1149 |
break ;
|
|
1150 |
}
|
|
1151 |
|
|
1152 |
case EMissedEvent :
|
|
1153 |
{
|
|
1154 |
val = R_LOG_DIR_MISSED ;
|
|
1155 |
break ;
|
|
1156 |
}
|
|
1157 |
|
|
1158 |
case EMissedEventAlternateline :
|
|
1159 |
{
|
|
1160 |
val = R_LOG_DIR_MISSED_ALT ;
|
|
1161 |
break ;
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
default :
|
|
1165 |
{
|
|
1166 |
var.Reset();
|
|
1167 |
IncorrectValueL( KDirectionKey.operator&() );
|
|
1168 |
User::Leave( SErrInvalidServiceArgument );
|
|
1169 |
}
|
|
1170 |
}
|
|
1171 |
|
|
1172 |
if( val )
|
|
1173 |
{
|
|
1174 |
filter->SetDirection( val ) ;
|
|
1175 |
}
|
|
1176 |
}
|
|
1177 |
|
|
1178 |
if( mapParam->FindL(KDeliveryStatusKey ,var) )
|
|
1179 |
{
|
|
1180 |
CheckInputTypeL( &var, LIW::EVariantTypeTInt32, KDeliveryStatusKey.operator&() );
|
|
1181 |
TInt val = 0 ;
|
|
1182 |
|
|
1183 |
switch( var.AsTInt32() )
|
|
1184 |
{
|
|
1185 |
case EStatusPending :
|
|
1186 |
{
|
|
1187 |
val = R_LOG_DEL_PENDING ;
|
|
1188 |
break ;
|
|
1189 |
}
|
|
1190 |
|
|
1191 |
case EStatusSent :
|
|
1192 |
{
|
|
1193 |
val = R_LOG_DEL_SENT ;
|
|
1194 |
break ;
|
|
1195 |
}
|
|
1196 |
|
|
1197 |
case EStatusFalied :
|
|
1198 |
{
|
|
1199 |
val = R_LOG_DEL_FAILED ;
|
|
1200 |
break ;
|
|
1201 |
}
|
|
1202 |
|
|
1203 |
case EStatusNone :
|
|
1204 |
{
|
|
1205 |
val = R_LOG_DEL_NONE ;
|
|
1206 |
break ;
|
|
1207 |
}
|
|
1208 |
|
|
1209 |
case EStatusDone :
|
|
1210 |
{
|
|
1211 |
val = R_LOG_DEL_DONE ;
|
|
1212 |
break ;
|
|
1213 |
}
|
|
1214 |
|
|
1215 |
case EStatusNotSent :
|
|
1216 |
{
|
|
1217 |
val = R_LOG_DEL_NOT_SENT ;
|
|
1218 |
break ;
|
|
1219 |
}
|
|
1220 |
|
|
1221 |
case EStatusScheduled :
|
|
1222 |
{
|
|
1223 |
val = R_LOG_DEL_SCHEDULED ;
|
|
1224 |
break ;
|
|
1225 |
}
|
|
1226 |
|
|
1227 |
default :
|
|
1228 |
{
|
|
1229 |
var.Reset();
|
|
1230 |
IncorrectValueL( KDeliveryStatusKey.operator&() );
|
|
1231 |
User::Leave( SErrInvalidServiceArgument );
|
|
1232 |
}
|
|
1233 |
}
|
|
1234 |
|
|
1235 |
if( val )
|
|
1236 |
{
|
|
1237 |
filter->SetStatus(val) ;
|
|
1238 |
}
|
|
1239 |
}
|
|
1240 |
|
|
1241 |
if( mapParam->FindL( KFlagsKey , var ) )
|
|
1242 |
{
|
|
1243 |
CheckInputTypeL( &var, LIW::EVariantTypeTInt32, KFlagsKey.operator&() );
|
|
1244 |
TUint8 val = 0 ;
|
|
1245 |
|
|
1246 |
switch( var.AsTInt32() )
|
|
1247 |
{
|
|
1248 |
case EKLogEventContactSearched :
|
|
1249 |
{
|
|
1250 |
val = KLogEventContactSearched ;
|
|
1251 |
break ;
|
|
1252 |
}
|
|
1253 |
|
|
1254 |
case EKLogEventRead :
|
|
1255 |
{
|
|
1256 |
val = KLogEventRead ;
|
|
1257 |
break ;
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
default :
|
|
1261 |
{
|
|
1262 |
var.Reset();
|
|
1263 |
IncorrectValueL( KFlagsKey.operator&() );
|
|
1264 |
User::Leave( SErrInvalidServiceArgument );
|
|
1265 |
}
|
|
1266 |
}
|
|
1267 |
|
|
1268 |
if( val )
|
|
1269 |
{
|
|
1270 |
filter->SetFlags( val ) ;
|
|
1271 |
}
|
|
1272 |
}
|
|
1273 |
|
|
1274 |
if( mapParam->FindL( KEndTimeKey , var ) )
|
|
1275 |
{
|
|
1276 |
CheckInputTypeL( &var, LIW::EVariantTypeTTime, KEndTimeKey.operator&() );
|
|
1277 |
filter->SetEndTime( var.AsTTime() ) ;
|
|
1278 |
}
|
|
1279 |
|
|
1280 |
if( mapParam->FindL( KRemotePartyKey , var ) )
|
|
1281 |
{
|
|
1282 |
CheckInputTypeL( &var, LIW::EVariantTypeDesC, KRemotePartyKey.operator&() );
|
|
1283 |
filter->SetRemoteParty( var.AsDes() ) ;
|
|
1284 |
}
|
|
1285 |
|
|
1286 |
if( mapParam->FindL( KEventTypeKey , var ) )
|
|
1287 |
{
|
|
1288 |
CheckInputTypeL( &var, LIW::EVariantTypeTInt32, KEventTypeKey.operator&() );
|
|
1289 |
TUid val = TUid::Null() ;
|
|
1290 |
|
|
1291 |
switch( var.AsTInt32() )
|
|
1292 |
{
|
|
1293 |
case EKLogCallEventType :
|
|
1294 |
{
|
|
1295 |
val = TUid :: Uid(KLogCallEventType);
|
|
1296 |
break ;
|
|
1297 |
}
|
|
1298 |
|
|
1299 |
case EKLogDataEventType :
|
|
1300 |
{
|
|
1301 |
val = TUid :: Uid (KLogDataEventType);
|
|
1302 |
break ;
|
|
1303 |
}
|
|
1304 |
|
|
1305 |
case EKLogFaxEventType :
|
|
1306 |
{
|
|
1307 |
val = TUid :: Uid (KLogFaxEventType);
|
|
1308 |
break ;
|
|
1309 |
}
|
|
1310 |
|
|
1311 |
case EKLogShortMessageEventType :
|
|
1312 |
{
|
|
1313 |
val = TUid :: Uid (KLogShortMessageEventType);
|
|
1314 |
break ;
|
|
1315 |
}
|
|
1316 |
|
|
1317 |
case EKLogPacketDataEventType :
|
|
1318 |
{
|
|
1319 |
val = TUid :: Uid (KLogPacketDataEventType) ;
|
|
1320 |
break ;
|
|
1321 |
}
|
|
1322 |
|
|
1323 |
default :
|
|
1324 |
{
|
|
1325 |
var.Reset();
|
|
1326 |
IncorrectValueL( KFlagsKey.operator&() );
|
|
1327 |
User::Leave( SErrInvalidServiceArgument );
|
|
1328 |
}
|
|
1329 |
}
|
|
1330 |
|
|
1331 |
if( val!=TUid::Null() )
|
|
1332 |
{
|
|
1333 |
filter->SetEventType( val ) ;
|
|
1334 |
}
|
|
1335 |
}
|
|
1336 |
|
|
1337 |
CleanupStack::Pop( &var );
|
|
1338 |
|
|
1339 |
var.Reset();
|
|
1340 |
|
|
1341 |
if ( KLiwOptASyncronous & aCmdOptions )
|
|
1342 |
{
|
|
1343 |
if( aCallback!=NULL )
|
|
1344 |
{
|
|
1345 |
aTansId = MLiwNotifyCallback :: GetTransactionID() ;
|
|
1346 |
LoggingInterfaceCB *cb = LoggingInterfaceCB :: NewL( aCallback ) ;
|
|
1347 |
CleanupStack :: PushL( cb ) ;
|
|
1348 |
cb->SetRequestType( EReadEvents ) ;
|
|
1349 |
iLogService->GetListL( aTansId, filter, cb ) ;
|
|
1350 |
CleanupStack :: Pop( cb ) ;
|
|
1351 |
CleanupStack :: Pop( filter ) ;
|
|
1352 |
delete filter ;
|
|
1353 |
return NULL;
|
|
1354 |
}
|
|
1355 |
else
|
|
1356 |
{
|
|
1357 |
iErrorString = KErrMissingCallback.operator()().Alloc();
|
|
1358 |
User::Leave( SErrInvalidServiceArgument );
|
|
1359 |
}
|
|
1360 |
}
|
|
1361 |
else
|
|
1362 |
{
|
|
1363 |
CLogIter *Iter = iLogService->GetListL(filter) ;
|
|
1364 |
CleanupStack :: Pop(filter) ;
|
|
1365 |
delete filter;
|
|
1366 |
return Iter;
|
|
1367 |
}
|
|
1368 |
}
|
|
1369 |
else
|
|
1370 |
{
|
|
1371 |
CLogsFilter *filter = CLogsFilter :: NewL() ;
|
|
1372 |
|
|
1373 |
filter->SetRequestType( EReadEvents ) ;
|
|
1374 |
|
|
1375 |
CleanupStack :: PushL( filter ) ;
|
|
1376 |
|
|
1377 |
if ( KLiwOptASyncronous & aCmdOptions )
|
|
1378 |
{
|
|
1379 |
if( aCallback!=NULL )
|
|
1380 |
{
|
|
1381 |
aTansId = MLiwNotifyCallback :: GetTransactionID() ;
|
|
1382 |
LoggingInterfaceCB *cb = LoggingInterfaceCB :: NewL( aCallback ) ;
|
|
1383 |
CleanupStack :: PushL( cb ) ;
|
|
1384 |
cb->SetRequestType( EReadEvents ) ;
|
|
1385 |
iLogService->GetListL( aTansId , filter , cb ) ;
|
|
1386 |
CleanupStack :: Pop( cb ) ;
|
|
1387 |
CleanupStack :: Pop( filter ) ;
|
|
1388 |
delete filter ;
|
|
1389 |
return NULL;
|
|
1390 |
}
|
|
1391 |
else
|
|
1392 |
{
|
|
1393 |
iErrorString = KErrMissingCallback.operator()().Alloc();
|
|
1394 |
User::Leave( SErrInvalidServiceArgument );
|
|
1395 |
}
|
|
1396 |
}
|
|
1397 |
else
|
|
1398 |
{
|
|
1399 |
CLogIter *Iter = iLogService->GetListL(filter) ;
|
|
1400 |
CleanupStack :: Pop(filter) ;
|
|
1401 |
delete filter;
|
|
1402 |
return Iter;
|
|
1403 |
}
|
|
1404 |
}
|
|
1405 |
|
|
1406 |
return 0;
|
|
1407 |
}
|
|
1408 |
|
|
1409 |
/**
|
|
1410 |
* Internal utility method, used for notification registration
|
|
1411 |
*
|
|
1412 |
* @param aCallback, callback address for notification requests.
|
|
1413 |
*/
|
|
1414 |
|
|
1415 |
TInt CLoggingInterface :: RequestNotificationsL( const TLiwGenericParam *aParam ,
|
|
1416 |
MLiwNotifyCallback *aCallback ,
|
|
1417 |
TUint& aTransId,
|
|
1418 |
TUint aCmdOptions )
|
|
1419 |
{
|
|
1420 |
TInt32 timeDelay = 0;
|
|
1421 |
|
|
1422 |
CheckInputTypeL( &aParam->Value(), LIW::EVariantTypeMap ,KFilter.operator&() );
|
|
1423 |
|
|
1424 |
const CLiwMap *notifymap = (aParam->Value()).AsMap() ;
|
|
1425 |
|
|
1426 |
if( !notifymap )
|
|
1427 |
{
|
|
1428 |
MissingValueL( KFilter.operator&() );
|
|
1429 |
}
|
|
1430 |
|
|
1431 |
TLiwVariant variant ;
|
|
1432 |
|
|
1433 |
if( notifymap->FindL( KDelayTime , variant ) )
|
|
1434 |
{
|
|
1435 |
CheckInputTypeL( &variant, LIW::EVariantTypeTInt32, KDelayTime.operator&() );
|
|
1436 |
timeDelay = variant.AsTInt32() ;
|
|
1437 |
}
|
|
1438 |
else
|
|
1439 |
{
|
|
1440 |
MissingValueL( KDelayTime.operator&() );
|
|
1441 |
}
|
|
1442 |
|
|
1443 |
if( timeDelay < 0 )
|
|
1444 |
{
|
|
1445 |
variant.Reset();
|
|
1446 |
IncorrectValueL( KDelayTime.operator&() );
|
|
1447 |
User::Leave( SErrInvalidServiceArgument );
|
|
1448 |
}
|
|
1449 |
|
|
1450 |
variant.Reset();
|
|
1451 |
|
|
1452 |
TTimeIntervalMicroSeconds32 DelayInterval = timeDelay ;
|
|
1453 |
|
|
1454 |
if( aCallback && ( KLiwOptASyncronous & aCmdOptions ) )
|
|
1455 |
{
|
|
1456 |
aTransId = MLiwNotifyCallback :: GetTransactionID() ;
|
|
1457 |
LoggingInterfaceCB *cb = LoggingInterfaceCB :: NewL( aCallback ) ;
|
|
1458 |
CleanupStack :: PushL( cb ) ;
|
|
1459 |
cb->SetRequestType( ENotification ) ;
|
|
1460 |
iLogService->NotifyUpdatesL( aTransId, DelayInterval, cb) ;
|
|
1461 |
CleanupStack :: Pop( cb ) ;
|
|
1462 |
return 0 ;
|
|
1463 |
}
|
|
1464 |
else
|
|
1465 |
{
|
|
1466 |
iErrorString = KErrMissingCallback.operator()().Alloc();
|
|
1467 |
User::Leave( SErrInvalidServiceArgument );
|
|
1468 |
}
|
|
1469 |
|
|
1470 |
return 0;
|
|
1471 |
}
|
|
1472 |
|
|
1473 |
/**
|
|
1474 |
* Internal utility method, used for Delete from the core class
|
|
1475 |
*
|
|
1476 |
* @param aParam, input paramater containg the logid
|
|
1477 |
* @param aCallback, callback address for notification requests.
|
|
1478 |
* @param aTransId, transaction id.
|
|
1479 |
*/
|
|
1480 |
TInt CLoggingInterface::DeleteEventL( const TLiwGenericParam *aParam ,
|
|
1481 |
TUint& aTansId ,
|
|
1482 |
TUint aCmdOptions,
|
|
1483 |
MLiwNotifyCallback* aCallback )
|
|
1484 |
{
|
|
1485 |
TInt32 logid;
|
|
1486 |
|
|
1487 |
CheckInputTypeL( &aParam->Value(), LIW::EVariantTypeMap ,KData.operator&() );
|
|
1488 |
|
|
1489 |
const CLiwMap *delmap = (aParam->Value()).AsMap() ;
|
|
1490 |
|
|
1491 |
if( !delmap )
|
|
1492 |
{
|
|
1493 |
MissingValueL( KData.operator&() );
|
|
1494 |
}
|
|
1495 |
|
|
1496 |
TLiwVariant variant ;
|
|
1497 |
|
|
1498 |
if( delmap->FindL( KLogId , variant ) )
|
|
1499 |
{
|
|
1500 |
CheckInputTypeL( &variant, LIW::EVariantTypeDesC, KLogId.operator&() );
|
|
1501 |
|
|
1502 |
if( variant.AsDes().Length() < 256 )
|
|
1503 |
{
|
|
1504 |
TBuf<256> itemid = variant.AsDes();
|
|
1505 |
TLex lex(itemid);
|
|
1506 |
TInt32 error = lex.Val(logid);
|
|
1507 |
|
|
1508 |
if( error!=KErrNone )
|
|
1509 |
{
|
|
1510 |
variant.Reset();
|
|
1511 |
IncorrectValueL( KLogId.operator&() );
|
|
1512 |
User::Leave( SErrInvalidServiceArgument );
|
|
1513 |
}
|
|
1514 |
}
|
|
1515 |
else
|
|
1516 |
{
|
|
1517 |
variant.Reset();
|
|
1518 |
IncorrectValueL( KLogId.operator&() );
|
|
1519 |
User::Leave( SErrInvalidServiceArgument );
|
|
1520 |
}
|
|
1521 |
}
|
|
1522 |
else
|
|
1523 |
{
|
|
1524 |
MissingValueL( KLogId.operator&() );
|
|
1525 |
}
|
|
1526 |
|
|
1527 |
variant.Reset();
|
|
1528 |
|
|
1529 |
if( KLiwOptASyncronous & aCmdOptions )
|
|
1530 |
{
|
|
1531 |
if( aCallback!=NULL )
|
|
1532 |
{
|
|
1533 |
aTansId = MLiwNotifyCallback :: GetTransactionID() ;
|
|
1534 |
LoggingInterfaceCB *cb = LoggingInterfaceCB :: NewL( aCallback ) ;
|
|
1535 |
CleanupStack :: PushL( cb ) ;
|
|
1536 |
cb->SetRequestType( EDeleteEvent ) ;
|
|
1537 |
iLogService->DeleteEventL( aTansId, logid, cb );
|
|
1538 |
CleanupStack :: Pop( cb ) ;
|
|
1539 |
return 0;
|
|
1540 |
}
|
|
1541 |
else
|
|
1542 |
{
|
|
1543 |
iErrorString = KErrMissingCallback.operator()().Alloc();
|
|
1544 |
User::Leave( SErrInvalidServiceArgument );
|
|
1545 |
}
|
|
1546 |
}
|
|
1547 |
else
|
|
1548 |
{
|
|
1549 |
return iLogService->DeleteEventL(logid );
|
|
1550 |
}
|
|
1551 |
|
|
1552 |
return 0;
|
|
1553 |
}
|
|
1554 |
|
|
1555 |
|
|
1556 |
|
|
1557 |
|
|
1558 |
|