Commit b8364fad authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Initial import

parent 1d9dd290
CMakeCache.txt
cmake_install.cmake
Makefile
CMakeFiles
bin
cscope.out
core*
//+=============================================================================
//
// 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 $
//
// $Revision: 1.2 $
//
// $Log: ClassFactory.cpp,v $
// Revision 1.2 2011-02-08 15:35:28 alessio
// Fix some build warnings
//
// Revision 1.1 2011/02/01 08:15:27 alessio
// Move source files to src/
//
// Revision 1.2 2008/07/02 15:11:22 enrico
// Added Parameter command to allow request custom parameter data (P1-P4)
// Added attributes for wave parameters such as NominalBits, VerticalScaledData
// ecc.
//
//
// 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 <LecroyInterfaceClass.h>
/**
* Create LecroyInterfaceClass singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
add_class(LecroyInterface_ns::LecroyInterfaceClass::init("LecroyInterface"));
}
//******************************************************************************************
//
//
// september 13, 2004 : Source file for the communication exceptions in socket mode
//
// with a Lecroy scope (avaiable for all models)
//
//
// author : X.Elattaoui
//
// LecroyException.cpp: interface for the socket & waveform exceptions class.
//
//******************************************************************************************
// ============================================================================
// DEPENDENCIES
#include "LecroyException.h"
namespace lecroy {
// ============================================================================
// Error::Error
// ============================================================================
Error::Error (void)
: reason ("unknown"),
desc ("unknown error"),
origin ("unknown"),
severity (lecroy::ERR)
{
}
// ============================================================================
// Error::Error
// ============================================================================
Error::Error (const char *_reason,
const char *_desc,
const char *_origin,
int _severity)
: reason (_reason),
desc (_desc),
origin (_origin),
severity (_severity)
{
}
// ============================================================================
// Error::Error
// ============================================================================
Error::Error (const std::string& _reason,
const std::string& _desc,
const std::string& _origin,
int _severity)
: reason (_reason),
desc (_desc),
origin (_origin),
severity (_severity)
{
}
// ============================================================================
// Error::Error
// ============================================================================
Error::Error (const Error& _src)
: reason (_src.reason),
desc (_src.desc),
origin (_src.origin),
severity (_src.severity)
{
}
// ============================================================================
// Error::~Error
// ============================================================================
Error::~Error (void)
{
}
// ============================================================================
// Error::operator=
// ============================================================================
Error& Error::operator= (const Error& _src)
{
//- no self assign
if (this == &_src) {
return *this;
}
this->reason = _src.reason;
this->desc = _src.desc;
this->origin = _src.origin;
this->severity = _src.severity;
return *this;
}
// ============================================================================
// LecroyException::LecroyException
// ============================================================================
LecroyException::LecroyException (void)
: errors(0)
{
this->push_error(Error());
}
// ============================================================================
// LecroyException::LecroyException
// ============================================================================
LecroyException::LecroyException (const char *_reason,
const char *_desc,
const char *_origin,
int _severity)
: errors(0)
{
this->push_error(Error(_reason, _desc, _origin, _severity));
}
// ============================================================================
// LecroyException::LecroyException
// ============================================================================
LecroyException::LecroyException (const std::string& _reason,
const std::string& _desc,
const std::string& _origin,
int _severity)
: errors(0)
{
this->push_error(_reason, _desc, _origin,_severity);
}
// ============================================================================
// LecroyException::LecroyException
// ============================================================================
LecroyException::LecroyException (const LecroyException& _src)
: errors(0)
{
for (unsigned int i = 0; i < _src.errors.size(); i++) {
this->push_error(_src.errors[i]);
}
}
// ============================================================================
// LecroyException::LecroyException
// ============================================================================
LecroyException& LecroyException::operator= (const LecroyException& _src)
{
//- no self assign
if (this == &_src) {
return *this;
}
this->errors.clear();
for (unsigned int i = 0; i < _src.errors.size(); i++) {
this->push_error(_src.errors[i]);
}
return *this;
}
// ============================================================================
// LecroyException::~LecroyException
// ============================================================================
LecroyException::~LecroyException (void)
{
this->errors.clear();
}
// ============================================================================
// LecroyException::push_error
// ============================================================================
void LecroyException::push_error (const char *_reason,
const char *_desc,
const char *_origin,
int _severity)
{
this->errors.push_back(Error(_reason, _desc, _origin, _severity));
}
// ============================================================================
// LecroyException::push_error
// ============================================================================
void LecroyException::push_error (const std::string& _reason,
const std::string& _desc,
const std::string& _origin,
int _severity)
{
this->errors.push_back(Error(_reason, _desc, _origin, _severity));
}
// ============================================================================
// LecroyException::push_error
// ============================================================================
void LecroyException::push_error (const Error& _error)
{
this->errors.push_back(_error);
}
} // namespace lecroy
#ifndef _LECROYEXCEPTION
#define _LECROYEXCEPTION
#include <string>
#include <vector>
namespace lecroy{
// ============================================================================
// lecroy Errors severities
// ============================================================================
typedef enum {
WARN,
ERR,
PANIC
} ErrorSeverity;
// ============================================================================
//! The lecroy exception abstraction base class.
// ============================================================================
//!
//! detailed description to be written
//!
// ============================================================================
class Error
{
public:
/**
* Initialization.
*/
Error (void);
/**
* Initialization.
*/
Error (const char *reason,
const char *desc,
const char *origin,
int severity = lecroy::ERR);
/**
* Initialization.
*/
Error (const std::string& reason,
const std::string& desc,
const std::string& origin,
int severity = lecroy::ERR);
/**
* Copy constructor.
*/
Error (const Error& src);
/**
* Error details: code
*/
virtual ~Error (void);
/**
* operator=
*/
Error& operator= (const Error& _src);
/**
* Error details: reason
*/
std::string reason;
/**
* Error details: description
*/
std::string desc;
/**
* Error details: origin
*/
std::string origin;
/**
* Error details: severity
*/
int severity;
};
// ============================================================================
// The lecroy error list.
// ============================================================================
typedef std::vector<Error> ErrorList;
// ============================================================================
//! The lecroy exception abstraction base class.
// ============================================================================
//!
//! detailed description to be written
//!
// ============================================================================
class LecroyException
{
public:
/**
* Initialization.
*/
LecroyException (void);
/**
* Initialization.
*/
LecroyException (const char *reason,
const char *desc,
const char *origin,
int severity = lecroy::ERR);
/**
* Initialization.
*/
LecroyException (const std::string& reason,
const std::string& desc,
const std::string& origin,
int severity = lecroy::ERR);
/**
* Initialization.
*/
LecroyException (const Error& error);
/**
* Copy constructor.
*/
LecroyException (const LecroyException& src);
/**
* operator=
*/
LecroyException& operator= (const LecroyException& _src);
/**
* Release resources.
*/
virtual ~LecroyException (void);
/**
* Push the specified error into the errors list.
*/
void push_error (const char *reason,
const char *desc,
const char *origin,
int severity = lecroy::ERR);
/**
* Push the specified error into the errors list.
*/
void push_error (const std::string& reason,
const std::string& desc,
const std::string& origin,
int severity = lecroy::ERR);
/**
* Push the specified error into the errors list.
*/
void push_error (const Error& error);
/**
* The errors list
*/
ErrorList errors;
};
} // end namspace lecroy
#endif //__LECROYEXCEPTION
This diff is collapsed.
//=============================================================================
//
// file : LecroyInterface.h
//
// description : Include for the LecroyInterface class.
//
// project :
//
// $Author: claudio $
//
// $Revision: 1.3 $
//
// $Log: LecroyInterface.h,v $
// Revision 1.3 2020-01-13 14:06:27 claudio
// use TANG_BASE_CLASS
//
// Revision 1.2 2019-06-13 07:35:44 alessio
// Move to Tango 9
//
// Revision 1.1 2011-02-01 08:15:27 alessio
// Move source files to src/
//
// Revision 1.6 2009/01/14 11:06:09 enrico
// Completed comments and descriptions; generated documents.
// ME
//
// Revision 1.5 2008/09/26 15:03:48 enrico
// Added commands to read counters in Pass/Fail mode
// (i.e. GetPassFailTotCounter and GetPassFailPassedCounter)
// ME
//
// Revision 1.4 2008/09/25 09:49:52 enrico
// Added Normal/Stop trigger mode/Clear sweeps commands.
// ...waiting for Lecroy engineers about misfunction of MTPC? command.
// ME
//
// Revision 1.3 2008/07/09 10:45:11 enrico
// Memory leak resolved. ME
//
// Revision 1.2 2008/07/02 15:11:22 enrico
// Added Parameter command to allow request custom parameter data (P1-P4)
// Added attributes for wave parameters such as NominalBits, VerticalScaledData
// ecc.
//
//
// 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) - Software Engineering Group - ESRF
//=============================================================================
#ifndef _LECROYINTERFACE_H
#define _LECROYINTERFACE_H
#include <tango.h>
//using namespace Tango;
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "SocketLecroy.h"
#include "Waveform.h"
#include "WaveformException.h"
const short BUF_LEN=512;
const int MAX_STRING_LENGTH = 256;
const int MAX_SIZE = 150000;
//const int MAX_WAVEFORM_DATA_LENGTH = 150000;
/**
* @author $Author: claudio $
* @version $Revision: 1.3 $
*/
// Add your own constants definitions here.
//-----------------------------------------------
namespace LecroyInterface_ns
{
/**
* Class Description:
*
*/
/*
* Device States Description:
* Tango::OPEN : *
* Tango::CLOSE : *
* Tango::FAULT : *
* Tango::ALARM :
*/
class LecroyInterface: 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::DevString *attr_TriggerTime_read;
Tango::DevDouble *attr_VerticalOffset_read;
Tango::DevDouble *attr_VerticalGain_read;
Tango::DevDouble *attr_HorizontalOffset_read;
Tango::DevDouble *attr_HorizontalInterval_read;
Tango::DevShort *attr_NominalBits_read;
Tango::DevLong *attr_WaveArray2_read;
Tango::DevLong *attr_WaveArray1_read;
Tango::DevLong *attr_WaveArrayCount_read;
Tango::DevDouble *attr_VerticalScaledData_read;
Tango::DevShort *attr_RawWaveformData_read;
//@}
/**
* @name Device properties
* Device properties member data.
*/
//@{
/**
*
*/
string ipAddress;
//@}
/**@name Constructors
* Miscellaneous constructors */
//@{
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
LecroyInterface(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
LecroyInterface(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
LecroyInterface(Tango::DeviceClass *cl,const char *s,const char *d);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/