diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e39ac2a0deedfa7bf971acf836f46313988af6ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.nse_depinfo +bin/ +obj/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..7882fde2726fa4871762607143c708e41c937a26 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +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 diff --git a/README.md b/README.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/doc/4UHV Controller User Manual.pdf b/doc/4UHV Controller User Manual.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4eb3cb1dd887dd73370eee6dd3a3c75f43eddf2e Binary files /dev/null and b/doc/4UHV Controller User Manual.pdf differ diff --git a/doc/IPCMini Ion Pump Controller User Manual.pdf b/doc/IPCMini Ion Pump Controller User Manual.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1ad750ec38c27d6918b9d6560218d66a6e81f9ce Binary files /dev/null and b/doc/IPCMini Ion Pump Controller User Manual.pdf differ diff --git a/doc/README b/doc/README new file mode 100644 index 0000000000000000000000000000000000000000..df1c0bac450fa8f2eb6fa9c7d7692d4615ac0843 --- /dev/null +++ b/doc/README @@ -0,0 +1,15 @@ +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. diff --git a/src/4uhv-srv.multi.xmi b/src/4uhv-srv.multi.xmi new file mode 100644 index 0000000000000000000000000000000000000000..56f0f9d83d71525176c7954fea0b1ca8b2c1f48a --- /dev/null +++ b/src/4uhv-srv.multi.xmi @@ -0,0 +1,19 @@ +<?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> diff --git a/src/Agilent4uhv.cpp b/src/Agilent4uhv.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c35174f40e3c97a35d54236ffcb642a2e4d906b7 --- /dev/null +++ b/src/Agilent4uhv.cpp @@ -0,0 +1,2241 @@ +/*----- PROTECTED REGION ID(Agilent4uhv.cpp) ENABLED START -----*/ +static const char *RcsId = "$Id: Agilent4uhv.cpp,v 1.25 2019-04-01 09:14:47 alessio Exp $"; +//============================================================================= +// +// file : Agilent4uhv.cpp +// +// description : C++ source for the Agilent4uhv class and its commands. +// The class is derived from Device. It represents the +// CORBA servant object which will be accessed from the +// network. All commands which can be executed on the +// Agilent4uhv are implemented in this file. +// +// 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.25 $ +// $Date: 2019-04-01 09:14:47 $ +// +// $HeadURL: $ +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#include <Agilent4uhv.h> +#include <Agilent4uhvClass.h> + +#define MAX_DEVSTRING_LENGTH 255 + +/*----- PROTECTED REGION END -----*/ // Agilent4uhv.cpp + +/** + * Agilent4uhv class description: + * + */ + +//================================================================ +// The following table gives the correspondence +// between command and method names. +// +// Command name | Method name +//================================================================ +// State | Inherited (no method) +// Status | Inherited (no method) +//================================================================ + +//================================================================ +// Attributes managed are: +//================================================================ +// Model | Tango::DevString Scalar +// SerialNumber | Tango::DevString Scalar +// Temperature | Tango::DevFloat Scalar +// CRCErrors | Tango::DevLong Scalar +// AutoStart | Tango::DevBoolean Scalar +//================================================================ + +namespace Agilent4uhv_ns +{ +/*----- PROTECTED REGION ID(Agilent4uhv::namespace_starting) ENABLED START -----*/ + +// static initializations + +/*----- PROTECTED REGION END -----*/ // Agilent4uhv::namespace_starting + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::Agilent4uhv() + * Description : Constructors for a Tango device + * implementing the classAgilent4uhv + */ +//-------------------------------------------------------- +Agilent4uhv::Agilent4uhv(Tango::DeviceClass *cl, string &s) + : Serial2Client(cl, s.c_str()) +{ + /*----- PROTECTED REGION ID(Agilent4uhv::constructor_1) ENABLED START -----*/ + init_device(); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::constructor_1 +} +//-------------------------------------------------------- +Agilent4uhv::Agilent4uhv(Tango::DeviceClass *cl, const char *s) + : Serial2Client(cl, s) +{ + /*----- PROTECTED REGION ID(Agilent4uhv::constructor_2) ENABLED START -----*/ + init_device(); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::constructor_2 +} +//-------------------------------------------------------- +Agilent4uhv::Agilent4uhv(Tango::DeviceClass *cl, const char *s, const char *d) + : Serial2Client(cl, s, d) +{ + /*----- PROTECTED REGION ID(Agilent4uhv::constructor_3) ENABLED START -----*/ + init_device(); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::constructor_3 +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::delete_device() + * Description : will be called at device destruction or at init command + */ +//-------------------------------------------------------- +void Agilent4uhv::delete_device() +{ + DEBUG_STREAM << "Agilent4uhv::delete_device() " << device_name << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::delete_device) ENABLED START -----*/ + if (worker) { + worker->stop(); + worker->join(NULL); + } + + // Delete device allocated objects + delete attr_Model_read[0]; + delete attr_SerialNumber_read[0]; + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::delete_device + delete[] attr_Model_read; + delete[] attr_SerialNumber_read; + delete[] attr_Temperature_read; + delete[] attr_CRCErrors_read; + delete[] attr_AutoStart_read; + + if (Tango::Util::instance()->is_svr_shutting_down()==false && + Tango::Util::instance()->is_device_restarting(device_name)==false && + Tango::Util::instance()->is_svr_starting()==false) + { + // If not shutting down call delete device for inherited object + Serial2Client_ns::Serial2Client::delete_device(); + } +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::init_device() + * Description : will be called at device initialization. + */ +//-------------------------------------------------------- +void Agilent4uhv::init_device() +{ + DEBUG_STREAM << "Agilent4uhv::init_device() create device " << device_name << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::init_device_before) ENABLED START -----*/ + + // Initialization before get_device_property() call + mandatoryNotDefined = false; + nchannel = 0; + odd_channel_quirk = false; + init_error.clear(); + worker = NULL; + norm_ops.clear(); + prio_ops.clear(); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::init_device_before + + if (Tango::Util::instance()->is_svr_starting() == false && + Tango::Util::instance()->is_device_restarting(device_name)==false) + { + // If not starting up call init device for inherited object + Serial2Client_ns::Serial2Client::init_device(); + } + + // Get the device properties from database + get_device_property(); + + attr_Model_read = new Tango::DevString[1]; + attr_SerialNumber_read = new Tango::DevString[1]; + attr_Temperature_read = new Tango::DevFloat[1]; + attr_CRCErrors_read = new Tango::DevLong[1]; + attr_AutoStart_read = new Tango::DevBoolean[1]; + // No longer if mandatory property not set. + if (mandatoryNotDefined) + return; + + /*----- PROTECTED REGION ID(Agilent4uhv::init_device) ENABLED START -----*/ + + // Waiting the device + int retries = 0; + while(get_state2() == 9 && retries++ < 5) { + sleep(1); + } + + try { + attr_Model_read[0] = new char[MAX_DEVSTRING_LENGTH]; + attr_SerialNumber_read[0] = new char[MAX_DEVSTRING_LENGTH]; + attr_CRCErrors_read[0] = 0; + + read_Model(); + read_SerialNumber(); + if (strncmp(attr_Model_read[0], "9299010", 7) == 0 || + strncmp(attr_Model_read[0], "9299011", 7) == 0 || + strncmp(attr_Model_read[0], "9299100", 7) == 0 || + strncmp(attr_Model_read[0], "9299101", 7) == 0 || + strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + nchannel = 1; + } else if (strncmp(attr_Model_read[0], "9299020", 7) == 0 || + strncmp(attr_Model_read[0], "9299021", 7) == 0 || + strncmp(attr_Model_read[0], "9299200", 7) == 0 || + strncmp(attr_Model_read[0], "9299201", 7) == 0 || + strncmp(attr_Model_read[0], "9299022", 7) == 0) { + + read_PowerMaxCh1(); + if (PowerMaxX_data["PowerMax1"] == 200) + odd_channel_quirk = true; + + nchannel = 2; + } else if (strncmp(attr_Model_read[0], "9299210", 7) == 0 || + strncmp(attr_Model_read[0], "9299211", 7) == 0 || + strncmp(attr_Model_read[0], "9299212", 7) == 0 || + strncmp(attr_Model_read[0], "9299213", 7) == 0) { + nchannel = 3; + } else if (strncmp(attr_Model_read[0], "9299400", 7) == 0 || + strncmp(attr_Model_read[0], "9299401", 7) == 0 || + strncmp(attr_Model_read[0], "9299402", 7) == 0) { + nchannel = 4; + } else { + Tango::Except::throw_exception( "", + "Unknown model", + "Agilent4uhv::init_device()"); + } + + + int pressure_unit; + read("600", pressure_unit); + if (pressure_unit != 1) + Tango::Except::throw_exception( "", + "Pressure unit is wrong", + "Agilent4uhv::init_device()"); + + if(nchannel >= 1) { + norm_ops.push_back(&Agilent4uhv::read_HVCh1); + norm_ops.push_back(&Agilent4uhv::read_DeviceNumberCh1); + prio_ops.push_back(&Agilent4uhv::read_PressureCh1); + norm_ops.push_back(&Agilent4uhv::read_PowerMaxCh1); + norm_ops.push_back(&Agilent4uhv::read_VTargetCh1); + norm_ops.push_back(&Agilent4uhv::read_IProtectCh1); + norm_ops.push_back(&Agilent4uhv::read_SetPointCh1); + norm_ops.push_back(&Agilent4uhv::read_TemperatureCh1); + norm_ops.push_back(&Agilent4uhv::read_IMeasuredCh1); + norm_ops.push_back(&Agilent4uhv::read_VMeasuredCh1); + norm_ops.push_back(&Agilent4uhv::read_ErrorCodeCh1); + } + + if(nchannel >= 2) { + norm_ops.push_back(&Agilent4uhv::read_HVCh2); + norm_ops.push_back(&Agilent4uhv::read_DeviceNumberCh2); + prio_ops.push_back(&Agilent4uhv::read_PressureCh2); + norm_ops.push_back(&Agilent4uhv::read_PowerMaxCh2); + norm_ops.push_back(&Agilent4uhv::read_VTargetCh2); + norm_ops.push_back(&Agilent4uhv::read_IProtectCh1); + norm_ops.push_back(&Agilent4uhv::read_SetPointCh2); + norm_ops.push_back(&Agilent4uhv::read_TemperatureCh2); + norm_ops.push_back(&Agilent4uhv::read_IMeasuredCh2); + norm_ops.push_back(&Agilent4uhv::read_VMeasuredCh2); + norm_ops.push_back(&Agilent4uhv::read_ErrorCodeCh2); + } + + if(nchannel >= 3) { + norm_ops.push_back(&Agilent4uhv::read_HVCh3); + norm_ops.push_back(&Agilent4uhv::read_DeviceNumberCh3); + prio_ops.push_back(&Agilent4uhv::read_PressureCh3); + norm_ops.push_back(&Agilent4uhv::read_PowerMaxCh3); + norm_ops.push_back(&Agilent4uhv::read_VTargetCh3); + norm_ops.push_back(&Agilent4uhv::read_IProtectCh1); + norm_ops.push_back(&Agilent4uhv::read_SetPointCh3); + norm_ops.push_back(&Agilent4uhv::read_TemperatureCh3); + norm_ops.push_back(&Agilent4uhv::read_IMeasuredCh3); + norm_ops.push_back(&Agilent4uhv::read_VMeasuredCh3); + norm_ops.push_back(&Agilent4uhv::read_ErrorCodeCh3); + } + + if(nchannel >= 4) { + norm_ops.push_back(&Agilent4uhv::read_HVCh4); + norm_ops.push_back(&Agilent4uhv::read_DeviceNumberCh4); + prio_ops.push_back(&Agilent4uhv::read_PressureCh4); + norm_ops.push_back(&Agilent4uhv::read_PowerMaxCh4); + norm_ops.push_back(&Agilent4uhv::read_VTargetCh4); + norm_ops.push_back(&Agilent4uhv::read_IProtectCh1); + norm_ops.push_back(&Agilent4uhv::read_SetPointCh4); + norm_ops.push_back(&Agilent4uhv::read_TemperatureCh4); + norm_ops.push_back(&Agilent4uhv::read_IMeasuredCh4); + norm_ops.push_back(&Agilent4uhv::read_VMeasuredCh4); + norm_ops.push_back(&Agilent4uhv::read_ErrorCodeCh4); + } + + // Related to all channels + norm_ops.push_back(&Agilent4uhv::read_FixedStep); + norm_ops.push_back(&Agilent4uhv::read_AutoStart); + norm_ops.push_back(&Agilent4uhv::read_Protect); + norm_ops.push_back(&Agilent4uhv::read_Temperature); + norm_ops.push_back(&Agilent4uhv::read_StatusSetPoint); + /* This must be the latest */ + norm_ops.push_back(&Agilent4uhv::read_Status); + + worker = new Agilent4uhvWorker(this); + worker->start(); + } catch(Tango::DevFailed &e) { + init_error = "Initialization failed: " + string(e.errors[0].desc); + ERROR_STREAM << init_error << endl; + set_state(Tango::UNKNOWN); + assert(false); + } catch (...) { + init_error = "Initialization failed: Unknown error"; + ERROR_STREAM << init_error << endl; + set_state(Tango::UNKNOWN); + assert(false); + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::init_device +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::get_device_property() + * Description : Read database to initialize property data members. + */ +//-------------------------------------------------------- +void Agilent4uhv::get_device_property() +{ + /*----- PROTECTED REGION ID(Agilent4uhv::get_device_property_before) ENABLED START -----*/ + + // Initialize property data members + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::get_device_property_before + + mandatoryNotDefined = false; + + // Read device properties from database. + Tango::DbData dev_prop; + dev_prop.push_back(Tango::DbDatum("DeviceName")); + dev_prop.push_back(Tango::DbDatum("PollingPause")); + dev_prop.push_back(Tango::DbDatum("PollingPeriod")); + + // is there at least one property to be read ? + if (dev_prop.size()>0) + { + // Call database and extract values + if (Tango::Util::instance()->_UseDb==true) + get_db_device()->get_property(dev_prop); + + // get instance on Agilent4uhvClass to get class property + Tango::DbDatum def_prop, cl_prop; + Agilent4uhvClass *ds_class = + (static_cast<Agilent4uhvClass *>(get_device_class())); + int i = -1; + + // Try to initialize DeviceName from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> deviceName; + else { + // Try to initialize DeviceName from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> deviceName; + } + // And try to extract DeviceName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> deviceName; + // Property StartDsPath is mandatory, check if has been defined in database. + check_mandatory_property(cl_prop, dev_prop[i]); + + // Try to initialize PollingPause from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> pollingPause; + else { + // Try to initialize PollingPause from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> pollingPause; + } + // And try to extract PollingPause value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> pollingPause; + + // Try to initialize PollingPeriod from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> pollingPeriod; + else { + // Try to initialize PollingPeriod from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> pollingPeriod; + } + // And try to extract PollingPeriod value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> pollingPeriod; + + } + + /*----- PROTECTED REGION ID(Agilent4uhv::get_device_property_after) ENABLED START -----*/ + + // Check device property data members init + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::get_device_property_after +} +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::check_mandatory_property() + * Description : For mandatory properties check if defined in database. + */ +//-------------------------------------------------------- +void Agilent4uhv::check_mandatory_property(Tango::DbDatum &class_prop, Tango::DbDatum &dev_prop) +{ + // Check if all properties are empty + if (class_prop.is_empty() && dev_prop.is_empty()) + { + TangoSys_OMemStream tms; + tms << endl <<"Property \'" << dev_prop.name; + if (Tango::Util::instance()->_UseDb==true) + tms << "\' is mandatory but not defined in database"; + else + tms << "\' is mandatory but cannot be defined without database"; + string status(get_status()); + status += tms.str(); + set_status(status); + mandatoryNotDefined = true; + /*----- PROTECTED REGION ID(Agilent4uhv::check_mandatory_property) ENABLED START -----*/ + cerr << tms.str() << " for " << device_name << endl; + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::check_mandatory_property + } +} + + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::always_executed_hook() + * Description : method always executed before any command is executed + */ +//-------------------------------------------------------- +void Agilent4uhv::always_executed_hook() +{ + DEBUG_STREAM << "Agilent4uhv::always_executed_hook() " << device_name << endl; + if (mandatoryNotDefined) + { + string status(get_status()); + Tango::Except::throw_exception( + (const char *)"PROPERTY_NOT_SET", + status.c_str(), + (const char *)"Agilent4uhv::always_executed_hook()"); + } + /*----- PROTECTED REGION ID(Agilent4uhv::always_executed_hook) ENABLED START -----*/ + + // code always executed before all requests + if (! init_error.empty()) { + set_state(Tango::UNKNOWN); + set_status(init_error); + return; + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::always_executed_hook +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::read_attr_hardware() + * Description : Hardware acquisition for attributes + */ +//-------------------------------------------------------- +void Agilent4uhv::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) +{ + DEBUG_STREAM << "Agilent4uhv::read_attr_hardware(vector<long> &attr_list) entering... " << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::read_attr_hardware) ENABLED START -----*/ + + // Add your own code + check_init_error(); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_attr_hardware +} +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::write_attr_hardware() + * Description : Hardware writing for attributes + */ +//-------------------------------------------------------- +void Agilent4uhv::write_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) +{ + DEBUG_STREAM << "Agilent4uhv::write_attr_hardware(vector<long> &attr_list) entering... " << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::write_attr_hardware) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_attr_hardware +} + +//-------------------------------------------------------- +/** + * Read attribute Model related method + * Description: + * + * Data type: Tango::DevString + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_Model(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_Model(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::read_Model) ENABLED START -----*/ + attr.set_value(attr_Model_read); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_Model +} +//-------------------------------------------------------- +/** + * Read attribute SerialNumber related method + * Description: + * + * Data type: Tango::DevString + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_SerialNumber(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_SerialNumber(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::read_SerialNumber) ENABLED START -----*/ + attr.set_value(attr_SerialNumber_read); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_SerialNumber +} +//-------------------------------------------------------- +/** + * Read attribute Temperature related method + * Description: + * + * Data type: Tango::DevFloat + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_Temperature(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_Temperature(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::read_Temperature) ENABLED START -----*/ + attr.set_value(attr_Temperature_read); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_Temperature +} +//-------------------------------------------------------- +/** + * Read attribute CRCErrors related method + * Description: CRC Errors + * + * Data type: Tango::DevLong + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_CRCErrors(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_CRCErrors(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::read_CRCErrors) ENABLED START -----*/ + attr.set_value(attr_CRCErrors_read); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_CRCErrors +} +//-------------------------------------------------------- +/** + * Read attribute AutoStart related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_AutoStart(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_AutoStart(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::read_AutoStart) ENABLED START -----*/ + // Set the attribute value + attr.set_value(attr_AutoStart_read); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_AutoStart +} +//-------------------------------------------------------- +/** + * Write attribute AutoStart related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::write_AutoStart(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::write_AutoStart(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevBoolean w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(Agilent4uhv::write_AutoStart) ENABLED START -----*/ + + check_init_error(); + + string newvalue; + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + if (w_val) + newvalue = "1"; + else + newvalue = "0"; + } else { + newvalue = "000000000"; + if (w_val) + newvalue.push_back('1'); + else + newvalue.push_back('0'); + } + + write("601", newvalue); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_AutoStart +} + +//-------------------------------------------------------- +/** + * Read attribute HVX related method + * Description: + * + * Data type: Tango::DevState + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_HVX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_HVX(Tango::Attribute &attr) entering... " << endl; + Tango::DevState *att_value = get_HVX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_HVX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_HVX +} +//-------------------------------------------------------- +/** + * Read attribute DeviceNumberX related method + * Description: + * + * Data type: Tango::DevLong + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_DeviceNumberX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_DeviceNumberX(Tango::Attribute &attr) entering... " << endl; + Tango::DevLong *att_value = get_DeviceNumberX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_DeviceNumberX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_DeviceNumberX +} +//-------------------------------------------------------- +/** + * Write attribute DeviceNumberX related method + * Description: + * + * Data type: Tango::DevLong + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::write_DeviceNumberX(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::write_DeviceNumberX(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevLong w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(Agilent4uhv::write_DeviceNumberX) ENABLED START -----*/ + + check_init_error(); + + int indexn; + convert(attr.get_name().substr(attr.get_name().size()-1), indexn); + + int newvalue = w_val; + + switch (indexn) + { + case 1: + write("610", newvalue); + break; + case 2: + write("620", newvalue); + break; + case 3: + write("630", newvalue); + break; + case 4: + write("640", newvalue); + break; + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_DeviceNumberX +} +//-------------------------------------------------------- +/** + * Read attribute PowerMaxX related method + * Description: + * + * Data type: Tango::DevUShort + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_PowerMaxX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_PowerMaxX(Tango::Attribute &attr) entering... " << endl; + Tango::DevUShort *att_value = get_PowerMaxX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_PowerMaxX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_PowerMaxX +} +//-------------------------------------------------------- +/** + * Write attribute PowerMaxX related method + * Description: + * + * Data type: Tango::DevUShort + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::write_PowerMaxX(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::write_PowerMaxX(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevUShort w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(Agilent4uhv::write_PowerMaxX) ENABLED START -----*/ + + check_init_error(); + + int indexn; + convert(attr.get_name().substr(attr.get_name().size()-1), indexn); + + int newvalue = w_val; + + switch (indexn) + { + case 1: + write("612", newvalue); + break; + case 2: + write("622", newvalue); + break; + case 3: + write("632", newvalue); + break; + case 4: + write("642", newvalue); + break; + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_PowerMaxX +} +//-------------------------------------------------------- +/** + * Read attribute VTargetX related method + * Description: + * + * Data type: Tango::DevUShort + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_VTargetX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_VTargetX(Tango::Attribute &attr) entering... " << endl; + Tango::DevUShort *att_value = get_VTargetX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_VTargetX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_VTargetX +} +//-------------------------------------------------------- +/** + * Write attribute VTargetX related method + * Description: + * + * Data type: Tango::DevUShort + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::write_VTargetX(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::write_VTargetX(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevUShort w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(Agilent4uhv::write_VTargetX) ENABLED START -----*/ + + check_init_error(); + + int indexn; + convert(attr.get_name().substr(attr.get_name().size()-1), indexn); + + int newvalue = w_val * 1000; + + switch (indexn) + { + case 1: + write("613", newvalue); + break; + case 2: + write("623", newvalue); + break; + case 3: + write("633", newvalue); + break; + case 4: + write("643", newvalue); + break; + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_VTargetX +} +//-------------------------------------------------------- +/** + * Read attribute IProtectX related method + * Description: + * + * Data type: Tango::DevUShort + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_IProtectX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_IProtectX(Tango::Attribute &attr) entering... " << endl; + Tango::DevUShort *att_value = get_IProtectX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_IProtectX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_IProtectX +} +//-------------------------------------------------------- +/** + * Write attribute IProtectX related method + * Description: + * + * Data type: Tango::DevUShort + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::write_IProtectX(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::write_IProtectX(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevUShort w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(Agilent4uhv::write_IProtectX) ENABLED START -----*/ + + check_init_error(); + + int indexn; + convert(attr.get_name().substr(attr.get_name().size()-1), indexn); + + int newvalue; + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + newvalue = w_val * 1000; + } else { + newvalue = w_val; + } + + switch (indexn) + { + case 1: + write("614", newvalue); + break; + case 2: + write("624", newvalue); + break; + case 3: + write("634", newvalue); + break; + case 4: + write("644", newvalue); + break; + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_IProtectX +} +//-------------------------------------------------------- +/** + * Read attribute SetPointX related method + * Description: + * + * Data type: Tango::DevDouble + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_SetPointX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_SetPointX(Tango::Attribute &attr) entering... " << endl; + Tango::DevDouble *att_value = get_SetPointX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_SetPointX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_SetPointX +} +//-------------------------------------------------------- +/** + * Write attribute SetPointX related method + * Description: + * + * Data type: Tango::DevDouble + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::write_SetPointX(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::write_SetPointX(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevDouble w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(Agilent4uhv::write_SetPointX) ENABLED START -----*/ + + check_init_error(); + + int indexn; + convert(attr.get_name().substr(attr.get_name().size()-1), indexn); + + string newvalue; + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + char buffer[ALPHANUMERIC_LENGTH_IPCMINI+1]; + int len = snprintf(buffer, ALPHANUMERIC_LENGTH_IPCMINI+1, "% *.1E", ALPHANUMERIC_LENGTH_IPCMINI, w_val); + newvalue = string(buffer, len); + } else { + char buffer[ALPHANUMERIC_LENGTH_4UHV+1]; + int len = snprintf(buffer, ALPHANUMERIC_LENGTH_4UHV+1, "% *.1E", ALPHANUMERIC_LENGTH_4UHV, w_val); + newvalue = string(buffer, len); + } + + switch (indexn) + { + case 1: + write("615", newvalue); + break; + case 2: + write("625", newvalue); + break; + case 3: + write("635", newvalue); + break; + case 4: + write("645", newvalue); + break; + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_SetPointX +} +//-------------------------------------------------------- +/** + * Read attribute TemperatureHVX related method + * Description: + * + * Data type: Tango::DevFloat + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_TemperatureHVX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_TemperatureHVX(Tango::Attribute &attr) entering... " << endl; + Tango::DevFloat *att_value = get_TemperatureHVX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_TemperatureHVX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_TemperatureHVX +} +//-------------------------------------------------------- +/** + * Read attribute VoltageX related method + * Description: + * + * Data type: Tango::DevDouble + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_VoltageX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_VoltageX(Tango::Attribute &attr) entering... " << endl; + Tango::DevDouble *att_value = get_VoltageX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_VoltageX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_VoltageX +} +//-------------------------------------------------------- +/** + * Read attribute CurrentX related method + * Description: + * + * Data type: Tango::DevDouble + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_CurrentX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_CurrentX(Tango::Attribute &attr) entering... " << endl; + Tango::DevDouble *att_value = get_CurrentX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_CurrentX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_CurrentX +} +//-------------------------------------------------------- +/** + * Read attribute PressureX related method + * Description: + * + * Data type: Tango::DevDouble + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_PressureX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_PressureX(Tango::Attribute &attr) entering... " << endl; + Tango::DevDouble *att_value = get_PressureX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_PressureX) ENABLED START -----*/ + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_PressureX +} +//-------------------------------------------------------- +/** + * Read attribute StateX related method + * Description: + * + * Data type: Tango::DevState + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_StateX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_StateX(Tango::Attribute &attr) entering... " << endl; + Tango::DevState *att_value = get_StateX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_StateX) ENABLED START -----*/ + // Set the attribute value + + string indexs = attr.get_name().substr(attr.get_name().size()-1); + int indexn; + convert(indexs, indexn); + + if (errorcode[indexn-1] != 0) { + *att_value = Tango::FAULT; + } else { + *att_value = HVX_data["HV" + indexs]; + } + + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_StateX +} +//-------------------------------------------------------- +/** + * Read attribute StatusX related method + * Description: + * + * Data type: Tango::DevString + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_StatusX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_StatusX(Tango::Attribute &attr) entering... " << endl; + Tango::DevString *att_value = get_StatusX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_StatusX) ENABLED START -----*/ + // Set the attribute value + + string indexs = attr.get_name().substr(attr.get_name().size()-1); + int indexn; + convert(attr.get_name().substr(attr.get_name().size()-1), indexn); + + string status; + if (HVX_data["HV" + indexs] == Tango::ON) + status = "The device is in ON state"; + else + status = "The device is in OFF state"; + + int err = errorcode[indexn-1]; + if (err != 0) + { + status = ""; + + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + if (err & 0x4) + status += "Over Temperature "; + if (err & 0x20) + status += "Interlock cable "; + if (err & 0x40) + status += "ShortCircuit "; + if (err & 0x80) + status += "Protect "; + } else { + if (err & 0x1) + status += "FAN error "; + if (err & 0x2) + status += "Power input error from HV "; + if (err & 0x4) + status += "Power input error from PFC "; + if (err & 0x8) + status += "Overtemp PFC "; + if (err & 0x10) + status += "Error communication CPU-HV "; + if (err & 0x20) + status += "Interlock cable "; + if (err & 0x40) + status += "Overtemp HV "; + if (err & 0x80) + status += "Protect "; + if (err & 0x100) + status += "Measurement error "; + if (err & 0x200) + status += "HV out error "; + if (err & 0x400) + status += "Short circuit "; + if (err & 0x800) + status += "HV disabled "; + } + + } + + if (*att_value != NULL) + CORBA::string_free(*att_value); + *att_value = CORBA::string_dup(status.c_str()); + + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_StatusX +} +//-------------------------------------------------------- +/** + * Read attribute ProtectX related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_ProtectX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_ProtectX(Tango::Attribute &attr) entering... " << endl; + Tango::DevBoolean *att_value = get_ProtectX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_ProtectX) ENABLED START -----*/ + // Set the attribute value + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_ProtectX +} +//-------------------------------------------------------- +/** + * Write attribute ProtectX related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::write_ProtectX(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::write_ProtectX(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevBoolean w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(Agilent4uhv::write_ProtectX) ENABLED START -----*/ + + check_init_error(); + + int indexn; + convert(attr.get_name().substr(attr.get_name().size()-1), indexn); + + string newvalue; + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + if (w_val) + newvalue = "1"; + else + newvalue = "0"; + } else { + read_Protect(); + newvalue = "0000000000"; + for(int i=1; i<5; ++i) { + if (i == indexn) { + if (w_val) + newvalue[10-i] = '1'; + else + newvalue[10-i] = '0'; + } else { + stringstream ss; + ss << i; + if (ProtectX_data["Protect" + ss.str()]) + newvalue[10-i] = '1'; + else + newvalue[10-i] = '0'; + } + } + } + + write("602", newvalue); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_ProtectX +} +//-------------------------------------------------------- +/** + * Read attribute FixedStepX related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_FixedStepX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_FixedStepX(Tango::Attribute &attr) entering... " << endl; + Tango::DevBoolean *att_value = get_FixedStepX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_FixedStepX) ENABLED START -----*/ + // Set the attribute value + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_FixedStepX +} +//-------------------------------------------------------- +/** + * Write attribute FixedStepX related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::write_FixedStepX(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::write_FixedStepX(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevBoolean w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(Agilent4uhv::write_FixedStepX) ENABLED START -----*/ + + check_init_error(); + + int indexn; + convert(attr.get_name().substr(attr.get_name().size()-1), indexn); + + string newvalue; + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + if (w_val) + newvalue = "1"; + else + newvalue = "0"; + } else { + read_FixedStep(); + newvalue = "0000000000"; + for(int i=1; i<5; ++i) { + if (i == indexn) { + if (w_val) + newvalue[10-i] = '1'; + else + newvalue[10-i] = '0'; + } else { + stringstream ss; + ss << i; + if (FixedStepX_data["Fixed" + ss.str()]) + newvalue[10-i] = '1'; + else + newvalue[10-i] = '0'; + } + } + } + + write("603", newvalue); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_FixedStepX +} +//-------------------------------------------------------- +/** + * Read attribute StatusSetPointX related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_StatusSetPointX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_StatusSetPointX(Tango::Attribute &attr) entering... " << endl; + Tango::DevBoolean *att_value = get_StatusSetPointX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_StatusSetPointX) ENABLED START -----*/ + // Set the attribute value + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_StatusSetPointX +} +//-------------------------------------------------------- +/** + * Read attribute StatMaskX related method + * Description: + * + * Data type: Tango::DevLong + * Attr type: Scalar + */ +//-------------------------------------------------------- +void Agilent4uhv::read_StatMaskX(Tango::Attribute &attr) +{ + DEBUG_STREAM << "Agilent4uhv::read_StatMaskX(Tango::Attribute &attr) entering... " << endl; + Tango::DevLong *att_value = get_StatMaskX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_StatMaskX) ENABLED START -----*/ + // Set the attribute value + + string indexs = attr.get_name().substr(attr.get_name().size()-1); + int indexn; + convert(indexs, indexn); + + *att_value = 0; + + if (HVX_data["HV" + indexs]) + *att_value |= 0x1; + + // FIXME How provides locale/remote bit (1)? + *att_value |= 0x1 << 1; + + if (errorcode[indexn-1] != 0) + *att_value |= 0x1 << 2; + + if (FixedStepX_data["Fixed" + indexs] == true) + *att_value |= 0x1 << 3; + + // FIXME bit 4,5,6 and 7 aren't implemented + + attr.set_value(att_value); + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_StatMaskX +} +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::add_dynamic_attributes() + * Description : Create the dynamic attributes if any + * for specified device. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_dynamic_attributes() +{ + // Example to add dynamic attribute: + // Copy inside the following protected area to create instance(s) at startup. + // add_HVX_dynamic_attribute("MyHVXAttribute"); + // add_DeviceNumberX_dynamic_attribute("MyDeviceNumberXAttribute"); + // add_PowerMaxX_dynamic_attribute("MyPowerMaxXAttribute"); + // add_VTargetX_dynamic_attribute("MyVTargetXAttribute"); + // add_IProtectX_dynamic_attribute("MyIProtectXAttribute"); + // add_SetPointX_dynamic_attribute("MySetPointXAttribute"); + // add_TemperatureHVX_dynamic_attribute("MyTemperatureHVXAttribute"); + // add_VoltageX_dynamic_attribute("MyVoltageXAttribute"); + // add_CurrentX_dynamic_attribute("MyCurrentXAttribute"); + // add_PressureX_dynamic_attribute("MyPressureXAttribute"); + // add_StateX_dynamic_attribute("MyStateXAttribute"); + // add_StatusX_dynamic_attribute("MyStatusXAttribute"); + // add_ProtectX_dynamic_attribute("MyProtectXAttribute"); + // add_FixedStepX_dynamic_attribute("MyFixedStepXAttribute"); + // add_StatusSetPointX_dynamic_attribute("MyStatusSetPointXAttribute"); + // add_StatMaskX_dynamic_attribute("MyStatMaskXAttribute"); + + /*----- PROTECTED REGION ID(Agilent4uhv::add_dynamic_attributes) ENABLED START -----*/ + + // Add your own code to create and add dynamic attributes if any + for (unsigned short i=1; i <= nchannel; ++i) + { + stringstream ssname; + string sname; + + if (odd_channel_quirk && i > 1) + ++i; + ssname.str(""); ssname.clear(); + ssname << "HV" << i << flush; + sname = ssname.str(); + add_HVX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "DeviceNumber" << i << flush; + sname = ssname.str(); + add_DeviceNumberX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "PowerMax" << i << flush; + sname = ssname.str(); + add_PowerMaxX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "VTarget" << i << flush; + sname = ssname.str(); + add_VTargetX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "IProtect" << i << flush; + sname = ssname.str(); + add_IProtectX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "SetPoint" << i << flush; + sname = ssname.str(); + add_SetPointX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "TemperatureHV" << i << flush; + sname = ssname.str(); + add_TemperatureHVX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "Voltage" << i << flush; + sname = ssname.str(); + add_VoltageX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "Current" << i << flush; + sname = ssname.str(); + add_CurrentX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "Pressure" << i << flush; + sname = ssname.str(); + add_PressureX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "State" << i << flush; + sname = ssname.str(); + add_StateX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "Status" << i << flush; + sname = ssname.str(); + add_StatusX_dynamic_attribute(sname); + Tango::DevString *att_value = get_StatusX_data_ptr(sname); + *att_value = NULL; + + ssname.str(""); ssname.clear(); + ssname << "Protect" << i << flush; + sname = ssname.str(); + add_ProtectX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "Fixed" << i << flush; + sname = ssname.str(); + add_FixedStepX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "StatusSetPoint" << i << flush; + sname = ssname.str(); + add_StatusSetPointX_dynamic_attribute(sname); + + ssname.str(""); ssname.clear(); + ssname << "StatMask" << i << flush; + sname = ssname.str(); + add_StatMaskX_dynamic_attribute(sname); + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::add_dynamic_attributes +} + +//-------------------------------------------------------- +/** + * Command OnHVX related method + * Description: + * + */ +//-------------------------------------------------------- +void Agilent4uhv::on_hvx(Tango::Command &command) +{ + DEBUG_STREAM << "Agilent4uhv::" << command.get_name() << " - " << device_name << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::on_hvx) ENABLED START -----*/ + + // Add your own code + check_init_error(); + + int indexn; + convert(command.get_name().substr(command.get_name().size()-1), indexn); + + bool new_state = true; + switch(indexn) { + case 1: + write("011", new_state); + break; + case 2: + write("012", new_state); + break; + case 3: + write("013", new_state); + break; + case 4: + write("014", new_state); + break; + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::on_hvx +} +//-------------------------------------------------------- +/** + * Command OffHVX related method + * Description: + * + */ +//-------------------------------------------------------- +void Agilent4uhv::off_hvx(Tango::Command &command) +{ + DEBUG_STREAM << "Agilent4uhv::" << command.get_name() << " - " << device_name << endl; + /*----- PROTECTED REGION ID(Agilent4uhv::off_hvx) ENABLED START -----*/ + + // Add your own code + check_init_error(); + + int indexn; + convert(command.get_name().substr(command.get_name().size()-1), indexn); + + bool new_state = false; + switch(indexn) { + case 1: + write("011", new_state); + break; + case 2: + write("012", new_state); + break; + case 3: + write("013", new_state); + break; + case 4: + write("014", new_state); + break; + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::off_hvx +} +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::add_dynamic_commands() + * Description : Create the dynamic commands if any + * for specified device. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_dynamic_commands() +{ + // Example to add dynamic command: + // Copy inside the folowing protected area to instanciate at startup. + // add_OnHVX_dynamic_command("MyOnHVXCommand", true); + // add_OffHVX_dynamic_command("MyOffHVXCommand", true); + + /*----- PROTECTED REGION ID(Agilent4uhv::add_dynamic_commands) ENABLED START -----*/ + + // Add your own code to create and add dynamic commands if any + for (unsigned short i=1; i <= nchannel; ++i) { + if (odd_channel_quirk && i > 1) + ++i; + + stringstream ss; + ss << i; + add_OnHVX_dynamic_command("OnHV" + ss.str(), true); + add_OffHVX_dynamic_command("OffHV" + ss.str(), true); + } + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::add_dynamic_commands +} + +/*----- PROTECTED REGION ID(Agilent4uhv::namespace_ending) ENABLED START -----*/ + +// Additional Methods +#define CRC_LENGTH 2 + +#define READ_WINDOW 0x30 +#define WRITE_WINDOW 0x31 + +struct MessageHeader { + unsigned char stx; + unsigned char addr; + char win[WIN_LENGTH]; + unsigned char com; +}; + +struct MessageFooter { + unsigned char etx; + unsigned char crc[CRC_LENGTH]; +}; + +struct ResponseHeader { + unsigned char stx; + unsigned char addr; + unsigned char ack; +}; + + +void Agilent4uhv::write_message(const char window[WIN_LENGTH], + const unsigned char com, const char * const data, + const size_t data_length) +{ + vector<unsigned char> message(sizeof(MessageHeader) + + data_length + sizeof(MessageFooter)); + + MessageHeader *header = (MessageHeader*)&message[0]; + MessageFooter *footer = (MessageFooter*)(&message[0] + + sizeof(MessageHeader) + data_length); + + header->stx = 0x02; + header->addr = 0x80; + memcpy(header->win, window, WIN_LENGTH); + header->com = com; + + memcpy(&message[0] + sizeof(MessageHeader), + data, data_length); + + footer->etx = 0x03; + + char crc_with_term[CRC_LENGTH+1]; + snprintf(crc_with_term, CRC_LENGTH+1, "%02X", + calc_crc(&message[1] /* Skip STX */, + sizeof(MessageHeader) + data_length)); + memcpy(footer->crc, crc_with_term, CRC_LENGTH); + + Serial2Client::write(message); +} + +string Agilent4uhv::read_answer() +{ + vector<unsigned char> answer, crc; + size_t data_length; + string ret; + + Serial2Client::read_until(0x03, answer); + Serial2Client::read(2, crc); + + data_length = answer.size() - sizeof(MessageHeader) - 1 /* Skip ETX */; + + char expected_crc[CRC_LENGTH+1]; + snprintf(expected_crc, CRC_LENGTH+1, "%02X", + calc_crc(&answer[1] /* Skip STX */, + answer.size()-1 /* Skip ETX */)); + + if(memcmp(&crc[0], expected_crc, CRC_LENGTH) != 0) { + attr_CRCErrors_read[0]++; + Tango::Except::throw_exception( "", + "CRC check failed", + "Agilent4uhv::read_answer()"); + } + + if (answer.size() == 4) { + ResponseHeader *header = (ResponseHeader*)&answer[0]; + + string err_mesg; + switch ((int)header->ack) + { + case 0x06: /* ACK */ + break; + case 0x15: /* NACK */ + err_mesg = "Execution of the command has failed"; + break; + case 0x32: /* Unknown Window */ + err_mesg = "The window specified in the command" + " is not a valid window"; + break; + case 0x33: /* Data Type Error */ + err_mesg = "The data type specified in the command" + " (Logic, Numeric or Alphanumeric) is not" + " in agreement with the Window specified"; + break; + case 0x35: /* Win Disabled */ + err_mesg = "The window specified is Read Only or" + " is temporarily disabled"; + break; + default: + // "Out of Range" perhaps? + err_mesg = "Unknown error"; + break; + } + + if (! err_mesg.empty()) + Tango::Except::throw_exception( "", + err_mesg, + "Agilent4uhv::read_answer()"); + } else { + ret = string((char*)(&answer[0] + sizeof(MessageHeader)), data_length); + } + return ret; +} + +string Agilent4uhv::read(const char window[WIN_LENGTH]) +{ + omni_mutex_lock l(io_mutex); + try { + write_message(window, READ_WINDOW, NULL, 0); + return read_answer(); + } catch(...) { + throw; + } +} + +void Agilent4uhv::write(const char window[WIN_LENGTH], const char * const data, + const size_t data_length) +{ + omni_mutex_lock l(io_mutex); + try { + write_message(window, WRITE_WINDOW, data, data_length); + (void)read_answer(); + } catch(...) { + throw; + } +} + +int Agilent4uhv::calc_crc(unsigned char *contents, size_t count) +{ + int ret = 0; + for (size_t i = 0; i < count; ++i) + ret ^= contents[i]; + return ret; +} + +void Agilent4uhv::check_init_error(void) +{ + if (! init_error.empty()) + Tango::Except::throw_exception( "", + init_error.c_str(), + "Agilent4uhv::check_init_error()"); +} + +void Agilent4uhv::read(const char window[WIN_LENGTH], string &data) { + data = read(window); +} + +void Agilent4uhv::read(const char window[WIN_LENGTH], bool &data) { + string tmp = read(window); + convert(tmp, data); +} + +void Agilent4uhv::read(const char window[WIN_LENGTH], int &data) { + string tmp = read(window); + convert(tmp, data); +} + +void Agilent4uhv::write(const char window[WIN_LENGTH], const string &data) { + if (strcmp(attr_Model_read[0], "X3602-64010") == 0) { + write(window, data.c_str(), ALPHANUMERIC_LENGTH_IPCMINI > data.size()? + data.size() : ALPHANUMERIC_LENGTH_IPCMINI); + } else { + write(window, data.c_str(), ALPHANUMERIC_LENGTH_4UHV > data.size()? + data.size() : ALPHANUMERIC_LENGTH_4UHV); + } +} + +void Agilent4uhv::write(const char window[WIN_LENGTH], const bool data) { + char data_[LOGIC_LENGTH+1]; + snprintf(data_, LOGIC_LENGTH+1, "%0*d", LOGIC_LENGTH, data); + write(window, data_, LOGIC_LENGTH); +} + +void Agilent4uhv::write(const char window[WIN_LENGTH], const int data) { + char data_[NUMERIC_LENGTH+1]; + snprintf(data_, NUMERIC_LENGTH+1, "%0*d", NUMERIC_LENGTH, data); + write(window, data_, NUMERIC_LENGTH); +} + +void Agilent4uhv::read_Status() { + int val; + read("205", val); + + if (val == 0) { + set_state(Tango::ON); + set_status("The device is in ON state"); + } else { + set_state(Tango::FAULT); + set_status("The device is in FAULT state"); + } +} + +void Agilent4uhv::read_Model() { + string val; + read("319", val); + strncpy(attr_Model_read[0], val.c_str(), + MAX_DEVSTRING_LENGTH > val.size()? + val.size() : MAX_DEVSTRING_LENGTH); +} + +void Agilent4uhv::read_PowerMaxCh1() { + int val; + read("612", val); + PowerMaxX_data["PowerMax1"] = val; +} + +void Agilent4uhv::read_PowerMaxCh2() { + int val; + read("622", val); + PowerMaxX_data["PowerMax2"] = val; +} + +void Agilent4uhv::read_PowerMaxCh3() { + int val; + read("632", val); + PowerMaxX_data["PowerMax3"] = val; +} + +void Agilent4uhv::read_PowerMaxCh4() { + int val; + read("642", val); + PowerMaxX_data["PowerMax4"] = val; +} + +void Agilent4uhv::read_PressureCh1() { + string val; + read("812", val); + double val2; + convert(val, val2); + PressureX_data["Pressure1"] = val2; +} + +void Agilent4uhv::read_PressureCh2() { + string val; + read("822", val); + double val2; + convert(val, val2); + PressureX_data["Pressure2"] = val2; +} + +void Agilent4uhv::read_PressureCh3() { + string val; + read("832", val); + double val2; + convert(val, val2); + PressureX_data["Pressure3"] = val2; +} + +void Agilent4uhv::read_PressureCh4() { + string val; + read("842", val); + double val2; + convert(val, val2); + PressureX_data["Pressure4"] = val2; +} + +void Agilent4uhv::read_HVCh1() { + bool val; + read("011", val); + + if (val) + HVX_data["HV1"] = Tango::ON; + else + HVX_data["HV1"] = Tango::OFF; +} + +void Agilent4uhv::read_HVCh2() { + bool val; + read("012", val); + + if (val) + HVX_data["HV2"] = Tango::ON; + else + HVX_data["HV2"] = Tango::OFF; +} + +void Agilent4uhv::read_HVCh3() { + bool val; + read("013", val); + + if (val) + HVX_data["HV3"] = Tango::ON; + else + HVX_data["HV3"] = Tango::OFF; +} + +void Agilent4uhv::read_HVCh4() { + bool val; + read("014", val); + + if (val) + HVX_data["HV4"] = Tango::ON; + else + HVX_data["HV4"] = Tango::OFF; +} + +void Agilent4uhv::read_ErrorCodeCh1() { + int val; + if (nchannel > 1) + write("505", 1); + read("206", val); + errorcode[0] = val; +} + +void Agilent4uhv::read_ErrorCodeCh2() { + int val; + write("505", 2); + read("206", val); + errorcode[1] = val; +} + +void Agilent4uhv::read_ErrorCodeCh3() { + int val; + write("505", 3); + read("206", val); + errorcode[2] = val; +} + +void Agilent4uhv::read_ErrorCodeCh4() { + int val; + write("505", 4); + read("206", val); + errorcode[3] = val; +} + +void Agilent4uhv::read_SerialNumber() { + string val; + read("323", val); + strncpy(attr_SerialNumber_read[0], val.c_str(), + MAX_DEVSTRING_LENGTH > val.size()? + val.size() : MAX_DEVSTRING_LENGTH); +} + +void Agilent4uhv::read_FixedStep() { + string val; + read("603", val); + + if (val.size() == 1) { + if (val[0] == '0') { + FixedStepX_data["Fixed1"] = false; + } else { + FixedStepX_data["Fixed1"] = true; + } + } else { + int j = 1; + for (int i = val.size(); i > ((int)val.size() - 4) /* Max channels */; --i) { + stringstream ss; + ss << j++; + if (val[i-1] == '0') { + FixedStepX_data["Fixed" + ss.str()] = false; + } else { + FixedStepX_data["Fixed" + ss.str()] = true; + } + } + } +} + +void Agilent4uhv::read_AutoStart() { + string val; + read("601", val); + + if (val[val.size()-1] == '1') { + attr_AutoStart_read[0] = true; + } else { + attr_AutoStart_read[0] = false; + } +} + +void Agilent4uhv::read_Protect() { + string val; + read("602", val); + + if (val.size() == 1) { + if (val[0] == '0') { + ProtectX_data["Protect1"] = false; + } else { + ProtectX_data["Protect1"] = true; + } + } else { + int j = 1; + for (int i = val.size(); i > ((int)val.size() - 4) /* Max channels */; --i) { + stringstream ss; + ss << j++; + if (val[i-1] == '0') { + ProtectX_data["Protect" + ss.str()] = false; + } else { + ProtectX_data["Protect" + ss.str()] = true; + } + } + } +} + +void Agilent4uhv::read_StatusSetPoint() { + string val; + read("804", val); + + if (val.size() == 1) { + if (val[0] == '0') { + StatusSetPointX_data["StatusSetPoint1"] = false; + } else { + StatusSetPointX_data["StatusSetPoint1"] = true; + } + } else { + int j = 1; + for (int i = val.size(); i > ((int)val.size() - 4) /* Max channels */; --i) { + stringstream ss; + ss << j++; + if (val[i-1] == '0') { + StatusSetPointX_data["StatusSetPoint" + ss.str()] = false; + } else { + StatusSetPointX_data["StatusSetPoint" + ss.str()] = true; + } + } + } +} + +void Agilent4uhv::read_DeviceNumberCh1() { + int val; + read("610", val); + DeviceNumberX_data["DeviceNumber1"] = val; +} + +void Agilent4uhv::read_DeviceNumberCh2() { + int val; + read("620", val); + DeviceNumberX_data["DeviceNumber2"] = val; +} + +void Agilent4uhv::read_DeviceNumberCh3() { + int val; + read("630", val); + DeviceNumberX_data["DeviceNumber3"] = val; +} + +void Agilent4uhv::read_DeviceNumberCh4() { + int val; + read("640", val); + DeviceNumberX_data["DeviceNumber4"] = val; +} + +void Agilent4uhv::read_VTargetCh1() { + int val; + read("613", val); + VTargetX_data["VTarget1"] = val / 1000; +} + +void Agilent4uhv::read_VTargetCh2() { + int val; + read("623", val); + VTargetX_data["VTarget2"] = val / 1000; +} + +void Agilent4uhv::read_VTargetCh3() { + int val; + read("633", val); + VTargetX_data["VTarget3"] = val / 1000; +} + +void Agilent4uhv::read_VTargetCh4() { + int val; + read("643", val); + VTargetX_data["VTarget4"] = val / 1000; +} + +void Agilent4uhv::read_IProtectCh1() { + int val; + read("614", val); + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + IProtectX_data["IProtect1"] = val / 1000; + } else { + IProtectX_data["IProtect1"] = val; + } +} + +void Agilent4uhv::read_IProtectCh2() { + int val; + read("624", val); + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + IProtectX_data["IProtect2"] = val / 1000; + } else { + IProtectX_data["IProtect2"] = val; + } +} + +void Agilent4uhv::read_IProtectCh3() { + int val; + read("634", val); + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + IProtectX_data["IProtect3"] = val / 1000; + } else { + IProtectX_data["IProtect3"] = val; + } +} + +void Agilent4uhv::read_IProtectCh4() { + int val; + read("644", val); + if (strncmp(attr_Model_read[0], "X3602-64010", 11) == 0) { + IProtectX_data["IProtect4"] = val / 1000; + } else { + IProtectX_data["IProtect4"] = val; + } +} + +void Agilent4uhv::read_SetPointCh1() { + string val; + read("615", val); + convert(val, SetPointX_data["SetPoint1"]); +} + +void Agilent4uhv::read_SetPointCh2() { + string val; + read("625", val); + convert(val, SetPointX_data["SetPoint2"]); +} + +void Agilent4uhv::read_SetPointCh3() { + string val; + read("635", val); + convert(val, SetPointX_data["SetPoint3"]); +} + +void Agilent4uhv::read_SetPointCh4() { + string val; + read("645", val); + convert(val, SetPointX_data["SetPoint4"]); +} + +void Agilent4uhv::read_Temperature() { + int val; + read("800", val); + attr_Temperature_read[0] = val; +} + +void Agilent4uhv::read_TemperatureCh1() { + int val; + read("801", val); + TemperatureHVX_data["TemperatureHV1"] = val; +} + +void Agilent4uhv::read_TemperatureCh2() { + int val; + read("802", val); + TemperatureHVX_data["TemperatureHV2"] = val; +} + +void Agilent4uhv::read_TemperatureCh3() { + int val; + read("808", val); + TemperatureHVX_data["TemperatureHV3"] = val; +} + +void Agilent4uhv::read_TemperatureCh4() { + int val; + read("809", val); + TemperatureHVX_data["TemperatureHV4"] = val; +} + +void Agilent4uhv::read_IMeasuredCh1() { + string val; + read("811", val); + convert(val, CurrentX_data["Current1"]); +} + +void Agilent4uhv::read_IMeasuredCh2() { + string val; + read("821", val); + convert(val, CurrentX_data["Current2"]); +} + +void Agilent4uhv::read_IMeasuredCh3() { + string val; + read("831", val); + convert(val, CurrentX_data["Current3"]); +} + +void Agilent4uhv::read_IMeasuredCh4() { + string val; + read("841", val); + convert(val, CurrentX_data["Current4"]); +} + +void Agilent4uhv::read_VMeasuredCh1() { + int val; + read("810", val); + VoltageX_data["Voltage1"] = val; +} + +void Agilent4uhv::read_VMeasuredCh2() { + int val; + read("820", val); + VoltageX_data["Voltage2"] = val; +} + +void Agilent4uhv::read_VMeasuredCh3() { + int val; + read("830", val); + VoltageX_data["Voltage3"] = val; +} + +void Agilent4uhv::read_VMeasuredCh4() { + int val; + read("840", val); + VoltageX_data["Voltage4"] = val; +} + +void* Agilent4uhvWorker::run_undetached(void * /*ptr*/) +{ + DEBUG_STREAM << "Agilent4uhvWorker::run_undetached() - enter" << endl; + + string error; + vector<ptrFunction>::iterator norm_it = device->norm_ops.begin(); + vector<ptrFunction>::iterator prio_it = device->prio_ops.begin(); + + while(cont) { + try { + error.clear(); + + // Retrieve priority data + (device->*(*prio_it))(); + if(++prio_it == device->prio_ops.end()) + prio_it = device->prio_ops.begin(); + + // A chance to exit from while loop + if(! cont) + break; + + usleep(device->pollingPause * 1000); + + // A chance to exit from while loop + if(! cont) + break; + + // Retrieve normal data + (device->*(*norm_it))(); + if(++norm_it == device->norm_ops.end()) + norm_it = device->norm_ops.begin(); + + // A chance to exit from while loop + if(! cont) + break; + + usleep(device->pollingPause * 1000); + } catch(Tango::DevFailed &e) { + error = string(e.errors[0].desc); + } catch(...) { + error = "Unknown error"; + } + + if(! error.empty()) { + ERROR_STREAM << error << endl; + device->set_state(Tango::UNKNOWN); + device->set_status(error); + assert(false); + } + + usleep(device->pollingPeriod * 1000); + } + + DEBUG_STREAM << "Agilent4uhvWorker::run_undetached() - exit" << endl; + + return NULL; +} + +/*----- PROTECTED REGION END -----*/ // Agilent4uhv::namespace_ending +} // namespace diff --git a/src/Agilent4uhv.h b/src/Agilent4uhv.h new file mode 100644 index 0000000000000000000000000000000000000000..f2bd6bddc3757558cd5a7f6c0a8a90ad6c60d872 --- /dev/null +++ b/src/Agilent4uhv.h @@ -0,0 +1,634 @@ +/*----- 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(); + 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 { + Agilent4uhv *device; + void* run_undetached(void*); + bool cont; +public: + Agilent4uhvWorker(Agilent4uhv *device_) : + LogAdapter((Tango::DeviceImpl*)device_), + device(device_), cont(false) {} + + void start() { + cont = true; + start_undetached(); + } + + void stop() { + cont = false; + } +}; + +/*----- PROTECTED REGION END -----*/ // Agilent4uhv::Additional Classes Definitions + +} // End of namespace + +#endif // Agilent4uhv_H diff --git a/src/Agilent4uhv.xmi b/src/Agilent4uhv.xmi new file mode 100644 index 0000000000000000000000000000000000000000..7d2682699abdfedf7654d341d6e59195a0e5d8ef --- /dev/null +++ b/src/Agilent4uhv.xmi @@ -0,0 +1,272 @@ +<?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="Agilent4uhv" pogoRevision="9.4"> + <description description="" title="" sourcePath="/home/alessio/Sources/cvs-trees/fermi/servers/4uhv/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> + <inheritances classname="Device_Impl" sourcePath=""/> + <inheritances classname="Serial2Client" sourcePath="../../serial2/src"/> + <identification contact="at elettra.eu> - Alessio Igor Bogani <alessio.bogani" author="Alessio Igor Bogani <alessio.bogani" emailDomain="elettra.eu>" classFamily="Vacuum" siteSpecific="" platform="Unix Like" bus="Serial Line" manufacturer="Agilent Technologies" reference="4UHV Ion Pump Controller"/> + </description> + <deviceProperties name="DeviceName" mandatory="true" description=""> + <type xsi:type="pogoDsl:StringType"/> + <status abstract="false" inherited="true" concrete="true"/> + </deviceProperties> + <deviceProperties name="PollingPause" description="Milliseconds between two command issued by internal poller in the same cycle"> + <type xsi:type="pogoDsl:IntType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + <DefaultPropValue>0</DefaultPropValue> + </deviceProperties> + <deviceProperties name="PollingPeriod" description="Milliseconds between two cycle of the internal poller"> + <type xsi:type="pogoDsl:IntType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + <DefaultPropValue>1000</DefaultPropValue> + </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> + <dynamicCommands name="OnHVX" description="" execMethod="on_hvx" displayLevel="OPERATOR" polledPeriod="0" isDynamic="true"> + <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"/> + <excludedStates>UNKNOWN</excludedStates> + </dynamicCommands> + <dynamicCommands name="OffHVX" description="" execMethod="off_hvx" displayLevel="OPERATOR" polledPeriod="0" isDynamic="true"> + <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"/> + <excludedStates>UNKNOWN</excludedStates> + </dynamicCommands> + <attributes name="Model" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:StringType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </attributes> + <attributes name="SerialNumber" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:StringType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </attributes> + <attributes name="Temperature" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:FloatType"/> + <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="C" standardUnit="" displayUnit="" format="" maxValue="200" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </attributes> + <attributes name="CRCErrors" attType="Scalar" rwType="READ" displayLevel="EXPERT" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:IntType"/> + <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="CRC Errors" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </attributes> + <attributes name="AutoStart" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:BooleanType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + <writeExcludedStates>UNKNOWN</writeExcludedStates> + </attributes> + <dynamicAttributes name="HVX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:StateType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="DeviceNumberX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:IntType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + <writeExcludedStates>UNKNOWN</writeExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="PowerMaxX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:UShortType"/> + <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="W" standardUnit="" displayUnit="" format="" maxValue="80" minValue="10" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + <writeExcludedStates>UNKNOWN</writeExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="VTargetX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:UShortType"/> + <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="kV" standardUnit="" displayUnit="" format="" maxValue="7" minValue="3" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + <writeExcludedStates>UNKNOWN</writeExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="IProtectX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:UShortType"/> + <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="mA" standardUnit="" displayUnit="" format="" maxValue="100" minValue="1" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + <writeExcludedStates>UNKNOWN</writeExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="SetPointX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + <writeExcludedStates>UNKNOWN</writeExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="TemperatureHVX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:FloatType"/> + <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="C" standardUnit="" displayUnit="" format="" maxValue="200" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="VoltageX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <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="V" standardUnit="" displayUnit="" format="" maxValue="10000" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="CurrentX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <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="A" standardUnit="" displayUnit="" format="" maxValue="9E-1" minValue="1E-10" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="PressureX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <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="mbar" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="StateX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:StateType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="StatusX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:StringType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="ProtectX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:BooleanType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + <writeExcludedStates>UNKNOWN</writeExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="FixedStepX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:BooleanType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + <writeExcludedStates>UNKNOWN</writeExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="StatusSetPointX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:BooleanType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <dynamicAttributes name="StatMaskX" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dataType xsi:type="pogoDsl:IntType"/> + <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=""/> + <readExcludedStates>UNKNOWN</readExcludedStates> + </dynamicAttributes> + <states name="ON" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <states name="ALARM" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <states name="FAULT" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <states name="UNKNOWN" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> + <preferences docHome="./doc_html" makefileHome="$(TANGO_HOME)"/> + </classes> +</pogoDsl:PogoSystem> diff --git a/src/Agilent4uhvClass.cpp b/src/Agilent4uhvClass.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c2fe0e15988e4021ceb23c4aa3704b35d9c06381 --- /dev/null +++ b/src/Agilent4uhvClass.cpp @@ -0,0 +1,766 @@ +/*----- 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 *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/"; +//============================================================================= +// +// file : Agilent4uhvClass.cpp +// +// description : C++ source for the Agilent4uhvClass. +// A singleton class derived from DeviceClass. +// It implements the command and attribute list +// and all properties and methods required +// by the Agilent4uhv once per process. +// +// 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.6 $ +// $Date: 2019-04-01 09:14:47 $ +// +// $HeadURL: $ +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#include <Agilent4uhvClass.h> + +/*----- PROTECTED REGION END -----*/ // Agilent4uhvClass.cpp + +//------------------------------------------------------------------- +/** + * Create Agilent4uhvClass singleton and + * return it in a C function for Python usage + */ +//------------------------------------------------------------------- +extern "C" { +#ifdef _TG_WINDOWS_ + +__declspec(dllexport) + +#endif + + Tango::DeviceClass *_create_Agilent4uhv_class(const char *name) { + return Agilent4uhv_ns::Agilent4uhvClass::init(name); + } +} + +namespace Agilent4uhv_ns +{ +//=================================================================== +// Initialize pointer for singleton pattern +//=================================================================== +Agilent4uhvClass *Agilent4uhvClass::_instance = NULL; + +//-------------------------------------------------------- +/** + * method : Agilent4uhvClass::Agilent4uhvClass(string &s) + * description : constructor for the Agilent4uhvClass + * + * @param s The class name + */ +//-------------------------------------------------------- +Agilent4uhvClass::Agilent4uhvClass(string &s):Serial2Client_ns::Serial2ClientClass(s) +{ + cout2 << "Entering Agilent4uhvClass constructor" << endl; + set_default_property(); + write_class_property(); + + /*----- PROTECTED REGION ID(Agilent4uhvClass::constructor) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::constructor + + cout2 << "Leaving Agilent4uhvClass constructor" << endl; +} + +//-------------------------------------------------------- +/** + * method : Agilent4uhvClass::~Agilent4uhvClass() + * description : destructor for the Agilent4uhvClass + */ +//-------------------------------------------------------- +Agilent4uhvClass::~Agilent4uhvClass() +{ + /*----- PROTECTED REGION ID(Agilent4uhvClass::destructor) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::destructor + + _instance = NULL; +} + + +//-------------------------------------------------------- +/** + * method : Agilent4uhvClass::init + * description : Create the object if not already done. + * Otherwise, just return a pointer to the object + * + * @param name The class name + */ +//-------------------------------------------------------- +Agilent4uhvClass *Agilent4uhvClass::init(const char *name) +{ + if (_instance == NULL) + { + try + { + string s(name); + _instance = new Agilent4uhvClass(s); + } + catch (bad_alloc &) + { + throw; + } + } + return _instance; +} + +//-------------------------------------------------------- +/** + * method : Agilent4uhvClass::instance + * description : Check if object already created, + * and return a pointer to the object + */ +//-------------------------------------------------------- +Agilent4uhvClass *Agilent4uhvClass::instance() +{ + if (_instance == NULL) + { + cerr << "Class is not initialised !!" << endl; + exit(-1); + } + return _instance; +} + + + +//=================================================================== +// Command execution method calls +//=================================================================== +//-------------------------------------------------------- +/** + * method : OnHVXClass::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 *OnHVXClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any)) +{ + cout2 << "OnHVXClass::execute(): arrived" << endl; + ((static_cast<Agilent4uhv *>(device))->on_hvx(*this)); + return new CORBA::Any(); +} + +//-------------------------------------------------------- +/** + * method : OffHVXClass::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 *OffHVXClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any)) +{ + cout2 << "OffHVXClass::execute(): arrived" << endl; + ((static_cast<Agilent4uhv *>(device))->off_hvx(*this)); + return new CORBA::Any(); +} + + +//=================================================================== +// Properties management +//=================================================================== +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::get_class_property() + * Description : Get the class property for specified name. + */ +//-------------------------------------------------------- +Tango::DbDatum Agilent4uhvClass::get_class_property(string &prop_name) +{ + for (unsigned int i=0 ; i<cl_prop.size() ; i++) + if (cl_prop[i].name == prop_name) + return cl_prop[i]; + // if not found, returns an empty DbDatum + return Tango::DbDatum(prop_name); +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::get_default_device_property() + * Description : Return the default value for device property. + */ +//-------------------------------------------------------- +Tango::DbDatum Agilent4uhvClass::get_default_device_property(string &prop_name) +{ + for (unsigned int i=0 ; i<dev_def_prop.size() ; i++) + if (dev_def_prop[i].name == prop_name) + return dev_def_prop[i]; + // if not found, return an empty DbDatum + return Tango::DbDatum(prop_name); +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::get_default_class_property() + * Description : Return the default value for class property. + */ +//-------------------------------------------------------- +Tango::DbDatum Agilent4uhvClass::get_default_class_property(string &prop_name) +{ + for (unsigned int i=0 ; i<cl_def_prop.size() ; i++) + if (cl_def_prop[i].name == prop_name) + return cl_def_prop[i]; + // if not found, return an empty DbDatum + return Tango::DbDatum(prop_name); +} + + +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::set_default_property() + * Description : Set default property (class and device) for wizard. + * For each property, add to wizard property name and description. + * If default value has been set, add it to wizard property and + * store it in a DbDatum. + */ +//-------------------------------------------------------- +void Agilent4uhvClass::set_default_property() +{ + string prop_name; + string prop_desc; + string prop_def; + vector<string> vect_data; + + // Set Default Class Properties + + // Set Default device Properties + prop_name = "PollingPause"; + prop_desc = "Milliseconds between two command issued by internal poller in the same cycle"; + prop_def = "0"; + vect_data.clear(); + vect_data.push_back("0"); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + prop_name = "PollingPeriod"; + prop_desc = "Milliseconds between two cycle of the internal poller"; + prop_def = "1000"; + vect_data.clear(); + vect_data.push_back("1000"); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::write_class_property() + * Description : Set class description fields as property in database + */ +//-------------------------------------------------------- +void Agilent4uhvClass::write_class_property() +{ + // First time, check if database used + if (Tango::Util::_UseDb == false) + return; + + Tango::DbData data; + string classname = get_name(); + string header; + string::size_type start, end; + + // Put title + Tango::DbDatum title("ProjectTitle"); + string str_title(""); + title << str_title; + data.push_back(title); + + // Put Description + Tango::DbDatum description("Description"); + vector<string> str_desc; + str_desc.push_back(""); + description << str_desc; + data.push_back(description); + + // put cvs or svn location + string filename("Agilent4uhv"); + filename += "Class.cpp"; + + // check for cvs information + string src_path(CvsPath); + start = src_path.find("/"); + if (start!=string::npos) + { + end = src_path.find(filename); + if (end>start) + { + string strloc = src_path.substr(start, end-start); + // Check if specific repository + start = strloc.find("/cvsroot/"); + if (start!=string::npos && start>0) + { + string repository = strloc.substr(0, start); + if (repository.find("/segfs/")!=string::npos) + strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); + } + Tango::DbDatum cvs_loc("cvs_location"); + cvs_loc << strloc; + data.push_back(cvs_loc); + } + } + + // check for svn information + else + { + string src_path(SvnPath); + start = src_path.find("://"); + if (start!=string::npos) + { + end = src_path.find(filename); + if (end>start) + { + header = "$HeadURL: "; + start = header.length(); + string strloc = src_path.substr(start, (end-start)); + + Tango::DbDatum svn_loc("svn_location"); + svn_loc << strloc; + data.push_back(svn_loc); + } + } + } + + // Get CVS or SVN revision tag + + // CVS tag + string tagname(TagName); + header = "$Name: "; + start = header.length(); + string endstr(" $"); + + end = tagname.find(endstr); + if (end!=string::npos && end>start) + { + string strtag = tagname.substr(start, end-start); + Tango::DbDatum cvs_tag("cvs_tag"); + cvs_tag << strtag; + data.push_back(cvs_tag); + } + + // SVN tag + string svnpath(SvnPath); + header = "$HeadURL: "; + start = header.length(); + + end = svnpath.find(endstr); + if (end!=string::npos && end>start) + { + string strloc = svnpath.substr(start, end-start); + + string tagstr ("/tags/"); + start = strloc.find(tagstr); + if ( start!=string::npos ) + { + start = start + tagstr.length(); + end = strloc.find(filename); + string strtag = strloc.substr(start, end-start-1); + + Tango::DbDatum svn_tag("svn_tag"); + svn_tag << strtag; + data.push_back(svn_tag); + } + } + + // Get URL location + string httpServ(HttpServer); + if (httpServ.length()>0) + { + Tango::DbDatum db_doc_url("doc_url"); + db_doc_url << httpServ; + data.push_back(db_doc_url); + } + + // Put inheritance + Tango::DbDatum inher_datum("InheritedFrom"); + vector<string> inheritance; + inheritance.push_back("TANGO_BASE_CLASS"); + inher_datum << inheritance; + data.push_back(inher_datum); + + // Call database and and values + get_db_class()->put_property(data); +} + +//=================================================================== +// Factory methods +//=================================================================== + +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::device_factory() + * Description : Create the device object(s) + * and store them in the device list + */ +//-------------------------------------------------------- +void Agilent4uhvClass::device_factory(const Tango::DevVarStringArray *devlist_ptr) +{ + /*----- PROTECTED REGION ID(Agilent4uhvClass::device_factory_before) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::device_factory_before + + // Create devices and add it into the device list + for (unsigned long i=0 ; i<devlist_ptr->length() ; i++) + { + cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl; + device_list.push_back(new Agilent4uhv(this, (*devlist_ptr)[i])); + } + + // Manage dynamic attributes if any + erase_dynamic_attributes(devlist_ptr, get_class_attr()->get_attr_list()); + + // Export devices to the outside world + for (unsigned long i=1 ; i<=devlist_ptr->length() ; i++) + { + // Add dynamic attributes if any + Agilent4uhv *dev = static_cast<Agilent4uhv *>(device_list[device_list.size()-i]); + dev->add_dynamic_attributes(); + dev->add_dynamic_commands(); + + // Check before if database used. + if ((Tango::Util::_UseDb == true) && (Tango::Util::_FileDb == false)) + export_device(dev); + else + export_device(dev, dev->get_name().c_str()); + } + + /*----- PROTECTED REGION ID(Agilent4uhvClass::device_factory_after) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::device_factory_after +} +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::attribute_factory() + * Description : Create the attribute object(s) + * and store them in the attribute list + */ +//-------------------------------------------------------- +void Agilent4uhvClass::attribute_factory(vector<Tango::Attr *> &att_list) +{ + /*----- PROTECTED REGION ID(Agilent4uhvClass::attribute_factory_before) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::attribute_factory_before + // Call atribute_factory for inherited class + Serial2Client_ns::Serial2ClientClass::attribute_factory(att_list); + + // Attribute : Model + ModelAttrib *model = new ModelAttrib(); + Tango::UserDefaultAttrProp model_prop; + // description not set for Model + // label not set for Model + // unit not set for Model + // standard_unit not set for Model + // display_unit not set for Model + // format not set for Model + // max_value not set for Model + // min_value not set for Model + // max_alarm not set for Model + // min_alarm not set for Model + // max_warning not set for Model + // min_warning not set for Model + // delta_t not set for Model + // delta_val not set for Model + + model->set_default_properties(model_prop); + // Not Polled + model->set_disp_level(Tango::OPERATOR); + // Not Memorized + att_list.push_back(model); + + // Attribute : SerialNumber + SerialNumberAttrib *serialnumber = new SerialNumberAttrib(); + Tango::UserDefaultAttrProp serialnumber_prop; + // description not set for SerialNumber + // label not set for SerialNumber + // unit not set for SerialNumber + // standard_unit not set for SerialNumber + // display_unit not set for SerialNumber + // format not set for SerialNumber + // max_value not set for SerialNumber + // min_value not set for SerialNumber + // max_alarm not set for SerialNumber + // min_alarm not set for SerialNumber + // max_warning not set for SerialNumber + // min_warning not set for SerialNumber + // delta_t not set for SerialNumber + // delta_val not set for SerialNumber + + serialnumber->set_default_properties(serialnumber_prop); + // Not Polled + serialnumber->set_disp_level(Tango::OPERATOR); + // Not Memorized + att_list.push_back(serialnumber); + + // Attribute : Temperature + TemperatureAttrib *temperature = new TemperatureAttrib(); + Tango::UserDefaultAttrProp temperature_prop; + // description not set for Temperature + // label not set for Temperature + temperature_prop.set_unit("C"); + // standard_unit not set for Temperature + // display_unit not set for Temperature + // format not set for Temperature + temperature_prop.set_max_value("200"); + temperature_prop.set_min_value("0"); + // max_alarm not set for Temperature + // min_alarm not set for Temperature + // max_warning not set for Temperature + // min_warning not set for Temperature + // delta_t not set for Temperature + // delta_val not set for Temperature + + temperature->set_default_properties(temperature_prop); + // Not Polled + temperature->set_disp_level(Tango::OPERATOR); + // Not Memorized + att_list.push_back(temperature); + + // Attribute : CRCErrors + CRCErrorsAttrib *crcerrors = new CRCErrorsAttrib(); + Tango::UserDefaultAttrProp crcerrors_prop; + crcerrors_prop.set_description("CRC Errors"); + // label not set for CRCErrors + // unit not set for CRCErrors + // standard_unit not set for CRCErrors + // display_unit not set for CRCErrors + // format not set for CRCErrors + // max_value not set for CRCErrors + // min_value not set for CRCErrors + // max_alarm not set for CRCErrors + // min_alarm not set for CRCErrors + // max_warning not set for CRCErrors + // min_warning not set for CRCErrors + // delta_t not set for CRCErrors + // delta_val not set for CRCErrors + + crcerrors->set_default_properties(crcerrors_prop); + // Not Polled + crcerrors->set_disp_level(Tango::EXPERT); + // Not Memorized + att_list.push_back(crcerrors); + + // Attribute : AutoStart + AutoStartAttrib *autostart = new AutoStartAttrib(); + Tango::UserDefaultAttrProp autostart_prop; + // description not set for AutoStart + // label not set for AutoStart + // unit not set for AutoStart + // standard_unit not set for AutoStart + // display_unit not set for AutoStart + // format not set for AutoStart + // max_value not set for AutoStart + // min_value not set for AutoStart + // max_alarm not set for AutoStart + // min_alarm not set for AutoStart + // max_warning not set for AutoStart + // min_warning not set for AutoStart + // delta_t not set for AutoStart + // delta_val not set for AutoStart + + autostart->set_default_properties(autostart_prop); + // Not Polled + autostart->set_disp_level(Tango::OPERATOR); + // Not Memorized + att_list.push_back(autostart); + + + // Create a list of static attributes + create_static_attribute_list(get_class_attr()->get_attr_list()); + /*----- PROTECTED REGION ID(Agilent4uhvClass::attribute_factory_after) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::attribute_factory_after +} +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::pipe_factory() + * Description : Create the pipe object(s) + * and store them in the pipe list + */ +//-------------------------------------------------------- +void Agilent4uhvClass::pipe_factory() +{ + /*----- PROTECTED REGION ID(Agilent4uhvClass::pipe_factory_before) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::pipe_factory_before + /*----- PROTECTED REGION ID(Agilent4uhvClass::pipe_factory_after) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::pipe_factory_after +} +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::command_factory() + * Description : Create the command object(s) + * and store them in the command list + */ +//-------------------------------------------------------- +void Agilent4uhvClass::command_factory() +{ + /*----- PROTECTED REGION ID(Agilent4uhvClass::command_factory_before) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::command_factory_before + // Call command_factory for inherited class + Serial2Client_ns::Serial2ClientClass::command_factory(); + + + + /*----- PROTECTED REGION ID(Agilent4uhvClass::command_factory_after) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::command_factory_after +} + +//=================================================================== +// Dynamic attributes related methods +//=================================================================== + +//-------------------------------------------------------- +/** + * method : Agilent4uhvClass::create_static_attribute_list + * description : Create the a list of static attributes + * + * @param att_list the ceated attribute list + */ +//-------------------------------------------------------- +void Agilent4uhvClass::create_static_attribute_list(vector<Tango::Attr *> &att_list) +{ + for (unsigned long i=0 ; i<att_list.size() ; i++) + { + string att_name(att_list[i]->get_name()); + transform(att_name.begin(), att_name.end(), att_name.begin(), ::tolower); + defaultAttList.push_back(att_name); + } + + cout2 << defaultAttList.size() << " attributes in default list" << endl; + + /*----- PROTECTED REGION ID(Agilent4uhvClass::create_static_att_list) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::create_static_att_list +} + + +//-------------------------------------------------------- +/** + * method : Agilent4uhvClass::erase_dynamic_attributes + * description : delete the dynamic attributes if any. + * + * @param devlist_ptr the device list pointer + * @param list of all attributes + */ +//-------------------------------------------------------- +void Agilent4uhvClass::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_ptr, vector<Tango::Attr *> &att_list) +{ + Tango::Util *tg = Tango::Util::instance(); + + for (unsigned long i=0 ; i<devlist_ptr->length() ; i++) + { + Tango::DeviceImpl *dev_impl = tg->get_device_by_name(((string)(*devlist_ptr)[i]).c_str()); + Agilent4uhv *dev = static_cast<Agilent4uhv *> (dev_impl); + + vector<Tango::Attribute *> &dev_att_list = dev->get_device_attr()->get_attribute_list(); + vector<Tango::Attribute *>::iterator ite_att; + for (ite_att=dev_att_list.begin() ; ite_att != dev_att_list.end() ; ++ite_att) + { + string att_name((*ite_att)->get_name_lower()); + if ((att_name == "state") || (att_name == "status")) + continue; + vector<string>::iterator ite_str = find(defaultAttList.begin(), defaultAttList.end(), att_name); + if (ite_str == defaultAttList.end()) + { + cout2 << att_name << " is a UNWANTED dynamic attribute for device " << (*devlist_ptr)[i] << endl; + Tango::Attribute &att = dev->get_device_attr()->get_attr_by_name(att_name.c_str()); + dev->remove_attribute(att_list[att.get_attr_idx()], true, false); + --ite_att; + } + } + } + /*----- PROTECTED REGION ID(Agilent4uhvClass::erase_dynamic_attributes) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::erase_dynamic_attributes +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhvClass::get_attr_by_name() + * Description : returns Tango::Attr * object found by name + */ +//-------------------------------------------------------- +Tango::Attr *Agilent4uhvClass::get_attr_object_by_name(vector<Tango::Attr *> &att_list, string attname) +{ + vector<Tango::Attr *>::iterator it; + for (it=att_list.begin() ; it<att_list.end() ; ++it) + if ((*it)->get_name()==attname) + return (*it); + // Attr does not exist + return NULL; +} + + +/*----- PROTECTED REGION ID(Agilent4uhvClass::Additional Methods) ENABLED START -----*/ + +/*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::Additional Methods +} // namespace diff --git a/src/Agilent4uhvClass.h b/src/Agilent4uhvClass.h new file mode 100644 index 0000000000000000000000000000000000000000..66828866bc4f810da41231ff04c6d22e69a0b061 --- /dev/null +++ b/src/Agilent4uhvClass.h @@ -0,0 +1,458 @@ +/*----- PROTECTED REGION ID(Agilent4uhvClass.h) ENABLED START -----*/ +//============================================================================= +// +// file : Agilent4uhvClass.h +// +// description : Include for the Agilent4uhv root class. +// This class is the singleton class for +// the Agilent4uhv device class. +// It contains all properties and methods which the +// Agilent4uhv requires only once e.g. the commands. +// +// 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.10 $ +// $Date: 2019-01-18 09:30:34 $ +// +// $HeadURL: $ +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#ifndef Agilent4uhvClass_H +#define Agilent4uhvClass_H + +#include <tango.h> +#include <Serial2ClientClass.h> +#include <Agilent4uhv.h> + + +/*----- PROTECTED REGION END -----*/ // Agilent4uhvClass.h + + +namespace Agilent4uhv_ns +{ +/*----- PROTECTED REGION ID(Agilent4uhvClass::classes for dynamic creation) ENABLED START -----*/ + + +/*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::classes for dynamic creation + +//========================================= +// Define classes for attributes +//========================================= +// Attribute Model class definition +class ModelAttrib: public Tango::Attr +{ +public: + ModelAttrib():Attr("Model", + Tango::DEV_STRING, Tango::READ) {}; + ~ModelAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_Model(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_Model_allowed(ty);} +}; + +// Attribute SerialNumber class definition +class SerialNumberAttrib: public Tango::Attr +{ +public: + SerialNumberAttrib():Attr("SerialNumber", + Tango::DEV_STRING, Tango::READ) {}; + ~SerialNumberAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_SerialNumber(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_SerialNumber_allowed(ty);} +}; + +// Attribute Temperature class definition +class TemperatureAttrib: public Tango::Attr +{ +public: + TemperatureAttrib():Attr("Temperature", + Tango::DEV_FLOAT, Tango::READ) {}; + ~TemperatureAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_Temperature(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_Temperature_allowed(ty);} +}; + +// Attribute CRCErrors class definition +class CRCErrorsAttrib: public Tango::Attr +{ +public: + CRCErrorsAttrib():Attr("CRCErrors", + Tango::DEV_LONG, Tango::READ) {}; + ~CRCErrorsAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_CRCErrors(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_CRCErrors_allowed(ty);} +}; + +// Attribute AutoStart class definition +class AutoStartAttrib: public Tango::Attr +{ +public: + AutoStartAttrib():Attr("AutoStart", + Tango::DEV_BOOLEAN, Tango::READ_WRITE) {}; + ~AutoStartAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_AutoStart(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<Agilent4uhv *>(dev))->write_AutoStart(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_AutoStart_allowed(ty);} +}; + + +//========================================= +// Define classes for dynamic attributes +//========================================= +// Attribute HVX class definition +class HVXAttrib: public Tango::Attr +{ +public: + HVXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_STATE, Tango::READ) {}; + ~HVXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_HVX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_HVX_allowed(ty);} +}; + +// Attribute DeviceNumberX class definition +class DeviceNumberXAttrib: public Tango::Attr +{ +public: + DeviceNumberXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_LONG, Tango::READ_WRITE) {}; + ~DeviceNumberXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_DeviceNumberX(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<Agilent4uhv *>(dev))->write_DeviceNumberX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_DeviceNumberX_allowed(ty);} +}; + +// Attribute PowerMaxX class definition +class PowerMaxXAttrib: public Tango::Attr +{ +public: + PowerMaxXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_USHORT, Tango::READ_WRITE) {}; + ~PowerMaxXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_PowerMaxX(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<Agilent4uhv *>(dev))->write_PowerMaxX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_PowerMaxX_allowed(ty);} +}; + +// Attribute VTargetX class definition +class VTargetXAttrib: public Tango::Attr +{ +public: + VTargetXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_USHORT, Tango::READ_WRITE) {}; + ~VTargetXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_VTargetX(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<Agilent4uhv *>(dev))->write_VTargetX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_VTargetX_allowed(ty);} +}; + +// Attribute IProtectX class definition +class IProtectXAttrib: public Tango::Attr +{ +public: + IProtectXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_USHORT, Tango::READ_WRITE) {}; + ~IProtectXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_IProtectX(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<Agilent4uhv *>(dev))->write_IProtectX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_IProtectX_allowed(ty);} +}; + +// Attribute SetPointX class definition +class SetPointXAttrib: public Tango::Attr +{ +public: + SetPointXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_DOUBLE, Tango::READ_WRITE) {}; + ~SetPointXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_SetPointX(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<Agilent4uhv *>(dev))->write_SetPointX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_SetPointX_allowed(ty);} +}; + +// Attribute TemperatureHVX class definition +class TemperatureHVXAttrib: public Tango::Attr +{ +public: + TemperatureHVXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_FLOAT, Tango::READ) {}; + ~TemperatureHVXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_TemperatureHVX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_TemperatureHVX_allowed(ty);} +}; + +// Attribute VoltageX class definition +class VoltageXAttrib: public Tango::Attr +{ +public: + VoltageXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_DOUBLE, Tango::READ) {}; + ~VoltageXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_VoltageX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_VoltageX_allowed(ty);} +}; + +// Attribute CurrentX class definition +class CurrentXAttrib: public Tango::Attr +{ +public: + CurrentXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_DOUBLE, Tango::READ) {}; + ~CurrentXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_CurrentX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_CurrentX_allowed(ty);} +}; + +// Attribute PressureX class definition +class PressureXAttrib: public Tango::Attr +{ +public: + PressureXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_DOUBLE, Tango::READ) {}; + ~PressureXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_PressureX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_PressureX_allowed(ty);} +}; + +// Attribute StateX class definition +class StateXAttrib: public Tango::Attr +{ +public: + StateXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_STATE, Tango::READ) {}; + ~StateXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_StateX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_StateX_allowed(ty);} +}; + +// Attribute StatusX class definition +class StatusXAttrib: public Tango::Attr +{ +public: + StatusXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_STRING, Tango::READ) {}; + ~StatusXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_StatusX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_StatusX_allowed(ty);} +}; + +// Attribute ProtectX class definition +class ProtectXAttrib: public Tango::Attr +{ +public: + ProtectXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_BOOLEAN, Tango::READ_WRITE) {}; + ~ProtectXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_ProtectX(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<Agilent4uhv *>(dev))->write_ProtectX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_ProtectX_allowed(ty);} +}; + +// Attribute FixedStepX class definition +class FixedStepXAttrib: public Tango::Attr +{ +public: + FixedStepXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_BOOLEAN, Tango::READ_WRITE) {}; + ~FixedStepXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_FixedStepX(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<Agilent4uhv *>(dev))->write_FixedStepX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_FixedStepX_allowed(ty);} +}; + +// Attribute StatusSetPointX class definition +class StatusSetPointXAttrib: public Tango::Attr +{ +public: + StatusSetPointXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_BOOLEAN, Tango::READ) {}; + ~StatusSetPointXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_StatusSetPointX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_StatusSetPointX_allowed(ty);} +}; + +// Attribute StatMaskX class definition +class StatMaskXAttrib: public Tango::Attr +{ +public: + StatMaskXAttrib(const string &att_name):Attr(att_name.c_str(), + Tango::DEV_LONG, Tango::READ) {}; + ~StatMaskXAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<Agilent4uhv *>(dev))->read_StatMaskX(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<Agilent4uhv *>(dev))->is_StatMaskX_allowed(ty);} +}; + + +//========================================= +// Define classes for dynamic commands +//========================================= +// Command OnHVX class definition +class OnHVXClass : public Tango::Command +{ +public: + OnHVXClass(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) {}; + + OnHVXClass(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out) + :Command(name,in,out) {}; + ~OnHVXClass() {}; + + 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<Agilent4uhv *>(dev))->is_OnHVX_allowed(any);} +}; + +// Command OffHVX class definition +class OffHVXClass : public Tango::Command +{ +public: + OffHVXClass(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) {}; + + OffHVXClass(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out) + :Command(name,in,out) {}; + ~OffHVXClass() {}; + + 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<Agilent4uhv *>(dev))->is_OffHVX_allowed(any);} +}; + + +/** + * The Agilent4uhvClass singleton definition + */ + +#ifdef _TG_WINDOWS_ +class __declspec(dllexport) Agilent4uhvClass : public Serial2Client_ns::Serial2ClientClass +#else +class Agilent4uhvClass : public Serial2Client_ns::Serial2ClientClass +#endif +{ + /*----- PROTECTED REGION ID(Agilent4uhvClass::Additionnal DServer data members) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhvClass::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 Agilent4uhvClass *init(const char *); + static Agilent4uhvClass *instance(); + ~Agilent4uhvClass(); + Tango::DbDatum get_class_property(string &); + Tango::DbDatum get_default_device_property(string &); + Tango::DbDatum get_default_class_property(string &); + + protected: + Agilent4uhvClass(string &); + static Agilent4uhvClass *_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 // Agilent4uhv_H diff --git a/src/Agilent4uhvDynAttrUtils.cpp b/src/Agilent4uhvDynAttrUtils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..000e7d61e74c2e22bcc80fff14650fae1c63d7d8 --- /dev/null +++ b/src/Agilent4uhvDynAttrUtils.cpp @@ -0,0 +1,1403 @@ +/*----- PROTECTED REGION ID(Agilent4uhv::DynAttrUtils.cpp) ENABLED START -----*/ +static const char *RcsId = "$Id: Agilent4uhvDynAttrUtils.cpp,v 1.8 2019-01-18 09:30:34 alessio Exp $"; +//============================================================================= +// +// file : Agilent4uhvDynAttrUtils.cpp +// +// description : Dynamic attributes utilities 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.8 $ +// $Date: 2019-01-18 09:30:34 $ +// +// $HeadURL: $ +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + + +#include <Agilent4uhv.h> +#include <Agilent4uhvClass.h> + +/*----- PROTECTED REGION END -----*/ // Agilent4uhv::DynAttrUtils.cpp + +//================================================================ +// Attributes managed are: +//================================================================ +// HVX | Tango::DevState Scalar +// DeviceNumberX | Tango::DevLong Scalar +// PowerMaxX | Tango::DevUShort Scalar +// VTargetX | Tango::DevUShort Scalar +// IProtectX | Tango::DevUShort Scalar +// SetPointX | Tango::DevDouble Scalar +// TemperatureHVX | Tango::DevFloat Scalar +// VoltageX | Tango::DevDouble Scalar +// CurrentX | Tango::DevDouble Scalar +// PressureX | Tango::DevDouble Scalar +// StateX | Tango::DevState Scalar +// StatusX | Tango::DevString Scalar +// ProtectX | Tango::DevBoolean Scalar +// FixedStepX | Tango::DevBoolean Scalar +// StatusSetPointX | Tango::DevBoolean Scalar +// StatMaskX | Tango::DevLong Scalar +//================================================================ + +// For compatibility reason, this file (Agilent4uhvDynAttrUtils) +// manage also the dynamic command utilities. +//================================================================ +// The following table gives the correspondence +// between command and method names. +// +// Command name | Method name +//================================================================ +// OnHVX | on_hvx +// OffHVX | off_hvx +//================================================================ + +namespace Agilent4uhv_ns +{ +//============================================================= +// Add/Remove dynamic attribute methods +//============================================================= + +//-------------------------------------------------------- +/** + * Add a HVX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_HVX_dynamic_attribute(string attname) +{ + // Attribute : HVX + HVXAttrib *hvx = new HVXAttrib(attname); + Tango::UserDefaultAttrProp hvx_prop; + // description not set for HVX + // label not set for HVX + // unit not set for HVX + // standard_unit not set for HVX + // display_unit not set for HVX + // format not set for HVX + // max_value not set for HVX + // min_value not set for HVX + // max_alarm not set for HVX + // min_alarm not set for HVX + // max_warning not set for HVX + // min_warning not set for HVX + // delta_t not set for HVX + // delta_val not set for HVX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_HVX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_HVX_dynamic_attribute + hvx->set_default_properties(hvx_prop); + // Not Polled + hvx->set_disp_level(Tango::OPERATOR); + // Not Memorized + HVX_data.insert(make_pair(attname, Tango::UNKNOWN)); + add_attribute(hvx); +} +//-------------------------------------------------------- +/** + * remove a HVX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_HVX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevState>::iterator ite; + if ((ite=HVX_data.find(attname))!=HVX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_HVX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_HVX_dynamic_attribute + HVX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a DeviceNumberX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_DeviceNumberX_dynamic_attribute(string attname) +{ + // Attribute : DeviceNumberX + DeviceNumberXAttrib *devicenumberx = new DeviceNumberXAttrib(attname); + Tango::UserDefaultAttrProp devicenumberx_prop; + // description not set for DeviceNumberX + // label not set for DeviceNumberX + // unit not set for DeviceNumberX + // standard_unit not set for DeviceNumberX + // display_unit not set for DeviceNumberX + // format not set for DeviceNumberX + // max_value not set for DeviceNumberX + // min_value not set for DeviceNumberX + // max_alarm not set for DeviceNumberX + // min_alarm not set for DeviceNumberX + // max_warning not set for DeviceNumberX + // min_warning not set for DeviceNumberX + // delta_t not set for DeviceNumberX + // delta_val not set for DeviceNumberX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_DeviceNumberX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_DeviceNumberX_dynamic_attribute + devicenumberx->set_default_properties(devicenumberx_prop); + // Not Polled + devicenumberx->set_disp_level(Tango::OPERATOR); + // Not Memorized + DeviceNumberX_data.insert(make_pair(attname, 0)); + add_attribute(devicenumberx); +} +//-------------------------------------------------------- +/** + * remove a DeviceNumberX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_DeviceNumberX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevLong>::iterator ite; + if ((ite=DeviceNumberX_data.find(attname))!=DeviceNumberX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_DeviceNumberX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_DeviceNumberX_dynamic_attribute + DeviceNumberX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a PowerMaxX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_PowerMaxX_dynamic_attribute(string attname) +{ + // Attribute : PowerMaxX + PowerMaxXAttrib *powermaxx = new PowerMaxXAttrib(attname); + Tango::UserDefaultAttrProp powermaxx_prop; + // description not set for PowerMaxX + // label not set for PowerMaxX + powermaxx_prop.set_unit("W"); + // standard_unit not set for PowerMaxX + // display_unit not set for PowerMaxX + // format not set for PowerMaxX + powermaxx_prop.set_max_value("80"); + powermaxx_prop.set_min_value("10"); + // max_alarm not set for PowerMaxX + // min_alarm not set for PowerMaxX + // max_warning not set for PowerMaxX + // min_warning not set for PowerMaxX + // delta_t not set for PowerMaxX + // delta_val not set for PowerMaxX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_PowerMaxX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_PowerMaxX_dynamic_attribute + powermaxx->set_default_properties(powermaxx_prop); + // Not Polled + powermaxx->set_disp_level(Tango::OPERATOR); + // Not Memorized + PowerMaxX_data.insert(make_pair(attname, 0)); + add_attribute(powermaxx); +} +//-------------------------------------------------------- +/** + * remove a PowerMaxX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_PowerMaxX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevUShort>::iterator ite; + if ((ite=PowerMaxX_data.find(attname))!=PowerMaxX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_PowerMaxX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_PowerMaxX_dynamic_attribute + PowerMaxX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a VTargetX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_VTargetX_dynamic_attribute(string attname) +{ + // Attribute : VTargetX + VTargetXAttrib *vtargetx = new VTargetXAttrib(attname); + Tango::UserDefaultAttrProp vtargetx_prop; + // description not set for VTargetX + // label not set for VTargetX + vtargetx_prop.set_unit("kV"); + // standard_unit not set for VTargetX + // display_unit not set for VTargetX + // format not set for VTargetX + vtargetx_prop.set_max_value("7"); + vtargetx_prop.set_min_value("3"); + // max_alarm not set for VTargetX + // min_alarm not set for VTargetX + // max_warning not set for VTargetX + // min_warning not set for VTargetX + // delta_t not set for VTargetX + // delta_val not set for VTargetX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_VTargetX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_VTargetX_dynamic_attribute + vtargetx->set_default_properties(vtargetx_prop); + // Not Polled + vtargetx->set_disp_level(Tango::OPERATOR); + // Not Memorized + VTargetX_data.insert(make_pair(attname, 0)); + add_attribute(vtargetx); +} +//-------------------------------------------------------- +/** + * remove a VTargetX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_VTargetX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevUShort>::iterator ite; + if ((ite=VTargetX_data.find(attname))!=VTargetX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_VTargetX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_VTargetX_dynamic_attribute + VTargetX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a IProtectX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_IProtectX_dynamic_attribute(string attname) +{ + // Attribute : IProtectX + IProtectXAttrib *iprotectx = new IProtectXAttrib(attname); + Tango::UserDefaultAttrProp iprotectx_prop; + // description not set for IProtectX + // label not set for IProtectX + iprotectx_prop.set_unit("mA"); + // standard_unit not set for IProtectX + // display_unit not set for IProtectX + // format not set for IProtectX + iprotectx_prop.set_max_value("100"); + iprotectx_prop.set_min_value("1"); + // max_alarm not set for IProtectX + // min_alarm not set for IProtectX + // max_warning not set for IProtectX + // min_warning not set for IProtectX + // delta_t not set for IProtectX + // delta_val not set for IProtectX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_IProtectX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_IProtectX_dynamic_attribute + iprotectx->set_default_properties(iprotectx_prop); + // Not Polled + iprotectx->set_disp_level(Tango::OPERATOR); + // Not Memorized + IProtectX_data.insert(make_pair(attname, 0)); + add_attribute(iprotectx); +} +//-------------------------------------------------------- +/** + * remove a IProtectX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_IProtectX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevUShort>::iterator ite; + if ((ite=IProtectX_data.find(attname))!=IProtectX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_IProtectX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_IProtectX_dynamic_attribute + IProtectX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a SetPointX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_SetPointX_dynamic_attribute(string attname) +{ + // Attribute : SetPointX + SetPointXAttrib *setpointx = new SetPointXAttrib(attname); + Tango::UserDefaultAttrProp setpointx_prop; + // description not set for SetPointX + // label not set for SetPointX + // unit not set for SetPointX + // standard_unit not set for SetPointX + // display_unit not set for SetPointX + // format not set for SetPointX + // max_value not set for SetPointX + // min_value not set for SetPointX + // max_alarm not set for SetPointX + // min_alarm not set for SetPointX + // max_warning not set for SetPointX + // min_warning not set for SetPointX + // delta_t not set for SetPointX + // delta_val not set for SetPointX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_SetPointX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_SetPointX_dynamic_attribute + setpointx->set_default_properties(setpointx_prop); + // Not Polled + setpointx->set_disp_level(Tango::OPERATOR); + // Not Memorized + SetPointX_data.insert(make_pair(attname, 0.0)); + add_attribute(setpointx); +} +//-------------------------------------------------------- +/** + * remove a SetPointX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_SetPointX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevDouble>::iterator ite; + if ((ite=SetPointX_data.find(attname))!=SetPointX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_SetPointX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_SetPointX_dynamic_attribute + SetPointX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a TemperatureHVX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_TemperatureHVX_dynamic_attribute(string attname) +{ + // Attribute : TemperatureHVX + TemperatureHVXAttrib *temperaturehvx = new TemperatureHVXAttrib(attname); + Tango::UserDefaultAttrProp temperaturehvx_prop; + // description not set for TemperatureHVX + // label not set for TemperatureHVX + temperaturehvx_prop.set_unit("C"); + // standard_unit not set for TemperatureHVX + // display_unit not set for TemperatureHVX + // format not set for TemperatureHVX + temperaturehvx_prop.set_max_value("200"); + temperaturehvx_prop.set_min_value("0"); + // max_alarm not set for TemperatureHVX + // min_alarm not set for TemperatureHVX + // max_warning not set for TemperatureHVX + // min_warning not set for TemperatureHVX + // delta_t not set for TemperatureHVX + // delta_val not set for TemperatureHVX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_TemperatureHVX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_TemperatureHVX_dynamic_attribute + temperaturehvx->set_default_properties(temperaturehvx_prop); + // Not Polled + temperaturehvx->set_disp_level(Tango::OPERATOR); + // Not Memorized + TemperatureHVX_data.insert(make_pair(attname, 0.0)); + add_attribute(temperaturehvx); +} +//-------------------------------------------------------- +/** + * remove a TemperatureHVX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_TemperatureHVX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevFloat>::iterator ite; + if ((ite=TemperatureHVX_data.find(attname))!=TemperatureHVX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_TemperatureHVX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_TemperatureHVX_dynamic_attribute + TemperatureHVX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a VoltageX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_VoltageX_dynamic_attribute(string attname) +{ + // Attribute : VoltageX + VoltageXAttrib *voltagex = new VoltageXAttrib(attname); + Tango::UserDefaultAttrProp voltagex_prop; + // description not set for VoltageX + // label not set for VoltageX + voltagex_prop.set_unit("V"); + // standard_unit not set for VoltageX + // display_unit not set for VoltageX + // format not set for VoltageX + voltagex_prop.set_max_value("10000"); + voltagex_prop.set_min_value("0"); + // max_alarm not set for VoltageX + // min_alarm not set for VoltageX + // max_warning not set for VoltageX + // min_warning not set for VoltageX + // delta_t not set for VoltageX + // delta_val not set for VoltageX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_VoltageX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_VoltageX_dynamic_attribute + voltagex->set_default_properties(voltagex_prop); + // Not Polled + voltagex->set_disp_level(Tango::OPERATOR); + // Not Memorized + VoltageX_data.insert(make_pair(attname, 0.0)); + add_attribute(voltagex); +} +//-------------------------------------------------------- +/** + * remove a VoltageX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_VoltageX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevDouble>::iterator ite; + if ((ite=VoltageX_data.find(attname))!=VoltageX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_VoltageX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_VoltageX_dynamic_attribute + VoltageX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a CurrentX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_CurrentX_dynamic_attribute(string attname) +{ + // Attribute : CurrentX + CurrentXAttrib *currentx = new CurrentXAttrib(attname); + Tango::UserDefaultAttrProp currentx_prop; + // description not set for CurrentX + // label not set for CurrentX + currentx_prop.set_unit("A"); + // standard_unit not set for CurrentX + // display_unit not set for CurrentX + // format not set for CurrentX + currentx_prop.set_max_value("9E-1"); + currentx_prop.set_min_value("1E-10"); + // max_alarm not set for CurrentX + // min_alarm not set for CurrentX + // max_warning not set for CurrentX + // min_warning not set for CurrentX + // delta_t not set for CurrentX + // delta_val not set for CurrentX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_CurrentX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_CurrentX_dynamic_attribute + currentx->set_default_properties(currentx_prop); + // Not Polled + currentx->set_disp_level(Tango::OPERATOR); + // Not Memorized + CurrentX_data.insert(make_pair(attname, 0.0)); + add_attribute(currentx); +} +//-------------------------------------------------------- +/** + * remove a CurrentX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_CurrentX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevDouble>::iterator ite; + if ((ite=CurrentX_data.find(attname))!=CurrentX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_CurrentX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_CurrentX_dynamic_attribute + CurrentX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a PressureX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_PressureX_dynamic_attribute(string attname) +{ + // Attribute : PressureX + PressureXAttrib *pressurex = new PressureXAttrib(attname); + Tango::UserDefaultAttrProp pressurex_prop; + // description not set for PressureX + // label not set for PressureX + pressurex_prop.set_unit("mbar"); + // standard_unit not set for PressureX + // display_unit not set for PressureX + // format not set for PressureX + // max_value not set for PressureX + // min_value not set for PressureX + // max_alarm not set for PressureX + // min_alarm not set for PressureX + // max_warning not set for PressureX + // min_warning not set for PressureX + // delta_t not set for PressureX + // delta_val not set for PressureX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_PressureX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_PressureX_dynamic_attribute + pressurex->set_default_properties(pressurex_prop); + // Not Polled + pressurex->set_disp_level(Tango::OPERATOR); + // Not Memorized + PressureX_data.insert(make_pair(attname, 0.0)); + add_attribute(pressurex); +} +//-------------------------------------------------------- +/** + * remove a PressureX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_PressureX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevDouble>::iterator ite; + if ((ite=PressureX_data.find(attname))!=PressureX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_PressureX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_PressureX_dynamic_attribute + PressureX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a StateX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_StateX_dynamic_attribute(string attname) +{ + // Attribute : StateX + StateXAttrib *statex = new StateXAttrib(attname); + Tango::UserDefaultAttrProp statex_prop; + // description not set for StateX + // label not set for StateX + // unit not set for StateX + // standard_unit not set for StateX + // display_unit not set for StateX + // format not set for StateX + // max_value not set for StateX + // min_value not set for StateX + // max_alarm not set for StateX + // min_alarm not set for StateX + // max_warning not set for StateX + // min_warning not set for StateX + // delta_t not set for StateX + // delta_val not set for StateX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_StateX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_StateX_dynamic_attribute + statex->set_default_properties(statex_prop); + // Not Polled + statex->set_disp_level(Tango::OPERATOR); + // Not Memorized + StateX_data.insert(make_pair(attname, Tango::UNKNOWN)); + add_attribute(statex); +} +//-------------------------------------------------------- +/** + * remove a StateX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_StateX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevState>::iterator ite; + if ((ite=StateX_data.find(attname))!=StateX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_StateX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_StateX_dynamic_attribute + StateX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a StatusX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_StatusX_dynamic_attribute(string attname) +{ + // Attribute : StatusX + StatusXAttrib *statusx = new StatusXAttrib(attname); + Tango::UserDefaultAttrProp statusx_prop; + // description not set for StatusX + // label not set for StatusX + // unit not set for StatusX + // standard_unit not set for StatusX + // display_unit not set for StatusX + // format not set for StatusX + // max_value not set for StatusX + // min_value not set for StatusX + // max_alarm not set for StatusX + // min_alarm not set for StatusX + // max_warning not set for StatusX + // min_warning not set for StatusX + // delta_t not set for StatusX + // delta_val not set for StatusX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_StatusX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_StatusX_dynamic_attribute + statusx->set_default_properties(statusx_prop); + // Not Polled + statusx->set_disp_level(Tango::OPERATOR); + // Not Memorized + char array[1]; + array[0] = '\0'; + StatusX_data.insert(make_pair(attname, array)); + add_attribute(statusx); +} +//-------------------------------------------------------- +/** + * remove a StatusX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_StatusX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevString>::iterator ite; + if ((ite=StatusX_data.find(attname))!=StatusX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_StatusX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_StatusX_dynamic_attribute + StatusX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a ProtectX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_ProtectX_dynamic_attribute(string attname) +{ + // Attribute : ProtectX + ProtectXAttrib *protectx = new ProtectXAttrib(attname); + Tango::UserDefaultAttrProp protectx_prop; + // description not set for ProtectX + // label not set for ProtectX + // unit not set for ProtectX + // standard_unit not set for ProtectX + // display_unit not set for ProtectX + // format not set for ProtectX + // max_value not set for ProtectX + // min_value not set for ProtectX + // max_alarm not set for ProtectX + // min_alarm not set for ProtectX + // max_warning not set for ProtectX + // min_warning not set for ProtectX + // delta_t not set for ProtectX + // delta_val not set for ProtectX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_ProtectX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_ProtectX_dynamic_attribute + protectx->set_default_properties(protectx_prop); + // Not Polled + protectx->set_disp_level(Tango::OPERATOR); + // Not Memorized + ProtectX_data.insert(make_pair(attname, false)); + add_attribute(protectx); +} +//-------------------------------------------------------- +/** + * remove a ProtectX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_ProtectX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevBoolean>::iterator ite; + if ((ite=ProtectX_data.find(attname))!=ProtectX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_ProtectX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_ProtectX_dynamic_attribute + ProtectX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a FixedStepX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_FixedStepX_dynamic_attribute(string attname) +{ + // Attribute : FixedStepX + FixedStepXAttrib *fixedstepx = new FixedStepXAttrib(attname); + Tango::UserDefaultAttrProp fixedstepx_prop; + // description not set for FixedStepX + // label not set for FixedStepX + // unit not set for FixedStepX + // standard_unit not set for FixedStepX + // display_unit not set for FixedStepX + // format not set for FixedStepX + // max_value not set for FixedStepX + // min_value not set for FixedStepX + // max_alarm not set for FixedStepX + // min_alarm not set for FixedStepX + // max_warning not set for FixedStepX + // min_warning not set for FixedStepX + // delta_t not set for FixedStepX + // delta_val not set for FixedStepX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_FixedStepX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_FixedStepX_dynamic_attribute + fixedstepx->set_default_properties(fixedstepx_prop); + // Not Polled + fixedstepx->set_disp_level(Tango::OPERATOR); + // Not Memorized + FixedStepX_data.insert(make_pair(attname, false)); + add_attribute(fixedstepx); +} +//-------------------------------------------------------- +/** + * remove a FixedStepX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_FixedStepX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevBoolean>::iterator ite; + if ((ite=FixedStepX_data.find(attname))!=FixedStepX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_FixedStepX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_FixedStepX_dynamic_attribute + FixedStepX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a StatusSetPointX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_StatusSetPointX_dynamic_attribute(string attname) +{ + // Attribute : StatusSetPointX + StatusSetPointXAttrib *statussetpointx = new StatusSetPointXAttrib(attname); + Tango::UserDefaultAttrProp statussetpointx_prop; + // description not set for StatusSetPointX + // label not set for StatusSetPointX + // unit not set for StatusSetPointX + // standard_unit not set for StatusSetPointX + // display_unit not set for StatusSetPointX + // format not set for StatusSetPointX + // max_value not set for StatusSetPointX + // min_value not set for StatusSetPointX + // max_alarm not set for StatusSetPointX + // min_alarm not set for StatusSetPointX + // max_warning not set for StatusSetPointX + // min_warning not set for StatusSetPointX + // delta_t not set for StatusSetPointX + // delta_val not set for StatusSetPointX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_StatusSetPointX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_StatusSetPointX_dynamic_attribute + statussetpointx->set_default_properties(statussetpointx_prop); + // Not Polled + statussetpointx->set_disp_level(Tango::OPERATOR); + // Not Memorized + StatusSetPointX_data.insert(make_pair(attname, false)); + add_attribute(statussetpointx); +} +//-------------------------------------------------------- +/** + * remove a StatusSetPointX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_StatusSetPointX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevBoolean>::iterator ite; + if ((ite=StatusSetPointX_data.find(attname))!=StatusSetPointX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_StatusSetPointX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_StatusSetPointX_dynamic_attribute + StatusSetPointX_data.erase(ite); + } +} +//-------------------------------------------------------- +/** + * Add a StatMaskX dynamic attribute. + * + * parameter attname: attribute name to be cretated and added. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_StatMaskX_dynamic_attribute(string attname) +{ + // Attribute : StatMaskX + StatMaskXAttrib *statmaskx = new StatMaskXAttrib(attname); + Tango::UserDefaultAttrProp statmaskx_prop; + // description not set for StatMaskX + // label not set for StatMaskX + // unit not set for StatMaskX + // standard_unit not set for StatMaskX + // display_unit not set for StatMaskX + // format not set for StatMaskX + // max_value not set for StatMaskX + // min_value not set for StatMaskX + // max_alarm not set for StatMaskX + // min_alarm not set for StatMaskX + // max_warning not set for StatMaskX + // min_warning not set for StatMaskX + // delta_t not set for StatMaskX + // delta_val not set for StatMaskX + + /*----- PROTECTED REGION ID(Agilent4uhv::att_StatMaskX_dynamic_attribute) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_StatMaskX_dynamic_attribute + statmaskx->set_default_properties(statmaskx_prop); + // Not Polled + statmaskx->set_disp_level(Tango::OPERATOR); + // Not Memorized + StatMaskX_data.insert(make_pair(attname, 0)); + add_attribute(statmaskx); +} +//-------------------------------------------------------- +/** + * remove a StatMaskX dynamic attribute. + * + * parameter attname: attribute name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_StatMaskX_dynamic_attribute(string attname) +{ + remove_attribute(attname, true); + map<string,Tango::DevLong>::iterator ite; + if ((ite=StatMaskX_data.find(attname))!=StatMaskX_data.end()) + { + /*----- PROTECTED REGION ID(Agilent4uhv::remove_StatMaskX_dynamic_attribute) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_StatMaskX_dynamic_attribute + StatMaskX_data.erase(ite); + } +} + + +//============================================================ +// Tool methods to get pointer on attribute data buffer +//============================================================ +//-------------------------------------------------------- +/** + * Return a pointer on HVX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevState *Agilent4uhv::get_HVX_data_ptr(string &name) +{ + map<string,Tango::DevState>::iterator ite; + if ((ite=HVX_data.find(name))==HVX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_HVX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on DeviceNumberX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevLong *Agilent4uhv::get_DeviceNumberX_data_ptr(string &name) +{ + map<string,Tango::DevLong>::iterator ite; + if ((ite=DeviceNumberX_data.find(name))==DeviceNumberX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_DeviceNumberX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on PowerMaxX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevUShort *Agilent4uhv::get_PowerMaxX_data_ptr(string &name) +{ + map<string,Tango::DevUShort>::iterator ite; + if ((ite=PowerMaxX_data.find(name))==PowerMaxX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_PowerMaxX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on VTargetX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevUShort *Agilent4uhv::get_VTargetX_data_ptr(string &name) +{ + map<string,Tango::DevUShort>::iterator ite; + if ((ite=VTargetX_data.find(name))==VTargetX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_VTargetX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on IProtectX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevUShort *Agilent4uhv::get_IProtectX_data_ptr(string &name) +{ + map<string,Tango::DevUShort>::iterator ite; + if ((ite=IProtectX_data.find(name))==IProtectX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_IProtectX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on SetPointX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevDouble *Agilent4uhv::get_SetPointX_data_ptr(string &name) +{ + map<string,Tango::DevDouble>::iterator ite; + if ((ite=SetPointX_data.find(name))==SetPointX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_SetPointX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on TemperatureHVX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevFloat *Agilent4uhv::get_TemperatureHVX_data_ptr(string &name) +{ + map<string,Tango::DevFloat>::iterator ite; + if ((ite=TemperatureHVX_data.find(name))==TemperatureHVX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_TemperatureHVX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on VoltageX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevDouble *Agilent4uhv::get_VoltageX_data_ptr(string &name) +{ + map<string,Tango::DevDouble>::iterator ite; + if ((ite=VoltageX_data.find(name))==VoltageX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_VoltageX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on CurrentX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevDouble *Agilent4uhv::get_CurrentX_data_ptr(string &name) +{ + map<string,Tango::DevDouble>::iterator ite; + if ((ite=CurrentX_data.find(name))==CurrentX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_CurrentX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on PressureX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevDouble *Agilent4uhv::get_PressureX_data_ptr(string &name) +{ + map<string,Tango::DevDouble>::iterator ite; + if ((ite=PressureX_data.find(name))==PressureX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_PressureX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on StateX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevState *Agilent4uhv::get_StateX_data_ptr(string &name) +{ + map<string,Tango::DevState>::iterator ite; + if ((ite=StateX_data.find(name))==StateX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_StateX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on StatusX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevString *Agilent4uhv::get_StatusX_data_ptr(string &name) +{ + map<string,Tango::DevString>::iterator ite; + if ((ite=StatusX_data.find(name))==StatusX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_StatusX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on ProtectX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevBoolean *Agilent4uhv::get_ProtectX_data_ptr(string &name) +{ + map<string,Tango::DevBoolean>::iterator ite; + if ((ite=ProtectX_data.find(name))==ProtectX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_ProtectX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on FixedStepX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevBoolean *Agilent4uhv::get_FixedStepX_data_ptr(string &name) +{ + map<string,Tango::DevBoolean>::iterator ite; + if ((ite=FixedStepX_data.find(name))==FixedStepX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_FixedStepX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on StatusSetPointX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevBoolean *Agilent4uhv::get_StatusSetPointX_data_ptr(string &name) +{ + map<string,Tango::DevBoolean>::iterator ite; + if ((ite=StatusSetPointX_data.find(name))==StatusSetPointX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_StatusSetPointX_data_ptr()"); + } + return &(ite->second); +} +//-------------------------------------------------------- +/** + * Return a pointer on StatMaskX data. + * + * parameter attname: the specified attribute name. + */ +//-------------------------------------------------------- +Tango::DevLong *Agilent4uhv::get_StatMaskX_data_ptr(string &name) +{ + map<string,Tango::DevLong>::iterator ite; + if ((ite=StatMaskX_data.find(name))==StatMaskX_data.end()) + { + TangoSys_OMemStream tms; + tms << "Dynamic attribute " << name << " has not been created"; + Tango::Except::throw_exception( + (const char *)"ATTRIBUTE_NOT_FOUND", + tms.str().c_str(), + (const char *)"Agilent4uhv::get_StatMaskX_data_ptr()"); + } + return &(ite->second); +} + + +//============================================================= +// Add/Remove dynamic command methods +//============================================================= + +//-------------------------------------------------------- +/** + * Add a OnHVX dynamic command. + * + * parameter cmdname: command name to be cretated and added. + * parameter device: Set this flag to true if the command must be added for only this device. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_OnHVX_dynamic_command(string cmdname, bool device) +{ + OnHVXClass *pOnHVXCmd = + new OnHVXClass(cmdname.c_str(), + Tango::DEV_VOID, Tango::DEV_VOID, + "", + "", + Tango::OPERATOR); + add_command(pOnHVXCmd, device); +} +//-------------------------------------------------------- +/** + * remove a OnHVX dynamic command. + * + * parameter cmdname: command name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_OnHVX_dynamic_command(string cmdname) +{ + remove_command(cmdname, true); +} +//-------------------------------------------------------- +/** + * Add a OffHVX dynamic command. + * + * parameter cmdname: command name to be cretated and added. + * parameter device: Set this flag to true if the command must be added for only this device. + */ +//-------------------------------------------------------- +void Agilent4uhv::add_OffHVX_dynamic_command(string cmdname, bool device) +{ + OffHVXClass *pOffHVXCmd = + new OffHVXClass(cmdname.c_str(), + Tango::DEV_VOID, Tango::DEV_VOID, + "", + "", + Tango::OPERATOR); + add_command(pOffHVXCmd, device); +} +//-------------------------------------------------------- +/** + * remove a OffHVX dynamic command. + * + * parameter cmdname: command name to be removed. + */ +//-------------------------------------------------------- +void Agilent4uhv::remove_OffHVX_dynamic_command(string cmdname) +{ + remove_command(cmdname, true); +} + +} // namespace diff --git a/src/Agilent4uhvStateMachine.cpp b/src/Agilent4uhvStateMachine.cpp new file mode 100644 index 0000000000000000000000000000000000000000..df7ebb03df3f33e2f3f5e3737a78bfc0f358143e --- /dev/null +++ b/src/Agilent4uhvStateMachine.cpp @@ -0,0 +1,744 @@ +/*----- PROTECTED REGION ID(Agilent4uhvStateMachine.cpp) ENABLED START -----*/ +static const char *RcsId = "$Id: Agilent4uhvStateMachine.cpp,v 1.11 2019-01-18 09:30:34 alessio Exp $"; +//============================================================================= +// +// file : Agilent4uhvStateMachine.cpp +// +// description : State machine 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.11 $ +// $Date: 2019-01-18 09:30:34 $ +// +// $HeadURL: $ +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + +#include <Agilent4uhv.h> + +/*----- PROTECTED REGION END -----*/ // Agilent4uhv::Agilent4uhvStateMachine.cpp + +//================================================================ +// States | Description +//================================================================ +// ON | +// ALARM | +// FAULT | +// UNKNOWN | + + +namespace Agilent4uhv_ns +{ +//================================================= +// Attributes Allowed Methods +//================================================= + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_Model_allowed() + * Description : Execution allowed for Model attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_Model_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::ModelStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::ModelStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_SerialNumber_allowed() + * Description : Execution allowed for SerialNumber attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_SerialNumber_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::SerialNumberStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::SerialNumberStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_Temperature_allowed() + * Description : Execution allowed for Temperature attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_Temperature_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::TemperatureStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::TemperatureStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_CRCErrors_allowed() + * Description : Execution allowed for CRCErrors attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_CRCErrors_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::CRCErrorsStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::CRCErrorsStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_AutoStart_allowed() + * Description : Execution allowed for AutoStart attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_AutoStart_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Check access type. + if ( type!=Tango::READ_REQ ) + { + // Compare device state with not allowed states for WRITE + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::AutoStartStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::AutoStartStateAllowed_WRITE + return false; + } + return true; + } + else + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::AutoStartStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::AutoStartStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_HVX_allowed() + * Description : Execution allowed for HVX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_HVX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::HVXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::HVXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_DeviceNumberX_allowed() + * Description : Execution allowed for DeviceNumberX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_DeviceNumberX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Check access type. + if ( type!=Tango::READ_REQ ) + { + // Compare device state with not allowed states for WRITE + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::DeviceNumberXStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::DeviceNumberXStateAllowed_WRITE + return false; + } + return true; + } + else + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::DeviceNumberXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::DeviceNumberXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_PowerMaxX_allowed() + * Description : Execution allowed for PowerMaxX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_PowerMaxX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Check access type. + if ( type!=Tango::READ_REQ ) + { + // Compare device state with not allowed states for WRITE + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::PowerMaxXStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::PowerMaxXStateAllowed_WRITE + return false; + } + return true; + } + else + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::PowerMaxXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::PowerMaxXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_VTargetX_allowed() + * Description : Execution allowed for VTargetX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_VTargetX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Check access type. + if ( type!=Tango::READ_REQ ) + { + // Compare device state with not allowed states for WRITE + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::VTargetXStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::VTargetXStateAllowed_WRITE + return false; + } + return true; + } + else + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::VTargetXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::VTargetXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_IProtectX_allowed() + * Description : Execution allowed for IProtectX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_IProtectX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Check access type. + if ( type!=Tango::READ_REQ ) + { + // Compare device state with not allowed states for WRITE + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::IProtectXStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::IProtectXStateAllowed_WRITE + return false; + } + return true; + } + else + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::IProtectXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::IProtectXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_SetPointX_allowed() + * Description : Execution allowed for SetPointX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_SetPointX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Check access type. + if ( type!=Tango::READ_REQ ) + { + // Compare device state with not allowed states for WRITE + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::SetPointXStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::SetPointXStateAllowed_WRITE + return false; + } + return true; + } + else + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::SetPointXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::SetPointXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_TemperatureHVX_allowed() + * Description : Execution allowed for TemperatureHVX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_TemperatureHVX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::TemperatureHVXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::TemperatureHVXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_VoltageX_allowed() + * Description : Execution allowed for VoltageX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_VoltageX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::VoltageXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::VoltageXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_CurrentX_allowed() + * Description : Execution allowed for CurrentX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_CurrentX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::CurrentXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::CurrentXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_PressureX_allowed() + * Description : Execution allowed for PressureX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_PressureX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::PressureXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::PressureXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_StateX_allowed() + * Description : Execution allowed for StateX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_StateX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::StateXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::StateXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_StatusX_allowed() + * Description : Execution allowed for StatusX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_StatusX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::StatusXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::StatusXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_ProtectX_allowed() + * Description : Execution allowed for ProtectX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_ProtectX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Check access type. + if ( type!=Tango::READ_REQ ) + { + // Compare device state with not allowed states for WRITE + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::ProtectXStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::ProtectXStateAllowed_WRITE + return false; + } + return true; + } + else + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::ProtectXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::ProtectXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_FixedStepX_allowed() + * Description : Execution allowed for FixedStepX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_FixedStepX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Check access type. + if ( type!=Tango::READ_REQ ) + { + // Compare device state with not allowed states for WRITE + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::FixedStepXStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::FixedStepXStateAllowed_WRITE + return false; + } + return true; + } + else + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::FixedStepXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::FixedStepXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_StatusSetPointX_allowed() + * Description : Execution allowed for StatusSetPointX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_StatusSetPointX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::StatusSetPointXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::StatusSetPointXStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_StatMaskX_allowed() + * Description : Execution allowed for StatMaskX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_StatMaskX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::StatMaskXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::StatMaskXStateAllowed_READ + return false; + } + return true; + } + return true; +} + + +//================================================= +// Commands Allowed Methods +//================================================= + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_OnHVX_allowed() + * Description : Execution allowed for OnHVX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_OnHVX_allowed(TANGO_UNUSED(const CORBA::Any &any)) +{ + // Compare device state with not allowed states. + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::OnHVXStateAllowed) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::OnHVXStateAllowed + return false; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : Agilent4uhv::is_OffHVX_allowed() + * Description : Execution allowed for OffHVX attribute + */ +//-------------------------------------------------------- +bool Agilent4uhv::is_OffHVX_allowed(TANGO_UNUSED(const CORBA::Any &any)) +{ + // Compare device state with not allowed states. + if (get_state()==Tango::UNKNOWN) + { + /*----- PROTECTED REGION ID(Agilent4uhv::OffHVXStateAllowed) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::OffHVXStateAllowed + return false; + } + return true; +} + + +/*----- PROTECTED REGION ID(Agilent4uhv::Agilent4uhvStateAllowed.AdditionalMethods) ENABLED START -----*/ + +// Additional Methods + +/*----- PROTECTED REGION END -----*/ // Agilent4uhv::Agilent4uhvStateAllowed.AdditionalMethods + +} // End of namespace diff --git a/src/MultiClassesFactory.cpp b/src/MultiClassesFactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..30e71d6473b0fc794f4b53bb4c69614c6c7cbd85 --- /dev/null +++ b/src/MultiClassesFactory.cpp @@ -0,0 +1,56 @@ +static const char *RcsId = "$Id: MultiClassesFactory.cpp,v 1.7 2019-01-18 09:31:15 alessio 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: alessio $ +// +// $Revision: 1.7 $ +// $Date: 2019-01-18 09:31:15 $ +// +// $HeadURL: $ +// +//============================================================================= +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +//============================================================================= + +#include <tango.h> +#include <Socket2Class.h> +#include <Serial2Class.h> +#include <Agilent4uhvClass.h> +#include <IonpumpClass.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(Agilent4uhv_ns::Agilent4uhvClass::init("Agilent4uhv")); + add_class(Ionpump_ns::IonpumpClass::init("Ionpump")); +} diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..287d209b9ab6479541953e95ea7edd5798f5ae6b --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,87 @@ +/*----- PROTECTED REGION ID(Agilent4uhv::main.cpp) ENABLED START -----*/ +static const char *RcsId = "$Id: main.cpp,v 1.2 2014-10-09 13:24:10 alessio Exp $"; +//============================================================================= +// +// file : main.cpp +// +// description : C++ source for the Agilent4uhv 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 : +// +// 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.2 $ +// $Date: 2014-10-09 13:24:10 $ +// +// $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 -----*/ // Agilent4uhv::main.cpp