#ifndef CARSD_INCLUDED
	#define CARSD_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 CARSD : public bncs_script_helper
{
public:
	CARSD( bncs_client_callback * parent, const char* path );
	virtual ~CARSD();

	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;
	
	// Variables for panel operation
	bncs_config myVals;
	bncs_string myHeader;
	bncs_string myParam;

	int car_names;				// Device ID for CAR Names databases
	int car_xpts;				// Device ID that holds crosspoint data for each source and destination in CAR SD SDI system
	int car_sdsdi;				// Device ID for the CAR SD-SDI router
	int car_audio;				// Device ID for the CAR Audio Router

	bool source_selected;		// Set true when a source select button is active
	bool dest_selected;			// Set true when a destination button is active
	bool videoEnabled;			// Set true if audio level crosspoint is to be made
	bool audioEnabled;			// Set true if video level crosspoint is to be made
	bool takeEnabled;
	bool takeState;				// Records which statesheet is currently active on the TAKE button.

	int source_index;			// Index for the selected source
	int dest_index;				// Index for the selected destination
	int myFirstSDIOS;
	int myLastSDIOS;
	int myFirstAudioOS;
	int myLastAudioOS;
	int dest_pkg1;				// Destination package number for OS1, there are three OS lines on sucessive packages
	int source_sdi;				// Holds the index of the source sdi part of a package
	int source_audio;			// Holds the index of the source audio part of a package
	int dest_sdi;				// Holds the index of the destination sdi part of a package
	int dest_audio;				// Holds the index of the destination audio part of a package

	bncs_string ws_sl;
	bncs_string my_classroom;
	bncs_string selected_os;
	bncs_string srctext;			// Used in fetching source package contents
	bncs_string dsttext;			// Used in fetching destination package contents
	bncs_string sp1, sp2, dp1, dp2;	// Used in spliting the package content strings

	// Local Support functions
	void checkTake(void);
};


#endif // CARSD_INCLUDED