/*----- PROTECTED REGION ID(Mks651d.h) ENABLED START -----*/
//=============================================================================
//
// file :        Mks651d.h
//
// description : Include for the Mks651d class.
//
// project :     Mks651d.
//
// $Author: mdm $
//
// $Revision: 1.2 $
// $Date: 2012-03-08 09:50:01 $
//
// SVN only:
// $HeadURL:  $
//
// CVS only:
// $Source: /home/cvsadm/cvsroot/fermi/servers/651d/src/Mks651d.h,v $
// $Log: Mks651d.h,v $
// Revision 1.2  2012-03-08 09:50:01  mdm
// New version of server
//
//
//=============================================================================
//                This file is generated by POGO
//        (Program Obviously used to Generate tango Object)
//=============================================================================


#ifndef MKS651D_H
#define MKS651D_H


#include <tango.h>

/*----- PROTECTED REGION END -----*/


/**
 *	Mks651d class Description:
 *	
 */

namespace Mks651d_ns
{
	/*----- PROTECTED REGION ID(Mks651d::Additional Class Declarations) ENABLED START -----*/

		//		Additional Class Declarations

	/*----- PROTECTED REGION END -----*/	//	Mks651d::Additional Class Declarations


class Mks651d : public Tango::Device_4Impl
{


	/*----- PROTECTED REGION ID(Mks651d::Data Members) ENABLED START -----*/

	Tango::DeviceProxy* device_proxy;
	omni_mutex proxy_mutex;

	bool init_completed;
	double current_back_off;
	time_t last_exception_t;

	/*----- PROTECTED REGION END -----*/	//	Mks651d::Data Members


//	Device property data members
public:		//	SerialDevice:	
	string	serialDevice;
	//	Timeout:	
	Tango::DevULong	timeout;
	//	MaxBackOff:	
	Tango::DevLong	maxBackOff;
	//	ShowPressure:	
	Tango::DevBoolean	showPressure;
	

//	Attribute data members
public:
	Tango::DevDouble	*attr_Pressure_read;
	Tango::DevDouble	*attr_Position_read;
	Tango::DevShort	*attr_ControlType_read;
	Tango::DevShort	*attr_SensorType_read;
	Tango::DevShort	*attr_SensorVoltage_read;
	Tango::DevShort	*attr_SensorRange_read;
	Tango::DevShort	*attr_ControlMode_read;
	Tango::DevShort	*attr_ValveType_read;
	Tango::DevShort	*attr_AnalogSPRange_read;
	Tango::DevShort	*attr_SelectedSP_read;
	Tango::DevShort	*attr_PowerFailResponse_read;



//	Constructors and destructors
public:
	/**
	 * Constructs a newly allocated Command object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device Name
	 */
	Mks651d(Tango::DeviceClass *cl,string &s);
	/**
	 * Constructs a newly allocated Command object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device Name
	 */
	Mks651d(Tango::DeviceClass *cl,const char *s);
	/**
	 * Constructs a newly allocated Command object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device name
	 *	@param d	Device description.
	 */
	Mks651d(Tango::DeviceClass *cl,const char *s,const char *d);
	/**
	 * The object destructor.
	 */	
	~Mks651d() {delete_device();};



//	Miscellaneous methods
public:
	/**
	 *	will be called at device destruction or at init command.
	 */
	void delete_device();
	/**
	 *	Initialize the device
	 */
	virtual void init_device();
	/**
	 *	Read the device properties from database
	 */
	 void get_device_property();
	/**
	 *	Always executed method before execution command method.
	 */
	virtual void always_executed_hook();


//	Attribute methods
public:
	/**
	 *	Method      : Mks651d::read_attr_hardware()
	 *	Description : Hardware acquisition for attributes.
	 */
	virtual void read_attr_hardware(vector<long> &attr_list);


	/**
	 *	Pressure attribute related methods.
	 *	Description: 
	 *
	 *	Data type:	Tango::DevDouble
	 *	Attr type:	Scalar 
	 */
	virtual void read_Pressure(Tango::Attribute &attr);
	virtual bool is_Pressure_allowed(Tango::AttReqType type);



	/**
	 *	Position attribute related methods.
	 *	Description: 
	 *
	 *	Data type:	Tango::DevDouble
	 *	Attr type:	Scalar 
	 */
	virtual void read_Position(Tango::Attribute &attr);
	virtual bool is_Position_allowed(Tango::AttReqType type);



	/**
	 *	ControlType attribute related methods.
	 *	Description: Control type
 *	             0 = self tuning
 *	             1 = PID
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_ControlType(Tango::Attribute &attr);
	virtual void write_ControlType(Tango::WAttribute &attr);
	virtual bool is_ControlType_allowed(Tango::AttReqType type);



	/**
	 *	SensorType attribute related methods.
	 *	Description: Sensor type
 *	             0 = Absolute
 *	             1 = Differential
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_SensorType(Tango::Attribute &attr);
	virtual void write_SensorType(Tango::WAttribute &attr);
	virtual bool is_SensorType_allowed(Tango::AttReqType type);



	/**
	 *	SensorVoltage attribute related methods.
	 *	Description: Sensor voltage range:
 *	             0 = 1 Volt
 *	             1 = 5 Volts
 *	             2 = 10 Volts
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_SensorVoltage(Tango::Attribute &attr);
	virtual void write_SensorVoltage(Tango::WAttribute &attr);
	virtual bool is_SensorVoltage_allowed(Tango::AttReqType type);



	/**
	 *	SensorRange attribute related methods.
	 *	Description: Sensor range:
 *	             00 = 0.1
 *	             01 = 0.2
 *	             02 = 0.5
 *	             03 = 1
 *	             04 = 2
 *	             05 = 5
 *	             06 = 10
 *	             07 = 50
 *	             08 = 100
 *	             09 = 500
 *	             10 = 1000
 *	             11 = 5000
 *	             12 = 10000
 *	             13 = 1.3
 *	             14 = 2.66
 *	             15 = 13.33
 *	             16 = 133.3
 *	             17 = 1333
 *	             18 = 6666
 *	             19 = 13332
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_SensorRange(Tango::Attribute &attr);
	virtual void write_SensorRange(Tango::WAttribute &attr);
	virtual bool is_SensorRange_allowed(Tango::AttReqType type);



	/**
	 *	ControlMode attribute related methods.
	 *	Description: Control type:
 *	             0 = direct
 *	             1 = reverse
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_ControlMode(Tango::Attribute &attr);
	virtual void write_ControlMode(Tango::WAttribute &attr);
	virtual bool is_ControlMode_allowed(Tango::AttReqType type);



	/**
	 *	ValveType attribute related methods.
	 *	Description: Valve type:
 *	             1 = Std 253
 *	             2 = Fast 253
 *	             3 = 653
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_ValveType(Tango::Attribute &attr);
	virtual bool is_ValveType_allowed(Tango::AttReqType type);



	/**
	 *	AnalogSPRange attribute related methods.
	 *	Description: 0 = 5 Volts
 *	             1 = 10 Volts
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_AnalogSPRange(Tango::Attribute &attr);
	virtual void write_AnalogSPRange(Tango::WAttribute &attr);
	virtual bool is_AnalogSPRange_allowed(Tango::AttReqType type);



	/**
	 *	SelectedSP attribute related methods.
	 *	Description: 0 = setpoint analog
 *	             1 = setpoint A
 *	             2 = setpoint B
 *	             3 = setpoint C
 *	             4 = setpoint D
 *	             5 = setpoint E
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_SelectedSP(Tango::Attribute &attr);
	virtual bool is_SelectedSP_allowed(Tango::AttReqType type);



	/**
	 *	PowerFailResponse attribute related methods.
	 *	Description: Power fail response:
 *	             0 = disabled
 *	             1 = open at power fail
 *	             2 = close at power fail
	 *
	 *	Data type:	Tango::DevShort
	 *	Attr type:	Scalar 
	 */
	virtual void read_PowerFailResponse(Tango::Attribute &attr);
	virtual void write_PowerFailResponse(Tango::WAttribute &attr);
	virtual bool is_PowerFailResponse_allowed(Tango::AttReqType type);



	/**
	 *	Method      : Mks651d::add_dynamic_attributes()
	 *	Description : Add dynamic attributes if any.
	 */
		void add_dynamic_attributes();

//	Command related methods
public: 


	/**
	 *	Command Open related methods.
	 */
	void open();
	virtual bool is_Open_allowed(const CORBA::Any &any);

	/**
	 *	Command Close related methods.
	 */
	void close();
	virtual bool is_Close_allowed(const CORBA::Any &any);

	/**
	 *	Command Stop related methods.
	 */
	void stop();
	virtual bool is_Stop_allowed(const CORBA::Any &any);

	/**
	 *	Command SelectSP related methods.
	 */
	void select_sp(Tango::DevShort argin);
	virtual bool is_SelectSP_allowed(const CORBA::Any &any);

	/**
	 *	Command ReadSPLevel related methods.
	 */
	Tango::DevDouble read_splevel(Tango::DevShort argin);
	virtual bool is_ReadSPLevel_allowed(const CORBA::Any &any);

	/**
	 *	Command WriteSPLevel related methods.
	 */
	void write_splevel(const Tango::DevVarDoubleArray *argin);
	virtual bool is_WriteSPLevel_allowed(const CORBA::Any &any);

	/**
	 *	Command ReadSPType related methods.
	 */
	Tango::DevShort read_sptype(Tango::DevShort argin);
	virtual bool is_ReadSPType_allowed(const CORBA::Any &any);

	/**
	 *	Command WriteSPType related methods.
	 */
	void write_sptype(const Tango::DevVarShortArray *argin);
	virtual bool is_WriteSPType_allowed(const CORBA::Any &any);

	/**
	 *	Command ReadSoftStart related methods.
	 */
	Tango::DevDouble read_soft_start(Tango::DevShort argin);
	virtual bool is_ReadSoftStart_allowed(const CORBA::Any &any);

	/**
	 *	Command WriteSoftStart related methods.
	 */
	void write_soft_start(const Tango::DevVarDoubleArray *argin);
	virtual bool is_WriteSoftStart_allowed(const CORBA::Any &any);

	/**
	 *	Command ReadSPGain related methods.
	 */
	Tango::DevDouble read_spgain(Tango::DevShort argin);
	virtual bool is_ReadSPGain_allowed(const CORBA::Any &any);

	/**
	 *	Command WriteSPGain related methods.
	 */
	void write_spgain(const Tango::DevVarDoubleArray *argin);
	virtual bool is_WriteSPGain_allowed(const CORBA::Any &any);

	/**
	 *	Command ReadSPLead related methods.
	 */
	Tango::DevLong read_splead(Tango::DevShort argin);
	virtual bool is_ReadSPLead_allowed(const CORBA::Any &any);

	/**
	 *	Command WriteSPLead related methods.
	 */
	void write_splead(const Tango::DevVarLongArray *argin);
	virtual bool is_WriteSPLead_allowed(const CORBA::Any &any);

	/**
	 *	Command ReadThreshold related methods.
	 */
	Tango::DevDouble read_threshold(Tango::DevShort argin);
	virtual bool is_ReadThreshold_allowed(const CORBA::Any &any);

	/**
	 *	Command WriteThreshold related methods.
	 */
	void write_threshold(const Tango::DevVarDoubleArray *argin);
	virtual bool is_WriteThreshold_allowed(const CORBA::Any &any);

	/**
	 *	Command StartLearning related methods.
	 */
	void start_learning();
	virtual bool is_StartLearning_allowed(const CORBA::Any &any);

	/**
	 *	Command StopLearning related methods.
	 */
	void stop_learning();
	virtual bool is_StopLearning_allowed(const CORBA::Any &any);

	/**
	 *	Command LearnAnalog related methods.
	 */
	void learn_analog();
	virtual bool is_LearnAnalog_allowed(const CORBA::Any &any);

	/**
	 *	Command CalibrateAdc related methods.
	 */
	void calibrate_adc(Tango::DevDouble argin);
	virtual bool is_CalibrateAdc_allowed(const CORBA::Any &any);

	/**
	 *	Command ZeroSensor related methods.
	 */
	void zero_sensor();
	virtual bool is_ZeroSensor_allowed(const CORBA::Any &any);

	/**
	 *	Command RemoveZero related methods.
	 */
	void remove_zero();
	virtual bool is_RemoveZero_allowed(const CORBA::Any &any);

	/**
	 *	Command SetZero related methods.
	 */
	void set_zero(Tango::DevDouble argin);
	virtual bool is_SetZero_allowed(const CORBA::Any &any);

	/**
	 *	Command LearnZero related methods.
	 */
	void learn_zero();
	virtual bool is_LearnZero_allowed(const CORBA::Any &any);

	/**
	 *	Command DirectCommand related methods.
	 */
	Tango::DevString direct_command(Tango::DevString argin);
	virtual bool is_DirectCommand_allowed(const CORBA::Any &any);



	/*----- PROTECTED REGION ID(Mks651d::Additional Method prototypes) ENABLED START -----*/

	virtual void update_state();
	virtual bool update_state_allowed();
	virtual std::string serial_in_out(std::string, bool);
	virtual void exception_handler(Tango::DevFailed &, Tango::DevState, const std::string);
	virtual void strip_last(std::string &, char, int);
	virtual void strip_first(std::string &, char, int);

	/*----- PROTECTED REGION END -----*/	//	Mks651d::Additional Method prototypes

};

	/*----- PROTECTED REGION ID(Mks651d::Additional Classes Definitions) ENABLED START -----*/

	//	Additional Classes definitions

	/*----- PROTECTED REGION END -----*/	//	Mks651d::Additional Classes Definitions

} //	namespace

#endif	//	MKS651D_H