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

	void buttonCallback( buttonNotify *b );
	int revertiveCallback( revertiveNotify * r );
	void databaseCallback( revertiveNotify * r );
	bncs_string parentCallback( parentNotify *p );
	void timerCallback( int );
	
private:
	bncs_string m_myInstance;	// Holds the instance data for this button
	bncs_string m_myText;		// Holds the text to display on the button
	bncs_string m_myStyle;		// Stylesheet name for the button
	bncs_string m_myOnState;	// Holds the state for GPI=1
	bncs_string m_myOffState;	// Holds the state for GPI=0
	
	int m_myDeviceID;			// The Device ID for the GPI driver
	int m_myContact;			// The contact ID for the GPI
	int m_my_OnOffState;		// Remembers the state of the contact received in a revertive. Initially set to -1
	
	bool m_myMode;				// Flag to indicate button or label style of display
	bool m_Rx_revert;			// Set true when a revertive has been received
	bool m_useText;				// Set true to use text field, else use "idtext" from instances.xml
	bool m_sendUpdate;			// Set true to send level toggles to the driver.
};


#endif // GPI_Button_INCLUDED