sapi_logging/tsrc/testing/tloggingservicetest/src/tgetrecent.cpp
changeset 0 14df0fbfcc4e
equal deleted inserted replaced
-1:000000000000 0:14df0fbfcc4e
       
     1 /*
       
     2 * Copyright (c) 2009 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32svr.h>
       
    19 #include "tloggingservicetest.h"
       
    20 #include <logcli.h>
       
    21 #include <logwrap.h>
       
    22 
       
    23 #include "loggingasyncservice.h"
       
    24 #include "loggingsyncservice.h"
       
    25 #include "loggingfilter.h"
       
    26 #include "loggingservice.h"
       
    27 #include "loggingevent.h"
       
    28 #include "tlogcallback.h"
       
    29 
       
    30 
       
    31 
       
    32  
       
    33 #include "logiter.h"
       
    34 
       
    35 
       
    36  
       
    37 	_LIT(KOwnEventSubject, "RandomLogiLogsEvent");
       
    38     _LIT(KOwnEventRemoteParty, "OwnContact");
       
    39 
       
    40   
       
    41      
       
    42       TInt  getrecent1(void )
       
    43     {
       
    44     
       
    45      
       
    46 	
       
    47 	 CLoggingService *iLoggingService = CLoggingService :: NewL() ;
       
    48 	 CLogsFilter *iLogsFilter = CLogsFilter :: NewL() ;
       
    49 	   
       
    50 	
       
    51 	 MLogCallback iCallback ;
       
    52 	 iLogsFilter->SetDirection(R_LOG_DIR_IN);
       
    53      iLogsFilter->SetRequestType(EGetRecent) ;
       
    54      iLogsFilter->SetRecentList(KLogNullRecentList) ;
       
    55 	 
       
    56 	 TBool ret = iLoggingService->GetListL(2,  iLogsFilter , &iCallback) ;
       
    57 	 
       
    58 	
       
    59 	 
       
    60 	 if(ret != KErrNone)
       
    61 	 	{
       
    62 	 	delete iLoggingService ;
       
    63 	 	delete iLogsFilter ;
       
    64 	 	return ret ;
       
    65 	 	}
       
    66 	 
       
    67 	 
       
    68 	 iCallback.Start() ;	
       
    69 	 delete iLogsFilter ;
       
    70 	 delete iLoggingService ;
       
    71 	 
       
    72 	 	
       
    73 	 return ret ; 
       
    74  
       
    75 	 
       
    76 	 
       
    77 	  
       
    78 	}
       
    79 	
       
    80 	
       
    81 	
       
    82 	
       
    83 	 TInt  getrecent2(void )
       
    84 	{
       
    85 	
       
    86      
       
    87      CLoggingService *iLoggingService = CLoggingService :: NewL() ;
       
    88 	   MLogCallback icallback ;
       
    89 	       CLogsEvent  *iLogsEvent = CLogsEvent::NewL();
       
    90 
       
    91 	   CLogsFilter *iLogsFilter = CLogsFilter :: NewL() ;
       
    92 	 const TUid KLogtestEventTypeUid = {0x1000550C};
       
    93   
       
    94    iLogsEvent->SetDuration(300);
       
    95     TUid tuid  = KLogtestEventTypeUid;
       
    96  
       
    97  iLoggingService->AddEventL(iLogsEvent);
       
    98 	   
       
    99 	  iLogsFilter->SetRequestType(EGetRecent) ;
       
   100 	   iLogsFilter->SetRecentList(KLogNullRecentList) ;
       
   101 	   
       
   102 	  TBool ret = iLoggingService->GetListL(1 , iLogsFilter , &icallback) ;
       
   103 	  // TInt count = 0;
       
   104 	   icallback.Start() ; 
       
   105 	 
       
   106 	    delete iLogsEvent;
       
   107 	    delete iLogsFilter ;
       
   108 	    delete iLoggingService ;
       
   109   	 return KErrNone;
       
   110   	 
       
   111   	 
       
   112   	 
       
   113 	}
       
   114