sl@0: /* sl@0: * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Contains functionality for a callback timer sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #ifndef __CALLBACKTIMER_H__ sl@0: #define __CALLBACKTIMER_H__ sl@0: sl@0: #include sl@0: sl@0: /** sl@0: * Interface class for using the services of CCallbackTimer sl@0: */ sl@0: class MTimerObserver sl@0: { sl@0: public: sl@0: virtual ~MTimerObserver() {}; sl@0: sl@0: /** sl@0: * Call back function to handle the expiry of the timer sl@0: * @param aError KErrNone if timer expired normally else any of the system-wide error codes to indicate a system error sl@0: */ sl@0: virtual void TimerRun(TInt aError) = 0; sl@0: }; sl@0: sl@0: /** sl@0: * A timer class that provides a call back on timer expiry sl@0: */ sl@0: class CCallbackTimer : public CTimer sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: * 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. sl@0: * @param aCallBackIf Callback interface that implements TimerRun() function sl@0: * @param aEnableCancelCallback If ETrue cancel events (client initiated by calling Cancel() method) are notified. Default is EFalse sl@0: */ sl@0: IMPORT_C static CCallbackTimer* NewL(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback = EFalse); sl@0: sl@0: private: sl@0: CCallbackTimer(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback); sl@0: sl@0: // Methods from CTimer/CActive sl@0: void RunL(); sl@0: sl@0: private: sl@0: MTimerObserver& iCallBackIf; sl@0: TBool iEnableCancelCallback; sl@0: }; sl@0: sl@0: #endif // __CALLBACKTIMER_H__