applayerprotocols/httptransportfw/Test/testfilter/CTimer.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 13:17:20 +0300
branchRCL_3
changeset 18 f21293830889
parent 3 5ee1d9ce5878
permissions -rw-r--r--
Revision: 201019 Kit: 2010121

// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//
#include "Timer.h"


CTimerOut* CTimerOut::NewL(MTimerObserver& aObserver)
{
	
	CTimerOut* iSelf = new (ELeave) CTimerOut(aObserver);
	CleanupStack::PushL(iSelf);
	iSelf->ConstructL();
	CleanupStack::Pop();
	
	return iSelf;
}


CTimerOut::CTimerOut(MTimerObserver& aObserver) : CActive(EPriorityStandard), iObserver(aObserver)
{
	
}


void CTimerOut::ConstructL()
{
	User::LeaveIfError(iTimer.CreateLocal());
	CActiveScheduler::Add(this);
	
}


CTimerOut::~CTimerOut()
{
	Deque();
	iTimer.Close();
	
}


void CTimerOut::Start(TTimeIntervalMicroSeconds32 aInterval)
{
	
	iTimer.After(iStatus,aInterval);
	SetActive();

}


void CTimerOut::Stop()
{

	Cancel();

}


void CTimerOut::DoCancel()
{
	
	iTimer.Cancel();
	
}


void CTimerOut::RunL()
{
	if(iStatus == KErrNone)
		iObserver.HandleTimerEventL(ETimerExpired);
	else
		iObserver.HandleTimerEventL(ETimerCancled);

}