testexecfw/stf/stfext/testmodules/teftestmod/teftestmodulefw/utils/inc/testblockcontroller.h
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 * @file
       
    16 * This contains TestBlockController.h
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __TEST_BLOCK_CONTROLLER_H__
       
    23 #define __TEST_BLOCK_CONTROLLER_H__
       
    24 
       
    25 #include <e32def.h>
       
    26 #include <e32cmn.h>
       
    27 
       
    28 #include <test/datadictionary.h>
       
    29 #include <test/testexecutestepbase.h>
       
    30 #include <test/activecallback.h>
       
    31 #include <test/tefresult.h>
       
    32 #include <test/commandprocessor.h>
       
    33 #include <test/blockitems.h>
       
    34 #include <test/teftimer.h>
       
    35 
       
    36 class CTestBlockController : public CTestStep, public MTEFResult, public MTEFTimerCallback, public MCommandProcessorCallback
       
    37 /**
       
    38  * @publishedPartner
       
    39  * @test
       
    40  *
       
    41  * @see		CTestStep
       
    42  * @see		MTEFResult
       
    43  * @see		MTEFTimerCallback
       
    44  * @see		MCommandProcessorCallback
       
    45  */
       
    46 	{
       
    47 public:
       
    48 	IMPORT_C 						CTestBlockController();
       
    49 	IMPORT_C virtual				~CTestBlockController();
       
    50 	IMPORT_C void					SetBlockArray( TTEFItemArray* aBlockArray );
       
    51 	IMPORT_C void					SetSharedData( MSharedData* aSharedData );
       
    52 
       
    53 	IMPORT_C virtual CDataWrapper*	CreateDataL( const TDesC& aData ) =0;
       
    54 
       
    55 	// CTestStep implementations
       
    56 	IMPORT_C virtual TVerdict		doTestStepPreambleL();
       
    57 	IMPORT_C virtual TVerdict		doTestStepL();
       
    58 	IMPORT_C virtual TVerdict		doTestStepPostambleL();
       
    59 
       
    60 	// MTEFResult implementation
       
    61 	IMPORT_C virtual void			SetError(const TInt aError);
       
    62 	IMPORT_C virtual void			SetAsyncError(const TInt aIndex, const TInt aError);
       
    63 	IMPORT_C virtual void			SetBlockResult(const TVerdict aResult);
       
    64 	IMPORT_C virtual TVerdict		BlockResult();
       
    65 
       
    66 	// MTEFTimerCallback implementation
       
    67 	IMPORT_C virtual void			TimerCompleted();
       
    68 
       
    69 	// MCommandProcessorCallback implementation
       
    70 	IMPORT_C virtual void			NextCommandL();
       
    71 
       
    72 protected:
       
    73 	IMPORT_C void					StartCommands();
       
    74 	IMPORT_C virtual TBool			DoCommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex);
       
    75 
       
    76 	inline	void					CreateObjectL(TTEFBlockItem& aCommand);
       
    77 	inline	void					RestoreObjectL(TTEFBlockItem& aCommand);
       
    78 	inline	void					StoreL(TTEFBlockItem& aCommand);
       
    79 	inline	void					StoreActiveScheduler(TTEFBlockItem& aCommand);
       
    80 	inline	void					CommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex);
       
    81 
       
    82 private:
       
    83 	class CBlockActiveScheduler : public CActiveScheduler
       
    84 		{
       
    85 	public:
       
    86 		IMPORT_C 				CBlockActiveScheduler(CTestBlockController& aTestStep);
       
    87 		IMPORT_C virtual		~CBlockActiveScheduler();
       
    88 		IMPORT_C virtual void	Error(TInt aError) const;
       
    89 
       
    90 	private:
       
    91 		CTestStep& iTestStep;
       
    92 		};
       
    93 
       
    94 	TTEFItemArray*				iBlockArray;
       
    95 	CDataDictionary				iDataDictionary;
       
    96 	CCommandProcessor*			iCommandProcessor;
       
    97 	CActiveScheduler*			iActiveScheduler;
       
    98 	CTEFTimer*					iTimer;
       
    99 	CPeriodic*					iPeriodic;
       
   100 	TBool						iAsyncTimer;
       
   101 	TBool						iTimerActive;
       
   102 	TInt						iCommandIndex;
       
   103 	TInt						iAsyncCount;
       
   104 	MSharedData*				iSharedData;
       
   105 	TBool						iDeleteSharedScheduler;
       
   106 
       
   107 	// Helper methods
       
   108 	IMPORT_C void				StartTimer(const TTEFBlockItem& aCommand);
       
   109 	IMPORT_C void				CancelTimer();
       
   110 
       
   111 	// CPerodic callback
       
   112 	IMPORT_C static TBool		OutstandingCallback( TAny* aAny );
       
   113 	IMPORT_C void				OutstandingCallback();
       
   114 
       
   115 	inline void					IncAsyncCount();
       
   116 	inline void					DecAsyncCount();
       
   117 	};
       
   118 
       
   119 #include <test/testblockcontroller.inl>
       
   120 
       
   121 #endif // __TEST_BLOCK_CONTROLLER_H__