Commit 9e55291f authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Initial import

parent f9485a14
.nse_depinfo
bin/
obj/
NAME_SRV = 4uhv-srv
SRC_FILES = ../serial2/src/Serial2Client.cpp ../serial2/src/Serial2ClientClass.cpp \
../serial2/src/Serial2ClientStateMachine.cpp \
../serial2/src/Serial2.cpp ../serial2/src/Serial2Class.cpp \
../serial2/src/Serial2StateMachine.cpp \
../socket2/src/Socket2.cpp ../socket2/src/Socket2Class.cpp \
../socket2/src/Socket2StateMachine.cpp \
../ionpump/src/Ionpump.cpp ../ionpump/src/IonpumpClass.cpp \
../ionpump/src/IonpumpStateMachine.cpp
CXXFLAGS = -I ../serial2/src -I ../socket2/src -I ../ionpump/src
LDFLAGS =
include ../makefiles/Make-9.3.3.in
test: bin/${NAME_SRV}
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(SDKTARGETSYSROOT)/usr/lib $(LOADER) bin/${NAME_SRV} test -v4
Connettore sul dispositivo:
RS232 DB9F
Cavo dritto
Ricordarsi di impostare MODE su SERIAL dal pannello frontale:
Tenere premuto il tasto Mode per piu di due secondi ed usando Enter per
entrare nei sottomenu, Esc per uscirne, < e > per scorrere tra le voci di uno
stesso menu, - e + per cambiare il valore dell'elemento (quello contrassegnato
con il quadratino e' il nuovo valore mentre quella che lampeggia e' quello
attualmente in uso) e salvandolo con Enter o ignorando la modifica con Esc.
Opzionalmente potrebbe essere auspicabile configurare un
baudrate piu' alto come 38400 invece di lasciare il valore di
default di soli 9600.
<?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.4" name="4uhv-srv" sourcePath="/home/alessio/Sources/cvs-trees/fermi/servers/4uhv/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="Agilent4uhv" sourcePath="./." hasDynamic="true">
<inheritances classname="Device_Impl" sourcePath=""/>
<inheritances classname="Serial2Client" sourcePath="/home/alessio/Sources/cvs-trees/fermi/servers/4uhv/src/././../../serial2/src"/>
</classes>
<classes classname="Ionpump" sourcePath="../../ionpump/src">
<inheritances classname="Device_4Impl" sourcePath=""/>
</classes>
<preferences makefileHome="$(TANGO_HOME)"/>
</multiClasses>
</pogoDsl:PogoSystem>
This diff is collapsed.
/*----- PROTECTED REGION ID(Agilent4uhv.h) ENABLED START -----*/
//=============================================================================
//
// file : Agilent4uhv.h
//
// description : Include file for the Agilent4uhv class
//
// 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: alessio $
//
// $Revision: 1.13 $
// $Date: 2019-04-01 09:14:47 $
//
// $HeadURL: $
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#ifndef Agilent4uhv_H
#define Agilent4uhv_H
#include <tango.h>
#include <Serial2Client.h>
/*----- PROTECTED REGION END -----*/ // Agilent4uhv.h
/**
* Agilent4uhv class description:
*
*/
namespace Agilent4uhv_ns
{
/*----- PROTECTED REGION ID(Agilent4uhv::Additional Class Declarations) ENABLED START -----*/
// Additional Class Declarations
#define WIN_LENGTH 3
class Agilent4uhv;
class Agilent4uhvWorker;
typedef void(Agilent4uhv::*ptrFunction)(void);
/*----- PROTECTED REGION END -----*/ // Agilent4uhv::Additional Class Declarations
class Agilent4uhv : public Serial2Client_ns::Serial2Client
{
/*----- PROTECTED REGION ID(Agilent4uhv::Data Members) ENABLED START -----*/
// Add your own data members
Tango::DevUShort nchannel;
string init_error;
/*
* 4UHV con 2 canali x 80W--> attivi canali 1 e 2
* 4UHV con 4 canali x 80W--> attivi canali da 1 a 4
* 4UHV con 2 canali x 200W--> attivi canali 1 e 3
*/
bool odd_channel_quirk;
omni_mutex io_mutex;
Agilent4uhvWorker *worker;
int errorcode[4];
public:
vector<ptrFunction> norm_ops, prio_ops;
/*----- PROTECTED REGION END -----*/ // Agilent4uhv::Data Members
// Device property data members
public:
// PollingPause: Milliseconds between two command issued by internal poller in the same cycle
Tango::DevLong pollingPause;
// PollingPeriod: Milliseconds between two cycle of the internal poller
Tango::DevLong pollingPeriod;
bool mandatoryNotDefined;
// Attribute data members
public:
Tango::DevString *attr_Model_read;
Tango::DevString *attr_SerialNumber_read;
Tango::DevFloat *attr_Temperature_read;
Tango::DevLong *attr_CRCErrors_read;
Tango::DevBoolean *attr_AutoStart_read;
// Constructors and destructors
public:
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
Agilent4uhv(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
Agilent4uhv(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
Agilent4uhv(Tango::DeviceClass *cl,const char *s,const char *d);
/**
* The device object destructor.
*/
~Agilent4uhv() {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();
/*
* Check if mandatory property has been set
*/
void check_mandatory_property(Tango::DbDatum &class_prop, Tango::DbDatum &dev_prop);
// Attribute methods
public:
//--------------------------------------------------------
/*
* Method : Agilent4uhv::read_attr_hardware()
* Description : Hardware acquisition for attributes.
*/
//--------------------------------------------------------
virtual void read_attr_hardware(vector<long> &attr_list);
//--------------------------------------------------------
/*
* Method : Agilent4uhv::write_attr_hardware()
* Description : Hardware writing for attributes.
*/
//--------------------------------------------------------
virtual void write_attr_hardware(vector<long> &attr_list);
/**
* Attribute Model related methods
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Model(Tango::Attribute &attr);
virtual bool is_Model_allowed(Tango::AttReqType type);
/**
* Attribute SerialNumber related methods
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_SerialNumber(Tango::Attribute &attr);
virtual bool is_SerialNumber_allowed(Tango::AttReqType type);
/**
* Attribute Temperature related methods
* Description:
*
* Data type: Tango::DevFloat
* Attr type: Scalar
*/
virtual void read_Temperature(Tango::Attribute &attr);
virtual bool is_Temperature_allowed(Tango::AttReqType type);
/**
* Attribute CRCErrors related methods
* Description: CRC Errors
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
virtual void read_CRCErrors(Tango::Attribute &attr);
virtual bool is_CRCErrors_allowed(Tango::AttReqType type);
/**
* Attribute AutoStart related methods
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_AutoStart(Tango::Attribute &attr);
virtual void write_AutoStart(Tango::WAttribute &attr);
virtual bool is_AutoStart_allowed(Tango::AttReqType type);
// Dynamic attribute methods
public:
/**
* Attribute HVX related methods
* Description:
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
virtual void read_HVX(Tango::Attribute &attr);
virtual bool is_HVX_allowed(Tango::AttReqType type);
void add_HVX_dynamic_attribute(string attname);
void remove_HVX_dynamic_attribute(string attname);
Tango::DevState *get_HVX_data_ptr(string &name);
map<string,Tango::DevState> HVX_data;
/**
* Attribute DeviceNumberX related methods
* Description:
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
virtual void read_DeviceNumberX(Tango::Attribute &attr);
virtual void write_DeviceNumberX(Tango::WAttribute &attr);
virtual bool is_DeviceNumberX_allowed(Tango::AttReqType type);
void add_DeviceNumberX_dynamic_attribute(string attname);
void remove_DeviceNumberX_dynamic_attribute(string attname);
Tango::DevLong *get_DeviceNumberX_data_ptr(string &name);
map<string,Tango::DevLong> DeviceNumberX_data;
/**
* Attribute PowerMaxX related methods
* Description:
*
* Data type: Tango::DevUShort
* Attr type: Scalar
*/
virtual void read_PowerMaxX(Tango::Attribute &attr);
virtual void write_PowerMaxX(Tango::WAttribute &attr);
virtual bool is_PowerMaxX_allowed(Tango::AttReqType type);
void add_PowerMaxX_dynamic_attribute(string attname);
void remove_PowerMaxX_dynamic_attribute(string attname);
Tango::DevUShort *get_PowerMaxX_data_ptr(string &name);
map<string,Tango::DevUShort> PowerMaxX_data;
/**
* Attribute VTargetX related methods
* Description:
*
* Data type: Tango::DevUShort
* Attr type: Scalar
*/
virtual void read_VTargetX(Tango::Attribute &attr);
virtual void write_VTargetX(Tango::WAttribute &attr);
virtual bool is_VTargetX_allowed(Tango::AttReqType type);
void add_VTargetX_dynamic_attribute(string attname);
void remove_VTargetX_dynamic_attribute(string attname);
Tango::DevUShort *get_VTargetX_data_ptr(string &name);
map<string,Tango::DevUShort> VTargetX_data;
/**
* Attribute IProtectX related methods
* Description:
*
* Data type: Tango::DevUShort
* Attr type: Scalar
*/
virtual void read_IProtectX(Tango::Attribute &attr);
virtual void write_IProtectX(Tango::WAttribute &attr);
virtual bool is_IProtectX_allowed(Tango::AttReqType type);
void add_IProtectX_dynamic_attribute(string attname);
void remove_IProtectX_dynamic_attribute(string attname);
Tango::DevUShort *get_IProtectX_data_ptr(string &name);
map<string,Tango::DevUShort> IProtectX_data;
/**
* Attribute SetPointX related methods
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_SetPointX(Tango::Attribute &attr);
virtual void write_SetPointX(Tango::WAttribute &attr);
virtual bool is_SetPointX_allowed(Tango::AttReqType type);
void add_SetPointX_dynamic_attribute(string attname);
void remove_SetPointX_dynamic_attribute(string attname);
Tango::DevDouble *get_SetPointX_data_ptr(string &name);
map<string,Tango::DevDouble> SetPointX_data;
/**
* Attribute TemperatureHVX related methods
* Description:
*
* Data type: Tango::DevFloat
* Attr type: Scalar
*/
virtual void read_TemperatureHVX(Tango::Attribute &attr);
virtual bool is_TemperatureHVX_allowed(Tango::AttReqType type);
void add_TemperatureHVX_dynamic_attribute(string attname);
void remove_TemperatureHVX_dynamic_attribute(string attname);
Tango::DevFloat *get_TemperatureHVX_data_ptr(string &name);
map<string,Tango::DevFloat> TemperatureHVX_data;
/**
* Attribute VoltageX related methods
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_VoltageX(Tango::Attribute &attr);
virtual bool is_VoltageX_allowed(Tango::AttReqType type);
void add_VoltageX_dynamic_attribute(string attname);
void remove_VoltageX_dynamic_attribute(string attname);
Tango::DevDouble *get_VoltageX_data_ptr(string &name);
map<string,Tango::DevDouble> VoltageX_data;
/**
* Attribute CurrentX related methods
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_CurrentX(Tango::Attribute &attr);
virtual bool is_CurrentX_allowed(Tango::AttReqType type);
void add_CurrentX_dynamic_attribute(string attname);
void remove_CurrentX_dynamic_attribute(string attname);
Tango::DevDouble *get_CurrentX_data_ptr(string &name);
map<string,Tango::DevDouble> CurrentX_data;
/**
* Attribute PressureX related methods
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_PressureX(Tango::Attribute &attr);
virtual bool is_PressureX_allowed(Tango::AttReqType type);
void add_PressureX_dynamic_attribute(string attname);
void remove_PressureX_dynamic_attribute(string attname);
Tango::DevDouble *get_PressureX_data_ptr(string &name);
map<string,Tango::DevDouble> PressureX_data;
/**
* Attribute StateX related methods
* Description:
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
virtual void read_StateX(Tango::Attribute &attr);
virtual bool is_StateX_allowed(Tango::AttReqType type);
void add_StateX_dynamic_attribute(string attname);
void remove_StateX_dynamic_attribute(string attname);
Tango::DevState *get_StateX_data_ptr(string &name);
map<string,Tango::DevState> StateX_data;
/**
* Attribute StatusX related methods
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_StatusX(Tango::Attribute &attr);
virtual bool is_StatusX_allowed(Tango::AttReqType type);
void add_StatusX_dynamic_attribute(string attname);
void remove_StatusX_dynamic_attribute(string attname);
Tango::DevString *get_StatusX_data_ptr(string &name);
map<string,Tango::DevString> StatusX_data;
/**
* Attribute ProtectX related methods
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_ProtectX(Tango::Attribute &attr);
virtual void write_ProtectX(Tango::WAttribute &attr);
virtual bool is_ProtectX_allowed(Tango::AttReqType type);
void add_ProtectX_dynamic_attribute(string attname);
void remove_ProtectX_dynamic_attribute(string attname);
Tango::DevBoolean *get_ProtectX_data_ptr(string &name);
map<string,Tango::DevBoolean> ProtectX_data;
/**
* Attribute FixedStepX related methods
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_FixedStepX(Tango::Attribute &attr);
virtual void write_FixedStepX(Tango::WAttribute &attr);
virtual bool is_FixedStepX_allowed(Tango::AttReqType type);
void add_FixedStepX_dynamic_attribute(string attname);
void remove_FixedStepX_dynamic_attribute(string attname);
Tango::DevBoolean *get_FixedStepX_data_ptr(string &name);
map<string,Tango::DevBoolean> FixedStepX_data;
/**
* Attribute StatusSetPointX related methods
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_StatusSetPointX(Tango::Attribute &attr);
virtual bool is_StatusSetPointX_allowed(Tango::AttReqType type);
void add_StatusSetPointX_dynamic_attribute(string attname);
void remove_StatusSetPointX_dynamic_attribute(string attname);
Tango::DevBoolean *get_StatusSetPointX_data_ptr(string &name);
map<string,Tango::DevBoolean> StatusSetPointX_data;
/**
* Attribute StatMaskX related methods
* Description:
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
virtual void read_StatMaskX(Tango::Attribute &attr);
virtual bool is_StatMaskX_allowed(Tango::AttReqType type);
void add_StatMaskX_dynamic_attribute(string attname);
void remove_StatMaskX_dynamic_attribute(string attname);
Tango::DevLong *get_StatMaskX_data_ptr(string &name);
map<string,Tango::DevLong> StatMaskX_data;
//--------------------------------------------------------
/**
* Method : Agilent4uhv::add_dynamic_attributes()
* Description : Add dynamic attributes if any.
*/
//--------------------------------------------------------
void add_dynamic_attributes();
// Command related methods
public:
// Dynamic commands methods
public:
/**
* Command OnHVX related method
* Description:
*
*/
virtual void on_hvx(Tango::Command &command);
virtual bool is_OnHVX_allowed(const CORBA::Any &any);
void add_OnHVX_dynamic_command(string cmdname, bool device);
void remove_OnHVX_dynamic_command(string cmdname);
/**
* Command OffHVX related method
* Description:
*
*/
virtual void off_hvx(Tango::Command &command);
virtual bool is_OffHVX_allowed(const CORBA::Any &any);
void add_OffHVX_dynamic_command(string cmdname, bool device);
void remove_OffHVX_dynamic_command(string cmdname);
//--------------------------------------------------------
/**
* Method : Agilent4uhv::add_dynamic_commands()
* Description : Add dynamic commands if any.
*/
//--------------------------------------------------------
void add_dynamic_commands();
/*----- PROTECTED REGION ID(Agilent4uhv::Additional Method prototypes) ENABLED START -----*/
// Additional Method prototypes
private:
void write_message(const char window[WIN_LENGTH], const unsigned char com,
const char * const data, const size_t data_length);
string read_answer();
void write(const char window[WIN_LENGTH], const char * const data,
const size_t data_length);
string read(const char window[WIN_LENGTH]);
template<typename T> void convert(const string &data, T &result) {
stringstream ss;
ss << data;
ss >> result;
if (ss.fail())
Tango::Except::throw_exception( "",
"Conversion fail of " + data,
"Agilent4uhv::convert()");
}
template<typename T> void convert(const T &data, string &result) {
stringstream ss;
ss << data;
result = ss.str();
if (ss.fail())
Tango::Except::throw_exception( "",
"Conversion fail of " + data,
"Agilent4uhv::convert()");
}
int calc_crc(unsigned char *contents, size_t count);
void check_init_error(void);
#define ALPHANUMERIC_LENGTH_4UHV 10
#define ALPHANUMERIC_LENGTH_IPCMINI 48
#define LOGIC_LENGTH 1
#define NUMERIC_LENGTH 6
void read(const char window[WIN_LENGTH], string &data);
void read(const char window[WIN_LENGTH], bool &data);
void read(const char window[WIN_LENGTH], int &data);
void write(const char window[WIN_LENGTH], const string &data);
void write(const char window[WIN_LENGTH], const bool data);
void write(const char window[WIN_LENGTH], const int data);
public:
void read_Status();
void read_Model();
void read_PowerMaxCh1();
void read_PowerMaxCh2();
void read_PowerMaxCh3();
void read_PowerMaxCh4();
void read_PressureCh1();
void read_PressureCh2();
void read_PressureCh3();
void read_PressureCh4();
void read_HVCh1();
void read_HVCh2();
void read_HVCh3();