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