Skip to content
Snippets Groups Projects
ConexAgp.h 7.5 KiB
Newer Older
/*----- PROTECTED REGION ID(ConexAgp.h) ENABLED START -----*/
//=============================================================================
//
// file :        ConexAgp.h
//
// description : Include file for the ConexAgp class
//
// project :     Newport ConexAgp Agilis-D controller
//
// This file is part of Tango device class.
// 
// Tango is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// Tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Tango.  If not, see <http://www.gnu.org/licenses/>.
// 
// $Author: graziano $
//
// $Revision: 1.1 $
// $Date: 2017-12-21 11:26:12 $
//
// $HeadURL:  $
//
//=============================================================================
//                This file is generated by POGO
//        (Program Obviously used to Generate tango Object)
//=============================================================================


#ifndef ConexAgp_H
#define ConexAgp_H

#include <tango.h>
#include <readthread.h>

#define GET_VERSION				"VE"
#define GET_STATE				"TS"
#define GET_POSITION			"TP"
#define GET_TARGET_POSITION		"TH"

#define MOVE_ABSOLUTE			"PA"
#define MOVE_RELATIVE			"PR"
#define STEP_RELATIVE			"XR"
#define SET_STEP_SIZE			"XU"
#define GET_STEP_SIZE			"XU"
#define STOP_MOTION				"ST"
#define HOMING					"OR"
#define RESET_CONTROLLER		"RS"
#define ENABLE					"MM"


/*----- PROTECTED REGION END -----*/	//	ConexAgp.h

/**
 *  ConexAgp class description:
 *    Newport ConexAgp Agilis-D controller
 */

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

//	Additional Class Declarations
struct state_desc {
        Tango::DevState _state;
        string _status;
};

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

class ConexAgp : public TANGO_BASE_CLASS
{

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

//	Add your own data members
	Tango::DeviceProxy *device_proxy;
	readthread *loop;
	omni_mutex *mutex;
public:
	map<uint8_t,state_desc>	controller_states;
	void SendReceive(const string & command, string & response);
	void SendReceive(const string & command, int & val);
	void SendReceive(const string & command, double & val);
	void write_serial(char *, long);
	void read_serial(char *, long &);

	state_desc make_state_desc(Tango::DevState, string);

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

//	Device property data members
public:
	//	DeviceName:	
	string	deviceName;
	//	ControllerAddr:	Controller Address
	Tango::DevLong	controllerAddr;
	//	LegacySerial:	Use legacy serial-srv
	Tango::DevBoolean	legacySerial;

//	Attribute data members
public:
	Tango::DevDouble	*attr_Position_read;
	Tango::DevDouble	*attr_TargetPosition_read;

//	Constructors and destructors
public:
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device Name
	 */
	ConexAgp(Tango::DeviceClass *cl,string &s);
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device Name
	 */
	ConexAgp(Tango::DeviceClass *cl,const char *s);
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device name
	 *	@param d	Device description.
	 */
	ConexAgp(Tango::DeviceClass *cl,const char *s,const char *d);
	/**
	 * The device object destructor.
	 */
	~ConexAgp() {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      : ConexAgp::read_attr_hardware()
	 *	Description : Hardware acquisition for attributes.
	 */
	//--------------------------------------------------------
	virtual void read_attr_hardware(vector<long> &attr_list);
	//--------------------------------------------------------
	/*
	 *	Method      : ConexAgp::write_attr_hardware()
	 *	Description : Hardware writing for attributes.
	 */
	//--------------------------------------------------------
	virtual void write_attr_hardware(vector<long> &attr_list);

/**
 *	Attribute Position related methods
 *	Description: 
 *
 *	Data type:	Tango::DevDouble
 *	Attr type:	Scalar
 */
	virtual void read_Position(Tango::Attribute &attr);
	virtual void write_Position(Tango::WAttribute &attr);
	virtual bool is_Position_allowed(Tango::AttReqType type);
/**
 *	Attribute TargetPosition related methods
 *	Description: 
 *
 *	Data type:	Tango::DevDouble
 *	Attr type:	Scalar
 */
	virtual void read_TargetPosition(Tango::Attribute &attr);
	virtual bool is_TargetPosition_allowed(Tango::AttReqType type);


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




//	Command related methods
public:
	/**
	 *	Command Homing related method
	 *	Description: 
	 *
	 */
	virtual void homing();
	virtual bool is_Homing_allowed(const CORBA::Any &any);
	/**
	 *	Command Stop related method
	 *	Description: 
	 *
	 */
	virtual void stop();
	virtual bool is_Stop_allowed(const CORBA::Any &any);
	/**
	 *	Command GetVersion related method
	 *	Description: 
	 *
	 *	@returns 
	 */
	virtual Tango::DevString get_version();
	virtual bool is_GetVersion_allowed(const CORBA::Any &any);
	/**
	 *	Command Reset related method
	 *	Description: Reset controller
	 *
	 */
	virtual void reset();
	virtual bool is_Reset_allowed(const CORBA::Any &any);
	/**
	 *	Command Backward related method
	 *	Description: 
	 *
	 *	@param argin 
	 */
	virtual void backward(Tango::DevDouble argin);
	virtual bool is_Backward_allowed(const CORBA::Any &any);
	/**
	 *	Command Forward related method
	 *	Description: 
	 *
	 *	@param argin 
	 */
	virtual void forward(Tango::DevDouble argin);
	virtual bool is_Forward_allowed(const CORBA::Any &any);
	/**
	 *	Command Enable related method
	 *	Description: 
	 *
	 */
	virtual void enable();
	virtual bool is_Enable_allowed(const CORBA::Any &any);
	/**
	 *	Command Disable related method
	 *	Description: 
	 *
	 */
	virtual void disable();
	virtual bool is_Disable_allowed(const CORBA::Any &any);


	//--------------------------------------------------------
	/**
	 *	Method      : ConexAgp::add_dynamic_commands()
	 *	Description : Add dynamic commands if any.
	 */
	//--------------------------------------------------------
	void add_dynamic_commands();

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

//	Additional Method prototypes

/*----- PROTECTED REGION END -----*/	//	ConexAgp::Additional Method prototypes
};

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

//	Additional Classes Definitions

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

}	//	End of namespace

#endif   //	ConexAgp_H