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: * Interface class for using the services of CCallbackTimer sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: #include "callbacktimer.h" sl@0: sl@0: // Implementation of class CCallbackTimer sl@0: EXPORT_C CCallbackTimer* CCallbackTimer::NewL(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback/*= EFalse*/) sl@0: { sl@0: CCallbackTimer* self = new (ELeave) CCallbackTimer(aCallBackIf, aEnableCancelCallback); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); // calls CTimer::ConstructL() sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CCallbackTimer::CCallbackTimer(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback) sl@0: : CTimer(CActive::EPriorityStandard), sl@0: iCallBackIf(aCallBackIf), sl@0: iEnableCancelCallback(aEnableCancelCallback) sl@0: { sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: sl@0: void CCallbackTimer::RunL() sl@0: { sl@0: // Notify the client sl@0: // Don't inform about cancels if that feature is disabled sl@0: TInt status = iStatus.Int(); sl@0: if (iEnableCancelCallback || status != KErrCancel) sl@0: { sl@0: iCallBackIf.TimerRun(status); sl@0: } sl@0: } sl@0: