buildverification/autosmoketest/Timew/Src/SM_RSP.CPP
changeset 15 5b5908ec640f
parent 13 3a35f7917fa6
child 17 03d9ade4748d
equal deleted inserted replaced
13:3a35f7917fa6 15:5b5908ec640f
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "sm_std.h"
       
    17 #include "almmod.h"
       
    18 
       
    19 //
       
    20 //	class CModelResponder
       
    21 //
       
    22 
       
    23 CModelResponder::CModelResponder(CModelBase& aModel,TInt aPriority)
       
    24 //
       
    25 //	Base class constructor
       
    26 //
       
    27 	: CActive(aPriority), iModel(&aModel)
       
    28 	{
       
    29 	}
       
    30 
       
    31 void CModelResponder::NotifyModel(TInt aStatus)
       
    32 //
       
    33 //	Funnel all response to the engine
       
    34 //
       
    35 	{
       
    36 	iModel->ProcessResponder(aStatus);
       
    37 	}
       
    38 
       
    39 void CModelResponder::RunL()
       
    40 //
       
    41 //	Handle changes in the servers
       
    42 //
       
    43 	{
       
    44 //	Reset the status request before notifiying the view
       
    45 //	so that it can catch anything untoward that the view does
       
    46 	TInt v=iStatus.Int();
       
    47 	Start();
       
    48 	NotifyModel(v);
       
    49 	}
       
    50 
       
    51 void CModelResponder::Start()
       
    52 //
       
    53 //	Start the response
       
    54 //
       
    55 	{
       
    56 	if (!IsActive())
       
    57 		{
       
    58 		SetActive();
       
    59 		DoStart();
       
    60 		}
       
    61 	}
       
    62 
       
    63 //
       
    64 //	class CAlmResponder
       
    65 //
       
    66 
       
    67 CAlmResponder::CAlmResponder(RASCliSession& aSvr,CAlmModel& aModel,TInt aResponderPriority)
       
    68 //
       
    69 //	Protected constructor
       
    70 //
       
    71 	: CModelResponder(aModel,aResponderPriority),iAlmSvr(&aSvr)
       
    72 	{
       
    73 	}
       
    74 
       
    75 void CAlmResponder::DoStart()
       
    76 //
       
    77 //	Start a repsonse
       
    78 //
       
    79 	{
       
    80 	iAlmSvr->NotifyChange(iStatus, iAlarmId);
       
    81 	}
       
    82 
       
    83 void CAlmResponder::DoCancel()
       
    84 //
       
    85 //	Stop the response
       
    86 //
       
    87 	{
       
    88 	if	(iStatus == KRequestPending)
       
    89 		iAlmSvr->NotifyChangeCancel();
       
    90 	}
       
    91