diff --git a/docs/fug-e-srv-eclinpsa-1.conf b/docs/fug-e-srv-eclinpsa-1.conf
new file mode 100644
index 0000000000000000000000000000000000000000..dc78af44f620feafe41fdd8eafb3d2613405a664
--- /dev/null
+++ b/docs/fug-e-srv-eclinpsa-1.conf
@@ -0,0 +1,66 @@
+#
+# Resource backup , created Mon Oct 04 11:30:26 CEST 2021
+#
+
+#---------------------------------------------------------
+# SERVER fug-e-srv/eclinpsa-1, Fug device declaration
+#---------------------------------------------------------
+
+fug-e-srv/eclinpsa-1/DEVICE/Fug: "eclinpsa-1/fug/p1"
+
+
+# --- eclinpsa-1/fug/p1 properties
+
+eclinpsa-1/fug/p1->lastcurset: 0
+eclinpsa-1/fug/p1->lastvoltset: 0
+eclinpsa-1/fug/p1->maxcurrent: 0.35
+eclinpsa-1/fug/p1->MaxDiffLen: 6
+eclinpsa-1/fug/p1->maxvoltage: 27.2
+eclinpsa-1/fug/p1->pausetime: 300
+eclinpsa-1/fug/p1->polled_attr: currentset,\ 
+                                1000
+eclinpsa-1/fug/p1->readback: true
+eclinpsa-1/fug/p1->serialdevice: "tom:20000/eclinpsa-1/ttyTIP/0"
+eclinpsa-1/fug/p1->sleeptime: 500
+eclinpsa-1/fug/p1->StringTerminator: 13
+
+
+# --- eclinpsa-1/fug/p1 attribute properties
+
+eclinpsa-1/fug/p1/CurrentSet->abs_change: 0.001
+eclinpsa-1/fug/p1/CurrentSet->description: "This is the current charge soil setting of the Fug.Some Fug verisions",\ 
+                                           "doesn't support this query.",\ 
+                                           "In this case last setting is stored in last curset device property"
+eclinpsa-1/fug/p1/CurrentSet->display_unit: A
+eclinpsa-1/fug/p1/CurrentSet->event_period: 1000
+eclinpsa-1/fug/p1/CurrentSet->format: %1.4f
+eclinpsa-1/fug/p1/CurrentSet->standard_unit: 1
+eclinpsa-1/fug/p1/CurrentSet->unit: A
+eclinpsa-1/fug/p1/MaxDiffVoltage->abs_change: 0.001
+eclinpsa-1/fug/p1/MaxDiffVoltage->description: "Actual measured voltage."
+eclinpsa-1/fug/p1/MaxDiffVoltage->display_unit: KVolt
+eclinpsa-1/fug/p1/MaxDiffVoltage->event_period: 1000
+eclinpsa-1/fug/p1/MaxDiffVoltage->format: %2.3f
+eclinpsa-1/fug/p1/MaxDiffVoltage->standard_unit: 1000
+eclinpsa-1/fug/p1/MaxDiffVoltage->unit: KVolt
+
+#---------------------------------------------------------
+# CLASS Fug properties
+#---------------------------------------------------------
+
+CLASS/Fug->cvs_location: "/home/cvsadm/cvsroot/fermi/servers/fug_elettra/src/"
+CLASS/Fug->cvs_tag: release_01
+CLASS/Fug->Description: "This is FuG HV power supply device server.",\ 
+                        "It supports the original version of FuG RS-232 interface: no reading of the",\ 
+                        setting.
+CLASS/Fug->doc_url: "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/"
+CLASS/Fug->InheritedFrom: Device_4Impl
+CLASS/Fug->ProjectTitle: "FuG HV power supply device server"
+
+# CLASS Fug attribute properties
+
+
+
+# --- dserver/fug-e-srv/eclinpsa-1 properties
+
+dserver/fug-e-srv/eclinpsa-1->polling_threads_pool_conf: "eclinpsa-1/fug/p1"
diff --git a/docs/fug-e-srv-eclinpsa-2.conf b/docs/fug-e-srv-eclinpsa-2.conf
new file mode 100644
index 0000000000000000000000000000000000000000..21f18ee130b6223426955b99cabb351bdc4be5ce
--- /dev/null
+++ b/docs/fug-e-srv-eclinpsa-2.conf
@@ -0,0 +1,68 @@
+#
+# Resource backup , created Fri Oct 29 13:37:53 CEST 2021
+#
+
+#---------------------------------------------------------
+# SERVER fug-e-srv/eclinpsa-2, Fug device declaration
+#---------------------------------------------------------
+
+fug-e-srv/eclinpsa-2/DEVICE/Fug: "eclinpsa-2/fug/p2"
+
+
+# --- eclinpsa-2/fug/p2 properties
+
+eclinpsa-2/fug/p2->lastcurset: 0
+eclinpsa-2/fug/p2->lastvoltset: 0
+eclinpsa-2/fug/p2->maxcurrent: 0.35
+eclinpsa-2/fug/p2->MaxDiffLen: 6
+eclinpsa-2/fug/p2->maxvoltage: 27.2
+eclinpsa-2/fug/p2->pausetime: 300
+eclinpsa-2/fug/p2->polled_attr: currentset,\ 
+                                1000,\ 
+                                maxdiffvoltage,\ 
+                                1000
+eclinpsa-2/fug/p2->readback: true
+eclinpsa-2/fug/p2->serialdevice: "tom:20000/eclinpsa-2/ttyTIP/0"
+eclinpsa-2/fug/p2->sleeptime: 500
+eclinpsa-2/fug/p2->StringTerminator: 13
+eclinpsa-2/fug/p2->__SubDevices: "tom:20000/eclinpsa-2/ttytip/0"
+
+# --- eclinpsa-2/fug/p2 attribute properties
+
+eclinpsa-2/fug/p2/CurrentSet->abs_change: 0.001
+eclinpsa-2/fug/p2/CurrentSet->description: "This is the current charge soil setting of the Fug.Some Fug verisions",\ 
+                                           "doesn't support this query.",\ 
+                                           "In this case last setting is stored in last curset device property"
+eclinpsa-2/fug/p2/CurrentSet->display_unit: A
+eclinpsa-2/fug/p2/CurrentSet->event_period: 1000
+eclinpsa-2/fug/p2/CurrentSet->format: %1.4f
+eclinpsa-2/fug/p2/CurrentSet->standard_unit: 1
+eclinpsa-2/fug/p2/CurrentSet->unit: A
+eclinpsa-2/fug/p2/MaxDiffVoltage->abs_change: 0.001
+eclinpsa-2/fug/p2/MaxDiffVoltage->description: "Actual measured voltage."
+eclinpsa-2/fug/p2/MaxDiffVoltage->display_unit: KVolt
+eclinpsa-2/fug/p2/MaxDiffVoltage->event_period: 1000
+eclinpsa-2/fug/p2/MaxDiffVoltage->format: %2.3f
+eclinpsa-2/fug/p2/MaxDiffVoltage->standard_unit: 1000
+eclinpsa-2/fug/p2/MaxDiffVoltage->unit: KVolt
+
+#---------------------------------------------------------
+# CLASS Fug properties
+#---------------------------------------------------------
+
+CLASS/Fug->cvs_location: "/home/cvsadm/cvsroot/fermi/servers/fug_elettra/src/"
+CLASS/Fug->cvs_tag: release_01
+CLASS/Fug->Description: "This is FuG HV power supply device server.",\ 
+                        "It supports the original version of FuG RS-232 interface: no reading of the",\ 
+                        setting.
+CLASS/Fug->doc_url: "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/"
+CLASS/Fug->InheritedFrom: Device_4Impl
+CLASS/Fug->ProjectTitle: "FuG HV power supply device server"
+
+# CLASS Fug attribute properties
+
+
+
+# --- dserver/fug-e-srv/eclinpsa-2 properties
+
+dserver/fug-e-srv/eclinpsa-2->polling_threads_pool_conf: "eclinpsa-2/fug/p2"
diff --git a/src/ClassFactory.cpp b/src/ClassFactory.cpp
index a0cd802547be5fa0f722d40f16d537765199615f..afaf99d2d13682c9396b4bc960fa060ed3291658 100644
--- a/src/ClassFactory.cpp
+++ b/src/ClassFactory.cpp
@@ -1,4 +1,3 @@
-static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fug_elettra/src/ClassFactory.cpp,v 1.1.1.1 2014-10-22 10:12:39 giulio Exp $";
 //+=============================================================================
 //
 // file :        ClassFactory.cpp
diff --git a/src/Fug.cpp b/src/Fug.cpp
index 75bb0e156bbba028d2c8198843f34f428fc1b19d..fed09d093257351d3c8f446c9a10b51250514eff 100644
--- a/src/Fug.cpp
+++ b/src/Fug.cpp
@@ -1,9 +1,8 @@
-static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fug_elettra/src/Fug.cpp,v 1.1.1.1 2014-10-22 10:12:39 giulio Exp $";
 //+=============================================================================
 //
 // file :         Fug.cpp
 //
-// description :  C++ source for the Fug and its commands. 
+// description :  C++ source for the Fug 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
@@ -30,11 +29,9 @@ static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fug_elet
 //  		This file is generated by POGO
 //	(Program Obviously used to Generate tango Object)
 //
-//         (c) - Software Engineering Group - ESRF 
+//         (c) - Software Engineering Group - ESRF
 //=============================================================================
 
-
-
 //===================================================================
 //
 //	The following table gives the correspondance
@@ -51,651 +48,624 @@ static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fug_elet
 //
 //===================================================================
 
-
-#include <tango.h>
 #include <Fug.h>
 #include <FugClass.h>
+#include <tango.h>
 
 #include <iostream>
-#include "Serial.h"
-#include "fugthread.h"
+#include <string>
+#include <vector>
 
-using namespace std;
+#include "fugthread.h"
 
-namespace Fug_ns
-{
+namespace Fug_ns {
 
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::Fug(string &s)
-// 
+//
 // description : 	constructor for simulated Fug
 //
 // in : - cl : Pointer to the DeviceClass object
-//      - s : Device name 
+//      - s : Device name
 //
 //-----------------------------------------------------------------------------
-Fug::Fug(Tango::DeviceClass *cl,string &s)
-:TANGO_BASE_CLASS(cl,s.c_str())
-{
-	init_device();
+Fug::Fug(Tango::DeviceClass *cl, string &s) : TANGO_BASE_CLASS(cl, s.c_str()) {
+  init_device();
 }
 
-Fug::Fug(Tango::DeviceClass *cl,const char *s)
-:TANGO_BASE_CLASS(cl,s)
-{
-	init_device();
+Fug::Fug(Tango::DeviceClass *cl, const char *s) : TANGO_BASE_CLASS(cl, s) {
+  init_device();
 }
 
-Fug::Fug(Tango::DeviceClass *cl,const char *s,const char *d)
-:TANGO_BASE_CLASS(cl,s,d)
-{
-	init_device();
+Fug::Fug(Tango::DeviceClass *cl, const char *s, const char *d)
+    : TANGO_BASE_CLASS(cl, s, d) {
+  init_device();
 }
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::delete_device()
-// 
+//
 // description : 	will be called at device destruction or at init command.
 //
 //-----------------------------------------------------------------------------
-void Fug::delete_device()
-{
-	//	Delete device's allocated object
-	abortflag = 1;
-	
-	sleep(2);
-	
-	if (devserial) {
-		delete devserial;
-		devserial = 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(attr_VoltageSet_read) {
-		delete attr_VoltageSet_read;
-		attr_VoltageSet_read = 0;
-	}
-	
-	if(attr_CurrentSet_read) {
-		delete attr_CurrentSet_read;
-		attr_CurrentSet_read = 0;
-	}		
-	
-	if(attr_MaxDiffVoltage_read) {
-		delete attr_MaxDiffVoltage_read;
-		attr_MaxDiffVoltage_read = 0;
-	}		
-
-	delete mutex;	
-
+void Fug::delete_device() {
+  //	Delete device's allocated object
+  abortflag = 1;
+
+  sleep(2);
+
+  if (devserial) {
+    delete devserial;
+    devserial = 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 (attr_VoltageSet_read) {
+    delete attr_VoltageSet_read;
+    attr_VoltageSet_read = 0;
+  }
+
+  if (attr_CurrentSet_read) {
+    delete attr_CurrentSet_read;
+    attr_CurrentSet_read = 0;
+  }
+
+  if (attr_MaxDiffVoltage_read) {
+    delete attr_MaxDiffVoltage_read;
+    attr_MaxDiffVoltage_read = 0;
+  }
+
+  delete mutex;
 }
 
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::init_device()
-// 
+//
 // description : 	will be called at device initialization.
 //
 //-----------------------------------------------------------------------------
-void Fug::init_device()
-{
-	INFO_STREAM << "Fug::Fug() create device " << device_name << endl;
-
-	// Initialise variables to default values
-	//--------------------------------------------
-	sprintf(rsn,"FugDeviceException");	
-	attr_Voltage_read = 0;
-	attr_Current_read = 0;	
-	attr_VoltageSet_read = 0;
-	attr_CurrentSet_read = 0;
-	
-	attr_Voltage_read = new Tango::DevDouble;
-	if(attr_Voltage_read == 0) {
-		Tango::Except::throw_exception (
-			(const char *)"OUT OF MEMORY",
-			(const char *)"out of memory error",
-			(const char *)"Fug::init_device()");
-	}
-	*attr_Voltage_read = 0;
-
-	attr_Current_read = new Tango::DevDouble;
-	if(attr_Current_read == 0) {
-		Tango::Except::throw_exception (
-			(const char *)"OUT OF MEMORY",
-			(const char *)"out of memory error",
-			(const char *)"Fug::init_device()");
-	}
-	*attr_Current_read = 0;	
-	
-	attr_VoltageSet_read = new Tango::DevDouble;
-	if(attr_VoltageSet_read == 0) {
-		Tango::Except::throw_exception (
-			(const char *)"OUT OF MEMORY",
-			(const char *)"out of memory error",
-			(const char *)"Fug::init_device()");
-	}
-	*attr_VoltageSet_read = 0;	
-		
-	attr_CurrentSet_read = new Tango::DevDouble;
-	if(attr_CurrentSet_read == 0) {
-		Tango::Except::throw_exception (
-			(const char *)"OUT OF MEMORY",
-			(const char *)"out of memory error",
-			(const char *)"Fug::init_device()");
-	}
-	*attr_CurrentSet_read = 0;
-
-	attr_MaxDiffVoltage_read = new Tango::DevDouble;
-	if(attr_MaxDiffVoltage_read == 0) {
-		Tango::Except::throw_exception (
-			(const char *)"OUT OF MEMORY",
-			(const char *)"out of memory error",
-			(const char *)"Fug::init_device()");
-	}
-	*attr_MaxDiffVoltage_read = 0;
-		
-	get_device_property();
-	
-	/* set exception reason */	
-
-	
-	/* connect to serialdevice */
-	devserial = new Tango::DeviceProxy(serialdevice);	
-	
-	/* check if serialdevice is responding */
-	try {
-		if (devserial->ping()) {
-			devserial->set_timeout_millis(FUG_SER_TOUT);
-			set_state(Tango::ON);	
-			set_status("Connected to serialdevice " + serialdevice);
-			cout << "Connected to serialdevice " + serialdevice << endl;
-		}	
-	} 
-	catch(Tango::DevFailed e) {
-		set_state(Tango::FAULT);
-		set_status("Failed to connect to serialdevice " + serialdevice);
-		cout << "Failed to connect to serialdevice " + serialdevice << endl; 			
-	}
-		
-	
-	// don't readback from database
-	tmpcurset = 0;
-	tmpvoltset = 0;
-	
-	voltage_t.data = 0.0;
-	sprintf(voltage_t.msg,"Data too old");
-	voltage_t.time.tv_sec = 0;voltage_t.time.tv_usec = 0;
-
-	current_t.data = 0.0;
-	sprintf(current_t.msg,"Data too old");
-	current_t.time.tv_sec = 0;current_t.time.tv_usec = 0;
-
-	voltageset_t.data = 0.0;
-	sprintf(voltageset_t.msg,"Data too old");
-	voltageset_t.time.tv_sec = 0;voltageset_t.time.tv_usec = 0;
-
-	currentset_t.data = 0.0;
-	sprintf(current_t.msg,"Data too old");
-	currentset_t.time.tv_sec = 0;currentset_t.time.tv_usec = 0;
-
-	stat_t.data = 0.0; // not useful
-	sprintf(stat_t.msg,"Data too old");
-	stat_t.time.tv_sec = 0;stat_t.time.tv_usec = 0;	
-	
-	mutex = new omni_mutex::omni_mutex();
-	abortflag = 0;	
-	readloop = new fugthread::fugthread(this);
-	readloop->start();
-
-	// millisec
-	timeout = (5*(((FUG_SER_TOUT+sleeptime+FUG_SER_SLEEP)*3)+pausetime)+2000); 
-	integration_time = 100;
-	
-	for (int i = 0; i < FUG_MAX_DIFF_BUFFER; i++) {
-		fug_buf[i].set_voltage = 0;
-		fug_buf[i].read_voltage = 0;		
-		gettimeofday(&fug_buf[i].fug_time, NULL);
-		fug_buf[i].fug_time.tv_sec -= 100;
-		fug_buf[i].init_flag = false;
-	}
-	fug_buf_idx = 0;
-	
-	
+void Fug::init_device() {
+  INFO_STREAM << "Fug::Fug() create device " << device_name << endl;
+
+  // Initialise variables to default values
+  //--------------------------------------------
+  sprintf(rsn, "FugDeviceException");
+  attr_Voltage_read = 0;
+  attr_Current_read = 0;
+  attr_VoltageSet_read = 0;
+  attr_CurrentSet_read = 0;
+
+  attr_Voltage_read = new Tango::DevDouble;
+  if (attr_Voltage_read == 0) {
+    Tango::Except::throw_exception(
+        static_cast<const char *>("OUT OF MEMORY"),
+        static_cast<const char *>("out of memory error"),
+        static_cast<const char *>("Fug::init_device()"));
+  }
+  *attr_Voltage_read = 0;
+
+  attr_Current_read = new Tango::DevDouble;
+  if (attr_Current_read == 0) {
+    Tango::Except::throw_exception(
+        static_cast<const char *>("OUT OF MEMORY"),
+        static_cast<const char *>("out of memory error"),
+        static_cast<const char *>("Fug::init_device()"));
+  }
+  *attr_Current_read = 0;
+
+  attr_VoltageSet_read = new Tango::DevDouble;
+  if (attr_VoltageSet_read == 0) {
+    Tango::Except::throw_exception(
+        static_cast<const char *>("OUT OF MEMORY"),
+        static_cast<const char *>("out of memory error"),
+        static_cast<const char *>("Fug::init_device()"));
+  }
+  *attr_VoltageSet_read = 0;
+
+  attr_CurrentSet_read = new Tango::DevDouble;
+  if (attr_CurrentSet_read == 0) {
+    Tango::Except::throw_exception(
+        static_cast<const char *>("OUT OF MEMORY"),
+        static_cast<const char *>("out of memory error"),
+        static_cast<const char *>("Fug::init_device()"));
+  }
+  *attr_CurrentSet_read = 0;
+
+  attr_MaxDiffVoltage_read = new Tango::DevDouble;
+  if (attr_MaxDiffVoltage_read == 0) {
+    Tango::Except::throw_exception(
+        static_cast<const char *>("OUT OF MEMORY"),
+        static_cast<const char *>("out of memory error"),
+        static_cast<const char *>("Fug::init_device()"));
+  }
+  *attr_MaxDiffVoltage_read = 0;
+
+  get_device_property();
+
+  /* set exception reason */
+
+  /* connect to serialdevice */
+  devserial = new Tango::DeviceProxy(serialdevice);
+
+  /* check if serialdevice is responding */
+  try {
+    if (devserial->ping()) {
+      devserial->set_timeout_millis(FUG_SER_TOUT);
+      set_state(Tango::ON);
+      set_status("Connected to serialdevice " + serialdevice);
+      cout << "Connected to serialdevice " + serialdevice << endl;
+    }
+  } catch (Tango::DevFailed &e) {
+    set_state(Tango::FAULT);
+    set_status("Failed to connect to serialdevice " + serialdevice);
+    cout << "Failed to connect to serialdevice " + serialdevice << endl;
+  }
+
+  // don't readback from database
+  tmpcurset = 0;
+  tmpvoltset = 0;
+
+  voltage_t.data = 0.0;
+  sprintf(voltage_t.msg, "Data too old");
+  voltage_t.time.tv_sec = 0;
+  voltage_t.time.tv_usec = 0;
+
+  current_t.data = 0.0;
+  sprintf(current_t.msg, "Data too old");
+  current_t.time.tv_sec = 0;
+  current_t.time.tv_usec = 0;
+
+  voltageset_t.data = 0.0;
+  sprintf(voltageset_t.msg, "Data too old");
+  voltageset_t.time.tv_sec = 0;
+  voltageset_t.time.tv_usec = 0;
+
+  currentset_t.data = 0.0;
+  sprintf(current_t.msg, "Data too old");
+  currentset_t.time.tv_sec = 0;
+  currentset_t.time.tv_usec = 0;
+
+  stat_t.data = 0.0;  // not useful
+  sprintf(stat_t.msg, "Data too old");
+  stat_t.time.tv_sec = 0;
+  stat_t.time.tv_usec = 0;
+
+  mutex = new omni_mutex();
+  abortflag = 0;
+  readloop = new fugthread(this);
+  readloop->start();
+
+  // millisec
+  timeout =
+      (5 * (((FUG_SER_TOUT + sleeptime + FUG_SER_SLEEP) * 3) + pausetime) +
+       2000);
+  integration_time = 100;
+
+  for (int i = 0; i < FUG_MAX_DIFF_BUFFER; i++) {
+    fug_buf[i].set_voltage = 0;
+    fug_buf[i].read_voltage = 0;
+    gettimeofday(&fug_buf[i].fug_time, NULL);
+    fug_buf[i].fug_time.tv_sec -= 100;
+    fug_buf[i].init_flag = false;
+  }
+  fug_buf_idx = 0;
 }
 
-
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::get_device_property()
-// 
+//
 // description : 	Read the device properties from database.
 //
 //-----------------------------------------------------------------------------
-void Fug::get_device_property()
-{
-	//	Initialize your default values here (if not done with  POGO).
-	//------------------------------------------------------------------
-
-	//	Read device properties from database.(Automatic code generation)
-	//------------------------------------------------------------------
-	Tango::DbData	dev_prop;
-	dev_prop.push_back(Tango::DbDatum("Serialdevice"));
-	dev_prop.push_back(Tango::DbDatum("Maxvoltage"));
-	dev_prop.push_back(Tango::DbDatum("Maxcurrent"));
-	dev_prop.push_back(Tango::DbDatum("Sleeptime"));
-	dev_prop.push_back(Tango::DbDatum("Readback"));
-	dev_prop.push_back(Tango::DbDatum("Pausetime"));
-	dev_prop.push_back(Tango::DbDatum("StringTerminator"));
-	dev_prop.push_back(Tango::DbDatum("MaxDiffLen"));
-
-	//	Call database and extract values
-	//--------------------------------------------
-	if (Tango::Util::instance()->_UseDb==true)
-		get_db_device()->get_property(dev_prop);
-	Tango::DbDatum	def_prop, cl_prop;
-	FugClass	*ds_class =
-		(static_cast<FugClass *>(get_device_class()));
-	int	i = -1;
-
-	//	Try to initialize Serialdevice from class property
-	cl_prop = ds_class->get_class_property(dev_prop[++i].name);
-	if (cl_prop.is_empty()==false)	cl_prop  >>  serialdevice;
-	//	Try to initialize Serialdevice from default device value
-	def_prop = ds_class->get_default_device_property(dev_prop[i].name);
-	if (def_prop.is_empty()==false)	def_prop  >>  serialdevice;
-	//	And try to extract Serialdevice value from database
-	if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  serialdevice;
-
-	//	Try to initialize Maxvoltage from class property
-	cl_prop = ds_class->get_class_property(dev_prop[++i].name);
-	if (cl_prop.is_empty()==false)	cl_prop  >>  maxvoltage;
-	//	Try to initialize Maxvoltage from default device value
-	def_prop = ds_class->get_default_device_property(dev_prop[i].name);
-	if (def_prop.is_empty()==false)	def_prop  >>  maxvoltage;
-	//	And try to extract Maxvoltage value from database
-	if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  maxvoltage;
-
-	//	Try to initialize Maxcurrent from class property
-	cl_prop = ds_class->get_class_property(dev_prop[++i].name);
-	if (cl_prop.is_empty()==false)	cl_prop  >>  maxcurrent;
-	//	Try to initialize Maxcurrent from default device value
-	def_prop = ds_class->get_default_device_property(dev_prop[i].name);
-	if (def_prop.is_empty()==false)	def_prop  >>  maxcurrent;
-	//	And try to extract Maxcurrent value from database
-	if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  maxcurrent;
-
-	//	Try to initialize Sleeptime from class property
-	cl_prop = ds_class->get_class_property(dev_prop[++i].name);
-	if (cl_prop.is_empty()==false)	cl_prop  >>  sleeptime;
-	//	Try to initialize Sleeptime from default device value
-	def_prop = ds_class->get_default_device_property(dev_prop[i].name);
-	if (def_prop.is_empty()==false)	def_prop  >>  sleeptime;
-	//	And try to extract Sleeptime value from database
-	if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  sleeptime;
-
-	//	Try to initialize Readback from class property
-	cl_prop = ds_class->get_class_property(dev_prop[++i].name);
-	if (cl_prop.is_empty()==false)	cl_prop  >>  readback;
-	//	Try to initialize Readback from default device value
-	def_prop = ds_class->get_default_device_property(dev_prop[i].name);
-	if (def_prop.is_empty()==false)	def_prop  >>  readback;
-	//	And try to extract Readback value from database
-	if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  readback;
-
-	//	Try to initialize Pausetime from class property
-	cl_prop = ds_class->get_class_property(dev_prop[++i].name);
-	if (cl_prop.is_empty()==false)	cl_prop  >>  pausetime;
-	//	Try to initialize Pausetime from default device value
-	def_prop = ds_class->get_default_device_property(dev_prop[i].name);
-	if (def_prop.is_empty()==false)	def_prop  >>  pausetime;
-	//	And try to extract Pausetime value from database
-	if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  pausetime;
-
-	//	Try to initialize StringTerminator from class property
-	cl_prop = ds_class->get_class_property(dev_prop[++i].name);
-	if (cl_prop.is_empty()==false)	cl_prop  >>  stringTerminator;
-	//	Try to initialize StringTerminator from default device value
-	def_prop = ds_class->get_default_device_property(dev_prop[i].name);
-	if (def_prop.is_empty()==false)	def_prop  >>  stringTerminator;
-	//	And try to extract StringTerminator value from database
-	if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  stringTerminator;
-
-	//	Try to initialize MaxDiffLen from class property
-	cl_prop = ds_class->get_class_property(dev_prop[++i].name);
-	if (cl_prop.is_empty()==false)	cl_prop  >>  maxDiffLen;
-	//	Try to initialize MaxDiffLen from default device value
-	def_prop = ds_class->get_default_device_property(dev_prop[i].name);
-	if (def_prop.is_empty()==false)	def_prop  >>  maxDiffLen;
-	//	And try to extract MaxDiffLen value from database
-	if (dev_prop[i].is_empty()==false)	dev_prop[i]  >>  maxDiffLen;
-
-
-
-	//	End of Automatic code generation
-	//------------------------------------------------------------------
-
+void Fug::get_device_property() {
+  //	Initialize your default values here (if not done with  POGO).
+  //------------------------------------------------------------------
+
+  //	Read device properties from database.(Automatic code generation)
+  //------------------------------------------------------------------
+  Tango::DbData dev_prop;
+  dev_prop.push_back(Tango::DbDatum("Serialdevice"));
+  dev_prop.push_back(Tango::DbDatum("Maxvoltage"));
+  dev_prop.push_back(Tango::DbDatum("Maxcurrent"));
+  dev_prop.push_back(Tango::DbDatum("Sleeptime"));
+  dev_prop.push_back(Tango::DbDatum("Readback"));
+  dev_prop.push_back(Tango::DbDatum("Pausetime"));
+  dev_prop.push_back(Tango::DbDatum("StringTerminator"));
+  dev_prop.push_back(Tango::DbDatum("MaxDiffLen"));
+
+  //	Call database and extract values
+  //--------------------------------------------
+  if (Tango::Util::instance()->_UseDb == true)
+    get_db_device()->get_property(dev_prop);
+  Tango::DbDatum def_prop, cl_prop;
+  FugClass *ds_class = (static_cast<FugClass *>(get_device_class()));
+  int i = -1;
+
+  //	Try to initialize Serialdevice from class property
+  cl_prop = ds_class->get_class_property(dev_prop[++i].name);
+  if (cl_prop.is_empty() == false) cl_prop >> serialdevice;
+  //	Try to initialize Serialdevice from default device value
+  def_prop = ds_class->get_default_device_property(dev_prop[i].name);
+  if (def_prop.is_empty() == false) def_prop >> serialdevice;
+  //	And try to extract Serialdevice value from database
+  if (dev_prop[i].is_empty() == false) dev_prop[i] >> serialdevice;
+
+  //	Try to initialize Maxvoltage from class property
+  cl_prop = ds_class->get_class_property(dev_prop[++i].name);
+  if (cl_prop.is_empty() == false) cl_prop >> maxvoltage;
+  //	Try to initialize Maxvoltage from default device value
+  def_prop = ds_class->get_default_device_property(dev_prop[i].name);
+  if (def_prop.is_empty() == false) def_prop >> maxvoltage;
+  //	And try to extract Maxvoltage value from database
+  if (dev_prop[i].is_empty() == false) dev_prop[i] >> maxvoltage;
+
+  //	Try to initialize Maxcurrent from class property
+  cl_prop = ds_class->get_class_property(dev_prop[++i].name);
+  if (cl_prop.is_empty() == false) cl_prop >> maxcurrent;
+  //	Try to initialize Maxcurrent from default device value
+  def_prop = ds_class->get_default_device_property(dev_prop[i].name);
+  if (def_prop.is_empty() == false) def_prop >> maxcurrent;
+  //	And try to extract Maxcurrent value from database
+  if (dev_prop[i].is_empty() == false) dev_prop[i] >> maxcurrent;
+
+  //	Try to initialize Sleeptime from class property
+  cl_prop = ds_class->get_class_property(dev_prop[++i].name);
+  if (cl_prop.is_empty() == false) cl_prop >> sleeptime;
+  //	Try to initialize Sleeptime from default device value
+  def_prop = ds_class->get_default_device_property(dev_prop[i].name);
+  if (def_prop.is_empty() == false) def_prop >> sleeptime;
+  //	And try to extract Sleeptime value from database
+  if (dev_prop[i].is_empty() == false) dev_prop[i] >> sleeptime;
+
+  //	Try to initialize Readback from class property
+  cl_prop = ds_class->get_class_property(dev_prop[++i].name);
+  if (cl_prop.is_empty() == false) cl_prop >> readback;
+  //	Try to initialize Readback from default device value
+  def_prop = ds_class->get_default_device_property(dev_prop[i].name);
+  if (def_prop.is_empty() == false) def_prop >> readback;
+  //	And try to extract Readback value from database
+  if (dev_prop[i].is_empty() == false) dev_prop[i] >> readback;
+
+  //	Try to initialize Pausetime from class property
+  cl_prop = ds_class->get_class_property(dev_prop[++i].name);
+  if (cl_prop.is_empty() == false) cl_prop >> pausetime;
+  //	Try to initialize Pausetime from default device value
+  def_prop = ds_class->get_default_device_property(dev_prop[i].name);
+  if (def_prop.is_empty() == false) def_prop >> pausetime;
+  //	And try to extract Pausetime value from database
+  if (dev_prop[i].is_empty() == false) dev_prop[i] >> pausetime;
+
+  //	Try to initialize StringTerminator from class property
+  cl_prop = ds_class->get_class_property(dev_prop[++i].name);
+  if (cl_prop.is_empty() == false) cl_prop >> stringTerminator;
+  //	Try to initialize StringTerminator from default device value
+  def_prop = ds_class->get_default_device_property(dev_prop[i].name);
+  if (def_prop.is_empty() == false) def_prop >> stringTerminator;
+  //	And try to extract StringTerminator value from database
+  if (dev_prop[i].is_empty() == false) dev_prop[i] >> stringTerminator;
+
+  //	Try to initialize MaxDiffLen from class property
+  cl_prop = ds_class->get_class_property(dev_prop[++i].name);
+  if (cl_prop.is_empty() == false) cl_prop >> maxDiffLen;
+  //	Try to initialize MaxDiffLen from default device value
+  def_prop = ds_class->get_default_device_property(dev_prop[i].name);
+  if (def_prop.is_empty() == false) def_prop >> maxDiffLen;
+  //	And try to extract MaxDiffLen value from database
+  if (dev_prop[i].is_empty() == false) dev_prop[i] >> maxDiffLen;
+
+  //	End of Automatic code generation
+  //------------------------------------------------------------------
 }
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::always_executed_hook()
-// 
+//
 // description : 	method always executed before any command is executed
 //
 //-----------------------------------------------------------------------------
-void Fug::always_executed_hook()
-{
-	
-}
+void Fug::always_executed_hook() {}
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::read_attr_hardware
-// 
+//
 // description : 	Hardware acquisition for attributes.
 //
 //-----------------------------------------------------------------------------
-void Fug::read_attr_hardware(vector<long> &attr_list)
-{
-	DEBUG_STREAM << "Fug::read_attr_hardware(vector<long> &attr_list) entering... "<< endl;
-	//	Add your own code here
+void Fug::read_attr_hardware(vector<long> &attr_list) {
+  DEBUG_STREAM
+      << "Fug::read_attr_hardware(vector<long> &attr_list) entering... "
+      << endl;
+  //	Add your own code here
 }
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::read_MaxDiffVoltage
-// 
-// description : 	Extract real attribute values for MaxDiffVoltage acquisition result.
+//
+// description : 	Extract real attribute values for MaxDiffVoltage
+// acquisition result.
 //
 //-----------------------------------------------------------------------------
-void Fug::read_MaxDiffVoltage(Tango::Attribute &attr)
-{
-	DEBUG_STREAM << "Fug::read_MaxDiffVoltage(Tango::Attribute &attr) entering... "<< endl;
-	
-	if (*attr_MaxDiffVoltage_read == -1) {
-		Tango::Except::throw_exception(
-				(const char *) "Error reading max diff voltage",
-				(const char *) "Buffer not ready",
-				(const char *) "Fug::read_MaxDiffVoltage", Tango::ERR);			
-	
-	}
-	
-	attr.set_value(attr_MaxDiffVoltage_read);
-	
+void Fug::read_MaxDiffVoltage(Tango::Attribute &attr) {
+  DEBUG_STREAM
+      << "Fug::read_MaxDiffVoltage(Tango::Attribute &attr) entering... "
+      << endl;
+
+  if (*attr_MaxDiffVoltage_read == -1) {
+    Tango::Except::throw_exception(
+        static_cast<const char *>("Error reading max diff voltage"),
+        static_cast<const char *>("Buffer not ready"),
+        static_cast<const char *>("Fug::read_MaxDiffVoltage"), Tango::ERR);
+  }
+
+  attr.set_value(attr_MaxDiffVoltage_read);
 }
 
-
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::read_Voltage
-// 
-// description : 	Extract real attribute values for Voltage acquisition result.
+//
+// description : 	Extract real attribute values for Voltage acquisition
+// result.
 //
 //-----------------------------------------------------------------------------
-void Fug::read_Voltage(Tango::Attribute &attr)
-{
-	DEBUG_STREAM << "Fug::read_Voltage(Tango::Attribute &attr) entering... "<< endl;
-
-	struct timeval now;
-	gettimeofday(&now,NULL);	
-
-	if (check_timeout(now, voltage_t.time, timeout) < 0) {
-		if (voltage_t.msg[0]) {
-			Tango::Except::throw_exception(
-				(const char *) "Error reading voltage",
-				(const char *) voltage_t.msg,
-				(const char *) "Fug::read_Voltage", Tango::ERR);			
-		}
-		else {
-			Tango::Except::throw_exception(
-				(const char *) "Data is not refreshed",
-				(const char *) "Data too old",
-				(const char *) "Fug::read_Voltage", Tango::ERR);				
-		}
-	}	
-	*attr_Voltage_read = voltage_t.data;		
-	attr.set_value(attr_Voltage_read);
-
+void Fug::read_Voltage(Tango::Attribute &attr) {
+  DEBUG_STREAM << "Fug::read_Voltage(Tango::Attribute &attr) entering... "
+               << endl;
+
+  struct timeval now;
+  gettimeofday(&now, NULL);
+
+  if (check_timeout(now, voltage_t.time, timeout) < 0) {
+    if (voltage_t.msg[0]) {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Error reading voltage"),
+          static_cast<const char *>(voltage_t.msg),
+          static_cast<const char *>("Fug::read_Voltage"), Tango::ERR);
+    } else {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Data is not refreshed"),
+          static_cast<const char *>("Data too old"),
+          static_cast<const char *>("Fug::read_Voltage"), Tango::ERR);
+    }
+  }
+  *attr_Voltage_read = voltage_t.data;
+  attr.set_value(attr_Voltage_read);
 }
 
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::write_Voltage
-// 
+//
 // description : 	Write Voltage attribute values to hardware.
 //
 //-----------------------------------------------------------------------------
-void Fug::write_Voltage(Tango::WAttribute &attr)
-{
-	DEBUG_STREAM << "Fug::write_Voltage(Tango::WAttribute &attr) entering... "<< endl;
-
-	string strout;
-	
-	attr.get_write_value(attr_Voltage_write);
-	
-	INFO_STREAM << "Fug::write_Voltage(): val = " << attr_Voltage_write << endl;
-	 
-	if (attr_Voltage_write > maxvoltage) {
-		Tango::Except::throw_exception(
-			(const char *) "Check voltage value error",
-			(const char *) "Voltage value > maxvoltage defined in device properties",
-			(const char *) "Fug::write_Voltage", Tango::ERR);
-	}		
-
-	ostringstream stream;
-	stream << "U" << (attr_Voltage_write*1000);
-	string strin(stream.str());
-	
-	try {
-		mutex->lock();
-		write_Fug(strin); 
-	}
-	catch(Tango::DevFailed e) {
-		mutex->unlock();
-		Tango::Except::re_throw_exception(e,
-			(const char *) "Settting voltage failed",
-			(const char *) "Error setting voltage",
-			(const char *) "Fug::write_Voltage", Tango::ERR);			
-	}		
-	
-	mutex->unlock();
-	
-	// store voltage setting into device property
-	if (readback == false) {
-		tmpvoltset = attr_Voltage_write;	
-	}	
-
+void Fug::write_Voltage(Tango::WAttribute &attr) {
+  DEBUG_STREAM << "Fug::write_Voltage(Tango::WAttribute &attr) entering... "
+               << endl;
+
+  string strout;
+
+  attr.get_write_value(attr_Voltage_write);
+
+  INFO_STREAM << "Fug::write_Voltage(): val = " << attr_Voltage_write << endl;
+
+  if (attr_Voltage_write > maxvoltage) {
+    Tango::Except::throw_exception(
+        static_cast<const char *>("Check voltage value error"),
+        static_cast<const char *>(
+            "Voltage value > maxvoltage defined in device properties"),
+        static_cast<const char *>("Fug::write_Voltage"), Tango::ERR);
+  }
+
+  ostringstream stream;
+  stream << "U" << (attr_Voltage_write * 1000);
+  string strin(stream.str());
+
+  try {
+    mutex->lock();
+    write_Fug(strin);
+  } catch (Tango::DevFailed &e) {
+    mutex->unlock();
+    Tango::Except::re_throw_exception(
+        e, static_cast<const char *>("Settting voltage failed"),
+        static_cast<const char *>("Error setting voltage"),
+        static_cast<const char *>("Fug::write_Voltage"), Tango::ERR);
+  }
+
+  mutex->unlock();
+
+  // store voltage setting into device property
+  if (readback == false) {
+    tmpvoltset = attr_Voltage_write;
+  }
 }
 
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::read_Current
-// 
-// description : 	Extract real attribute values for Current acquisition result.
+//
+// description : 	Extract real attribute values for Current acquisition
+// result.
 //
 //-----------------------------------------------------------------------------
-void Fug::read_Current(Tango::Attribute &attr)
-{
-	DEBUG_STREAM << "Fug::read_Current(Tango::Attribute &attr) entering... "<< endl;
-
-	struct timeval now;
-	gettimeofday(&now,NULL);
-
-	if (check_timeout(now, current_t.time, timeout) < 0) {
-		if (current_t.msg[0]) {
-			Tango::Except::throw_exception(
-				(const char *) "Error reading current",
-				(const char *) current_t.msg,
-				(const char *) "Fug::read_Current", Tango::ERR);			
-		}
-		else {
-			Tango::Except::throw_exception(
-				(const char *) "Data is not refreshed",
-				(const char *) "Data too old",
-				(const char *) "Fug::read_Current", Tango::ERR);				
-		}
-	}	
-	*attr_Current_read = current_t.data;	
-	attr.set_value(attr_Current_read);
-
+void Fug::read_Current(Tango::Attribute &attr) {
+  DEBUG_STREAM << "Fug::read_Current(Tango::Attribute &attr) entering... "
+               << endl;
+
+  struct timeval now;
+  gettimeofday(&now, NULL);
+
+  if (check_timeout(now, current_t.time, timeout) < 0) {
+    if (current_t.msg[0]) {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Error reading current"),
+          static_cast<const char *>(current_t.msg),
+          static_cast<const char *>("Fug::read_Current"), Tango::ERR);
+    } else {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Data is not refreshed"),
+          static_cast<const char *>("Data too old"),
+          static_cast<const char *>("Fug::read_Current"), Tango::ERR);
+    }
+  }
+  *attr_Current_read = current_t.data;
+  attr.set_value(attr_Current_read);
 }
 
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::write_Current
-// 
+//
 // description : 	Write Current attribute values to hardware.
 //
 //-----------------------------------------------------------------------------
-void Fug::write_Current(Tango::WAttribute &attr)
-{
-	DEBUG_STREAM << "Fug::write_Current(Tango::WAttribute &attr) entering... "<< endl;
-
-	string strout;
-	Tango::DevDouble argin;
-	
-	attr.get_write_value(attr_Current_write);
-
-	INFO_STREAM << "Fug::write_Current(): val = " << attr_Current_write << endl;
-		
-	if (attr_Current_write > maxcurrent) {
-		Tango::Except::throw_exception(
-				(const char *) "Check current value error",
-				(const char *) "Current value > maxcurrent defined in device properties",
-				(const char *) "Fug::write_Current", Tango::ERR);
-	}	
-	ostringstream stream;
-	stream << "I" << (attr_Current_write);
-	string strin(stream.str());	
-	
-	try {
-		mutex->lock();
-		write_Fug(strin); 
-	}
-	catch(Tango::DevFailed e) {
-		mutex->unlock();
-		Tango::Except::re_throw_exception(e,
-			(const char *) "Settting current failed",
-			(const char *) "Error setting current",
-			(const char *) "Fug::write_Current", Tango::ERR);					
-	}
-
-	mutex->unlock();
-
-	if (readback == false) {
-		tmpcurset = attr_Current_write;	
-	}
-
+void Fug::write_Current(Tango::WAttribute &attr) {
+  DEBUG_STREAM << "Fug::write_Current(Tango::WAttribute &attr) entering... "
+               << endl;
+
+  string strout;
+
+  attr.get_write_value(attr_Current_write);
+
+  INFO_STREAM << "Fug::write_Current(): val = " << attr_Current_write << endl;
+
+  if (attr_Current_write > maxcurrent) {
+    Tango::Except::throw_exception(
+        static_cast<const char *>("Check current value error"),
+        static_cast<const char *>(
+            "Current value > maxcurrent defined in device properties"),
+        static_cast<const char *>("Fug::write_Current"), Tango::ERR);
+  }
+  ostringstream stream;
+  stream << "I" << (attr_Current_write);
+  string strin(stream.str());
+
+  try {
+    mutex->lock();
+    write_Fug(strin);
+  } catch (Tango::DevFailed &e) {
+    mutex->unlock();
+    Tango::Except::re_throw_exception(
+        e, static_cast<const char *>("Setting current failed"),
+        static_cast<const char *>("Error setting current"),
+        static_cast<const char *>("Fug::write_Current"), Tango::ERR);
+  }
+
+  mutex->unlock();
+
+  if (readback == false) {
+    tmpcurset = attr_Current_write;
+  }
 }
 
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::read_VoltageSet
-// 
-// description : 	Extract real attribute values for VoltageSet acquisition result.
+//
+// description : 	Extract real attribute values for VoltageSet acquisition
+// result.
 //
 //-----------------------------------------------------------------------------
-void Fug::read_VoltageSet(Tango::Attribute &attr)
-{
-	DEBUG_STREAM << "Fug::read_VoltageSet(Tango::Attribute &attr) entering... "<< endl;
-
-	struct timeval now;
-	gettimeofday(&now,NULL);
-
-	if (check_timeout(now, voltageset_t.time, timeout) < 0) {
-		if (voltageset_t.msg[0]) {
-			Tango::Except::throw_exception(
-				(const char *) "Error reading voltage setpoint",
-				(const char *) voltageset_t.msg,
-				(const char *) "Fug::read_VoltageSet", Tango::ERR);			
-		}
-		else {
-			Tango::Except::throw_exception(
-				(const char *) "Data is not refreshed",
-				(const char *) "Data too old",
-				(const char *) "Fug::read_VoltageSet", Tango::ERR);				
-		}
-	}				
-	*attr_VoltageSet_read = voltageset_t.data;
-	attr.set_value(attr_VoltageSet_read);
-
+void Fug::read_VoltageSet(Tango::Attribute &attr) {
+  DEBUG_STREAM << "Fug::read_VoltageSet(Tango::Attribute &attr) entering... "
+               << endl;
+
+  struct timeval now;
+  gettimeofday(&now, NULL);
+
+  if (check_timeout(now, voltageset_t.time, timeout) < 0) {
+    if (voltageset_t.msg[0]) {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Error reading voltage setpoint"),
+          static_cast<const char *>(voltageset_t.msg),
+          static_cast<const char *>("Fug::read_VoltageSet"), Tango::ERR);
+    } else {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Data is not refreshed"),
+          static_cast<const char *>("Data too old"),
+          static_cast<const char *>("Fug::read_VoltageSet"), Tango::ERR);
+    }
+  }
+  *attr_VoltageSet_read = voltageset_t.data;
+  attr.set_value(attr_VoltageSet_read);
 }
 
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::read_CurrentSet
-// 
-// description : 	Extract real attribute values for CurrentSet acquisition result.
+//
+// description : 	Extract real attribute values for CurrentSet acquisition
+// result.
 //
 //-----------------------------------------------------------------------------
-void Fug::read_CurrentSet(Tango::Attribute &attr)
-{
-	DEBUG_STREAM << "Fug::read_CurrentSet(Tango::Attribute &attr) entering... "<< endl;
-
-	struct timeval now;
-	gettimeofday(&now,NULL);
-	
-	if (check_timeout(now, currentset_t.time, timeout) < 0) {
-		if (currentset_t.msg[0]) {
-			Tango::Except::throw_exception(
-				(const char *) "Error reading current setpoint",
-				(const char *) currentset_t.msg,
-				(const char *) "Fug::read_CurrentSet", Tango::ERR);			
-		}
-		else {
-			Tango::Except::throw_exception(
-				(const char *) "Data is not refreshed",
-				(const char *) "Data too old",
-				(const char *) "Fug::read_CurrentSet", Tango::ERR);				
-		}
-	}	
-	*attr_CurrentSet_read = currentset_t.data;
-	attr.set_value(attr_CurrentSet_read);	
-
+void Fug::read_CurrentSet(Tango::Attribute &attr) {
+  DEBUG_STREAM << "Fug::read_CurrentSet(Tango::Attribute &attr) entering... "
+               << endl;
+
+  struct timeval now;
+  gettimeofday(&now, NULL);
+
+  if (check_timeout(now, currentset_t.time, timeout) < 0) {
+    if (currentset_t.msg[0]) {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Error reading current setpoint"),
+          static_cast<const char *>(currentset_t.msg),
+          static_cast<const char *>("Fug::read_CurrentSet"), Tango::ERR);
+    } else {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Data is not refreshed"),
+          static_cast<const char *>("Data too old"),
+          static_cast<const char *>("Fug::read_CurrentSet"), Tango::ERR);
+    }
+  }
+  *attr_CurrentSet_read = currentset_t.data;
+  attr.set_value(attr_CurrentSet_read);
 }
 
 //+----------------------------------------------------------------------------
 //
 // method : 		Fug::read_Stat
-// 
-// description : 	Extract real attribute values for Stat acquisition result.
+//
+// description : 	Extract real attribute values for Stat acquisition
+// result.
 //
 //-----------------------------------------------------------------------------
-void Fug::read_Stat(Tango::Attribute &attr)
-{
-	DEBUG_STREAM << "Fug::read_Stat(Tango::Attribute &attr) entering... "<< endl;
-
-	struct timeval now;
-	gettimeofday(&now,NULL);
-
-	if (check_timeout(now, stat_t.time, timeout) < 0) {
-		if (stat_t.msg[0]) {
-			Tango::Except::throw_exception(
-				(const char *) "Error reading fug status",
-				(const char *) stat_t.msg,
-				(const char *) "Fug::read_Stat", Tango::ERR);			
-		}	
-		else {
-			Tango::Except::throw_exception(
-				(const char *) "Data is not refreshed",
-				(const char *) "Data too old",
-				(const char *) "Fug::read_Stat", Tango::ERR);				
-		}
-	}		
-	// attr_Stat_read points to FugStat[0]
-	attr_Stat_read = &FugStat[0];
-	attr.set_value(attr_Stat_read, 5, 0, false);
-
+void Fug::read_Stat(Tango::Attribute &attr) {
+  DEBUG_STREAM << "Fug::read_Stat(Tango::Attribute &attr) entering... " << endl;
+
+  struct timeval now;
+  gettimeofday(&now, NULL);
+
+  if (check_timeout(now, stat_t.time, timeout) < 0) {
+    if (stat_t.msg[0]) {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Error reading fug status"),
+          static_cast<const char *>(stat_t.msg),
+          static_cast<const char *>("Fug::read_Stat"), Tango::ERR);
+    } else {
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Data is not refreshed"),
+          static_cast<const char *>("Data too old"),
+          static_cast<const char *>("Fug::read_Stat"), Tango::ERR);
+    }
+  }
+  // attr_Stat_read points to FugStat[0]
+  attr_Stat_read = &FugStat[0];
+  attr.set_value(attr_Stat_read, 5, 0, false);
 }
 
-
 //+------------------------------------------------------------------
 /**
  *	method:	Fug::on
@@ -707,14 +677,12 @@ void Fug::read_Stat(Tango::Attribute &attr)
  *
  */
 //+------------------------------------------------------------------
-void Fug::on()
-{
-	DEBUG_STREAM << "Fug::on(): entering... !" << endl;
-
-	//	Add your own code to control device here
-	INFO_STREAM << "Fug::on()" << endl;
-	write_Fug("F1");
-	
+void Fug::on() {
+  DEBUG_STREAM << "Fug::on(): entering... !" << endl;
+
+  //	Add your own code to control device here
+  INFO_STREAM << "Fug::on()" << endl;
+  write_Fug("F1");
 }
 
 //+------------------------------------------------------------------
@@ -728,18 +696,16 @@ void Fug::on()
  *
  */
 //+------------------------------------------------------------------
-void Fug::off()
-{
-	DEBUG_STREAM << "Fug::off(): entering... !" << endl;
-
-	//	Add your own code to control device here
-	INFO_STREAM << "Fug::off()" << endl;
-	if (readback == false) {
-		tmpcurset = 0;
-		tmpvoltset = 0;
-	}
-	write_Fug("F0");
-
+void Fug::off() {
+  DEBUG_STREAM << "Fug::off(): entering... !" << endl;
+
+  //	Add your own code to control device here
+  INFO_STREAM << "Fug::off()" << endl;
+  if (readback == false) {
+    tmpcurset = 0;
+    tmpvoltset = 0;
+  }
+  write_Fug("F0");
 }
 
 //+------------------------------------------------------------------
@@ -748,56 +714,70 @@ void Fug::off()
  *
  *	description:	method to execute "SetIntegrationTime"
  *
- * @param	argin	
+ * @param	argin
  *
  */
 //+------------------------------------------------------------------
-void Fug::set_integration_time(Tango::DevLong argin)
-{
-	DEBUG_STREAM << "Fug::set_integration_time(): entering... !" << endl;
-
-	//	Add your own code to control device here
-	string strout;
-	int intgr_time;
-	
-	INFO_STREAM << "Fug::set_integration_time(): val = " << argin << endl;
-	
-	switch(argin) {
-		case 2:   intgr_time = 0; break;
-		case 16:  intgr_time = 1; break;
-		case 20:  intgr_time = 2; break;
-		case 50:  intgr_time = 3; break;
-		case 60:  intgr_time = 4; break;
-		case 100: intgr_time = 5; break;
-		case 200: intgr_time = 6; break;
-		case 800: intgr_time = 7; break;													
-		default:
-			Tango::Except::throw_exception(
-			(const char *) "Failed to set integration measure time",
-			(const char *) "Allowed values [ms] are: 2, 16, 20, 50, 60, 100, 200, 800",
-			(const char *) "Fug::set_integration_time", Tango::ERR);
-	}			
-
-	ostringstream stream;
-	stream << "S" << intgr_time;
-	string strin(stream.str());
-	
-	try {
-		mutex->lock();
-		write_Fug(strin); 
-	}
-	catch(Tango::DevFailed &e) {
-		mutex->unlock();
-		Tango::Except::re_throw_exception(e,
-			(const char *) "Failed to set integration measure time",
-			(const char *) "Error getting integration time",
-			(const char *) "Fug::set_integration_time", Tango::ERR);			
-	}		
-	
-	integration_time = argin;
-	
-	mutex->unlock();
-	
+void Fug::set_integration_time(Tango::DevLong argin) {
+  DEBUG_STREAM << "Fug::set_integration_time(): entering... !" << endl;
+
+  //	Add your own code to control device here
+  string strout;
+  int intgr_time;
+
+  INFO_STREAM << "Fug::set_integration_time(): val = " << argin << endl;
+
+  switch (argin) {
+    case 2:
+      intgr_time = 0;
+      break;
+    case 16:
+      intgr_time = 1;
+      break;
+    case 20:
+      intgr_time = 2;
+      break;
+    case 50:
+      intgr_time = 3;
+      break;
+    case 60:
+      intgr_time = 4;
+      break;
+    case 100:
+      intgr_time = 5;
+      break;
+    case 200:
+      intgr_time = 6;
+      break;
+    case 800:
+      intgr_time = 7;
+      break;
+    default:
+      Tango::Except::throw_exception(
+          static_cast<const char *>("Failed to set integration measure time"),
+          static_cast<const char *>(
+              "Allowed values [ms] are: 2, 16, 20, 50, 60, 100, 200, 800"),
+          static_cast<const char *>("Fug::set_integration_time"), Tango::ERR);
+  }
+
+  ostringstream stream;
+  stream << "S" << intgr_time;
+  string strin(stream.str());
+
+  try {
+    mutex->lock();
+    write_Fug(strin);
+  } catch (Tango::DevFailed &e) {
+    mutex->unlock();
+    Tango::Except::re_throw_exception(
+        e, static_cast<const char *>("Failed to set integration measure time"),
+        static_cast<const char *>("Error getting integration time"),
+        static_cast<const char *>("Fug::set_integration_time"), Tango::ERR);
+  }
+
+  integration_time = argin;
+
+  mutex->unlock();
 }
 
 //+------------------------------------------------------------------
@@ -806,65 +786,18 @@ void Fug::set_integration_time(Tango::DevLong argin)
  *
  *	description:	method to execute "GetIntegrationTime"
  *
- * @return	
+ * @return
  *
  */
 //+------------------------------------------------------------------
-Tango::DevLong Fug::get_integration_time()
-{
-	Tango::DevLong	argout ;
-	DEBUG_STREAM << "Fug::get_integration_time(): entering... !" << endl;
-
-	//	Add your own code to control device here
-	string strout;
-	int intgr_time;
-	
-	/*
-	try {
-		mutex->lock();
-		write_Fug("S");
-		strout = read_Fug();
-	}
-	catch(Tango::DevFailed &e) {
-		mutex->unlock();
-		Tango::Except::re_throw_exception(e,
-			(const char *) "Failed to get integration measure time",
-			(const char *) "Error getting integration time",
-			(const char *) "Fug::get_integration_time", Tango::ERR);			
-	}		
-	
-	mutex->unlock();	
-	
-	if ((strout.length() < 7) || (strout[3]-'0' != 0)) {	
-		memset(tmpstr,0,20);
-		strncpy(tmpstr,strout.c_str(),20);			
-		sprintf(myfug->stat_t.msg,"Failed to read fug status, string: %s",tmpstr);
-		return -1;
-	}
-	
-	
-	intgr_time = strout[1]-'0';
-	
-	switch(intgr_time) {
-		case 0:   argout = 2; break;
-		case 1:  argout = 16; break;
-		case 2:  argout = 20; break;
-		case 3:  argout = 50; break;
-		case 4:  argout = 60; break;
-		case 5: argout = 100; break;
-		case 6: argout = 200; break;
-		case 7: argout = 800; break;													
-		default:
-			Tango::Except::throw_exception(
-			(const char *) "Not valid integration time value",
-			(const char *) "Failed to get integration measure time",
-			(const char *) "Fug::get_integration_time", Tango::ERR);
-	}			
-	*/
-	
-	argout = integration_time;
-	return argout;
-
+Tango::DevLong Fug::get_integration_time() {
+  Tango::DevLong argout;
+  DEBUG_STREAM << "Fug::get_integration_time(): entering... !" << endl;
+
+  //	Add your own code to control device here
+  string strout;
+  argout = integration_time;
+  return (argout);
 }
 
 //+------------------------------------------------------------------
@@ -877,38 +810,34 @@ Tango::DevLong Fug::get_integration_time()
  *
  */
 //+------------------------------------------------------------------
-void Fug::write_Fug(string input)
-{
-	DEBUG_STREAM << "Fug::write_Fug(): entering... !" << endl;
-
-	//	Add your own code to control device here
-	Tango::DeviceData Din;
-	int i;
-	long flush = 2;
-
-	input += (char) stringTerminator;  /* add fug endline */	
-	Din << input;
-	try {
-		devserial->command_inout("DevSerWriteString",Din);
-	}
-	catch(Tango::DevFailed e) {	
-			TangoSys_MemStream out_stream;
-			out_stream << "Write command to SerialDeviceServer failed" << ends;
-			set_state(Tango::UNKNOWN);
-			set_status("Errors from serialdevice " + serialdevice);		
-			Tango::Except::re_throw_exception(e,
-				(const char *) rsn,
-				out_stream.str(),
-				(const char *) "SerialDeviceServer error", Tango::ERR);
-	}
-		
-	/*printf("write %s: %s\n",device_name.c_str(),input.c_str());*/
-	
-	set_state(Tango::ON);
-	set_status("Connected to serialdevice " + serialdevice);
-	
-	omni_thread::sleep(0,FUG_SER_SLEEP*1000000); // convert millisecond to nanosecond (sleep 70ms.)
-
+void Fug::write_Fug(string input) {
+  DEBUG_STREAM << "Fug::write_Fug(): entering... !" << endl;
+
+  //	Add your own code to control device here
+  Tango::DeviceData Din;
+
+  input += stringTerminator; /* add fug endline */
+  Din << input;
+  try {
+    devserial->command_inout("DevSerWriteString", Din);
+  } catch (Tango::DevFailed &e) {
+    TangoSys_MemStream out_stream;
+    out_stream << "Write command to SerialDeviceServer failed" << ends;
+    set_state(Tango::UNKNOWN);
+    set_status("Errors from serialdevice " + serialdevice);
+    Tango::Except::re_throw_exception(
+        e, static_cast<const char *>(rsn), out_stream.str(),
+        static_cast<const char *>("SerialDeviceServer error"), Tango::ERR);
+  }
+
+  /*printf("write %s: %s\n",device_name.c_str(),input.c_str());*/
+
+  set_state(Tango::ON);
+  set_status("Connected to serialdevice " + serialdevice);
+
+  omni_thread::sleep(
+      0, FUG_SER_SLEEP *
+             1000000);  // convert millisecond to nanosecond (sleep 70ms.)
 }
 
 //+------------------------------------------------------------------
@@ -921,82 +850,78 @@ void Fug::write_Fug(string input)
  *
  */
 //+------------------------------------------------------------------
-string Fug::read_Fug()
-{
-	DEBUG_STREAM << "Fug::read_Fug(): entering... !" << endl;
-
-	//	Add your own code to control device here
-	Tango::DevVarLongStringArray strin;
-	string input, strout, strout_filt;
-	Tango::DeviceData Din,Dout;
-	int i;
-	char tmp[5];
-
-	input.resize(3);	
-	input[0] = '?';
-	input[1] = stringTerminator;
-	input[2] = 0;
-
-	Din << input;
-	try {
-		devserial->command_inout("DevSerWriteString",Din);
-	}
-	catch(Tango::DevFailed e) {	
-		TangoSys_MemStream out_stream;
-		out_stream << "Write command to SerialDeviceServer failed" << ends;
-		set_state(Tango::FAULT);
-		set_status("Errors from serialdevice " + serialdevice);		
-		Tango::Except::re_throw_exception(e,
-			(const char *) rsn,
-			out_stream.str(),
-			(const char *) "SerialDeviceServer error", Tango::ERR);
-	}
-	
-	omni_thread::sleep(0,sleeptime*1000000); // convert millisecond to microsecond	
-	
-	try {	
-		Dout = devserial->command_inout("DevSerReadRaw");
-	}
-	catch(Tango::DevFailed e) {
-		TangoSys_MemStream out_stream;
-		out_stream << "DevSerReadRaw command to SerialDeviceServer failed" << ends;
-		set_state(Tango::FAULT);
-		set_status("Errors from serialdevice " + serialdevice);			
-		Tango::Except::re_throw_exception(e,
-			(const char *) rsn,
-			out_stream.str(),
-			(const char *) "SerialDeviceServer error", Tango::ERR);
-	}
-	Dout >> strout;
-	
-	if (strout.length() == 0) {
-		set_state(Tango::FAULT);
-		set_status("Errors from serialdevice " + serialdevice);			
-		Tango::Except::throw_exception(
-			(const char *) "Serial communication error",
-			(const char *) "No data from serialline",
-			(const char *) "Fug::read_Fug", Tango::ERR);		
-	}
-		
-	set_state(Tango::ON);
-	set_status("Connected to serialdevice " + serialdevice);
-	
-	omni_thread::sleep(0,FUG_SER_SLEEP*1000000);
-	
-	i = 0;
-	while (strout[i] == 'E') {
-		i+=3;
-	}
-	strout_filt.resize(strout.length()-i);
-	strncpy((char *)strout_filt.c_str(),(char *)strout.c_str()+i,strout.length()-i);
-	
-	/*printf("read %s: %s\n",device_name.c_str(),strout_filt.c_str());*/
-	
-	return strout_filt;
-
+string Fug::read_Fug() {
+  DEBUG_STREAM << "Fug::read_Fug(): entering... !" << endl;
+
+  //	Add your own code to control device here
+  Tango::DevVarLongStringArray strin;
+  string input;
+  string strout;
+  string strout_filt;
+  Tango::DeviceData Din;
+  Tango::DeviceData Dout;
+  int i;
+
+  input.resize(3);
+  input[0] = '?';
+  input[1] = stringTerminator;
+  input[2] = 0;
+
+  Din << input;
+  try {
+    devserial->command_inout("DevSerWriteString", Din);
+  } catch (Tango::DevFailed &e) {
+    TangoSys_MemStream out_stream;
+    out_stream << "Write command to SerialDeviceServer failed" << ends;
+    set_state(Tango::FAULT);
+    set_status("Errors from serialdevice " + serialdevice);
+    Tango::Except::re_throw_exception(
+        e, static_cast<const char *>(rsn), out_stream.str(),
+        static_cast<const char *>("SerialDeviceServer error"), Tango::ERR);
+  }
+
+  omni_thread::sleep(
+      0, sleeptime * 1000000);  // convert millisecond to microsecond
+
+  try {
+    Dout = devserial->command_inout("DevSerReadRaw");
+  } catch (Tango::DevFailed &e) {
+    TangoSys_MemStream out_stream;
+    out_stream << "DevSerReadRaw command to SerialDeviceServer failed" << ends;
+    set_state(Tango::FAULT);
+    set_status("Errors from serialdevice " + serialdevice);
+    Tango::Except::re_throw_exception(
+        e, static_cast<const char *>(rsn), out_stream.str(),
+        static_cast<const char *>("SerialDeviceServer error"), Tango::ERR);
+  }
+  Dout >> strout;
+
+  if (strout.length() == 0) {
+    set_state(Tango::FAULT);
+    set_status("Errors from serialdevice " + serialdevice);
+    Tango::Except::throw_exception(
+        static_cast<const char *>("Serial communication error"),
+        static_cast<const char *>("No data from serialline"),
+        static_cast<const char *>("Fug::read_Fug"), Tango::ERR);
+  }
+
+  set_state(Tango::ON);
+  set_status("Connected to serialdevice " + serialdevice);
+
+  omni_thread::sleep(0, FUG_SER_SLEEP * 1000000);
+
+  i = 0;
+  while (strout[i] == 'E') {
+    i += 3;
+  }
+  strout_filt.resize(strout.length() - i);
+  strncpy((char *)strout_filt.c_str(), (char *)strout.c_str() + i, strout.length() - i);
+
+  /*printf("read %s: %s\n",device_name.c_str(),strout_filt.c_str());*/
+
+  return (strout_filt);
 }
 
-
 //+------------------------------------------------------------------
 /**
  *	method:	Fug::check_timeout
@@ -1007,18 +932,16 @@ string Fug::read_Fug()
  *
  */
 //+------------------------------------------------------------------
-int Fug::check_timeout(timeval timenow, timeval time, int timeout)
-{
-	if ((timenow.tv_sec -	time.tv_sec) > (timeout/1000)) {
-		return -1;
-	}	
-	if (((timenow.tv_sec -	time.tv_sec)*1000 - 
-			(int)((float)(timenow.tv_usec -	time.tv_usec)/1000)) > timeout) {		
-		return -1;
-	}
-	return 0;
-	
-}	/* end check_timeout() */	
-
-
-}	//	namespace
+int Fug::check_timeout(timeval timenow, timeval time, unsigned int time_out) {
+  if ((timenow.tv_sec - time.tv_sec) > (time_out / 1000)) {
+    return (-1);
+  }
+  if (((timenow.tv_sec - time.tv_sec) * 1000 -
+       (int)((timenow.tv_usec - time.tv_usec) / 1000.0)) > time_out) {
+    return (-1);
+  }
+  return (0);
+
+} /* end check_timeout() */
+
+}  // namespace Fug_ns
diff --git a/src/Fug.h b/src/Fug.h
index bd066dc3848d52ea8768d7d32bb6d8204762c66c..55ed007c0715d5ea78b3d7fc4f56f79ec2ffbc9c 100644
--- a/src/Fug.h
+++ b/src/Fug.h
@@ -31,11 +31,7 @@
 #define _FUG_H
 
 #include <tango.h>
-//using namespace Tango;
-
-#include <tango.h>      
-#include <sys/time.h>
-#include <time.h>
+#include <ctime>
 
 #define FUG_SER_TOUT 150 //ms.
 #define FUG_SER_SLEEP 80 //ms.
@@ -51,13 +47,13 @@ typedef struct {
 } fug_t;
 
 typedef struct {
-	double set_voltage,
-	       read_voltage;
+	double set_voltage;
+	double read_voltage;
 	struct timeval fug_time;
 	bool init_flag;
 } fug_buf_t;
 
-class fugthread;
+
 
 
 /**
@@ -71,7 +67,7 @@ class fugthread;
 
 namespace Fug_ns
 {
-
+	class fugthread;
 /**
  * Class Description:
  * This is FuG HV power supply device server.
@@ -327,24 +323,26 @@ private :
 	Tango::DeviceProxy *devserial;
 	int abortflag;  // flag used to abort loops (On,Off,Standby)	
 	bool FugStat[5];	
-	fug_t voltage_t,current_t,
-	      voltageset_t,currentset_t,
-				stat_t;
+	fug_t voltage_t;
+	fug_t current_t;
+	fug_t voltageset_t;
+	fug_t currentset_t;
+	fug_t stat_t;
 	int integration_time;
-	double tmpcurset,tmpvoltset;
+	double tmpcurset;
+	double tmpvoltset;
 	fugthread *readloop;
-	omni_mutex::omni_mutex *mutex;
-	unsigned long timeout;
-	
+	omni_mutex *mutex;
+	unsigned int timeout;
 	fug_buf_t fug_buf[FUG_MAX_DIFF_BUFFER];
-	long fug_buf_idx;
+	int fug_buf_idx;
 	
 protected :	
 	//	Add your own data members here
 	//-----------------------------------------
 	void write_Fug(string);
 	string read_Fug();
-	int check_timeout(timeval, timeval, int);
+	int check_timeout(timeval, timeval, unsigned int);
 	Tango::DevDouble attr_d_rd;	
 	char rsn[25];  // Fug Exception reason	
 
diff --git a/src/FugStateMachine.cpp b/src/FugStateMachine.cpp
index ada253ede96299ff718c84f66116745edfcaf4b1..8069982513ab5b219678d37688dd1ffd71442497 100644
--- a/src/FugStateMachine.cpp
+++ b/src/FugStateMachine.cpp
@@ -1,4 +1,3 @@
-static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fug_elettra/src/FugStateMachine.cpp,v 1.1.1.1 2014-10-22 10:12:39 giulio Exp $";
 //+=============================================================================
 //
 // file :         FugStateMachine.cpp
diff --git a/src/TangoClassID.txt b/src/TangoClassID.txt
new file mode 100644
index 0000000000000000000000000000000000000000..bbdfd5a4edab2577608b68932bc03d3c7221a070
--- /dev/null
+++ b/src/TangoClassID.txt
@@ -0,0 +1,11 @@
+/**
+ * Device Class Identification:
+ * 
+ * Class Name   :	Fug
+ * Contact      :	giulio.gaio@elettra.eu
+ * Class Family :	Controllers
+ * Platform     :	Unix Like
+ * Bus          :	Serial Line
+ * Manufacturer :	FUG
+ * Reference    :	
+ */
diff --git a/src/fugthread.cpp b/src/fugthread.cpp
index b1adc6c9b05cf964806b32e8f900fa31fab8de0a..4da9b7ccf099542f074423e8ea2fe0fd633f855e 100644
--- a/src/fugthread.cpp
+++ b/src/fugthread.cpp
@@ -20,16 +20,21 @@
 //
 
 #include "fugthread.h"
-
+namespace Fug_ns
+{
+	
 /* 
  *	fugthread::run()
  *	Run  
  */		
 void fugthread::run(void *) 
 {
-	int pausesec,pausenano,pausesec_dfl,pausenano_dfl,
-	    cnt_err = 0,
-			max_cnt_err = 3;
+	int pausesec;
+	int pausenano;
+	int pausesec_dfl;
+	int pausenano_dfl;
+	int cnt_err = 0;
+	int max_cnt_err = 3;
 
 	pausesec = pausesec_dfl = (int)myfug->pausetime/1000;
 	pausenano = pausenano_dfl = (myfug->pausetime-pausesec*1000)*1000000;
@@ -233,7 +238,7 @@ int fugthread::Voltage(void)
 		myfug->write_Fug("N0");
 		strout = myfug->read_Fug();
 	}
-	catch(Tango::DevFailed e) {
+	catch(Tango::DevFailed& e) {
 		std::string temp;
 		temp = e.errors[0].desc;
 		strncpy(myfug->voltage_t.msg,temp.c_str(),FUG_MSG_LEN);
@@ -259,8 +264,7 @@ int fugthread::Voltage(void)
 		sprintf(myfug->voltage_t.msg,"Returned not valid string: %s",tmpstr);
 		return -1;
 	}			
-	
-	myfug->voltage_t.data = atof(strout.c_str()+1)/1000*sign;
+	myfug->voltage_t.data = strtod(strout.c_str(),nullptr)/1000;
 	myfug->voltage_t.msg[0]=0;
 	
 	gettimeofday(&myfug->voltage_t.time,NULL);
@@ -281,7 +285,7 @@ int fugthread::Current(void)
 		myfug->write_Fug("N1");
 		strout = myfug->read_Fug();
 	}
-	catch(Tango::DevFailed e) {
+	catch(Tango::DevFailed& e) {
 		std::string temp;
 		temp = e.errors[0].desc;
 		strncpy(myfug->current_t.msg,temp.c_str(),FUG_MSG_LEN);
@@ -308,7 +312,8 @@ int fugthread::Current(void)
 		return -1;
 	}	
 			
-	myfug->current_t.data = atof(strout.c_str()+1)*sign;
+	//myfug->current_t.data = atof(strout.c_str()+1)*sign;
+	myfug->current_t.data = strtod(strout.c_str(),nullptr);
 	myfug->current_t.msg[0]=0;
 
 	gettimeofday(&myfug->current_t.time,NULL);
@@ -328,7 +333,7 @@ int fugthread::VoltageSet(void)
 			myfug->write_Fug("N0");
 			strout = myfug->read_Fug();
 		}
-		catch(Tango::DevFailed e) {
+		catch(Tango::DevFailed& e) {
 			std::string temp;
 			temp = e.errors[0].desc;
 			strncpy(myfug->voltageset_t.msg,temp.c_str(),FUG_MSG_LEN);
@@ -354,7 +359,8 @@ int fugthread::VoltageSet(void)
 			sprintf(myfug->voltageset_t.msg,"Returned not valid string: %s",tmpstr);
 			return -1;
 		}	
-		myfug->voltageset_t.data = (atof(strout.c_str()+1)/1000)*sign;
+		//myfug->voltageset_t.data = (atof(strout.c_str()+1)/1000)*sign;
+		myfug->voltageset_t.data = strtod(strout.c_str(),nullptr)/1000;
 
 	}
 	else {
@@ -380,7 +386,7 @@ int fugthread::CurrentSet(void)
 			myfug->write_Fug("N1");
 			strout = myfug->read_Fug();
 		}
-		catch(Tango::DevFailed e) {
+		catch(Tango::DevFailed& e) {
 			std::string temp;
 			temp = e.errors[0].desc;
 			strncpy(myfug->currentset_t.msg,temp.c_str(),FUG_MSG_LEN);
@@ -406,7 +412,8 @@ int fugthread::CurrentSet(void)
 			sprintf(myfug->currentset_t.msg,"Returned not valid string: %s",tmpstr);
 			return -1;
 		}	
-		myfug->currentset_t.data = (atof(strout.c_str()+1))*sign;
+		//myfug->currentset_t.data = (atof(strout.c_str()+1))*sign;
+		myfug->currentset_t.data = strtod(strout.c_str(),nullptr);
 
 	}
 	else {
@@ -429,7 +436,7 @@ int fugthread::Stat(void)
 		myfug->write_Fug("N2");
 		strout = myfug->read_Fug();
 	}
-	catch(Tango::DevFailed e) {
+	catch(Tango::DevFailed& e) {
 		std::string temp;
 		temp = e.errors[0].desc;
 		strncpy(myfug->stat_t.msg,temp.c_str(),FUG_MSG_LEN);
@@ -443,11 +450,11 @@ int fugthread::Stat(void)
 	}
 
 	for (int i=0; i<3; i++) {
-		myfug->FugStat[i] = (bool) ((strout[i]-'0') == 1);
+		myfug->FugStat[i] = static_cast<Tango::DevBoolean>((strout[i]-'0') == 1);
 	}
 	
-	myfug->FugStat[3] = (bool) (((strout[6]-'0') % 2) == 1);
-	myfug->FugStat[4] = (bool) (((strout[6]-'0') / 2) == 1);
+	myfug->FugStat[3] = static_cast<Tango::DevBoolean>(((strout[6]-'0') % 2) == 1);
+	myfug->FugStat[4] = static_cast<Tango::DevBoolean>(((strout[6]-'0') / 2) == 1);
 	
 	myfug->stat_t.msg[0]=0;
 	gettimeofday(&myfug->stat_t.time,NULL);
@@ -457,7 +464,7 @@ int fugthread::Stat(void)
 }
 
 
-
+} //namespace
 
 
 
diff --git a/src/fugthread.h b/src/fugthread.h
index a4e3b15423b9ed4aa4ac20f1a317e6cc2bcc6723..8d333941cb64ccfd4aa387f277811ee5146ebbea 100644
--- a/src/fugthread.h
+++ b/src/fugthread.h
@@ -26,13 +26,13 @@
 #include <omnithread.h>
 #include <tango.h>
 #include <Fug.h>
-
+namespace Fug_ns
+{
 
 class fugthread : public omni_thread 
 {	
 	private:
-		Fug_ns::Fug *myfug;		
-				
+		Fug_ns::Fug *myfug;
 	public:
 		
 		/* fugthread::fugthread(): initialize init loop */
@@ -52,9 +52,7 @@ class fugthread : public omni_thread
 		int MaxVoltageDiff(void);
 				
 };	/* end class fugthread() */
-
-
-
+}
 #endif
 
 /* EOF */
diff --git a/src/main.cpp b/src/main.cpp
index 64ad2c567a5d41397733e683bcb40e43b297df4e..9b2f4115d33ac5ee0f1ae68a1a8afbc37bca3bab 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,4 +1,3 @@
-static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fug_elettra/src/main.cpp,v 1.1.1.1 2014-10-22 10:12:39 giulio Exp $";
 //+=============================================================================
 //
 // file :        main.cpp
@@ -38,7 +37,7 @@ static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fug_elet
 int main(int argc,char *argv[])
 {
 
-	Tango::Util *tg;
+	Tango::Util *tg = 0;
 	try
 	{
 		// Initialise the device server
@@ -55,7 +54,7 @@ int main(int argc,char *argv[])
 		cout << "Ready to accept request" << endl;
 		tg->server_run();
 	}
-	catch (bad_alloc)
+	catch (bad_alloc &)
 	{
 		cout << "Can't allocate memory to store device object !!!" << endl;
 		cout << "Exiting" << endl;