From 345563fcc725e15087e9f937f638724c9a5239c2 Mon Sep 17 00:00:00 2001
From: Claudio Scafuri <claudio.scafuri@elettra.eu>
Date: Thu, 23 Apr 2020 10:24:54 +0200
Subject: [PATCH] first import from cvs repo fermi/servers/ionpump release_08

---
 .gitignore                  |  19 ++
 Makefile                    |   9 +
 src/ClassFactory.cpp        |  52 +++
 src/Ionpump.cpp             | 512 +++++++++++++++++++++++++++++
 src/Ionpump.h               | 212 ++++++++++++
 src/Ionpump.xmi             |  58 ++++
 src/IonpumpClass.cpp        | 628 ++++++++++++++++++++++++++++++++++++
 src/IonpumpClass.h          | 151 +++++++++
 src/IonpumpStateMachine.cpp | 108 +++++++
 src/main.cpp                |  87 +++++
 10 files changed, 1836 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Makefile
 create mode 100644 src/ClassFactory.cpp
 create mode 100644 src/Ionpump.cpp
 create mode 100644 src/Ionpump.h
 create mode 100644 src/Ionpump.xmi
 create mode 100644 src/IonpumpClass.cpp
 create mode 100644 src/IonpumpClass.h
 create mode 100644 src/IonpumpStateMachine.cpp
 create mode 100644 src/main.cpp

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f768f79
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+.pydevproject
+.project
+.cproject
+.settings
+obj
+bin
+core*
+*~
+*.pyc
+*.so
+*.so*
+.pylintrc
+.metadata
+.idea
+.cvsignore
+.nse_depinfo
+software
+oldsrc
+CVS
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c47af5a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+NAME_SRV = ionpump-srv
+
+CXXFLAGS =
+LDFLAGS =
+
+include ../Make.in
+
+test: bin/${NAME_SRV}
+	LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(SDKTARGETSYSROOT)/usr/lib $(LOADER) bin/${NAME_SRV} test -v4
diff --git a/src/ClassFactory.cpp b/src/ClassFactory.cpp
new file mode 100644
index 0000000..027f14f
--- /dev/null
+++ b/src/ClassFactory.cpp
@@ -0,0 +1,52 @@
+/*----- PROTECTED REGION ID(Ionpump::ClassFactory.cpp) ENABLED START -----*/
+static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/ionpump/src/ClassFactory.cpp,v 1.2 2014-10-13 10:15:01 alessio Exp $";
+//+=============================================================================
+//
+// file :        ClassFactory.cpp
+//
+// description : C++ source for the class_factory method of the DServer
+//               device class. This method is responsible to create
+//               all class singletin for a device server. It is called
+//               at device server startup
+//
+// project :     TANGO Device Server
+//
+// $Author: alessio $ Giulio Gaio
+//
+// $Revision: 1.2 $ 1.0
+//
+// $Log: ClassFactory.cpp,v $
+// Revision 1.2  2014-10-13 10:15:01  alessio
+// Regenerate with latest Pogo
+//
+// Revision 1.1.1.1  2013-08-12 09:36:49  lorenzo
+// mport.
+//
+//
+// copyleft :   Sincrotrone Trieste S.C.p.A.
+//              Strada Statale 14 - km 163,5 in AREA Science Park
+//              34012 Basovizza, Trieste ITALY
+//
+//-=============================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - ELETTRA U.O. Controlli
+//=============================================================================
+
+
+#include <tango.h>
+#include <IonpumpClass.h>
+
+/**
+ *	Create IonpumpClass singleton and store it in DServer object.
+ */
+
+void Tango::DServer::class_factory()
+{
+
+	add_class(Ionpump_ns::IonpumpClass::init("Ionpump"));
+
+}
+/*----- PROTECTED REGION END -----*/	//	Ionpump::ClassFactory.cpp
diff --git a/src/Ionpump.cpp b/src/Ionpump.cpp
new file mode 100644
index 0000000..57035c3
--- /dev/null
+++ b/src/Ionpump.cpp
@@ -0,0 +1,512 @@
+/*----- PROTECTED REGION ID(Ionpump.cpp) ENABLED START -----*/
+static const char *RcsId = "$Id: Ionpump.cpp,v 1.9 2019-01-30 16:37:36 alessio Exp $";
+//=============================================================================
+//
+// file :        Ionpump.cpp
+//
+// description : C++ source for the Ionpump 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
+//               Ionpump are implemented in this file.
+//
+// project :     Ionpump device server
+//
+// 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.9 $
+// $Date: 2019-01-30 16:37:36 $
+//
+// $HeadURL:  $
+//
+//=============================================================================
+//                This file is generated by POGO
+//        (Program Obviously used to Generate tango Object)
+//=============================================================================
+
+
+#include <tango.h>
+#include <Ionpump.h>
+#include <IonpumpClass.h>
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump.cpp
+
+/**
+ *  Ionpump class description:
+ *    This is the device server of the ion pump.
+ */
+
+//================================================================
+//  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:
+//================================================================
+//  Pressure  |  Tango::DevDouble	Scalar
+//  Voltage   |  Tango::DevDouble	Scalar
+//  Current   |  Tango::DevDouble	Scalar
+//================================================================
+
+namespace Ionpump_ns
+{
+/*----- PROTECTED REGION ID(Ionpump::namespace_starting) ENABLED START -----*/
+
+//	static initializations
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump::namespace_starting
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::Ionpump()
+ *	Description : Constructors for a Tango device
+ *                implementing the classIonpump
+ */
+//--------------------------------------------------------
+Ionpump::Ionpump(Tango::DeviceClass *cl, string &s)
+ : TANGO_BASE_CLASS(cl, s.c_str())
+{
+	/*----- PROTECTED REGION ID(Ionpump::constructor_1) ENABLED START -----*/
+	init_device();
+	
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::constructor_1
+}
+//--------------------------------------------------------
+Ionpump::Ionpump(Tango::DeviceClass *cl, const char *s)
+ : TANGO_BASE_CLASS(cl, s)
+{
+	/*----- PROTECTED REGION ID(Ionpump::constructor_2) ENABLED START -----*/
+	init_device();
+	
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::constructor_2
+}
+//--------------------------------------------------------
+Ionpump::Ionpump(Tango::DeviceClass *cl, const char *s, const char *d)
+ : TANGO_BASE_CLASS(cl, s, d)
+{
+	/*----- PROTECTED REGION ID(Ionpump::constructor_3) ENABLED START -----*/
+	init_device();
+	
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::constructor_3
+}
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::delete_device()
+ *	Description : will be called at device destruction or at init command
+ */
+//--------------------------------------------------------
+void Ionpump::delete_device()
+{
+	DEBUG_STREAM << "Ionpump::delete_device() " << device_name << endl;
+	/*----- PROTECTED REGION ID(Ionpump::delete_device) ENABLED START -----*/
+	
+	//	Delete device allocated objects
+	//	Delete device's allocated object
+	
+	if(attr_Pressure_read) {
+		delete attr_Pressure_read;
+		attr_Pressure_read = 0;
+	}
+	
+	if(attr_Voltage_read) {
+		delete attr_Voltage_read;
+		attr_Voltage_read = 0;
+	}	
+	
+	if(attr_Current_read) {
+		delete attr_Current_read;
+		attr_Current_read = 0;
+	}
+	
+	if (devps) {
+		delete devps;
+		devps = 0;
+	}
+
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::delete_device
+}
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::init_device()
+ *	Description : will be called at device initialization.
+ */
+//--------------------------------------------------------
+void Ionpump::init_device()
+{
+	DEBUG_STREAM << "Ionpump::init_device() create device " << device_name << endl;
+	/*----- PROTECTED REGION ID(Ionpump::init_device_before) ENABLED START -----*/
+	
+	//	Initialization before get_device_property() call
+	attr_Pressure_read = new Tango::DevDouble;
+	*attr_Pressure_read = 0;
+	
+	attr_Voltage_read = new Tango::DevDouble;
+	*attr_Voltage_read = 0;
+
+	attr_Current_read = new Tango::DevDouble;
+	*attr_Current_read = 0;
+
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::init_device_before
+	
+	//	No device property to be read from database
+	
+	/*----- PROTECTED REGION ID(Ionpump::init_device) ENABLED START -----*/
+	
+	//	Initialize device
+
+	try {
+		get_ps_name();
+	}
+	catch(Tango::DevFailed &e) {
+		cout << "Can't get dual name" << endl;
+		exit(1);
+	}
+	
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::init_device
+}
+
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::always_executed_hook()
+ *	Description : method always executed before any command is executed
+ */
+//--------------------------------------------------------
+void Ionpump::always_executed_hook()
+{
+	DEBUG_STREAM << "Ionpump::always_executed_hook()  " << device_name << endl;
+	/*----- PROTECTED REGION ID(Ionpump::always_executed_hook) ENABLED START -----*/
+	
+	//	code always executed before all requests
+	/*
+	 * bit 0 = off(0) --- on(1)
+	 * bit 1 = loc(0) --- rem(1)
+	 * bit 2 = noerr(0) --- err(1)
+	 * bit 3 = fix(0) --- step(1)
+	 * bit 4 = start(0) --- protect(1)
+	 * bit 5 = panel interlock (1 = active)
+	 * bit 6 = remote interlock (1 = active)
+	 * bit 7 = cable interlock (1 = active)
+	 */	
+	
+	char mask[12];
+	std::stringstream s;
+	
+	sprintf(mask,"StatMask%d",channel);
+	string stat_attr(mask);
+	
+	long statmask = 0;
+
+	try {	
+		devps->read_attribute(stat_attr) >> statmask;
+
+		if ((statmask & 0x4) || (statmask & 0xE0)) {
+			set_state(Tango::FAULT);
+			s << "Ion pump ERROR" << endl;	
+		} else if (statmask & 0x1) {
+			set_state(Tango::ON);
+			s << "Ion pump is ON" << endl;	
+		} else {
+			set_state(Tango::OFF);
+			s << "Ion pump is OFF" << endl;		
+		}	
+	} catch(Tango::DevFailed &e) {
+		set_state(Tango::FAULT);
+		s << "Error reading PS status" << endl;
+	}		
+	
+	set_status(s.str());
+
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::always_executed_hook
+}
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::read_attr_hardware()
+ *	Description : Hardware acquisition for attributes
+ */
+//--------------------------------------------------------
+void Ionpump::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list))
+{
+	DEBUG_STREAM << "Ionpump::read_attr_hardware(vector<long> &attr_list) entering... " << endl;
+	/*----- PROTECTED REGION ID(Ionpump::read_attr_hardware) ENABLED START -----*/
+	
+	//	Add your own code
+	//	Add your own code here
+
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::read_attr_hardware
+}
+
+//--------------------------------------------------------
+/**
+ *	Read attribute Pressure related method
+ *	Description: Ion pump pressure.
+ *
+ *	Data type:	Tango::DevDouble
+ *	Attr type:	Scalar
+ */
+//--------------------------------------------------------
+void Ionpump::read_Pressure(Tango::Attribute &attr)
+{
+	DEBUG_STREAM << "Ionpump::read_Pressure(Tango::Attribute &attr) entering... " << endl;
+	/*----- PROTECTED REGION ID(Ionpump::read_Pressure) ENABLED START -----*/
+	double pressure;
+	
+	char mask[12];
+	sprintf(mask,"Pressure%d",channel);
+	string press_attr(mask);
+	
+	try {	
+		devps->read_attribute(press_attr) >> pressure;
+	}
+	catch(Tango::DevFailed &e) {
+		TangoSys_MemStream out_stream;
+		out_stream << "Reading dual failed" << ends;
+		Tango::Except::re_throw_exception(e,
+			(const char *)"Error reading pressure",
+			out_stream.str(),
+			(const char *) "Ionpump::read_Pressure()", Tango::ERR);
+	}	
+
+	if (pressure == 0.0)
+		pressure = 1.0e-11;
+
+	if (pressure >= IONPUMP_MAX_THRESHOLD) {
+		TangoSys_MemStream out_stream;
+		out_stream << "Too high pressure" << ends;
+		Tango::Except::throw_exception(
+			(const char *)"Error reading pressure",
+			out_stream.str(),
+			(const char *) "Ionpump::read_Pressure()", Tango::ERR);
+	}			
+	
+	*attr_Pressure_read = pressure;
+	attr.set_value(attr_Pressure_read);
+
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::read_Pressure
+}
+//--------------------------------------------------------
+/**
+ *	Read attribute Voltage related method
+ *	Description: Ion pump voltage.
+ *
+ *	Data type:	Tango::DevDouble
+ *	Attr type:	Scalar
+ */
+//--------------------------------------------------------
+void Ionpump::read_Voltage(Tango::Attribute &attr)
+{
+	DEBUG_STREAM << "Ionpump::read_Voltage(Tango::Attribute &attr) entering... " << endl;
+	/*----- PROTECTED REGION ID(Ionpump::read_Voltage) ENABLED START -----*/
+	double voltage;
+	
+	char mask[12];
+	sprintf(mask,"Voltage%d",channel);
+	string volt_attr(mask);
+	
+	try {	
+		devps->read_attribute(volt_attr) >> voltage;
+	}
+	catch(Tango::DevFailed &e) {
+		TangoSys_MemStream out_stream;
+		out_stream << "Error reading voltage" << ends;
+		Tango::Except::re_throw_exception(e,
+			(const char *)"Reading voltage failed",
+			out_stream.str(),
+			(const char *) "Ionpump::read_Voltage()", Tango::ERR);
+	}	
+
+	*attr_Voltage_read = voltage;
+
+	attr.set_value(attr_Voltage_read);
+
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::read_Voltage
+}
+//--------------------------------------------------------
+/**
+ *	Read attribute Current related method
+ *	Description: Ion pump current.
+ *
+ *	Data type:	Tango::DevDouble
+ *	Attr type:	Scalar
+ */
+//--------------------------------------------------------
+void Ionpump::read_Current(Tango::Attribute &attr)
+{
+	DEBUG_STREAM << "Ionpump::read_Current(Tango::Attribute &attr) entering... " << endl;
+	/*----- PROTECTED REGION ID(Ionpump::read_Current) ENABLED START -----*/
+	double current;
+	
+	char mask[12];
+	sprintf(mask,"Current%d",channel);
+	string curr_attr(mask);
+	
+	try {	
+		devps->read_attribute(curr_attr) >> current;
+	}
+	catch(Tango::DevFailed &e) {
+		TangoSys_MemStream out_stream;
+		out_stream << "Error reading current" << ends;
+		Tango::Except::re_throw_exception(e,
+			(const char *)"Reading current failed",
+			out_stream.str(),
+			(const char *) "Ionpump::read_Current()", Tango::ERR);
+	}	
+
+	*attr_Current_read = current;
+
+	attr.set_value(attr_Current_read);
+
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::read_Current
+}
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::add_dynamic_attributes()
+ *	Description : Create the dynamic attributes if any
+ *                for specified device.
+ */
+//--------------------------------------------------------
+void Ionpump::add_dynamic_attributes()
+{
+	/*----- PROTECTED REGION ID(Ionpump::add_dynamic_attributes) ENABLED START -----*/
+	
+	//	Add your own code to create and add dynamic attributes if any
+	
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::add_dynamic_attributes
+}
+
+
+/*----- PROTECTED REGION ID(Ionpump::namespace_ending) ENABLED START -----*/
+
+//	Additional Methods
+//+------------------------------------------------------------------
+/**
+ *	method:	Dual::get_ps_name()
+ *          Get ps name
+ *     
+ */
+//+------------------------------------------------------------------
+void Ionpump::get_ps_name()
+{
+	DEBUG_STREAM << "Dual::get_ps_name(): entering... !" << endl;
+
+	//	Add your own code to control device here
+	using namespace Tango; 
+	char count;
+	Database *db = new Database();	
+	int found_flag = 0;
+
+	DbData db_data_ps;
+	db_data_ps.push_back(DbDatum("power_supply"));
+	db->get_property("vacuum",db_data_ps);
+
+	if (db_data_ps[0].is_empty()) {
+		cout << "Cant'find vacuum ps devices in database" << endl;	
+		Tango::Except::throw_exception(
+				(const char *) "Cant'find vacuum ps device in database",
+				(const char *) "No ps devices found",
+				(const char *) "Dual::get_sip_names()",Tango::ERR);		
+	}
+	else {
+		vector<string> device_names_ps;
+		
+		db_data_ps[0] >> device_names_ps;
+	
+		for (vector<string>::const_iterator it = device_names_ps.begin(); it < device_names_ps.end(); it++) {
+			std::string token;
+			std::istringstream iss(*it);
+			count = 0;
+			found_flag = 0;
+			while ( getline(iss, token, ':') ) {
+				switch (count) {
+					case 0: psname = token;
+					        break;
+					case 1: if (device_name == token) {
+							found_flag = 1;
+						}	
+						break;
+					case 2: if (device_name == token) {
+							found_flag = 2;
+						}	
+					        break;
+					case 3: if (device_name == token) {
+							found_flag = 3;
+						}	
+					        break;
+					case 4: if (device_name == token) {
+							found_flag = 4;
+						}	
+					        break;
+				}
+				
+				if (found_flag)
+					break;
+				
+				count++;
+				if (count >= 5)
+					break;										
+   			}
+			
+			if (found_flag)
+				break;
+									
+		}		
+	
+	}
+	
+	/* ps name not found in database */
+	if (found_flag == 0) {
+		cout << "No ps found" << endl;			
+		Tango::Except::throw_exception(
+				(const char *) "No ps found",
+				(const char *) "Invalid vacuum PS resource format",
+				(const char *) "Dual::get_sip_names()",Tango::ERR);		
+	}		
+	else {
+
+		channel = found_flag;
+	
+		try {
+			devps = new Tango::DeviceProxy(psname);
+			/* connect to ps device (dual) */	
+			if (devps->ping()) {
+				cout << device_name << ": found ps device " + psname << " channel " << channel << endl;
+				devps->set_timeout_millis(IONPUMP_DEV_TOUT);
+			}	
+		} 
+		catch(Tango::DevFailed e) {
+			cout << device_name << ": not found ps device " + psname << " channel " << channel << endl;	
+		}	
+	}
+	
+	delete db;		
+	
+}
+
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump::namespace_ending
+} //	namespace
diff --git a/src/Ionpump.h b/src/Ionpump.h
new file mode 100644
index 0000000..1518bb2
--- /dev/null
+++ b/src/Ionpump.h
@@ -0,0 +1,212 @@
+/*----- PROTECTED REGION ID(Ionpump.h) ENABLED START -----*/
+//=============================================================================
+//
+// file :        Ionpump.h
+//
+// description : Include file for the Ionpump class
+//
+// project :     Ionpump device server
+//
+// 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.4 $
+// $Date: 2014-10-13 10:20:57 $
+//
+// $HeadURL:  $
+//
+//=============================================================================
+//                This file is generated by POGO
+//        (Program Obviously used to Generate tango Object)
+//=============================================================================
+
+
+#ifndef Ionpump_H
+#define Ionpump_H
+
+#include <tango.h>
+
+#define IONPUMP_DEV_TOUT 500
+#define IONPUMP_MAX_THRESHOLD 0.00001
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump.h
+
+/**
+ *  Ionpump class description:
+ *    This is the device server of the ion pump.
+ */
+
+namespace Ionpump_ns
+{
+/*----- PROTECTED REGION ID(Ionpump::Additional Class Declarations) ENABLED START -----*/
+
+//	Additional Class Declarations
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump::Additional Class Declarations
+
+class Ionpump : public TANGO_BASE_CLASS
+{
+
+/*----- PROTECTED REGION ID(Ionpump::Data Members) ENABLED START -----*/
+
+//	Add your own data members
+public:
+
+
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump::Data Members
+
+
+//	Attribute data members
+public:
+	Tango::DevDouble	*attr_Pressure_read;
+	Tango::DevDouble	*attr_Voltage_read;
+	Tango::DevDouble	*attr_Current_read;
+
+//	Constructors and destructors
+public:
+	/**
+	 * Constructs a newly device object.
+	 *
+	 *	@param cl	Class.
+	 *	@param s 	Device Name
+	 */
+	Ionpump(Tango::DeviceClass *cl,string &s);
+	/**
+	 * Constructs a newly device object.
+	 *
+	 *	@param cl	Class.
+	 *	@param s 	Device Name
+	 */
+	Ionpump(Tango::DeviceClass *cl,const char *s);
+	/**
+	 * Constructs a newly device object.
+	 *
+	 *	@param cl	Class.
+	 *	@param s 	Device name
+	 *	@param d	Device description.
+	 */
+	Ionpump(Tango::DeviceClass *cl,const char *s,const char *d);
+	/**
+	 * The device object destructor.
+	 */	
+	~Ionpump() {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();
+	/*
+	 *	Always executed method before execution command method.
+	 */
+	virtual void always_executed_hook();
+
+
+//	Attribute methods
+public:
+	//--------------------------------------------------------
+	/*
+	 *	Method      : Ionpump::read_attr_hardware()
+	 *	Description : Hardware acquisition for attributes.
+	 */
+	//--------------------------------------------------------
+	virtual void read_attr_hardware(vector<long> &attr_list);
+
+/**
+ *	Attribute Pressure related methods
+ *	Description: Ion pump pressure.
+ *
+ *	Data type:	Tango::DevDouble
+ *	Attr type:	Scalar
+ */
+	virtual void read_Pressure(Tango::Attribute &attr);
+	virtual bool is_Pressure_allowed(Tango::AttReqType type);
+/**
+ *	Attribute Voltage related methods
+ *	Description: Ion pump voltage.
+ *
+ *	Data type:	Tango::DevDouble
+ *	Attr type:	Scalar
+ */
+	virtual void read_Voltage(Tango::Attribute &attr);
+	virtual bool is_Voltage_allowed(Tango::AttReqType type);
+/**
+ *	Attribute Current related methods
+ *	Description: Ion pump current.
+ *
+ *	Data type:	Tango::DevDouble
+ *	Attr type:	Scalar
+ */
+	virtual void read_Current(Tango::Attribute &attr);
+	virtual bool is_Current_allowed(Tango::AttReqType type);
+
+
+	//--------------------------------------------------------
+	/**
+	 *	Method      : Ionpump::add_dynamic_attributes()
+	 *	Description : Add dynamic attributes if any.
+	 */
+	//--------------------------------------------------------
+	void add_dynamic_attributes();
+
+
+
+//	Command related methods
+public:
+
+
+	//--------------------------------------------------------
+	/**
+	 *	Method      : Ionpump::add_dynamic_commands()
+	 *	Description : Add dynamic commands if any.
+	 */
+	//--------------------------------------------------------
+	void add_dynamic_commands();
+
+/*----- PROTECTED REGION ID(Ionpump::Additional Method prototypes) ENABLED START -----*/
+
+//	Additional Method prototypes
+protected :	
+	Tango::DeviceProxy *devps;  // dual device server
+	short channel;
+	string psname;
+	
+/*
+ * get_sip_names()
+ * Get sip names from database
+ */
+	void get_ps_name(void);
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump::Additional Method prototypes
+};
+
+/*----- PROTECTED REGION ID(Ionpump::Additional Classes Definitions) ENABLED START -----*/
+
+//	Additional Classes Definitions
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump::Additional Classes Definitions
+
+}	//	End of namespace
+
+#endif   //	Ionpump_H
diff --git a/src/Ionpump.xmi b/src/Ionpump.xmi
new file mode 100644
index 0000000..79aa18d
--- /dev/null
+++ b/src/Ionpump.xmi
@@ -0,0 +1,58 @@
+<?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="Ionpump" pogoRevision="8.4">
+    <description description="This is the device server of the ion pump." title="Ionpump device server" sourcePath="/home/alessio/WIP/fermi/servers/ionpump/src" language="Cpp" filestogenerate="XMI   file,Code files" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false">
+      <inheritances classname="Device_4Impl" sourcePath=""/>
+      <identification contact="at elettra.eu> - Alessio Igor Bogani &lt;alessio.bogani" author="Alessio Igor Bogani &lt;alessio.bogani" emailDomain="elettra.eu>" classFamily="Vacuum" siteSpecific="" platform="Unix Like" bus="Socket" manufacturer="" reference=""/>
+    </description>
+    <commands name="State" description="This command gets the device state (stored in its &lt;i>device_state&lt;/i> 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="State Code">
+        <type xsi:type="pogoDsl:StateType"/>
+      </argout>
+      <status abstract="true" inherited="true" concrete="true" concreteHere="false"/>
+    </commands>
+    <commands name="Status" description="This command gets the device status (stored in its &lt;i>device_status&lt;/i> 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="Status description">
+        <type xsi:type="pogoDsl:ConstStringType"/>
+      </argout>
+      <status abstract="true" inherited="true" concrete="true" concreteHere="false"/>
+    </commands>
+    <attributes name="Pressure" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="0" maxY="0">
+      <dataType xsi:type="pogoDsl:DoubleType"/>
+      <changeEvent fire="false" libCheckCriteria="false"/>
+      <archiveEvent fire="false" libCheckCriteria="false"/>
+      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
+      <properties description="Ion pump pressure." label="Pressure" unit="mbar" standardUnit="1" displayUnit="mbar" format="%1.2e" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
+    </attributes>
+    <attributes name="Voltage" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="0" maxY="0">
+      <dataType xsi:type="pogoDsl:DoubleType"/>
+      <changeEvent fire="false" libCheckCriteria="false"/>
+      <archiveEvent fire="false" libCheckCriteria="false"/>
+      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
+      <properties description="Ion pump voltage." label="Voltage" unit="V" standardUnit="1" displayUnit="V" format="%1.2e" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
+    </attributes>
+    <attributes name="Current" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="0" maxY="0">
+      <dataType xsi:type="pogoDsl:DoubleType"/>
+      <changeEvent fire="false" libCheckCriteria="false"/>
+      <archiveEvent fire="false" libCheckCriteria="false"/>
+      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
+      <properties description="Ion pump current." label="Current" unit="A" standardUnit="1" displayUnit="A" format="%1.2e" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
+    </attributes>
+    <states name="ON" description="PS is ON">
+      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
+    </states>
+    <states name="OFF" description="PS is OFF">
+      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
+    </states>
+    <states name="FAULT" description="PS is in fault state">
+      <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
+    </states>
+    <preferences docHome="./doc_html" makefileHome="/usr/local/tango-8.1.2.c/share/pogo/preferences"/>
+  </classes>
+</pogoDsl:PogoSystem>
diff --git a/src/IonpumpClass.cpp b/src/IonpumpClass.cpp
new file mode 100644
index 0000000..5911732
--- /dev/null
+++ b/src/IonpumpClass.cpp
@@ -0,0 +1,628 @@
+/*----- PROTECTED REGION ID(IonpumpClass.cpp) ENABLED START -----*/
+static const char *RcsId      = "$Id: IonpumpClass.cpp,v 1.4 2017-06-14 11:48:04 alessio Exp $";
+static const char *TagName    = "Ionpump $Name:  $";
+static const char *CvsPath    = "$Source: /home/cvsadm/cvsroot/fermi/servers/ionpump/src/IonpumpClass.cpp,v $";
+static const char *SvnPath    = "$HeadURL:  $";
+static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc/ds_doc/";
+//=============================================================================
+//
+// file :        IonpumpClass.cpp
+//
+// description : C++ source for the IonpumpClass.
+//               A singleton class derived from DeviceClass.
+//               It implements the command and attribute list
+//               and all properties and methods required
+//               by the Ionpump once per process.
+//
+// project :     Ionpump device server
+//
+// 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.4 $
+// $Date: 2017-06-14 11:48:04 $
+//
+// $HeadURL:  $
+//
+//=============================================================================
+//                This file is generated by POGO
+//        (Program Obviously used to Generate tango Object)
+//=============================================================================
+
+
+#include <tango.h>
+#include <Ionpump.h>
+#include <IonpumpClass.h>
+
+/*----- PROTECTED REGION END -----*/	//	IonpumpClass.cpp
+
+//-------------------------------------------------------------------
+/**
+ *	Create IonpumpClass singleton and
+ *	return it in a C function for Python usage
+ */
+//-------------------------------------------------------------------
+extern "C" {
+#ifdef _TG_WINDOWS_
+
+__declspec(dllexport)
+
+#endif
+
+	Tango::DeviceClass *_create_Ionpump_class(const char *name) {
+		return Ionpump_ns::IonpumpClass::init(name);
+	}
+}
+
+namespace Ionpump_ns
+{
+//===================================================================
+//	Initialize pointer for singleton pattern
+//===================================================================
+IonpumpClass *IonpumpClass::_instance = NULL;
+
+//--------------------------------------------------------
+/**
+ * method : 		IonpumpClass::IonpumpClass(string &s)
+ * description : 	constructor for the IonpumpClass
+ *
+ * @param s	The class name
+ */
+//--------------------------------------------------------
+IonpumpClass::IonpumpClass(string &s):Tango::DeviceClass(s)
+{
+	cout2 << "Entering IonpumpClass constructor" << endl;
+	set_default_property();
+	write_class_property();
+
+	/*----- PROTECTED REGION ID(IonpumpClass::constructor) ENABLED START -----*/
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::constructor
+
+	cout2 << "Leaving IonpumpClass constructor" << endl;
+}
+
+//--------------------------------------------------------
+/**
+ * method : 		IonpumpClass::~IonpumpClass()
+ * description : 	destructor for the IonpumpClass
+ */
+//--------------------------------------------------------
+IonpumpClass::~IonpumpClass()
+{
+	/*----- PROTECTED REGION ID(IonpumpClass::destructor) ENABLED START -----*/
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::destructor
+
+	_instance = NULL;
+}
+
+
+//--------------------------------------------------------
+/**
+ * method : 		IonpumpClass::init
+ * description : 	Create the object if not already done.
+ *                  Otherwise, just return a pointer to the object
+ *
+ * @param	name	The class name
+ */
+//--------------------------------------------------------
+IonpumpClass *IonpumpClass::init(const char *name)
+{
+	if (_instance == NULL)
+	{
+		try
+		{
+			string s(name);
+			_instance = new IonpumpClass(s);
+		}
+		catch (bad_alloc &)
+		{
+			throw;
+		}		
+	}		
+	return _instance;
+}
+
+//--------------------------------------------------------
+/**
+ * method : 		IonpumpClass::instance
+ * description : 	Check if object already created,
+ *                  and return a pointer to the object
+ */
+//--------------------------------------------------------
+IonpumpClass *IonpumpClass::instance()
+{
+	if (_instance == NULL)
+	{
+		cerr << "Class is not initialised !!" << endl;
+		exit(-1);
+	}
+	return _instance;
+}
+
+
+
+//===================================================================
+//	Command execution method calls
+//===================================================================
+
+//===================================================================
+//	Properties management
+//===================================================================
+//--------------------------------------------------------
+/**
+ *	Method      : IonpumpClass::get_class_property()
+ *	Description : Get the class property for specified name.
+ */
+//--------------------------------------------------------
+Tango::DbDatum IonpumpClass::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      : IonpumpClass::get_default_device_property()
+ *	Description : Return the default value for device property.
+ */
+//--------------------------------------------------------
+Tango::DbDatum IonpumpClass::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      : IonpumpClass::get_default_class_property()
+ *	Description : Return the default value for class property.
+ */
+//--------------------------------------------------------
+Tango::DbDatum IonpumpClass::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      : IonpumpClass::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 IonpumpClass::set_default_property()
+{
+	string	prop_name;
+	string	prop_desc;
+	string	prop_def;
+	vector<string>	vect_data;
+
+	//	Set Default Class Properties
+
+	//	Set Default device Properties
+}
+
+//--------------------------------------------------------
+/**
+ *	Method      : IonpumpClass::write_class_property()
+ *	Description : Set class description fields as property in database
+ */
+//--------------------------------------------------------
+void IonpumpClass::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("Ionpump device server");
+	title << str_title;
+	data.push_back(title);
+
+	//	Put Description
+	Tango::DbDatum	description("Description");
+	vector<string>	str_desc;
+	str_desc.push_back("This is the device server of the ion pump.");
+	description << str_desc;
+	data.push_back(description);
+
+	//	put cvs or svn location
+	string	filename("Ionpump");
+	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      : IonpumpClass::device_factory()
+ *	Description : Create the device object(s)
+ *                and store them in the device list
+ */
+//--------------------------------------------------------
+void IonpumpClass::device_factory(const Tango::DevVarStringArray *devlist_ptr)
+{
+	/*----- PROTECTED REGION ID(IonpumpClass::device_factory_before) ENABLED START -----*/
+	
+	//	Add your own code
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::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 Ionpump(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
+		Ionpump *dev = static_cast<Ionpump *>(device_list[device_list.size()-i]);
+		dev->add_dynamic_attributes();
+
+		//	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(IonpumpClass::device_factory_after) ENABLED START -----*/
+	
+	//	Add your own code
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::device_factory_after
+}
+//--------------------------------------------------------
+/**
+ *	Method      : IonpumpClass::attribute_factory()
+ *	Description : Create the attribute object(s)
+ *                and store them in the attribute list
+ */
+//--------------------------------------------------------
+void IonpumpClass::attribute_factory(vector<Tango::Attr *> &att_list)
+{
+	/*----- PROTECTED REGION ID(IonpumpClass::attribute_factory_before) ENABLED START -----*/
+	
+	//	Add your own code
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::attribute_factory_before
+	//	Attribute : Pressure
+	PressureAttrib	*pressure = new PressureAttrib();
+	Tango::UserDefaultAttrProp	pressure_prop;
+	pressure_prop.set_description("Ion pump pressure.");
+	pressure_prop.set_label("Pressure");
+	pressure_prop.set_unit("mbar");
+	pressure_prop.set_standard_unit("1");
+	pressure_prop.set_display_unit("mbar");
+	pressure_prop.set_format("%1.2e");
+	//	max_value	not set for Pressure
+	//	min_value	not set for Pressure
+	//	max_alarm	not set for Pressure
+	//	min_alarm	not set for Pressure
+	//	max_warning	not set for Pressure
+	//	min_warning	not set for Pressure
+	//	delta_t	not set for Pressure
+	//	delta_val	not set for Pressure
+	
+	pressure->set_default_properties(pressure_prop);
+	//	Not Polled
+	pressure->set_disp_level(Tango::OPERATOR);
+	//	Not Memorized
+	att_list.push_back(pressure);
+
+	//	Attribute : Voltage
+	VoltageAttrib	*voltage = new VoltageAttrib();
+	Tango::UserDefaultAttrProp	voltage_prop;
+	voltage_prop.set_description("Ion pump voltage.");
+	voltage_prop.set_label("Voltage");
+	voltage_prop.set_unit("V");
+	voltage_prop.set_standard_unit("1");
+	voltage_prop.set_display_unit("V");
+	voltage_prop.set_format("%1.2e");
+	//	max_value	not set for Voltage
+	//	min_value	not set for Voltage
+	//	max_alarm	not set for Voltage
+	//	min_alarm	not set for Voltage
+	//	max_warning	not set for Voltage
+	//	min_warning	not set for Voltage
+	//	delta_t	not set for Voltage
+	//	delta_val	not set for Voltage
+	
+	voltage->set_default_properties(voltage_prop);
+	//	Not Polled
+	voltage->set_disp_level(Tango::OPERATOR);
+	//	Not Memorized
+	att_list.push_back(voltage);
+
+	//	Attribute : Current
+	CurrentAttrib	*current = new CurrentAttrib();
+	Tango::UserDefaultAttrProp	current_prop;
+	current_prop.set_description("Ion pump current.");
+	current_prop.set_label("Current");
+	current_prop.set_unit("A");
+	current_prop.set_standard_unit("1");
+	current_prop.set_display_unit("A");
+	current_prop.set_format("%1.2e");
+	//	max_value	not set for Current
+	//	min_value	not set for Current
+	//	max_alarm	not set for Current
+	//	min_alarm	not set for Current
+	//	max_warning	not set for Current
+	//	min_warning	not set for Current
+	//	delta_t	not set for Current
+	//	delta_val	not set for Current
+	
+	current->set_default_properties(current_prop);
+	//	Not Polled
+	current->set_disp_level(Tango::OPERATOR);
+	//	Not Memorized
+	att_list.push_back(current);
+
+	//	Create a list of static attributes
+	create_static_attribute_list(get_class_attr()->get_attr_list());
+	/*----- PROTECTED REGION ID(IonpumpClass::attribute_factory_after) ENABLED START -----*/
+	
+	//	Add your own code
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::attribute_factory_after
+}
+//--------------------------------------------------------
+/**
+ *	Method      : IonpumpClass::command_factory()
+ *	Description : Create the command object(s)
+ *                and store them in the command list
+ */
+//--------------------------------------------------------
+void IonpumpClass::command_factory()
+{
+	/*----- PROTECTED REGION ID(IonpumpClass::command_factory_before) ENABLED START -----*/
+	
+	//	Add your own code
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::command_factory_before
+
+
+	/*----- PROTECTED REGION ID(IonpumpClass::command_factory_after) ENABLED START -----*/
+	
+	//	Add your own code
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::command_factory_after
+}
+
+//===================================================================
+//	Dynamic attributes related methods
+//===================================================================
+
+//--------------------------------------------------------
+/**
+ * method : 		IonpumpClass::create_static_attribute_list
+ * description : 	Create the a list of static attributes
+ *
+ * @param	att_list	the ceated attribute list 
+ */
+//--------------------------------------------------------
+void IonpumpClass::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(IonpumpClass::create_static_att_list) ENABLED START -----*/
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::create_static_att_list
+}
+
+
+//--------------------------------------------------------
+/**
+ * method : 		IonpumpClass::erase_dynamic_attributes
+ * description : 	delete the dynamic attributes if any.
+ *
+ * @param	devlist_ptr	the device list pointer
+ * @param	list of all attributes
+ */
+//--------------------------------------------------------
+void IonpumpClass::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());
+		Ionpump *dev = static_cast<Ionpump *> (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(IonpumpClass::erase_dynamic_attributes) ENABLED START -----*/
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::erase_dynamic_attributes
+}
+
+//--------------------------------------------------------
+/**
+ *	Method      : IonpumpClass::get_attr_by_name()
+ *	Description : returns Tango::Attr * object found by name
+ */
+//--------------------------------------------------------
+Tango::Attr *IonpumpClass::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(IonpumpClass::Additional Methods) ENABLED START -----*/
+
+/*----- PROTECTED REGION END -----*/	//	IonpumpClass::Additional Methods
+} //	namespace
diff --git a/src/IonpumpClass.h b/src/IonpumpClass.h
new file mode 100644
index 0000000..f8c9c4a
--- /dev/null
+++ b/src/IonpumpClass.h
@@ -0,0 +1,151 @@
+/*----- PROTECTED REGION ID(IonpumpClass.h) ENABLED START -----*/
+//=============================================================================
+//
+// file :        IonpumpClass.h
+//
+// description : Include for the Ionpump root class.
+//               This class is the singleton class for
+//                the Ionpump device class.
+//               It contains all properties and methods which the 
+//               Ionpump requires only once e.g. the commands.
+//
+// project :     Ionpump device server
+//
+// 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-13 10:15:01 $
+//
+// $HeadURL:  $
+//
+//=============================================================================
+//                This file is generated by POGO
+//        (Program Obviously used to Generate tango Object)
+//=============================================================================
+
+
+#ifndef IonpumpClass_H
+#define IonpumpClass_H
+
+#include <tango.h>
+#include <Ionpump.h>
+
+/*----- PROTECTED REGION END -----*/	//	IonpumpClass.h
+
+
+namespace Ionpump_ns
+{
+/*----- PROTECTED REGION ID(IonpumpClass::classes for dynamic creation) ENABLED START -----*/
+
+
+/*----- PROTECTED REGION END -----*/	//	IonpumpClass::classes for dynamic creation
+
+//=========================================
+//	Define classes for attributes
+//=========================================
+//	Attribute Pressure class definition
+class PressureAttrib: public Tango::Attr
+{
+public:
+	PressureAttrib():Attr("Pressure",
+			Tango::DEV_DOUBLE, Tango::READ) {};
+	~PressureAttrib() {};
+	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
+		{(static_cast<Ionpump *>(dev))->read_Pressure(att);}
+	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
+		{return (static_cast<Ionpump *>(dev))->is_Pressure_allowed(ty);}
+};
+
+//	Attribute Voltage class definition
+class VoltageAttrib: public Tango::Attr
+{
+public:
+	VoltageAttrib():Attr("Voltage",
+			Tango::DEV_DOUBLE, Tango::READ) {};
+	~VoltageAttrib() {};
+	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
+		{(static_cast<Ionpump *>(dev))->read_Voltage(att);}
+	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
+		{return (static_cast<Ionpump *>(dev))->is_Voltage_allowed(ty);}
+};
+
+//	Attribute Current class definition
+class CurrentAttrib: public Tango::Attr
+{
+public:
+	CurrentAttrib():Attr("Current",
+			Tango::DEV_DOUBLE, Tango::READ) {};
+	~CurrentAttrib() {};
+	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
+		{(static_cast<Ionpump *>(dev))->read_Current(att);}
+	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
+		{return (static_cast<Ionpump *>(dev))->is_Current_allowed(ty);}
+};
+
+
+/**
+ *	The IonpumpClass singleton definition
+ */
+
+#ifdef _TG_WINDOWS_
+class __declspec(dllexport)  IonpumpClass : public Tango::DeviceClass
+#else
+class IonpumpClass : public Tango::DeviceClass
+#endif
+{
+	/*----- PROTECTED REGION ID(IonpumpClass::Additionnal DServer data members) ENABLED START -----*/
+	
+	
+	/*----- PROTECTED REGION END -----*/	//	IonpumpClass::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 IonpumpClass *init(const char *);
+		static IonpumpClass *instance();
+		~IonpumpClass();
+		Tango::DbDatum	get_class_property(string &);
+		Tango::DbDatum	get_default_device_property(string &);
+		Tango::DbDatum	get_default_class_property(string &);
+	
+	protected:
+		IonpumpClass(string &);
+		static IonpumpClass *_instance;
+		void command_factory();
+		void attribute_factory(vector<Tango::Attr *> &);
+		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   //	Ionpump_H
diff --git a/src/IonpumpStateMachine.cpp b/src/IonpumpStateMachine.cpp
new file mode 100644
index 0000000..952d9b5
--- /dev/null
+++ b/src/IonpumpStateMachine.cpp
@@ -0,0 +1,108 @@
+/*----- PROTECTED REGION ID(IonpumpStateMachine.cpp) ENABLED START -----*/
+static const char *RcsId = "$Id: IonpumpStateMachine.cpp,v 1.2 2014-10-13 10:15:01 alessio Exp $";
+//=============================================================================
+//
+// file :        IonpumpStateMachine.cpp
+//
+// description : State machine file for the Ionpump class
+//
+// project :     Ionpump device server
+//
+// 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-13 10:15:01 $
+//
+// $HeadURL:  $
+//
+//=============================================================================
+//                This file is generated by POGO
+//        (Program Obviously used to Generate tango Object)
+//=============================================================================
+
+#include <Ionpump.h>
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump::IonpumpStateMachine.cpp
+
+//================================================================
+//  States  |  Description
+//================================================================
+//  ON      |  PS is ON
+//  OFF     |  PS is OFF
+//  FAULT   |  PS is in fault state
+
+
+namespace Ionpump_ns
+{
+//=================================================
+//		Attributes Allowed Methods
+//=================================================
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::is_Pressure_allowed()
+ *	Description : Execution allowed for Pressure attribute
+ */
+//--------------------------------------------------------
+bool Ionpump::is_Pressure_allowed(TANGO_UNUSED(Tango::AttReqType type))
+{
+
+	//	Not any excluded states for Pressure attribute in read access.
+	/*----- PROTECTED REGION ID(Ionpump::PressureStateAllowed_READ) ENABLED START -----*/
+	
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::PressureStateAllowed_READ
+	return true;
+}
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::is_Voltage_allowed()
+ *	Description : Execution allowed for Voltage attribute
+ */
+//--------------------------------------------------------
+bool Ionpump::is_Voltage_allowed(TANGO_UNUSED(Tango::AttReqType type))
+{
+
+	//	Not any excluded states for Voltage attribute in read access.
+	/*----- PROTECTED REGION ID(Ionpump::VoltageStateAllowed_READ) ENABLED START -----*/
+	
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::VoltageStateAllowed_READ
+	return true;
+}
+
+//--------------------------------------------------------
+/**
+ *	Method      : Ionpump::is_Current_allowed()
+ *	Description : Execution allowed for Current attribute
+ */
+//--------------------------------------------------------
+bool Ionpump::is_Current_allowed(TANGO_UNUSED(Tango::AttReqType type))
+{
+
+	//	Not any excluded states for Current attribute in read access.
+	/*----- PROTECTED REGION ID(Ionpump::CurrentStateAllowed_READ) ENABLED START -----*/
+	
+	/*----- PROTECTED REGION END -----*/	//	Ionpump::CurrentStateAllowed_READ
+	return true;
+}
+
+//=================================================
+//		Commands Allowed Methods
+//=================================================
+
+}	//	End of namespace
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..3b19539
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,87 @@
+/*----- PROTECTED REGION ID(Ionpump::main.cpp) ENABLED START -----*/
+static const char *RcsId = "$Id: main.cpp,v 1.2 2014-10-13 10:15:01 alessio Exp $";
+//=============================================================================
+//
+// file :        main.cpp
+//
+// description : C++ source for the Ionpump 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 :     Ionpump device server
+//
+// 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-13 10:15:01 $
+//
+// $HeadURL:  $
+//
+//=============================================================================
+//                This file is generated by POGO
+//        (Program Obviously used to Generate tango Object)
+//=============================================================================
+
+
+#include <tango.h>
+
+
+int main(int argc,char *argv[])
+{
+
+	Tango::Util *tg;
+
+	Tango::Util::_daemon = true;
+	Tango::Util::_sleep_between_connect = 10;	
+	
+	try
+	{	
+	
+		// Initialise the device server
+		//----------------------------------------
+		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;
+	}
+	tg->server_cleanup();
+	return(0);
+}
+
+
+/*----- PROTECTED REGION END -----*/	//	Ionpump::main.cpp
-- 
GitLab