Skip to content
Snippets Groups Projects
Commit 67ebbd02 authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files

First import from CVS release_01

parent 50b41cba
No related branches found
No related tags found
No related merge requests found
.nse_depinfo
bin
obj
# Eclipse
.cproject
.project
.settings
[submodule "deps/socket2"]
path = deps/socket2
url = git@gitlab.elettra.eu:cs/ds/socket2.git
[submodule "deps/serial2"]
path = deps/serial2
url = git@gitlab.elettra.eu:cs/ds/serial2.git
NAME_SRV = conexagp-srv
SRC_FILES = $(wildcard deps/socket2*/src/Socket2*.cpp) $(wildcard deps/serial2*/src/Serial2*.cpp)
CXXFLAGS = -Ideps/socket2/src -Ideps/serial2/src
LDFLAGS =
include ../makefiles/Make-9.3.3.in
Subproject commit 67275450e778cfafc02dee7744db90fe6540b86e
Subproject commit bb9a27ed07c1e55b56da991632dd913bc58b953e
This diff is collapsed.
/*----- 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
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<multiClasses pogoRevision="9.1" name="ConexAgp" sourcePath="/home/graziano/workspace/fermi/servers/conexagp/src" description="" filestogenerate="XMI file,Code files,Protected Regions">
<classes classname="Socket2" sourcePath="../../socket2/src">
<inheritances classname="Device_Impl" sourcePath=""/>
</classes>
<classes classname="Serial2" sourcePath="../../serial2/src">
<inheritances classname="Device_Impl" sourcePath=""/>
</classes>
<classes classname="ConexAgp" sourcePath="./">
<inheritances classname="Device_Impl" sourcePath=""/>
</classes>
<preferences makefileHome="/usr/local/tango-8.1.2.c/share/pogo/preferences"/>
</multiClasses>
</pogoDsl:PogoSystem>
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="ConexAgp" pogoRevision="9.4">
<description description="Newport ConexAgp Agilis-D controller" title="Newport ConexAgp Agilis-D controller" sourcePath="/home/graziano/workspace/fermi/servers/conexagp/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at elettra.eu - graziano.scalamera" author="graziano.scalamera" emailDomain="elettra.eu" classFamily="Motion" siteSpecific="" platform="Unix Like" bus="Serial" manufacturer="Newport" reference=""/>
</description>
<deviceProperties name="DeviceName" description="">
<type xsi:type="pogoDsl:StringType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="ControllerAddr" description="Controller Address">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="LegacySerial" description="Use legacy serial-srv">
<type xsi:type="pogoDsl:BooleanType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device state">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device status">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="Homing" description="" execMethod="homing" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Stop" description="" execMethod="stop" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="GetVersion" description="" execMethod="get_version" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:StringType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Reset" description="Reset controller" execMethod="reset" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Backward" description="" execMethod="backward" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:DoubleType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Forward" description="" execMethod="forward" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:DoubleType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Enable" description="" execMethod="enable" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Disable" description="" execMethod="disable" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<attributes name="Position" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:DoubleType"/>
<changeEvent fire="true" libCheckCriteria="true"/>
<archiveEvent fire="true" libCheckCriteria="true"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="TargetPosition" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:DoubleType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.2.5a/share/pogo/preferences"/>
</classes>
</pogoDsl:PogoSystem>
This diff is collapsed.
/*----- PROTECTED REGION ID(ConexAgpClass.h) ENABLED START -----*/
//=============================================================================
//
// file : ConexAgpClass.h
//
// description : Include for the ConexAgp root class.
// This class is the singleton class for
// the ConexAgp device class.
// It contains all properties and methods which the
// ConexAgp requires only once e.g. the commands.
//
// 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 ConexAgpClass_H
#define ConexAgpClass_H
#include <tango.h>
#include <ConexAgp.h>
/*----- PROTECTED REGION END -----*/ // ConexAgpClass.h
namespace ConexAgp_ns
{
/*----- PROTECTED REGION ID(ConexAgpClass::classes for dynamic creation) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgpClass::classes for dynamic creation
//=========================================
// Define classes for attributes
//=========================================
// Attribute Position class definition
class PositionAttrib: public Tango::Attr
{
public:
PositionAttrib():Attr("Position",
Tango::DEV_DOUBLE, Tango::READ_WRITE) {};
~PositionAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<ConexAgp *>(dev))->read_Position(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<ConexAgp *>(dev))->write_Position(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<ConexAgp *>(dev))->is_Position_allowed(ty);}
};
// Attribute TargetPosition class definition
class TargetPositionAttrib: public Tango::Attr
{
public:
TargetPositionAttrib():Attr("TargetPosition",
Tango::DEV_DOUBLE, Tango::READ) {};
~TargetPositionAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<ConexAgp *>(dev))->read_TargetPosition(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<ConexAgp *>(dev))->is_TargetPosition_allowed(ty);}
};
//=========================================
// Define classes for commands
//=========================================
// Command Homing class definition
class HomingClass : public Tango::Command
{
public:
HomingClass(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) {};
HomingClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~HomingClass() {};
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<ConexAgp *>(dev))->is_Homing_allowed(any);}
};
// Command Stop class definition
class StopClass : public Tango::Command
{
public:
StopClass(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) {};
StopClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~StopClass() {};
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<ConexAgp *>(dev))->is_Stop_allowed(any);}
};
// Command GetVersion class definition
class GetVersionClass : public Tango::Command
{
public:
GetVersionClass(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) {};
GetVersionClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~GetVersionClass() {};
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<ConexAgp *>(dev))->is_GetVersion_allowed(any);}
};
// Command Reset class definition
class ResetClass : public Tango::Command
{
public:
ResetClass(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) {};
ResetClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~ResetClass() {};
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<ConexAgp *>(dev))->is_Reset_allowed(any);}
};
// Command Backward class definition
class BackwardClass : public Tango::Command
{
public:
BackwardClass(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) {};
BackwardClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~BackwardClass() {};
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<ConexAgp *>(dev))->is_Backward_allowed(any);}
};
// Command Forward class definition
class ForwardClass : public Tango::Command
{
public:
ForwardClass(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) {};
ForwardClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~ForwardClass() {};
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<ConexAgp *>(dev))->is_Forward_allowed(any);}
};
// Command Enable class definition
class EnableClass : public Tango::Command
{
public:
EnableClass(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) {};
EnableClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~EnableClass() {};
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<ConexAgp *>(dev))->is_Enable_allowed(any);}
};
// Command Disable class definition
class DisableClass : public Tango::Command
{
public:
DisableClass(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) {};
DisableClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~DisableClass() {};
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<ConexAgp *>(dev))->is_Disable_allowed(any);}
};
/**
* The ConexAgpClass singleton definition
*/
#ifdef _TG_WINDOWS_
class __declspec(dllexport) ConexAgpClass : public Tango::DeviceClass
#else
class ConexAgpClass : public Tango::DeviceClass
#endif
{
/*----- PROTECTED REGION ID(ConexAgpClass::Additionnal DServer data members) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgpClass::Additionnal DServer data members
public:
// write class properties data members
Tango::DbData cl_prop;
Tango::DbData cl_def_prop;
Tango::DbData dev_def_prop;
// Method prototypes
static ConexAgpClass *init(const char *);
static ConexAgpClass *instance();
~ConexAgpClass();
Tango::DbDatum get_class_property(string &);
Tango::DbDatum get_default_device_property(string &);
Tango::DbDatum get_default_class_property(string &);
protected:
ConexAgpClass(string &);
static ConexAgpClass *_instance;
void command_factory();
void attribute_factory(vector<Tango::Attr *> &);
void pipe_factory();
void write_class_property();
void set_default_property();
void get_class_property();
string get_cvstag();
string get_cvsroot();
private:
void device_factory(const Tango::DevVarStringArray *);
void create_static_attribute_list(vector<Tango::Attr *> &);
void erase_dynamic_attributes(const Tango::DevVarStringArray *,vector<Tango::Attr *> &);
vector<string> defaultAttList;
Tango::Attr *get_attr_object_by_name(vector<Tango::Attr *> &att_list, string attname);
};
} // End of namespace
#endif // ConexAgp_H
/*----- PROTECTED REGION ID(ConexAgpStateMachine.cpp) ENABLED START -----*/
static const char *RcsId = "$Id: ConexAgpStateMachine.cpp,v 1.1 2017-12-21 11:26:12 graziano Exp $";
//=============================================================================
//
// file : ConexAgpStateMachine.cpp
//
// description : State machine 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)
//=============================================================================
#include <ConexAgp.h>
/*----- PROTECTED REGION END -----*/ // ConexAgp::ConexAgpStateMachine.cpp
//================================================================
// States | Description
//================================================================
namespace ConexAgp_ns
{
//=================================================
// Attributes Allowed Methods
//=================================================
//--------------------------------------------------------
/**
* Method : ConexAgp::is_Position_allowed()
* Description : Execution allowed for Position attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_Position_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for Position attribute in Write access.
/*----- PROTECTED REGION ID(ConexAgp::PositionStateAllowed_WRITE) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::PositionStateAllowed_WRITE
// Not any excluded states for Position attribute in read access.
/*----- PROTECTED REGION ID(ConexAgp::PositionStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::PositionStateAllowed_READ
return true;
}
//--------------------------------------------------------
/**
* Method : ConexAgp::is_TargetPosition_allowed()
* Description : Execution allowed for TargetPosition attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_TargetPosition_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for TargetPosition attribute in read access.
/*----- PROTECTED REGION ID(ConexAgp::TargetPositionStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::TargetPositionStateAllowed_READ
return true;
}
//=================================================
// Commands Allowed Methods
//=================================================
//--------------------------------------------------------
/**
* Method : ConexAgp::is_Homing_allowed()
* Description : Execution allowed for Homing attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_Homing_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Homing command.
/*----- PROTECTED REGION ID(ConexAgp::HomingStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::HomingStateAllowed
return true;
}
//--------------------------------------------------------
/**
* Method : ConexAgp::is_Stop_allowed()
* Description : Execution allowed for Stop attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_Stop_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Stop command.
/*----- PROTECTED REGION ID(ConexAgp::StopStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::StopStateAllowed
return true;
}
//--------------------------------------------------------
/**
* Method : ConexAgp::is_GetVersion_allowed()
* Description : Execution allowed for GetVersion attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_GetVersion_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for GetVersion command.
/*----- PROTECTED REGION ID(ConexAgp::GetVersionStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::GetVersionStateAllowed
return true;
}
//--------------------------------------------------------
/**
* Method : ConexAgp::is_Reset_allowed()
* Description : Execution allowed for Reset attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_Reset_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Reset command.
/*----- PROTECTED REGION ID(ConexAgp::ResetStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::ResetStateAllowed
return true;
}
//--------------------------------------------------------
/**
* Method : ConexAgp::is_Backward_allowed()
* Description : Execution allowed for Backward attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_Backward_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Backward command.
/*----- PROTECTED REGION ID(ConexAgp::BackwardStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::BackwardStateAllowed
return true;
}
//--------------------------------------------------------
/**
* Method : ConexAgp::is_Forward_allowed()
* Description : Execution allowed for Forward attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_Forward_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Forward command.
/*----- PROTECTED REGION ID(ConexAgp::ForwardStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::ForwardStateAllowed
return true;
}
//--------------------------------------------------------
/**
* Method : ConexAgp::is_Enable_allowed()
* Description : Execution allowed for Enable attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_Enable_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Enable command.
/*----- PROTECTED REGION ID(ConexAgp::EnableStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::EnableStateAllowed
return true;
}
//--------------------------------------------------------
/**
* Method : ConexAgp::is_Disable_allowed()
* Description : Execution allowed for Disable attribute
*/
//--------------------------------------------------------
bool ConexAgp::is_Disable_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Disable command.
/*----- PROTECTED REGION ID(ConexAgp::DisableStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // ConexAgp::DisableStateAllowed
return true;
}
/*----- PROTECTED REGION ID(ConexAgp::ConexAgpStateAllowed.AdditionalMethods) ENABLED START -----*/
// Additional Methods
/*----- PROTECTED REGION END -----*/ // ConexAgp::ConexAgpStateAllowed.AdditionalMethods
} // End of namespace
static const char *RcsId = "$Id: MultiClassesFactory.cpp,v 1.1 2017-12-21 11:26:12 graziano Exp $";
//=============================================================================
//
// file : MultiClassessFactory.cpp
//
// description : C++ source for the class_factory method of the DServer
// device class. This method is responsible for the creation of
// all class singleton for a device server. It is called
// at device server startup.
//
// project :
//
// 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)
//=============================================================================
#include <tango.h>
#include <Socket2Class.h>
#include <Serial2Class.h>
#include <ConexAgpClass.h>
/**
* Create Class singletons and store them in DServer object.
*/
void Tango::DServer::class_factory()
{
add_class(Socket2_ns::Socket2Class::init("Socket2"));
add_class(Serial2_ns::Serial2Class::init("Serial2"));
add_class(ConexAgp_ns::ConexAgpClass::init("ConexAgp"));
}
/*----- PROTECTED REGION ID(ConexAgp::main.cpp) ENABLED START -----*/
static const char *RcsId = "$Id: main.cpp,v 1.1 2017-12-21 11:26:12 graziano Exp $";
//=============================================================================
//
// file : main.cpp
//
// description : C++ source for the ConexAgp device server main.
// The main rule is to initialise (and create) the Tango
// system and to create the DServerClass singleton.
// The main should be the same for every Tango device server.
//
// 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)
//=============================================================================
#include <tango.h>
// Check if crash reporting is used.
#if defined(ENABLE_CRASH_REPORT)
# include <crashreporting/crash_report.h>
#else
# define DECLARE_CRASH_HANDLER
# define INSTALL_CRASH_HANDLER
#endif
DECLARE_CRASH_HANDLER
int main(int argc,char *argv[])
{
INSTALL_CRASH_HANDLER
try
{
// Initialise the device server
//----------------------------------------
Tango::Util *tg = Tango::Util::init(argc,argv);
// Create the device server singleton
// which will create everything
//----------------------------------------
tg->server_init(false);
// Run the endless loop
//----------------------------------------
cout << "Ready to accept request" << endl;
tg->server_run();
}
catch (bad_alloc &)
{
cout << "Can't allocate memory to store device object !!!" << endl;
cout << "Exiting" << endl;
}
catch (CORBA::Exception &e)
{
Tango::Except::print_exception(e);
cout << "Received a CORBA_Exception" << endl;
cout << "Exiting" << endl;
}
Tango::Util::instance()->server_cleanup();
return(0);
}
/*----- PROTECTED REGION END -----*/ // ConexAgp::main.cpp
//
// file : readthread.cpp
//
// description : reading thread
//
// project : TANGO Device Server
//
// $Author: graziano $
//
// $Revision: 1.1 $
//
// $Log: readthread.cpp,v $
// Revision 1.1 2017-12-21 11:26:12 graziano
// first commit
//
//
//
//
//
//
// copyleft : Sincrotrone Trieste S.C.p.A.
// Strada Statale 14 - km 163,5 in AREA Science Park
// 34012 Basovizza, Trieste ITALY
//
#include "readthread.h"
#include "ConexAgp.h"
#include <math.h>
static const char __FILE__rev[] = __FILE__ " $Revision: 1.1 $";
namespace ConexAgp_ns
{
//+------------------------------------------------------------------
//
// method: readthread::readthread()
//
// description: readthread constructor
//
//-------------------------------------------------------------------
readthread::readthread(Tango::DeviceImpl* devImpl):Tango::LogAdapter(devImpl)
{
DEBUG_STREAM << "readthread::readthread(): constructor... :" << __FILE__rev << endl;
device = devImpl;
}
//+------------------------------------------------------------------
//
// method: readthread::~readthread()
//
// description: readthread destructor
//
//-------------------------------------------------------------------
readthread::~readthread()
{
DEBUG_STREAM << "readthread::~readthread(): destructor... !" << endl;
}
//+------------------------------------------------------------------
//
// method: readthread::run()
//
// description: Run
//
//-------------------------------------------------------------------
void readthread::run(void *)
{
INFO_STREAM << "readthread::run(): running... !" << endl;
/*int pausesec,pausenano,pausesec_dfl,pausenano_dfl,
cnt_err = 0,
max_cnt_err = 3,
ret;*/
abortflag = false;
ConexAgp *_device = static_cast<ConexAgp *>(device);
while (!abortflag)
{
DEBUG_STREAM << "readthread::run(): looping "<< endl;
string tstate;
_device->SendReceive(GET_STATE, tstate);
if(tstate.length() == 6)
{
/*uint16_t positioner_err = ((tstate[0]-0x30) << 12) |
((tstate[1]-0x30) << 8) |
((tstate[2]-0x30) << 4) |
((tstate[3]-0x30));
uint8_t controller_state = (((tstate[4]-0x30) << 4) | ((tstate[5]-0x30)));*/
stringstream pos_err;
pos_err << tstate[0] << tstate[1] << tstate[2] << tstate[3];
uint16_t positioner_err;
pos_err >> hex >> positioner_err;
stringstream contr_state;
contr_state << tstate[4] << tstate[5];
uint16_t controller_state;
contr_state >> hex >> controller_state;
INFO_STREAM << __func__<<": state '" << tstate << "' len="<<tstate.length() << " positioner_err=0x"<<hex<<positioner_err<<" controller_state=0x"<<(int)controller_state<<dec;
stringstream _status;
Tango::DevState _state;
if(positioner_err != 0)
{
_state = Tango::ALARM;
_status << "Positioner error=0x"<<hex << positioner_err << dec;
if(positioner_err & 0x0020)
_status << " (Motion time out)";
}
else
{
map<uint8_t,state_desc>::iterator it = _device->controller_states.find(controller_state);
if(it != _device->controller_states.end())
{
_state = it->second._state;
_status << it->second._status;
}
else
{
_state = Tango::UNKNOWN;
_status << "Unknown state 0x" << (int)controller_state;
}
}
_device->set_state(_state);
_device->push_change_event("State");
_device->push_archive_event("State");
_device->set_status(_status.str());
}
else
{
INFO_STREAM << __func__<<": error parsing state '" << tstate << "' len="<<tstate.length();
}
usleep(10000);
double posx;
_device->SendReceive(string(GET_POSITION), posx);
*(_device->attr_Position_read) = posx;
_device->push_change_event("Position",_device->attr_Position_read);
_device->push_archive_event("Position",_device->attr_Position_read);
usleep(10000);
double postx;
_device->SendReceive(string(GET_TARGET_POSITION), postx);
*(_device->attr_TargetPosition_read) = postx;
usleep(10000);
INFO_STREAM << __func__<<": " << posx << " -> "<<*(_device->attr_Position_read);
abort_sleep(1);
}
INFO_STREAM << "readthread::run(): exit!!!" << endl;
}
//+------------------------------------------------------------------
//
// method: readthread::abort_sleep
//
// description: Resume from sleep if abort_flag set (sec.)
//
//-------------------------------------------------------------------
void readthread::abort_sleep(double time)
{
for (int i = 0; i < (time/0.3); i++) {
if (abortflag)
break;
omni_thread::sleep(0,300000000);
}
}
}
//
// file : readthread.h
//
// description : reading thread
//
// project : TANGO Device Server
//
// $Author: graziano $
//
// $Revision: 1.1 $
//
// $Log: readthread.h,v $
// Revision 1.1 2017-12-21 11:26:12 graziano
// first commit
//
// Revision 1.1 2016-12-12 10:43:59 graziano
// first commit
//
//
//
//
// copyleft : Sincrotrone Trieste S.C.p.A.
// Strada Statale 14 - km 163,5 in AREA Science Park
// 34012 Basovizza, Trieste ITALY
//
#ifndef READTHREAD_H
#define READTHREAD_H
#include <omnithread.h>
#include <tango.h>
#include <inttypes.h>
namespace ConexAgp_ns
{
class readthread : public omni_thread, public Tango::LogAdapter
{
private:
Tango::DeviceImpl* device;
void abort_sleep(double time);
public:
readthread(Tango::DeviceImpl* devImpl);
~readthread();
bool abortflag;
protected:
void run(void *);
}; /* end class readthread() */
}
#endif
/* EOF */
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment