Commit 2c14ea7e authored by Roberto  Borghes's avatar Roberto Borghes
Browse files

First import from SVN

parent 95fe6adc
NAME_SRV = aml-srv
CXXFLAGS =
LDFLAGS =
include ../../../cs/ds/makefiles/Make-9.3.3.in
This diff is collapsed.
//=============================================================================
//
// file : Aml.h
//
// description : Include for the Aml class.
//
// project :
//
// $Author: $
//
// $Revision: $
//
// $Log: $
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#ifndef _AML_H
#define _AML_H
//Including TANGO library
#include <tango.h>
//Including libraries
#include <string.h>
#include <termio.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <termio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <math.h>
#include <fcntl.h>
#include <string.h>
#define AMLBUFFLEN 256
#define AMLOKY "Y"
#define AMLOKQ "Q"
#define AMLOKV "V"
#define AMLBUSY "B"
#define AMLERROR "E"
#define AML_MAX_RETRY 10
#define AML_SEL_MOTOR "B"
#define AML_SET_MIN_STEP_RATE1 "M1"
#define AML_SET_MIN_STEP_RATE2 "M2"
#define AML_SET_MIN_STEP_RATE4 "M4"
#define AML_REMOVE_PHASE_CURRENT "h"
#define AML_SET_RAMP "R"
#define AML_SMOOTH_STOP "Z"
#define AML_START_STOP_SPEED "S"
#define AML_SET_SLEEW_SPEED "T"
#define AML_SET_INIT_POS "I1"
#define AML_ABS_POS "G"
#define AML_GET_POS "V1"
#define AML_AXIS1 "1"
#define AML_AXIS2 "2"
//using namespace Tango;
/**
* @author $Author: $
* @version $Revision: $
*/
// Add your own constants definitions here.
//-----------------------------------------------
namespace Aml_ns
{
/**
* Class Description:
*
*/
/*
* Device States Description:
*/
class Aml: public Tango::Device_4Impl
{
public :
// Add your own data members here
//-----------------------------------------
void initSerialPort();
bool checkRangeOk(string ,Tango::DevLong );
void ClearError(void);
void SetError(char *msg, int num);
void amlError(char *, char *);
int checkStatus();
char * talkListen(char *, const int );
void selectMotor(string );
int device;
string curPos;
Tango::DevLong currentPosAxis1;
Tango::DevLong currentPosAxis2;
string errorMessage;
string logMessage;
int errorNumber;
string Motor1Name, Motor2Name;
// Here is the Start of the automatic code generation part
//-------------------------------------------------------------
/**
* @name attributes
* Attributs member data.
*/
//@{
Tango::DevLong *attr_Axis1_Position_read;
Tango::DevLong *attr_Axis2_Position_read;
//@}
/**
* @name Device properties
* Device properties member data.
*/
//@{
/**
*
*/
string logicalName;
/**
* Serial port device (ttyS0,ttyS1, ...)
*/
string serialPort;
/**
*
*/
Tango::DevShort controllerVersion;
/**
*
*/
string axis1_Name;
/**
*
*/
string axis1_MinStepRate1;
/**
*
*/
string axis1_MinStepRate2;
/**
*
*/
string axis1_MinStepRate3;
/**
*
*/
string axis1_PhaseCurrent;
/**
*
*/
string axis1_Ramp;
/**
*
*/
string axis1_StartStopSpeed;
/**
*
*/
string axis1_SleewSpeed;
/**
*
*/
string axis1_Range;
/**
*
*/
string axis1_SetAccelerAndRetardPars;
/**
*
*/
string axis2_Name;
/**
*
*/
string axis2_MinStepRate1;
/**
*
*/
string axis2_MinStepRate2;
/**
*
*/
string axis2_MinStepRate3;
/**
*
*/
string axis2_PhaseCurrent;
/**
*
*/
string axis2_Ramp;
/**
*
*/
string axis2_StartStopSpeed;
/**
*
*/
string axis2_SleewSpeed;
/**
*
*/
string axis2_Range;
/**
*
*/
string axis2_SetAccelerAndRetardPars;
//@}
/**@name Constructors
* Miscellaneous constructors */
//@{
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
Aml(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
Aml(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
Aml(Tango::DeviceClass *cl,const char *s,const char *d);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/
~Aml() {delete_device();};
/**
* will be called at device destruction or at init command.
*/
void delete_device();
//@}
/**@name Miscellaneous methods */
//@{
/**
* Initialize the device
*/
virtual void init_device();
/**
* Always executed method befor execution command method.
*/
virtual void always_executed_hook();
//@}
/**
* @name Aml methods prototypes
*/
//@{
/**
* Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* Extract real attribute values for Axis1_Position acquisition result.
*/
virtual void read_Axis1_Position(Tango::Attribute &attr);
/**
* Extract real attribute values for Axis2_Position acquisition result.
*/
virtual void read_Axis2_Position(Tango::Attribute &attr);
/**
* Read/Write allowed for Axis1_Position attribute.
*/
virtual bool is_Axis1_Position_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Axis2_Position attribute.
*/
virtual bool is_Axis2_Position_allowed(Tango::AttReqType type);
/**
* Execution allowed for Axis1_MoveRelative command.
*/
virtual bool is_Axis1_MoveRelative_allowed(const CORBA::Any &any);
/**
* Execution allowed for Axis2_MoveRelative command.
*/
virtual bool is_Axis2_MoveRelative_allowed(const CORBA::Any &any);
/**
* Execution allowed for Axis1_MoveAbsolute command.
*/
virtual bool is_Axis1_MoveAbsolute_allowed(const CORBA::Any &any);
/**
* Execution allowed for Axis2_MoveAbsolute command.
*/
virtual bool is_Axis2_MoveAbsolute_allowed(const CORBA::Any &any);
/**
* Execution allowed for InitMotor command.
*/
virtual bool is_InitMotor_allowed(const CORBA::Any &any);
/**
* Execution allowed for Stop command.
*/
virtual bool is_Stop_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetPosition command.
*/
virtual bool is_GetPosition_allowed(const CORBA::Any &any);
/**
*
* @param argin
* @exception DevFailed
*/
void axis1__move_relative(Tango::DevLong);
/**
*
* @param argin
* @exception DevFailed
*/
void axis2__move_relative(Tango::DevLong);
/**
*
* @param argin
* @exception DevFailed
*/
void axis1__move_absolute(Tango::DevLong);
/**
*
* @param argin
* @exception DevFailed
*/
void axis2__move_absolute(Tango::DevLong);
/**
*
* @exception DevFailed
*/
void init_motor();
/**
*
* @param argin
* @exception DevFailed
*/
void stop(Tango::DevShort);
/**
*
* @param argin
* @return
* @exception DevFailed
*/
Tango::DevLong get_position(Tango::DevShort);
/**
* Read the device properties from database
*/
void get_device_property();
//@}
// Here is the end of the automatic code generation part
//-------------------------------------------------------------
protected :
// Add your own data members here
//-----------------------------------------
Tango::DevLong attr_long_value;
int actualSelectedMotor;
};
} // namespace_ns
#endif // _AML_H
This diff is collapsed.
//=============================================================================
//
// file : AmlClass.h
//
// description : Include for the AmlClass root class.
// This class is represents the singleton class for
// the Aml device class.
// It contains all properties and methods which the
// Aml requires only once e.g. the commands.
//
// project : TANGO Device Server
//
// $Author: $
//
// $Revision: $
//
// $Log: $
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#ifndef _AMLCLASS_H
#define _AMLCLASS_H
#include <tango.h>
#include <Aml.h>
namespace Aml_ns
{
//=====================================
// Define classes for attributes
//=====================================
class Axis2_PositionAttrib: public Tango::Attr
{
public:
Axis2_PositionAttrib():Attr("Axis2_Position", Tango::DEV_LONG, Tango::READ) {};
~Axis2_PositionAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<Aml *>(dev))->read_Axis2_Position(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<Aml *>(dev))->is_Axis2_Position_allowed(ty);}
};
class Axis1_PositionAttrib: public Tango::Attr
{
public:
Axis1_PositionAttrib():Attr("Axis1_Position", Tango::DEV_LONG, Tango::READ) {};
~Axis1_PositionAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<Aml *>(dev))->read_Axis1_Position(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<Aml *>(dev))->is_Axis1_Position_allowed(ty);}
};
//=========================================
// Define classes for commands
//=========================================
class GetPositionClass : public Tango::Command
{
public:
GetPositionClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
GetPositionClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~GetPositionClass() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<Aml *>(dev))->is_GetPosition_allowed(any);}
};
class StopCmd : public Tango::Command
{
public:
StopCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
StopCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~StopCmd() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<Aml *>(dev))->is_Stop_allowed(any);}
};
class InitMotorCmd : public Tango::Command
{
public:
InitMotorCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
InitMotorCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~InitMotorCmd() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<Aml *>(dev))->is_InitMotor_allowed(any);}
};
class Axis2_MoveAbsoluteCmd : public Tango::Command
{
public:
Axis2_MoveAbsoluteCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
Axis2_MoveAbsoluteCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~Axis2_MoveAbsoluteCmd() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<Aml *>(dev))->is_Axis2_MoveAbsolute_allowed(any);}
};
class Axis1_MoveAbsoluteCmd : public Tango::Command
{
public:
Axis1_MoveAbsoluteCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
Axis1_MoveAbsoluteCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~Axis1_MoveAbsoluteCmd() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<Aml *>(dev))->is_Axis1_MoveAbsolute_allowed(any);}
};
class Axis2_MoveRelativeCmd : public Tango::Command
{
public:
Axis2_MoveRelativeCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
Axis2_MoveRelativeCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~Axis2_MoveRelativeCmd() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<Aml *>(dev))->is_Axis2_MoveRelative_allowed(any);}
};
class Axis1_MoveRelativeCmd : public Tango::Command
{
public:
Axis1_MoveRelativeCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
Axis1_MoveRelativeCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~Axis1_MoveRelativeCmd() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<Aml *>(dev))->is_Axis1_MoveRelative_allowed(any);}