#ifndef SysControl_INCLUDED
	#define SysControl_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
 
#define MAX_MV_CONFIG 20		// Maximum number of multiviewer configurations

class SysControl : public bncs_script_helper
{
public:
	SysControl( bncs_client_callback * parent, const char* path );
	virtual ~SysControl();

	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;
	
	int currentPage;							// Holds the current menu page that is on display	
	int tslSlots[MAX_MV_CONFIG+1];				// Entries 1 to 20 hold the TSL cue signal used to recall the preset. Entry 0 is unused.
	int mvSelectedBtn;							// Holds the numeric id of the selected button on the multiviewer preset panel.
	int txStatus;								// Holds the current Off/Reh/Tx state for the studio.
	int txStatusDevice;							// Device number of the infodriver that has the TX status slot
	int txStatusSlot;							// Slot number that holds the Tx Status
	int sdi_driver_id;							// Driver to monitor for video to line signal
	int sdi_line_out;							// Holds the line output destination read from instances.xml

	// Houselight control variables
	int stc_gpi_drv1;							// GPI driver ID for Studio C
	int hl_status;								// Studio C Houselight status 0=Off, 1 = On
	int hl_command;								// Studio C Houselights command value.
	int fl_status;								// Studio C Firelane status
	int fl_command;								// Studio C firelane relay command
	int gl_mon_command;							// Studio C Gallery houselight control monitor wall side 
	int gl_apps_command;						// Studio C Gallery houselight control apps room side 
	int ms_hl_status;							// Studio C mini-studio houselight status
	int ms_hl_command;							// studio C mini-studio houselight command

	// Multiviewer recall panel variables
	int umd_driver;								// Holds the addres of the UMD driver Infodriver
	int layoutID;
	int recallTallyId;							// Holds the address in the infodriver slot for the tally used to recall a multiviewer set up.
	bool layoutSelected;

	// Local Methods
	void processMenuSelect(buttonNotify *b);	// Function to process the menus
	void processRXTXbuttons(buttonNotify *b);	// Process buttons on teh RX TX page
	void processHouselights(buttonNotify *b);	// Process the buttons on the houselights panel
	void processMultiviewer(buttonNotify *b);	// Process the buttons on the multiviewer layout recall page.
	void loadMultiviewPresets();				// Load the multiviewer configs from file.

};


#endif // SysControl_INCLUDED