sysstatemgmt/systemstatemgr/test/tss/inc/testandcanceler.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 
       
    17 
       
    18 #ifndef __TESTANDCANCELER_H__
       
    19 #define __TESTANDCANCELER_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32def.h>
       
    23 
       
    24 #include <ssm/ssmstartsafe.h>
       
    25 #include "tss_step_base.h"
       
    26 #include "ssconst.h"
       
    27 
       
    28 
       
    29 
       
    30 class CStartAcknowledge : public CActive
       
    31 	{
       
    32 public:
       
    33 	CStartAcknowledge( MSsTestAsyncNotifier* aSsTestAsyncNotifier );
       
    34 	~CStartAcknowledge();
       
    35 	
       
    36 protected:
       
    37 	void RunL();
       
    38 	void DoCancel(){}
       
    39 	
       
    40 private:
       
    41 	MSsTestAsyncNotifier* iSsTestAsyncNotifier;
       
    42 	};
       
    43 
       
    44 
       
    45 
       
    46 class CStartCanceler : public CActive
       
    47 	{
       
    48 public:
       
    49 	CStartCanceler( TInt& aSsIndex, CSsmStartSafe& aSsmStartSafe, TInt aTimeout );
       
    50 	~CStartCanceler(){ iTimer.Close(); }
       
    51 
       
    52 protected:
       
    53 	void RunL();
       
    54 	void DoCancel(){}
       
    55 
       
    56 private:
       
    57 	CSsmStartSafe& iSsmStartSafe;
       
    58 	TInt& iSsIndex;
       
    59 	RTimer iTimer;
       
    60 	TInt iTimeout;
       
    61 	};
       
    62 
       
    63 
       
    64 
       
    65 enum TSsTestDuffBehaviour
       
    66 	{
       
    67 	ESsTestDuffBehaviourGood = 0,
       
    68 	ESsTestDuffBehaviourBadIndex
       
    69 	};
       
    70 
       
    71 class CTestAndCanceler : public CActive
       
    72 	{
       
    73 public:
       
    74 	CTestAndCanceler( CSsmStartSafe& aSsmStartSafe, 
       
    75 					 const CSsmStartupProperties &aStartupProperties, 
       
    76 					 RProcess& aProcess, 
       
    77 					 TInt aTimeout,
       
    78 					 MSsTestAsyncNotifier* aSsTestAsyncNotifier = NULL );
       
    79 
       
    80 	CTestAndCanceler( CSsmStartSafe& aSsmStartSafe, 
       
    81 			 const CSsmStartupProperties &aStartupProperties, 
       
    82 			 RProcess& aProcess, 
       
    83 			 TInt aTimeout,
       
    84 			 MSsTestAsyncNotifier* aSsTestAsyncNotifier, TSsTestDuffBehaviour aDuffBehaviour );
       
    85 	
       
    86 	~CTestAndCanceler();
       
    87 
       
    88 protected:
       
    89 	void RunL();
       
    90 	TInt RunError( TInt aError );
       
    91 	void DoCancel();
       
    92 
       
    93 private:
       
    94 	TInt iCycle; 
       
    95 	RTimer iTimer;
       
    96 	CSsmStartSafe& iSsmStartSafe;
       
    97 	const CSsmStartupProperties& iStartupProperties;
       
    98 	RProcess& iProcess;
       
    99 	TInt iTimeout;
       
   100 	MSsTestAsyncNotifier* iSsTestAsyncNotifier; // Not owning
       
   101 	TInt iSsIndex;
       
   102 	CStartCanceler* iStartCanceler;
       
   103 	TSsTestDuffBehaviour iDuff;
       
   104 	};
       
   105 
       
   106 
       
   107 
       
   108 #endif // __TESTANDCANCELER_H__