diff -r 50974a8b132e -r 5d0ec8b709be serviceproviders/sapi_logging/src/loggingcallback.cpp --- a/serviceproviders/sapi_logging/src/loggingcallback.cpp Tue Nov 24 08:56:33 2009 +0200 +++ b/serviceproviders/sapi_logging/src/loggingcallback.cpp Thu Dec 17 09:09:50 2009 +0200 @@ -18,7 +18,17 @@ #include #include + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS #include +#else +#include +#include +#include +#include +#include +#endif + #include #include "logiter.h" @@ -178,6 +188,218 @@ } } +void LoggingInterfaceCB :: HandleReqeustL( TUint aTransId, TUint aStatus, CLogsEvent *aEvents ) + { + TInt i = 0; + CleanupStack :: PushL( this ) ; + + CLiwGenericParamList *OutParm = CLiwGenericParamList :: NewL() ; + CleanupStack :: PushL(OutParm) ; + CLiwGenericParamList *InParm = CLiwGenericParamList :: NewL() ; + CleanupStack :: PushL(InParm) ; + + TInt32 sapierror ; + + sapierror = CLoggingInterface::ConvertToSapiError( aStatus ); + + OutParm->AppendL(TLiwGenericParam(KErrCode , TLiwVariant((TInt32)sapierror))) ; + + CleanupStack::PushL(aEvents); + + CLiwDefaultMap *evntmap = CLiwDefaultMap :: NewL() ; + + CleanupClosePushL( *evntmap ); + + TLiwVariant entry; + + /** + * Extract all the event details form CLogsEvent object + * and push it to the aEntry + */ + + TInt32 val = 0 ; + + switch( (aEvents->getEventType()).iUid ) + { + case KLogCallEventType : + { + val = CLoggingInterface :: EKLogCallEventType ; + break ; + } + + case KLogDataEventType : + { + val = CLoggingInterface :: EKLogDataEventType ; + break ; + } + + case KLogFaxEventType : + { + val = CLoggingInterface :: EKLogFaxEventType ; + break ; + } + + case KLogShortMessageEventType : + { + val = CLoggingInterface :: EKLogShortMessageEventType ; + break ; + } + + case KLogPacketDataEventType : + { + val = CLoggingInterface :: EKLogPacketDataEventType ; + break ; + } + + default : + { + break ; + } + } + + evntmap->InsertL(KEventTypeKey , TLiwVariant((TInt32)val)); + + evntmap->InsertL(KRemotePartyKey , TLiwVariant(aEvents->getRemoteParty())) ; + + evntmap->InsertL(KEventDurationKey ,TLiwVariant((TInt32)aEvents->getDuration())) ; + + evntmap->InsertL(KEventTimeKey , TLiwVariant(aEvents->getTime())) ; + + val = 0 ; + + /** + * Need to convert status to int value + */ + if( ( ( aEvents->getStatus() ).Compare( KStatusPending ) ) == KErrNone ) + { + val = CLoggingInterface :: EStatusPending ; + } + else if( ( ( aEvents->getStatus() ).Compare( KStatusSent ) ) == KErrNone ) + { + val =CLoggingInterface :: EStatusSent ; + } + else if( ( ( aEvents->getStatus() ).Compare( KStatusFalied ) ) == KErrNone ) + { + val = CLoggingInterface :: EStatusFalied ; + } + else if( ( ( aEvents->getStatus() ).Compare( KStatusNone ) ) == KErrNone ) + { + val = CLoggingInterface :: EStatusNone; + } + else if( ( ( aEvents->getStatus() ).Compare( KStatusDone ) ) == KErrNone ) + { + val = CLoggingInterface :: EStatusDone; + } + else if( ( ( aEvents->getStatus() ).Compare( KStatusNotSent ) ) == KErrNone ) + { + val = CLoggingInterface :: EStatusNotSent; + } + else if( ( ( aEvents->getStatus() ).Compare( KStatusScheduled ) ) == KErrNone ) + { + val = CLoggingInterface :: EStatusScheduled; + } + else + { + val = CLoggingInterface :: EStatusNotPresent; + } + + if( val != -1 ) + { + evntmap->InsertL(KDeliveryStatusKey , TLiwVariant((TInt32)val)) ; + } + + evntmap->InsertL(KSubjectKey , TLiwVariant(aEvents->getSubject())) ; + + evntmap->InsertL(KPhoneNumberKey , TLiwVariant(aEvents->getNumber())) ; + + evntmap->InsertL(KDescriptionKey , TLiwVariant (aEvents->getDescription())) ; + + evntmap->InsertL(KLinkKey , TLiwVariant((TInt32)aEvents->getLink())) ; + + val = 0 ; + + if( aEvents->Flags() & KLogEventContactSearched ) + { + val = CLoggingInterface :: EKLogEventContactSearched ; + } + else if( aEvents->Flags() & KLogEventRead ) + { + val = CLoggingInterface :: EKLogEventRead ; + } + + else + { + val = CLoggingInterface :: EFlagNotPresent; + } + + if( val != -1 ) + { + evntmap->InsertL(KFlagsKey , TLiwVariant((TInt32)val) ); + } + + TInt32 ret = aEvents->Id(); + TBuf<8> des; + des.Num(ret); + evntmap->InsertL(KLogId , TLiwVariant( des)) ; + + val = 0 ; + + if( ( ( aEvents->getDirection() ).Compare( KIncomingEvent ) ) == KErrNone ) + { + val = CLoggingInterface :: EIncomingEvent ; + } + else if( ( ( aEvents->getDirection() ).Compare( KOutgoingEvent ) ) == KErrNone ) + { + val = CLoggingInterface :: EOutgoingEvent ; + } + else if( ( ( aEvents->getDirection() ).Compare( KIncomingEventAlternateline ) ) == KErrNone ) + { + val = CLoggingInterface :: EIncomingEventAlternateline ; + } + else if( ( ( aEvents->getDirection() ).Compare( KOutgoingEventAlternateline ) ) == KErrNone ) + { + val = CLoggingInterface :: EOutgoingEventAlternateline; + } + else if( ( ( aEvents->getDirection() ).Compare( KFetchedEvent ) ) == KErrNone ) + { + val = CLoggingInterface :: EFetchedEvent; + } + else if( ( ( aEvents->getDirection() ).Compare( KMissedEvent ) ) == KErrNone ) + { + val = CLoggingInterface :: EMissedEvent; + } + else if( ( ( aEvents->getDirection() ).Compare( KMissedEventAlternateline ) ) == KErrNone ) + { + val = CLoggingInterface :: EMissedEventAlternateline; + } + else + { + val = CLoggingInterface :: EDirectionNotPresent; + } + + if( val != -1 ) + { + evntmap->InsertL(KDirectionKey , TLiwVariant((TInt32)val)) ; + } + + evntmap->InsertL(KEventDataKey , TLiwVariant(aEvents->getDataL())); + + entry.SetL( evntmap ) ; + OutParm->AppendL( TLiwGenericParam( KResponse , entry ) ) ; + CleanupStack :: Pop( evntmap ) ; + evntmap->DecRef(); + CleanupStack::Pop( aEvents ); + delete aEvents; + + + iCallBack->HandleNotifyL( aTransId, KLiwEventInProgress, *OutParm, *InParm ) ; + + CleanupStack::PopAndDestroy( InParm ); + CleanupStack::PopAndDestroy( OutParm ); + CleanupStack::Pop(this); + } + + void LoggingInterfaceCB :: CancelNotifyL( TUint aTransid ) { CleanupStack :: PushL( this ) ;