applayerprotocols/httptransportfw/Test/testfilter/CTimer.cpp
branchRCL_3
changeset 3 5ee1d9ce5878
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/applayerprotocols/httptransportfw/Test/testfilter/CTimer.cpp	Fri Feb 19 23:50:57 2010 +0200
@@ -0,0 +1,85 @@
+// 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);
+
+}
+