serviceproviders/sapi_logging/src/loggingcallback.cpp
changeset 26 5d0ec8b709be
parent 23 50974a8b132e
child 35 68159986cd41
equal deleted inserted replaced
23:50974a8b132e 26:5d0ec8b709be
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 #include <liwserviceifbase.h>
    19 #include <liwserviceifbase.h>
    20 #include <liwcommon.h>
    20 #include <liwcommon.h>
       
    21 
       
    22 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    21 #include <logwrap.h>
    23 #include <logwrap.h>
       
    24 #else
       
    25 #include <logwrap.h>
       
    26 #include <logengevents.h>
       
    27 #include <logwraplimits.h>
       
    28 #include <logfilterandeventconstants.hrh>
       
    29 #include <logengdurations.h>
       
    30 #endif
       
    31 
    22 #include <logclientchangeobserver.h>
    32 #include <logclientchangeobserver.h>
    23 
    33 
    24 #include "logiter.h"
    34 #include "logiter.h"
    25 #include "logginginterface.h"
    35 #include "logginginterface.h"
    26 #include "loggingasyncservice.h"
    36 #include "loggingasyncservice.h"
   176             break ;
   186             break ;
   177             }
   187             }
   178         }
   188         }
   179     }   
   189     }   
   180 
   190 
       
   191 void  LoggingInterfaceCB :: HandleReqeustL( TUint aTransId, TUint aStatus, CLogsEvent *aEvents )
       
   192     {
       
   193     TInt i = 0;
       
   194     CleanupStack :: PushL( this ) ;
       
   195     
       
   196     CLiwGenericParamList *OutParm = CLiwGenericParamList :: NewL() ;
       
   197     CleanupStack :: PushL(OutParm) ;
       
   198     CLiwGenericParamList *InParm = CLiwGenericParamList :: NewL() ;
       
   199     CleanupStack :: PushL(InParm) ;
       
   200     
       
   201     TInt32 sapierror  ;
       
   202     
       
   203     sapierror = CLoggingInterface::ConvertToSapiError( aStatus );
       
   204     
       
   205     OutParm->AppendL(TLiwGenericParam(KErrCode , TLiwVariant((TInt32)sapierror))) ;
       
   206     
       
   207     CleanupStack::PushL(aEvents);
       
   208     
       
   209     CLiwDefaultMap *evntmap = CLiwDefaultMap :: NewL() ;
       
   210     
       
   211     CleanupClosePushL( *evntmap );
       
   212     
       
   213     TLiwVariant entry;
       
   214     
       
   215     /**
       
   216      * Extract all the event details form CLogsEvent object
       
   217      * and push it to the aEntry
       
   218      */    
       
   219     
       
   220     TInt32 val = 0 ;
       
   221     
       
   222     switch( (aEvents->getEventType()).iUid )
       
   223         {
       
   224         case KLogCallEventType :
       
   225             {
       
   226             val = CLoggingInterface :: EKLogCallEventType ;
       
   227             break ;
       
   228             }
       
   229         
       
   230         case KLogDataEventType :
       
   231             {
       
   232             val = CLoggingInterface :: EKLogDataEventType ;
       
   233             break ;
       
   234             }
       
   235         
       
   236         case KLogFaxEventType :
       
   237             {
       
   238             val = CLoggingInterface :: EKLogFaxEventType ;
       
   239             break ;
       
   240             }
       
   241         
       
   242         case KLogShortMessageEventType :
       
   243             {
       
   244             val = CLoggingInterface :: EKLogShortMessageEventType ;
       
   245             break ;
       
   246             }
       
   247             
       
   248         case KLogPacketDataEventType :
       
   249             {
       
   250             val = CLoggingInterface :: EKLogPacketDataEventType ;
       
   251             break ;
       
   252             }     
       
   253         
       
   254         default :
       
   255             {
       
   256             break ;
       
   257             }
       
   258         }
       
   259     
       
   260     evntmap->InsertL(KEventTypeKey , TLiwVariant((TInt32)val));
       
   261     
       
   262     evntmap->InsertL(KRemotePartyKey , TLiwVariant(aEvents->getRemoteParty())) ;
       
   263     
       
   264     evntmap->InsertL(KEventDurationKey ,TLiwVariant((TInt32)aEvents->getDuration())) ;
       
   265     
       
   266     evntmap->InsertL(KEventTimeKey , TLiwVariant(aEvents->getTime())) ;
       
   267     
       
   268     val = 0 ;
       
   269     
       
   270     /**
       
   271      * Need to convert status to int value
       
   272      */    
       
   273     if( ( ( aEvents->getStatus() ).Compare( KStatusPending ) ) == KErrNone )
       
   274         {
       
   275         val = CLoggingInterface :: EStatusPending ;
       
   276         }
       
   277     else if( ( ( aEvents->getStatus() ).Compare( KStatusSent ) ) == KErrNone )
       
   278         {
       
   279         val =CLoggingInterface :: EStatusSent ;
       
   280         }
       
   281     else if( ( ( aEvents->getStatus() ).Compare( KStatusFalied ) ) == KErrNone )
       
   282         {
       
   283         val = CLoggingInterface :: EStatusFalied ;
       
   284         }
       
   285     else if( ( ( aEvents->getStatus() ).Compare( KStatusNone ) ) == KErrNone )
       
   286         {
       
   287         val = CLoggingInterface :: EStatusNone;
       
   288         }
       
   289     else if( ( ( aEvents->getStatus() ).Compare( KStatusDone ) ) == KErrNone )
       
   290         {
       
   291         val = CLoggingInterface :: EStatusDone;
       
   292         }
       
   293     else if( ( ( aEvents->getStatus() ).Compare( KStatusNotSent ) ) == KErrNone )
       
   294         {
       
   295         val = CLoggingInterface :: EStatusNotSent;
       
   296         }
       
   297     else if( ( ( aEvents->getStatus() ).Compare( KStatusScheduled ) ) == KErrNone )
       
   298         {
       
   299         val = CLoggingInterface :: EStatusScheduled;
       
   300         }
       
   301     else
       
   302         {
       
   303         val = CLoggingInterface :: EStatusNotPresent;
       
   304         }
       
   305         
       
   306     if( val != -1 )  
       
   307         {
       
   308         evntmap->InsertL(KDeliveryStatusKey , TLiwVariant((TInt32)val)) ;
       
   309         }
       
   310     
       
   311     evntmap->InsertL(KSubjectKey , TLiwVariant(aEvents->getSubject())) ;
       
   312     
       
   313     evntmap->InsertL(KPhoneNumberKey , TLiwVariant(aEvents->getNumber())) ;
       
   314     
       
   315     evntmap->InsertL(KDescriptionKey , TLiwVariant (aEvents->getDescription())) ;
       
   316     
       
   317     evntmap->InsertL(KLinkKey , TLiwVariant((TInt32)aEvents->getLink())) ;
       
   318     
       
   319     val = 0 ;
       
   320     
       
   321     if( aEvents->Flags() & KLogEventContactSearched )
       
   322         {
       
   323         val = CLoggingInterface :: EKLogEventContactSearched ;
       
   324         }
       
   325     else if( aEvents->Flags() & KLogEventRead )
       
   326         {
       
   327         val = CLoggingInterface :: EKLogEventRead ;
       
   328         }
       
   329     
       
   330     else
       
   331         {
       
   332         val = CLoggingInterface :: EFlagNotPresent;
       
   333         }
       
   334         
       
   335     if( val != -1 )  
       
   336         {    
       
   337         evntmap->InsertL(KFlagsKey , TLiwVariant((TInt32)val) );
       
   338         }
       
   339     
       
   340     TInt32 ret =  aEvents->Id();
       
   341     TBuf<8> des;
       
   342     des.Num(ret);
       
   343     evntmap->InsertL(KLogId , TLiwVariant( des)) ;
       
   344     
       
   345     val = 0 ;
       
   346     
       
   347     if( ( ( aEvents->getDirection() ).Compare( KIncomingEvent ) ) == KErrNone )
       
   348         {
       
   349         val = CLoggingInterface :: EIncomingEvent ;
       
   350         }
       
   351     else if( ( ( aEvents->getDirection() ).Compare( KOutgoingEvent ) ) == KErrNone )
       
   352         {
       
   353         val = CLoggingInterface :: EOutgoingEvent ;
       
   354         }
       
   355     else if( ( ( aEvents->getDirection() ).Compare( KIncomingEventAlternateline ) ) == KErrNone )
       
   356         {
       
   357         val = CLoggingInterface :: EIncomingEventAlternateline ;
       
   358         }
       
   359     else if( ( ( aEvents->getDirection() ).Compare( KOutgoingEventAlternateline ) ) == KErrNone )
       
   360         {
       
   361         val = CLoggingInterface :: EOutgoingEventAlternateline;
       
   362         }
       
   363     else if( ( ( aEvents->getDirection() ).Compare( KFetchedEvent ) ) == KErrNone )
       
   364         {
       
   365         val = CLoggingInterface :: EFetchedEvent;
       
   366         }
       
   367     else if( ( ( aEvents->getDirection() ).Compare( KMissedEvent ) ) == KErrNone )
       
   368         {
       
   369         val = CLoggingInterface :: EMissedEvent;
       
   370         }
       
   371     else if( ( ( aEvents->getDirection() ).Compare( KMissedEventAlternateline ) ) == KErrNone )
       
   372         {
       
   373         val = CLoggingInterface :: EMissedEventAlternateline;
       
   374         }
       
   375     else
       
   376         {
       
   377         val = CLoggingInterface :: EDirectionNotPresent;
       
   378         }
       
   379         
       
   380     if( val != -1 )  
       
   381         {    
       
   382         evntmap->InsertL(KDirectionKey , TLiwVariant((TInt32)val)) ;
       
   383         }
       
   384         
       
   385     evntmap->InsertL(KEventDataKey , TLiwVariant(aEvents->getDataL()));
       
   386     
       
   387     entry.SetL( evntmap ) ;
       
   388     OutParm->AppendL( TLiwGenericParam( KResponse , entry  ) ) ;
       
   389     CleanupStack :: Pop( evntmap ) ;
       
   390     evntmap->DecRef();
       
   391     CleanupStack::Pop( aEvents );
       
   392     delete aEvents;
       
   393         
       
   394         
       
   395     iCallBack->HandleNotifyL( aTransId, KLiwEventInProgress, *OutParm, *InParm ) ;
       
   396     
       
   397     CleanupStack::PopAndDestroy( InParm );
       
   398     CleanupStack::PopAndDestroy( OutParm );
       
   399     CleanupStack::Pop(this);   
       
   400     }   
       
   401 
       
   402 
   181  void  LoggingInterfaceCB :: CancelNotifyL( TUint aTransid )
   403  void  LoggingInterfaceCB :: CancelNotifyL( TUint aTransid )
   182     {
   404     {
   183     CleanupStack :: PushL( this ) ;
   405     CleanupStack :: PushL( this ) ;
   184     CLiwGenericParamList *OutParm = CLiwGenericParamList :: NewL() ;
   406     CLiwGenericParamList *OutParm = CLiwGenericParamList :: NewL() ;
   185     CleanupStack :: PushL( OutParm ) ;
   407     CleanupStack :: PushL( OutParm ) ;