common/tools/ats/smoketest/Timew/Src/SM_RSP.CPP
changeset 117 483f966c6335
child 872 17498133d9ad
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/Timew/Src/SM_RSP.CPP	Fri May 29 08:07:21 2009 +0100
@@ -0,0 +1,90 @@
+// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Symbian Foundation License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "sm_std.h"
+#include "almmod.h"
+
+//
+//	class CModelResponder
+//
+
+CModelResponder::CModelResponder(CModelBase& aModel,TInt aPriority)
+//
+//	Base class constructor
+//
+	: CActive(aPriority), iModel(&aModel)
+	{
+	}
+
+void CModelResponder::NotifyModel(TInt aStatus)
+//
+//	Funnel all response to the engine
+//
+	{
+	iModel->ProcessResponder(aStatus);
+	}
+
+void CModelResponder::RunL()
+//
+//	Handle changes in the servers
+//
+	{
+//	Reset the status request before notifiying the view
+//	so that it can catch anything untoward that the view does
+	TInt v=iStatus.Int();
+	Start();
+	NotifyModel(v);
+	}
+
+void CModelResponder::Start()
+//
+//	Start the response
+//
+	{
+	if (!IsActive())
+		{
+		SetActive();
+		DoStart();
+		}
+	}
+
+//
+//	class CAlmResponder
+//
+
+CAlmResponder::CAlmResponder(RASCliSession& aSvr,CAlmModel& aModel,TInt aResponderPriority)
+//
+//	Protected constructor
+//
+	: CModelResponder(aModel,aResponderPriority),iAlmSvr(&aSvr)
+	{
+	}
+
+void CAlmResponder::DoStart()
+//
+//	Start a repsonse
+//
+	{
+	iAlmSvr->NotifyChange(iStatus, iAlarmId);
+	}
+
+void CAlmResponder::DoCancel()
+//
+//	Stop the response
+//
+	{
+	if	(iStatus == KRequestPending)
+		iAlmSvr->NotifyChangeCancel();
+	}