Commit 6306b1d0 authored by Claudio Scafuri's avatar Claudio Scafuri 💬
Browse files

Merge branch 'elettra/release_06' into 'master'

Elettra/release 06

See merge request !1
parents 9e55291f 1d355636
.nse_depinfo
bin/
obj/
CVS
[submodule "deps/serial2"]
path = deps/serial2
url = git@gitlab.elettra.eu:cs/ds/serial2.git
[submodule "deps/serial2client"]
path = deps/serial2client
url = git@gitlab.elettra.eu:cs/cls/serial2client.git
[submodule "deps/socket2"]
path = deps/socket2
url = git@gitlab.elettra.eu:cs/ds/socket2.git
[submodule "deps/ionpump"]
path = deps/ionpump
url = git@gitlab.elettra.eu:cs/ds/ionpump.git
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
SRC_FILES = $(wildcard deps/serial2*/src/Serial2*.cpp deps/socket2/src/Socket2*.cpp deps/ionpump/src/Ionpump*.cpp)
CXXFLAGS = -Ideps/serial2/src -Ideps/serial2client/src -Ideps/socket2/src -Ideps/ionpump/src
LDFLAGS =
include ../makefiles/Make-9.3.3.in
......
Subproject commit 427b337c604c4a560c83ff4d67c7f46e2d7317e7
Subproject commit bbebd3e523a530a607ab8afa109613c95d1ff596
Subproject commit 10769ee9428a5b12a8015ff804efac6ad4352b85
Subproject commit 5fa2980f5656473d6329be8b05212252bc00b833
<?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">
<multiClasses pogoRevision="9.4" name="4uhv-srv" sourcePath="/home/alessio/fermi/servers/4uhv/src" description="" filestogenerate="XMI file,Code files,Protected Regions">
<classes classname="Socket2" sourcePath="../../socket2/src">
<inheritances classname="Device_Impl" sourcePath=""/>
</classes>
......@@ -9,7 +9,7 @@
</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"/>
<inheritances classname="Serial2Client" sourcePath="/home/alessio/fermi/servers/4uhv/src/././../../serial2/src"/>
</classes>
<classes classname="Ionpump" sourcePath="../../ionpump/src">
<inheritances classname="Device_4Impl" sourcePath=""/>
......
This diff is collapsed.
......@@ -24,8 +24,8 @@
//
// $Author: alessio $
//
// $Revision: 1.13 $
// $Date: 2019-04-01 09:14:47 $
// $Revision: 1.9 $
// $Date: 2018-05-10 08:04:51 $
//
// $HeadURL: $
//
......@@ -53,12 +53,32 @@ 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);
class Worker;
struct Data {
string model;
string serial_number;
Tango::DevFloat temperature_fan;
int hvch[4];
Tango::DevLong device_number[4];
Tango::DevUShort power_max[4];
Tango::DevUShort vtarget[4];
Tango::DevUShort iprotect[4];
Tango::DevDouble setpoint[4];
Tango::DevFloat temperaturehv[4];
Tango::DevDouble vmeasured[4];
Tango::DevDouble imeasured[4];
Tango::DevDouble pressure[4];
vector<unsigned char> autostart;
vector<unsigned char> protect;
vector<unsigned char> fs;
vector<unsigned char> ssp;
vector<unsigned char> is;
vector<unsigned char> ec;
Tango::DevState state;
string status;
};
/*----- PROTECTED REGION END -----*/ // Agilent4uhv::Additional Class Declarations
......@@ -70,31 +90,19 @@ class Agilent4uhv : public Serial2Client_ns::Serial2Client
// 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];
omni_mutex iomutex;
public:
vector<ptrFunction> norm_ops, prio_ops;
Worker *worker;
Data data;
omni_mutex data_mutex;
/*----- 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;
......@@ -103,8 +111,6 @@ 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:
......@@ -146,10 +152,6 @@ public:
* Initialize the device
*/
virtual void init_device();
/*
* Read the device properties from database
*/
void get_device_property();
/*
* Always executed method before execution command method.
*/
......@@ -169,13 +171,6 @@ public:
*/
//--------------------------------------------------------
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
......@@ -204,25 +199,6 @@ public:
*/
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:
......@@ -400,6 +376,21 @@ public:
Tango::DevString *get_StatusX_data_ptr(string &name);
map<string,Tango::DevString> StatusX_data;
/**
* Attribute AutoStartX related methods
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_AutoStartX(Tango::Attribute &attr);
virtual void write_AutoStartX(Tango::WAttribute &attr);
virtual bool is_AutoStartX_allowed(Tango::AttReqType type);
void add_AutoStartX_dynamic_attribute(string attname);
void remove_AutoStartX_dynamic_attribute(string attname);
Tango::DevBoolean *get_AutoStartX_data_ptr(string &name);
map<string,Tango::DevBoolean> AutoStartX_data;
/**
* Attribute ProtectX related methods
* Description:
......@@ -444,6 +435,20 @@ public:
Tango::DevBoolean *get_StatusSetPointX_data_ptr(string &name);
map<string,Tango::DevBoolean> StatusSetPointX_data;
/**
* Attribute InterlockStatusX related methods
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_InterlockStatusX(Tango::Attribute &attr);
virtual bool is_InterlockStatusX_allowed(Tango::AttReqType type);
void add_InterlockStatusX_dynamic_attribute(string attname);
void remove_InterlockStatusX_dynamic_attribute(string attname);
Tango::DevBoolean *get_InterlockStatusX_data_ptr(string &name);
map<string,Tango::DevBoolean> InterlockStatusX_data;
/**
* Attribute StatMaskX related methods
* Description:
......@@ -471,27 +476,63 @@ public:
// Command related methods
public:
// Dynamic commands methods
public:
/**
* Command OnHVX related method
* Command OffHV1 related method
* Description:
*
*/
virtual void off_hv1();
virtual bool is_OffHV1_allowed(const CORBA::Any &any);
/**
* Command OffHV2 related method
* Description:
*
*/
virtual void off_hv2();
virtual bool is_OffHV2_allowed(const CORBA::Any &any);
/**
* Command OnHV1 related method
* Description:
*
*/
virtual void on_hv1();
virtual bool is_OnHV1_allowed(const CORBA::Any &any);
/**
* Command OnHV2 related method
* Description:
*
*/
virtual void on_hv2();
virtual bool is_OnHV2_allowed(const CORBA::Any &any);
/**
* Command OffHV3 related method
* Description:
*
*/
virtual void off_hv3();
virtual bool is_OffHV3_allowed(const CORBA::Any &any);
/**
* Command OffHV4 related method
* Description:
*
*/
virtual void off_hv4();
virtual bool is_OffHV4_allowed(const CORBA::Any &any);
/**
* Command OnHV3 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);
virtual void on_hv3();
virtual bool is_OnHV3_allowed(const CORBA::Any &any);
/**
* Command OffHVX related method
* Command OnHV4 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);
virtual void on_hv4();
virtual bool is_OnHV4_allowed(const CORBA::Any &any);
//--------------------------------------------------------
/**
......@@ -504,129 +545,100 @@ public:
/*----- 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,
void write(const int win, string &value);
template<typename T> void write(const int win, T &value)
{
string data;
convert(value, data);
write(win, data);
}
void read(const int win, string &value);
template<typename T> void read(const int win, T &value)
{
string answer;
read(win, answer);
convert(answer, value);
}
void write(const int win, vector<unsigned char> &data);
void read(const int win, vector<unsigned char> &answer);
void check_ack();
void write_message(const string win_s, const unsigned char com, vector<unsigned char> &data);
void read_answer(const string win_s, const unsigned char com, vector<unsigned char> &answer);
unsigned char calc_crc(const vector<unsigned char> &message);
template<typename F, typename T> void convert(const F &reply, T &reply_converted)
{
stringstream conv;
convert(reply, conv);
conv >> reply_converted;
if (conv.fail())
Tango::Except::throw_exception(
"API_ConverionError",
"Conversion fail " + conv.str(),
"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,
template<typename F> void convert(const F &reply, stringstream &conv)
{
conv << reply << flush;
if (conv.fail())
Tango::Except::throw_exception(
"API_ConverionError",
"Conversion fail " + conv.str(),
"Agilent4uhv::convert()");
}
int calc_crc(unsigned char *contents, size_t count);
template<typename F> void convert(const F &reply, string &reply_converted)
{
stringstream conv;
convert(reply, conv);
reply_converted = conv.str();
}
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();
void read_HVCh4();
void read_ErrorCodeCh1();
void read_ErrorCodeCh2();
void read_ErrorCodeCh3();
void read_ErrorCodeCh4();
void read_SerialNumber();
void read_FixedStep();
void read_AutoStart();
void read_Protect();
void read_DeviceNumberCh1();
void read_DeviceNumberCh2();
void read_DeviceNumberCh3();
void read_DeviceNumberCh4();
void read_VTargetCh1();
void read_VTargetCh2();
void read_VTargetCh3();
void read_VTargetCh4();
void read_IProtectCh1();
void read_IProtectCh2();
void read_IProtectCh3();
void read_IProtectCh4();
void read_SetPointCh1();
void read_SetPointCh2();
void read_SetPointCh3();
void read_SetPointCh4();
void read_Temperature();
void read_TemperatureCh1();
void read_TemperatureCh2();
void read_TemperatureCh3();
void read_TemperatureCh4();
void read_IMeasuredCh1();
void read_IMeasuredCh2();
void read_IMeasuredCh3();
void read_IMeasuredCh4();
void read_VMeasuredCh1();
void read_VMeasuredCh2();
void read_VMeasuredCh3();
void read_VMeasuredCh4();
void read_StatusSetPoint();
/*----- PROTECTED REGION END -----*/ // Agilent4uhv::Additional Method prototypes
};
/*----- PROTECTED REGION ID(Agilent4uhv::Additional Classes Definitions) ENABLED START -----*/
// Additional Classes Definitions
class Agilent4uhvWorker : public omni_thread, public Tango::LogAdapter {
class Worker : public omni_thread, public Tango::LogAdapter
{
Agilent4uhv *device;
void* run_undetached(void*);
bool cont;
public:
Agilent4uhvWorker(Agilent4uhv *device_) :
LogAdapter((Tango::DeviceImpl*)device_),
device(device_), cont(false) {}
void start() {
cont = true;
public:
void start(void) {
start_undetached();
}
void stop() {
void stop(void) {
cont = false;
}
void wait(unsigned int millisecs)
{
while(cont && millisecs) {
if (millisecs >= 250) {
omni_thread::self()->sleep(0, 250000000);
millisecs -= 250;
} else {
omni_thread::self()->sleep(0, millisecs * 1000000);
millisecs = 0;
}
}
}
Worker(Agilent4uhv *device_) :
LogAdapter((Tango::DeviceImpl*)device_),
device(device_) {
cont = true;
}
};
/*----- PROTECTED REGION END -----*/ // Agilent4uhv::Additional Classes Definitions
} // End of namespace
......
This diff is collapsed.
/*----- PROTECTED REGION ID(Agilent4uhvClass.cpp) ENABLED START -----*/
static const char *RcsId = "$Id: Agilent4uhvClass.cpp,v 1.6 2019-04-01 09:14:47 alessio Exp $";
static const char *TagName = "Agilent4uhv $Name: $";
static const char *RcsId = "$Id: Agilent4uhvClass.cpp,v 1.3 2016-05-23 07:50:11 alessio Exp $";
static const char *TagName = "Agilent4uhv $Name: release_06 $";
static const char *CvsPath = "$Source: /home/cvsadm/cvsroot/fermi/servers/4uhv/src/Agilent4uhvClass.cpp,v $";
static const char *SvnPath = "$HeadURL: $";
static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc/ds_doc/";
......@@ -33,8 +33,8 @@ static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc
//
// $Author: alessio $
//
// $Revision: 1.6 $
// $Date: 2019-04-01 09:14:47 $
// $Revision: 1.3 $
// $Date: 2016-05-23 07:50:11 $
//
// $HeadURL: $
//
......@@ -160,7 +160,7 @@ Agilent4uhvClass *Agilent4uhvClass::instance()
//===================================================================
//--------------------------------------------------------
/**
* method : OnHVXClass::execute()
* method : OffHV1Class::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -169,16 +169,16 @@ Agilent4uhvClass *Agilent4uhvClass::instance()
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *OnHVXClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
CORBA::Any *OffHV1Class::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "OnHVXClass::execute(): arrived" << endl;
((static_cast<Agilent4uhv *>(device))->on_hvx(*this));
cout2 << "OffHV1Class::execute(): arrived" << endl;
((static_cast<Agilent4uhv *>(device))->off_hv1());
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : OffHVXClass::execute()
* method : OffHV2Class::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -187,10 +187,118 @@ CORBA::Any *OnHVXClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CO
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *OffHVXClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
CORBA::Any *OffHV2Class::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "OffHVXClass::execute(): arrived" << endl;
((static_cast<Agilent4uhv *>(device))->off_hvx(*this));
cout2 << "OffHV2Class::execute(): arrived" << endl;
((static_cast<Agilent4uhv *>(device))->off_hv2());
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : OnHV1Class::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
* @param in_any The command input data
*
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *OnHV1Class::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "OnHV1Class::execute(): arrived" << endl;
((static_cast<Agilent4uhv *>(device))->on_hv1());
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : OnHV2Class::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
* @param in_any The command input data
*
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------