cryptomgmtlibs/securityutils/inc/callbacktimer.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2008-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 * Contains functionality for a callback timer
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24  @internalTechnology
       
    25  @released
       
    26 */
       
    27 
       
    28 #ifndef __CALLBACKTIMER_H__
       
    29 #define __CALLBACKTIMER_H__
       
    30 
       
    31 #include <e32base.h>
       
    32 
       
    33 /**
       
    34  * Interface class for using the services of CCallbackTimer
       
    35  */
       
    36 class MTimerObserver
       
    37 	{
       
    38 public:
       
    39 	virtual ~MTimerObserver() {};
       
    40 
       
    41 	/**
       
    42 	 * Call back function to handle the expiry of the timer
       
    43 	 * @param aError	KErrNone if timer expired normally else any of the system-wide error codes to indicate a system error
       
    44 	 */
       
    45 	virtual void TimerRun(TInt aError) = 0;
       
    46 	};
       
    47 
       
    48 /**
       
    49  * A timer class that provides a call back on timer expiry
       
    50  */
       
    51 class CCallbackTimer : public CTimer
       
    52 	{
       
    53 	public:
       
    54 
       
    55 	/**
       
    56 	 * Create and return a new instance of the CCallbackTimer. An ongoing timer operation can be cancelled by the client by calling the Cancel() method on this object.
       
    57 	 * @param aCallBackIf			Callback interface that implements TimerRun() function
       
    58 	 * @param aEnableCancelCallback	If ETrue cancel events (client initiated by calling Cancel() method) are notified. Default is EFalse
       
    59 	 */
       
    60 	IMPORT_C static CCallbackTimer* NewL(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback = EFalse);
       
    61 
       
    62 private:
       
    63 	CCallbackTimer(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback);
       
    64 
       
    65 	// Methods from CTimer/CActive
       
    66 	void RunL();
       
    67 
       
    68 private:
       
    69 	MTimerObserver& iCallBackIf;
       
    70 	TBool iEnableCancelCallback;
       
    71 	};
       
    72 
       
    73 #endif // __CALLBACKTIMER_H__