os/security/cryptomgmtlibs/securityutils/inc/callbacktimer.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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  @file
    22  @publishedPartner
    23  @released
    24 */
    25 
    26 #ifndef __CALLBACKTIMER_H__
    27 #define __CALLBACKTIMER_H__
    28 
    29 #include <e32base.h>
    30 
    31 /**
    32  * Interface class for using the services of CCallbackTimer
    33  */
    34 class MTimerObserver
    35 	{
    36 public:
    37 	virtual ~MTimerObserver() {};
    38 
    39 	/**
    40 	 * Call back function to handle the expiry of the timer
    41 	 * @param aError	KErrNone if timer expired normally else any of the system-wide error codes to indicate a system error
    42 	 */
    43 	virtual void TimerRun(TInt aError) = 0;
    44 	};
    45 
    46 /**
    47  * A timer class that provides a call back on timer expiry
    48  */
    49 class CCallbackTimer : public CTimer
    50 	{
    51 	public:
    52 
    53 	/**
    54 	 * 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.
    55 	 * @param aCallBackIf			Callback interface that implements TimerRun() function
    56 	 * @param aEnableCancelCallback	If ETrue cancel events (client initiated by calling Cancel() method) are notified. Default is EFalse
    57 	 */
    58 	IMPORT_C static CCallbackTimer* NewL(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback = EFalse);
    59 
    60 private:
    61 	CCallbackTimer(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback);
    62 
    63 	// Methods from CTimer/CActive
    64 	void RunL();
    65 
    66 private:
    67 	MTimerObserver& iCallBackIf;
    68 	TBool iEnableCancelCallback;
    69 	};
    70 
    71 #endif // __CALLBACKTIMER_H__