serviceproviders/sapi_logging/tsrc/dev/tloggingprovidertest/src/tprovidercallback.cpp
changeset 19 989d2f495d90
child 33 50974a8b132e
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     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 <e32std.h>
       
    20 #include <StifParser.h>
       
    21 #include <Stiftestinterface.h>
       
    22 #include <logcli.h>
       
    23 #include <logwrap.h>
       
    24 #include <LiwServiceHandler.h>
       
    25 #include <LiwCommon.h>
       
    26 
       
    27 #include "tprovidertest.h"
       
    28 
       
    29 #include "tprovidercallback.h"
       
    30 #include "liwlogiter.h"
       
    31  _LIT8(KLogIter , "Iterator") ;
       
    32 
       
    33 
       
    34 
       
    35 //-------------------------------------------------------------
       
    36 // Generic call back function implementation, used by logging 
       
    37 // component
       
    38 //--------------------------------------------------------------
       
    39 
       
    40 static TInt count = 0 ;
       
    41 
       
    42 //--------------------------------------------------------------
       
    43 // Default constructor
       
    44 //--------------------------------------------------------------
       
    45 
       
    46 NotifyCB :: NotifyCB()
       
    47 	{
       
    48 	 iScheduler = new CActiveSchedulerWait() ;
       
    49 	 //iConsumer = aConsumer ;
       
    50 	}
       
    51 
       
    52 //----------------------------------------------------------------
       
    53 // Default destructor
       
    54 //----------------------------------------------------------------
       
    55 
       
    56 NotifyCB :: ~NotifyCB()
       
    57 	{
       
    58 	delete iScheduler ;
       
    59 	}
       
    60 	
       
    61 //-----------------------------------------------------------------
       
    62 //Starts the async wait loop
       
    63 //-----------------------------------------------------------------
       
    64 
       
    65 
       
    66 void NotifyCB :: Start()
       
    67 	{
       
    68 	 iScheduler->Start() ;
       
    69 	}
       
    70 	
       
    71 TInt NotifyCB :: HandleNotifyL(TInt aCmdId,TInt aEventId,
       
    72                      CLiwGenericParamList& aEventParamList,
       
    73                    const CLiwGenericParamList& aInParamList)
       
    74 {
       
    75  	++count ;
       
    76     TInt pos=0;
       
    77  	const TLiwGenericParam *LogIterParam = aEventParamList.FindFirst(pos , KLogIter)  ;
       
    78  	
       
    79  	if(pos != KErrNotFound)
       
    80  	    {
       
    81         CLiwIterable *liwiter = (LogIterParam->Value()).AsIterable() ;
       
    82         liwiter->Reset() ;
       
    83    	    
       
    84  	    }
       
    85     
       
    86    // aEventParamList.Reset();
       
    87     //(const_cast<CLiwGenericParamList&>(aInParamList)).Reset() ;
       
    88     //delete &aEventParamList;
       
    89     //delete &aInParamList;
       
    90 	if( count > 0 && (aEventId == KLiwEventCompleted || aEventId == KLiwEventError ))
       
    91 		{
       
    92 		 iScheduler->AsyncStop() ;
       
    93 		}
       
    94 		
       
    95    	if( aEventId == KLiwEventInProgress )
       
    96 		{
       
    97 		 iScheduler->AsyncStop() ;
       
    98 		}		
       
    99 	iRetVal = KErrNone ;
       
   100 	
       
   101 
       
   102 
       
   103 }