testexecmgmt/ucc/Source/Uccs.v2/Core/UCCS_CBatchEngine.h
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     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 * Filename: UCCS_CBatchEngine.h
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __UCCSBATCHENGINE_H__
       
    22 #define __UCCSBATCHENGINE_H__
       
    23 
       
    24 
       
    25 /***********************************************************************************
       
    26  *
       
    27  * System Includes
       
    28  *
       
    29  **********************************************************************************/
       
    30 #include <stdio.h>
       
    31 #include <stdlib.h>
       
    32 #include <windows.h>
       
    33 
       
    34 
       
    35 /***********************************************************************************
       
    36  *
       
    37  * Local Includes
       
    38  *
       
    39  **********************************************************************************/
       
    40 #include "UCCS_Interfaces.h"	
       
    41 #include "UCCS_CExecuteCommand.h"
       
    42 #include "CSynchronisation.h"
       
    43 
       
    44 
       
    45 /***********************************************************************************
       
    46  *
       
    47  * Definitions
       
    48  *
       
    49  **********************************************************************************/
       
    50 #define MAXFILENAMELENGTH		256
       
    51 #define INVALID_USECASE_ID		-1
       
    52 
       
    53 #define ETS_IDLE				0
       
    54 #define ETS_EXECUTING_SCRIPT	1
       
    55 #define ETS_COMPLETED_SCRIPT	2
       
    56 
       
    57 #define CTS_IDLE				0
       
    58 #define CTS_USECASE_STARTED		1
       
    59 #define CTS_USECASE_ENDED		2
       
    60 
       
    61 /***********************************************************************************
       
    62  *
       
    63  * Definitions
       
    64  *
       
    65  **********************************************************************************/
       
    66 class CBatchEngine : public MUccsControl
       
    67 {
       
    68 	public:
       
    69 		
       
    70 		//methods
       
    71 		CBatchEngine( IRetrieveCommand *aRetrieveCommand, IOutput *aOutput );
       
    72 		~CBatchEngine();	
       
    73 
       
    74 		// From MUccsControl - THREAD A
       
    75 		int StartUsecase( int aUsecaseID );
       
    76 		int Signal( int aUsecaseID );
       
    77 		int Rendezvous( int aUseCaseID );
       
    78 		int Wait( int aUseCaseID );
       
    79 		int EndUsecase( int aUsecaseID, int aResult, int *aScriptResult);
       
    80 		int GetEnvVariable(char *aVariableName, char *aOutputBuffer, int aOutputBufferLen);
       
    81 		int RunCommand( char* aCommandLine );
       
    82 
       
    83 		// Script execution - THREAD B
       
    84 		int ExecuteScript( void );
       
    85 			
       
    86 	private:
       
    87 		
       
    88 		// shared state that is static for the lifetime of batchengine 
       
    89 		IRetrieveCommand *iRetrieveCommand;
       
    90 		IOutput *iOutput;
       
    91 
       
    92 		// shared state -- note that these are set (NOT UPDATED!!) by one thread and
       
    93 		// read by another so there is no need for synchronisation
       
    94 		int iExecutionThreadState;
       
    95 		int iControlThreadState;
       
    96 		int iLastError;
       
    97 
       
    98 		// shared synchronisation state
       
    99 		CSynchronisation *iSync;
       
   100 
       
   101 		// THREAD A state
       
   102 		int iUsecaseID;
       
   103 		HANDLE hThreadHandle;
       
   104 
       
   105 		// THREAD B state
       
   106 		CExecuteCommand *iExecuteCommand;
       
   107 };
       
   108 
       
   109 //--------------------------------------------------------------------------------------------------
       
   110 
       
   111 #endif __UCCSBATCHENGINE_H__