Commit 69ec4af3 authored by Stefano Cleva's avatar Stefano Cleva
Browse files

First commit

parent 5a56034d
NAME_SRV = wett8-srv
CXXFLAGS =
LDFLAGS =
include ../makefiles/Make-9.3.3.in
static const char *RcsId = "$Header: $";
//+=============================================================================
//
// 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: $
//
// $Revision: $
//
// $Log: $
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//-=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#include <tango.h>
#include <WetTwebIOClass.h>
/**
* Create WetTwebIOClass singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
add_class(WetTwebIO_ns::WetTwebIOClass::init("WetTwebIO"));
}
/**
* Device Class Identification:
*
* Class Name : WetTwebIO
* Contact : stefano.cleva@elettra.trieste.it
* Class Family : thermograph
* Platform : All Platforms
* Bus : ethernet
* Manufacturer : none
* Reference :
*/
This diff is collapsed.
//=============================================================================
//
// file : WetTwebIO.h
//
// description : Include for the WetTwebIO class.
//
// project : WetTwebIO
//
// $Author: $
//
// $Revision: $
//
// $Log: $
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#include <sys/socket.h>
#include <arpa/inet.h>
#include <string.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/time.h>
#include <time.h>
#ifndef _WETTWEBIO_H
#define _WETTWEBIO_H
#define NumTemp 8
#include <tango.h>
//using namespace Tango;
/**
* @author $Author: $
* @version $Revision: $
*/
// Add your own constants definitions here.
//-----------------------------------------------
namespace WetTwebIO_ns
{
/**
* Class Description:
* WetTwebIO temp meas
*/
/*
* Device States Description:
*/
class WetTwebIO: public TANGO_BASE_CLASS
{
public :
// Add your own data members here
//-----------------------------------------
// Here is the Start of the automatic code generation part
//-------------------------------------------------------------
/**
* @name attributes
* Attributs member data.
*/
//@{
Tango::DevDouble *attr_Temperature1_read;
Tango::DevDouble *attr_Temperature2_read;
Tango::DevDouble *attr_Temperature3_read;
Tango::DevDouble *attr_Temperature4_read;
Tango::DevDouble *attr_Temperature5_read;
Tango::DevDouble *attr_Temperature6_read;
Tango::DevDouble *attr_Temperature7_read;
Tango::DevDouble *attr_Temperature8_read;
//@}
/**
* @name Device properties
* Device properties member data.
*/
//@{
/**
* device location
*/
string location;
/**
* device IP address
*/
string iPaddr;
/**
* device name
*/
string host_name;
//@}
/**@name Constructors
* Miscellaneous constructors */
//@{
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
WetTwebIO(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
WetTwebIO(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
WetTwebIO(Tango::DeviceClass *cl,const char *s,const char *d);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/
~WetTwebIO() {delete_device();};
/**
* will be called at device destruction or at init command.
*/
void delete_device();
//@}
/**@name Miscellaneous methods */
//@{
/**
* Initialize the device
*/
virtual void init_device();
/**
* Always executed method befor execution command method.
*/
virtual void always_executed_hook();
//@}
/**
* @name WetTwebIO methods prototypes
*/
//@{
/**
* Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* Extract real attribute values for Temperature1 acquisition result.
*/
virtual void read_Temperature1(Tango::Attribute &attr);
/**
* Extract real attribute values for Temperature2 acquisition result.
*/
virtual void read_Temperature2(Tango::Attribute &attr);
/**
* Extract real attribute values for Temperature3 acquisition result.
*/
virtual void read_Temperature3(Tango::Attribute &attr);
/**
* Extract real attribute values for Temperature4 acquisition result.
*/
virtual void read_Temperature4(Tango::Attribute &attr);
/**
* Extract real attribute values for Temperature5 acquisition result.
*/
virtual void read_Temperature5(Tango::Attribute &attr);
/**
* Extract real attribute values for Temperature6 acquisition result.
*/
virtual void read_Temperature6(Tango::Attribute &attr);
/**
* Extract real attribute values for Temperature7 acquisition result.
*/
virtual void read_Temperature7(Tango::Attribute &attr);
/**
* Extract real attribute values for Temperature8 acquisition result.
*/
virtual void read_Temperature8(Tango::Attribute &attr);
/**
* Read/Write allowed for Temperature1 attribute.
*/
virtual bool is_Temperature1_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Temperature2 attribute.
*/
virtual bool is_Temperature2_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Temperature3 attribute.
*/
virtual bool is_Temperature3_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Temperature4 attribute.
*/
virtual bool is_Temperature4_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Temperature5 attribute.
*/
virtual bool is_Temperature5_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Temperature6 attribute.
*/
virtual bool is_Temperature6_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Temperature7 attribute.
*/
virtual bool is_Temperature7_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Temperature8 attribute.
*/
virtual bool is_Temperature8_allowed(Tango::AttReqType type);
/**
* Read the device properties from database
*/
void get_device_property();
//@}
// Here is the end of the automatic code generation part
//-------------------------------------------------------------
protected :
// Add your own data members here
//-----------------------------------------
struct sockaddr_in serv_addr;
int sockfd, portno;
Tango::DevDouble IniMeasuredTemp;
Tango::DevDouble TempVector[NumTemp];
bool IsChanAvail[NumTemp];
bool AtLeastOne;
bool cycle;
long ElapsedTime;
//struct timeval SetTrigTimeVal, ClearTrigTimeVal;
int string_explode(string str, string separator, vector<string>* results);
int string_replace(string str, string original, string replaced, string* results);
//bool string_explode(string str, string separator, vector<string>* results);
double get_double_value(string stringin);
bool critical_properties_missing;
//void ReadTempVector();
//void SetTrigTime(struct timeval);
void TimerReset();
double TimerGetElapsedTime();
//bool CheckTrigTime();
};
} // namespace_ns
#endif // _WETTWEBIO_H
static const char *RcsId = "$Header: $";
static const char *TagName = "$Name: $";
static const char *HttpServer= "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/";
//+=============================================================================
//
// file : WetTwebIOClass.cpp
//
// description : C++ source for the WetTwebIOClass. A singleton
// class derived from DeviceClass. It implements the
// command list and all properties and methods required
// by the WetTwebIO once per process.
//
// project : TANGO Device Server
//
// $Author: $
//
// $Revision: $
//
// $Log: $
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//-=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#include <tango.h>
#include <WetTwebIO.h>
#include <WetTwebIOClass.h>
//+----------------------------------------------------------------------------
/**
* Create WetTwebIOClass singleton and return it in a C function for Python usage
*/
//+----------------------------------------------------------------------------
extern "C" {
#ifdef WIN32
__declspec(dllexport)
#endif
Tango::DeviceClass *_create_WetTwebIO_class(const char *name) {
return WetTwebIO_ns::WetTwebIOClass::init(name);
}
}
namespace WetTwebIO_ns
{
//
//----------------------------------------------------------------
// Initialize pointer for singleton pattern
//----------------------------------------------------------------
//
WetTwebIOClass *WetTwebIOClass::_instance = NULL;
//+----------------------------------------------------------------------------
//
// method : WetTwebIOClass::WetTwebIOClass(string &s)
//
// description : constructor for the WetTwebIOClass
//
// in : - s : The class name
//
//-----------------------------------------------------------------------------
WetTwebIOClass::WetTwebIOClass(string &s):DeviceClass(s)
{
cout2 << "Entering WetTwebIOClass constructor" << endl;
set_default_property();
get_class_property();
write_class_property();
cout2 << "Leaving WetTwebIOClass constructor" << endl;
}
//+----------------------------------------------------------------------------
//
// method : WetTwebIOClass::~WetTwebIOClass()
//
// description : destructor for the WetTwebIOClass
//
//-----------------------------------------------------------------------------
WetTwebIOClass::~WetTwebIOClass()
{
_instance = NULL;
}
//+----------------------------------------------------------------------------
//
// method : WetTwebIOClass::instance
//
// description : Create the object if not already done. Otherwise, just
// return a pointer to the object
//
// in : - name : The class name
//
//-----------------------------------------------------------------------------
WetTwebIOClass *WetTwebIOClass::init(const char *name)
{
if (_instance == NULL)
{
try
{
string s(name);
_instance = new WetTwebIOClass(s);
}
catch (bad_alloc)
{
throw;
}
}
return _instance;
}
WetTwebIOClass *WetTwebIOClass::instance()
{
if (_instance == NULL)
{
cerr << "Class is not initialised !!" << endl;
exit(-1);
}
return _instance;
}
//+----------------------------------------------------------------------------
//
// method : WetTwebIOClass::command_factory
//
// description : Create the command object(s) and store them in the
// command list
//
//-----------------------------------------------------------------------------
void WetTwebIOClass::command_factory()
{
// add polling if any
for (unsigned int i=0 ; i<command_list.size(); i++)
{
}
}
//+----------------------------------------------------------------------------
//
// method : WetTwebIOClass::get_class_property
//
// description : Get the class property for specified name.
//
// in : string name : The property name
//
//+----------------------------------------------------------------------------
Tango::DbDatum WetTwebIOClass::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, return an empty DbDatum
return Tango::DbDatum(prop_name);
}
//+----------------------------------------------------------------------------
//
// method : WetTwebIOClass::get_default_device_property()
//
// description : Return the default value for device property.
//
//-----------------------------------------------------------------------------
Tango::DbDatum WetTwebIOClass::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 : WetTwebIOClass::get_default_class_property()
//
// description : Return the default value for class property.
//
//-----------------------------------------------------------------------------
Tango::DbDatum WetTwebIOClass::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 : WetTwebIOClass::device_factory
//
// description : Create the device object(s) and store them in the
// device list
//
// in : Tango::DevVarStringArray *devlist_ptr : The device name list
//
//-----------------------------------------------------------------------------
void WetTwebIOClass::device_factory(const Tango::DevVarStringArray *devlist_ptr)
{
// Create all devices.(Automatic code generation)
//-------------------------------------------------------------
for (unsigned long i=0 ; i < devlist_ptr->length() ; i++)
{
cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl;
// Create devices and add it into the device list
//----------------------------------------------------
device_list.push_back(new WetTwebIO(this, (*devlist_ptr)[i]));
// Export device to the outside world
// Check before if database used.
//---------------------------------------------
if ((Tango::Util::_UseDb == true) && (Tango::Util::_FileDb == false))
export_device(device_list.back());
else
export_device(device_list.back(), (*devlist_ptr)[i]);
}
// End of Automatic code generation
//-------------------------------------------------------------
}
//+----------------------------------------------------------------------------
// Method: WetTwebIOClass::attribute_factory(vector<Tango::Attr *> &att_list)
//-----------------------------------------------------------------------------
void WetTwebIOClass::attribute_factory(vector<Tango::Attr *> &att_list)
{
// Attribute : Temperature1
Temperature1Attrib *temperature1 = new Temperature1Attrib();
Tango::UserDefaultAttrProp temperature1_prop;
temperature1_prop.set_description("measured temperature");
temperature1->set_default_properties(temperature1_prop);
att_list.push_back(temperature1);
// Attribute : Temperature2
Temperature2Attrib *temperature2 = new Temperature2Attrib();
Tango::UserDefaultAttrProp temperature2_prop;
temperature2_prop.set_description("measured temperature");
temperature2->set_default_properties(temperature2_prop);
att_list.push_back(temperature2);
// Attribute : Temperature3
Temperature3Attrib *temperature3 = new Temperature3Attrib();
Tango::UserDefaultAttrProp temperature3_prop;
temperature3_prop.set_description("measured temperature");
temperature3->set_default_properties(temperature3_prop);
att_list.push_back(temperature3);
// Attribute : Temperature4
Temperature4Attrib *temperature4 = new Temperature4Attrib();
Tango::UserDefaultAttrProp temperature4_prop;
temperature4_prop.set_description("measured temperature");
temperature4->set_default_properties(temperature4_prop);
att_list.push_back(temperature4);
// Attribute : Temperature5
Temperature5Attrib *temperature5 = new Temperature5Attrib();
Tango::UserDefaultAttrProp temperature5_prop;
temperature5_prop.set_description("measured temperature");
temperature5->set_default_properties(temperature5_prop);
att_list.push_back(temperature5);
// Attribute : Temperature6
Temperature6Attrib *temperature6 = new Temperature6Attrib();
Tango::UserDefaultAttrProp temperature6_prop;
temperature6_prop.set_description("measured temperature");
temperature6->set_default_properties(temperature6_prop);
att_list.push_back(temperature6);
// Attribute : Temperature7
Temperature7Attrib *temperature7 = new Temperature7Attrib();
Tango::UserDefaultAttrProp temperature7_prop;
temperature7_prop.set_description("measured temperature");
temperature7->set_default_properties(temperature7_prop);
att_list.push_back(temperature7);