First public contribution.
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Contains functionality for a callback timer
26 #ifndef __CALLBACKTIMER_H__
27 #define __CALLBACKTIMER_H__
32 * Interface class for using the services of CCallbackTimer
37 virtual ~MTimerObserver() {};
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
43 virtual void TimerRun(TInt aError) = 0;
47 * A timer class that provides a call back on timer expiry
49 class CCallbackTimer : public CTimer
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
58 IMPORT_C static CCallbackTimer* NewL(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback = EFalse);
61 CCallbackTimer(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback);
63 // Methods from CTimer/CActive
67 MTimerObserver& iCallBackIf;
68 TBool iEnableCancelCallback;
71 #endif // __CALLBACKTIMER_H__