#ifndef TallyAssoc_INCLUDED
	#define TallyAssoc_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 SDI_MTX_SIZE 128


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

	void buttonCallback( buttonNotify *b );
	int revertiveCallback( revertiveNotify * r );
	void databaseCallback( revertiveNotify * r );
	bncs_string parentCallback( parentNotify *p );
	void timerCallback( int );
	
private:
	int sdi_dev;			// SDI router ID
	int tally_dev;			// Tally Infodriver ID
	int now_primary;		// Current primary source selection
	int now_assoc;			// Current key association id
	int new_assoc;			// Newly selected key association
	bool pollDone;			// Set true when all tally infodriver poll values received.
	bool inEdit;			// Set true when edit displays are active.

	int keyAssoc[SDI_MTX_SIZE + 1];
	bool keyTallied[SDI_MTX_SIZE + 1];

	// Local methods
	void hideAssocSelect(void);
	void showAssocSelect(void);
	bool checkAllTallyRx(void);
	void clearDataMimics(void);		// Clears the id and name fields to blank.
	void displayAssociations(void);	// Show a list of active associations
};


#endif // TallyAssoc_INCLUDED