#ifndef StA_TX_Auto_INCLUDED
	#define StA_TX_Auto_INCLUDED

#include <bncs_script_helper.h>

#ifdef WIN32
	#ifdef DOEXPORT_SCRIPT
		#define EXPORT_SCRIPT __declspec(dllexport) 
	#else
		#define EXPORT_SCRIPT 
	#endif
#else 
	#define EXPORT_SCRIPT
#endif
 
class StA_TX_Auto : public bncs_script_helper
{
public:
	StA_TX_Auto( bncs_client_callback * parent, const char* path );
	virtual ~StA_TX_Auto();

	void buttonCallback( buttonNotify *b );
	int revertiveCallback( revertiveNotify * r );
	void databaseCallback( revertiveNotify * r );
	bncs_string parentCallback( parentNotify *p );
	void timerCallback( int );
	
private:
	bncs_string m_myParam;
	bncs_string m_instance;
	
	bncs_config myVals;				// Used when reading values from wn_academy.xml

	bncs_string offmode, rehmode, txmode;

	int currentState_A;				// Holds the current Gallery A Off/Reh/TX status
	int newState_A;					// Used during revertive processing to detect changes in status
	int currentState_C;				// Holds the current Gallery C Off/Reh/TX status
	int newState_C;					// Used during revertive processing to detect changes of status
	int tallyInfodriver;			// Holds the BNCS driver ID for the tally infodriver
	int sdiRouterdriver;			// Holds the BNCS driver ID for the sdi router
	int audioRouterdriver;			// Holds the BNCS driver ID for the audio router
	int GPIdriver;					// Holds the number of teh GPI driver used for Blue/Red control
	int GPIcontact_1;				// Holds the GPI slot for the first GPI output
	int StA_Floor;					// Holds the current control mode for Studio A floor
	int StC_Floor;					// Holds the current control mode for Studio C floor
	int StC_News;					// Holds the current control mode for News Studio C

	bool tallyReg;					// Flags that show if the drivers have been registered for revertives
	bool SDIReg;
	bool audioReg;

	// Private methods
	void Update_A_Floor_Relays(int A_TX_State);
	void setTXgpi(void);						// Sets the GPI relay states needed for Transmission mode active
	void setREHgpi(void);						// Sets the GPI relay states needed for Rehearse mode active
	void clearTX_REHgpi(void);					// Clear all relays to off to set the OFF condition
	void update_C_Floor_Tally(int newstate);
	void update_C_News_Tally(int newstate);
	void update_A_Floor_Tally(int newstate);
	void StA_Floor_StC_Control(int newstate);
};


#endif // StA_TX_Auto_INCLUDED