os/security/cryptomgmtlibs/securityutils/source/secutil/callbacktimer.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 * Interface class for using the services of CCallbackTimer
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file
    22 */
    23 
    24 #include "callbacktimer.h"
    25 
    26 // Implementation of class CCallbackTimer
    27 EXPORT_C CCallbackTimer* CCallbackTimer::NewL(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback/*= EFalse*/)
    28 	{
    29 	CCallbackTimer* self = new (ELeave) CCallbackTimer(aCallBackIf, aEnableCancelCallback);
    30 	CleanupStack::PushL(self);
    31 	self->ConstructL();		// calls CTimer::ConstructL()
    32 	CleanupStack::Pop(self);
    33 	return self;
    34 	}
    35 
    36 CCallbackTimer::CCallbackTimer(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback)
    37 	: CTimer(CActive::EPriorityStandard),
    38 	iCallBackIf(aCallBackIf),
    39 	iEnableCancelCallback(aEnableCancelCallback)
    40 	{
    41 	CActiveScheduler::Add(this);
    42 	}
    43 
    44 void CCallbackTimer::RunL()
    45 	{
    46 	// Notify the client
    47 	// Don't inform about cancels if that feature is disabled
    48 	TInt status = iStatus.Int();
    49 	if (iEnableCancelCallback || status != KErrCancel)
    50 		{
    51 		iCallBackIf.TimerRun(status);
    52 		}
    53 	}
    54