Commit d74a56dd authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files

Initial import

parent 69b20498
.nse_depinfo
bin
obj
# Eclipse
.cproject
.project
.settings
NAME_SRV = fbm-srv
CXXFLAGS =
LDFLAGS = -lrnm -lrnmshare -lfbm
include ../makefiles/Make-8.1.2.c.in
static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fbm/src/ClassFactory.cpp,v 1.1 2010/06/11 08:38:05 graziano Exp $";
//+=============================================================================
//
// file : ClassFactory.cpp
//
// description : C++ source for the class_factory method of the DServer
// device class. This method is responsible to create
// all class singletin for a device server. It is called
// at device server startup
//
// project : TANGO Device Server
//
// $Author: graziano $
//
// $Revision: 1.1 $
//
// $Log: ClassFactory.cpp,v $
// Revision 1.1 2010/06/11 08:38:05 graziano
// first commit
//
//
// 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 <FBMClass.h>
/**
* Create FBMClass singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
add_class(FBM_ns::FBMClass::init("FBM"));
}
This diff is collapsed.
//=============================================================================
//
// file : FBM.h
//
// description : Include for the FBM class.
//
// project : Fast Trajectoy Feedback
//
// $Author: graziano $
//
// $Revision: 1.5 $
//
// $Log: FBM.h,v $
// Revision 1.5 2012-01-12 08:50:12 graziano
// added command normalize bpm
//
// Revision 1.4 2011/04/14 13:06:41 graziano
// fixed bug in history
// added charge rms
//
// Revision 1.3 2011/02/14 15:14:38 graziano
// fixed
//
// Revision 1.2 2010/06/11 08:54:26 graziano
// added bpm calibration
//
// Revision 1.1 2010/06/11 08:38:05 graziano
// first commit
//
//
// 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
//=============================================================================
#ifndef _FBM_H
#define _FBM_H
#include <tango.h>
#include <fbm_shm.h>
#include <fbm.h>
#define IS_BPM 0x80000000
#define IS_CM 0x40000000
//using namespace Tango;
/**
* @author $Author: graziano $
* @version $Revision: 1.5 $
*/
// Add your own constants definitions here.
//-----------------------------------------------
namespace FBM_ns
{
typedef struct
{
char bpm_name[FBM_DEVNAME_LEN];
long rnm_index;
long zposition;
int enable;
long thresh;
double calib[2]; //offset, factor
} bpm_str_t;
typedef struct
{
char cm_name[FBM_DEVNAME_LEN];
long rnm_index;
long zposition;
int enable;
long thresh;
double calib[2]; //offset, factor
//long max_val;
} cm_str_t;
/**
* Class Description:
* Fermi Fast Trajectory Feedback
*/
/*
* Device States Description:
*/
class FBM: public Tango::Device_4Impl
{
public :
// Add your own data members here
//-----------------------------------------
// Here is the Start of the automatic code generation part
//-------------------------------------------------------------
/**
* @name attributes
* Attributs member data.
*/
//@{
Tango::DevLong *attr_NumSamples_read;
Tango::DevLong attr_NumSamples_write;
Tango::DevDouble *attr_BeamZPosition_read;
Tango::DevDouble *attr_BeamZPositionOK_read;
Tango::DevString *attr_NamesBpm_read;
Tango::DevString *attr_NamesCm_read;
Tango::DevDouble *attr_ChargeBpm_read;
Tango::DevDouble *attr_ChargeCm_read;
Tango::DevDouble *attr_ChargeRmsBpm_read;
Tango::DevDouble *attr_ChargeRmsCm_read;
Tango::DevBoolean *attr_EnableBpm_read;
const Tango::DevBoolean *attr_EnableBpm_write;
Tango::DevBoolean *attr_EnableCm_read;
const Tango::DevBoolean *attr_EnableCm_write;
Tango::DevBoolean *attr_Enable_read;
const Tango::DevBoolean *attr_Enable_write;
Tango::DevString *attr_Names_read;
Tango::DevDouble *attr_Charge_read;
Tango::DevDouble *attr_ChargeRms_read;
Tango::DevDouble *attr_ChargeBpmHistory_read;
Tango::DevDouble *attr_ChargeCmHistory_read;
Tango::DevDouble *attr_ChargeHistory_read;
Tango::DevBoolean *attr_StatBpm_read;
Tango::DevBoolean *attr_StatCm_read;
Tango::DevBoolean *attr_Stat_read;
Tango::DevDouble *attr_ZPositionBpm_read;
Tango::DevDouble *attr_ZPositionCm_read;
Tango::DevDouble *attr_ZPosition_read;
//@}
/**
* @name Device properties
* Device properties member data.
*/
//@{
/**
* bpm name: threshold: enabled
*/
vector<string> bpmConfig;
/**
* cm name: threshold: enabled
*/
vector<string> cmConfig;
/**
* Number of samples for buffering
*/
Tango::DevLong numSamples;
//@}
/**@name Constructors
* Miscellaneous constructors */
//@{
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
FBM(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
FBM(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
FBM(Tango::DeviceClass *cl,const char *s,const char *d);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/
~FBM() {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 FBM methods prototypes
*/
//@{
/**
* Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* Extract real attribute values for NumSamples acquisition result.
*/
virtual void read_NumSamples(Tango::Attribute &attr);
/**
* Write NumSamples attribute values to hardware.
*/
virtual void write_NumSamples(Tango::WAttribute &attr);
/**
* Extract real attribute values for BeamZPosition acquisition result.
*/
virtual void read_BeamZPosition(Tango::Attribute &attr);
/**
* Extract real attribute values for BeamZPositionOK acquisition result.
*/
virtual void read_BeamZPositionOK(Tango::Attribute &attr);
/**
* Extract real attribute values for NamesBpm acquisition result.
*/
virtual void read_NamesBpm(Tango::Attribute &attr);
/**
* Extract real attribute values for NamesCm acquisition result.
*/
virtual void read_NamesCm(Tango::Attribute &attr);
/**
* Extract real attribute values for ChargeBpm acquisition result.
*/
virtual void read_ChargeBpm(Tango::Attribute &attr);
/**
* Extract real attribute values for ChargeCm acquisition result.
*/
virtual void read_ChargeCm(Tango::Attribute &attr);
/**
* Extract real attribute values for ChargeRmsBpm acquisition result.
*/
virtual void read_ChargeRmsBpm(Tango::Attribute &attr);
/**
* Extract real attribute values for ChargeRmsCm acquisition result.
*/
virtual void read_ChargeRmsCm(Tango::Attribute &attr);
/**
* Extract real attribute values for EnableBpm acquisition result.
*/
virtual void read_EnableBpm(Tango::Attribute &attr);
/**
* Write EnableBpm attribute values to hardware.
*/
virtual void write_EnableBpm(Tango::WAttribute &attr);
/**
* Extract real attribute values for EnableCm acquisition result.
*/
virtual void read_EnableCm(Tango::Attribute &attr);
/**
* Write EnableCm attribute values to hardware.
*/
virtual void write_EnableCm(Tango::WAttribute &attr);
/**
* Extract real attribute values for Enable acquisition result.
*/
virtual void read_Enable(Tango::Attribute &attr);
/**
* Write Enable attribute values to hardware.
*/
virtual void write_Enable(Tango::WAttribute &attr);
/**
* Extract real attribute values for Names acquisition result.
*/
virtual void read_Names(Tango::Attribute &attr);
/**
* Extract real attribute values for Charge acquisition result.
*/
virtual void read_Charge(Tango::Attribute &attr);
/**
* Extract real attribute values for ChargeRms acquisition result.
*/
virtual void read_ChargeRms(Tango::Attribute &attr);
/**
* Extract real attribute values for ChargeBpmHistory acquisition result.
*/
virtual void read_ChargeBpmHistory(Tango::Attribute &attr);
/**
* Extract real attribute values for ChargeCmHistory acquisition result.
*/
virtual void read_ChargeCmHistory(Tango::Attribute &attr);
/**
* Extract real attribute values for ChargeHistory acquisition result.
*/
virtual void read_ChargeHistory(Tango::Attribute &attr);
/**
* Extract real attribute values for StatBpm acquisition result.
*/
virtual void read_StatBpm(Tango::Attribute &attr);
/**
* Extract real attribute values for StatCm acquisition result.
*/
virtual void read_StatCm(Tango::Attribute &attr);
/**
* Extract real attribute values for Stat acquisition result.
*/
virtual void read_Stat(Tango::Attribute &attr);
/**
* Extract real attribute values for ZPositionBpm acquisition result.
*/
virtual void read_ZPositionBpm(Tango::Attribute &attr);
/**
* Extract real attribute values for ZPositionCm acquisition result.
*/
virtual void read_ZPositionCm(Tango::Attribute &attr);
/**
* Extract real attribute values for ZPosition acquisition result.
*/
virtual void read_ZPosition(Tango::Attribute &attr);
/**
* Read/Write allowed for NumSamples attribute.
*/
virtual bool is_NumSamples_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for BeamZPosition attribute.
*/
virtual bool is_BeamZPosition_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for BeamZPositionOK attribute.
*/
virtual bool is_BeamZPositionOK_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for NamesBpm attribute.
*/
virtual bool is_NamesBpm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for NamesCm attribute.
*/
virtual bool is_NamesCm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for ChargeBpm attribute.
*/
virtual bool is_ChargeBpm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for ChargeCm attribute.
*/
virtual bool is_ChargeCm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for ChargeRmsBpm attribute.
*/
virtual bool is_ChargeRmsBpm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for ChargeRmsCm attribute.
*/
virtual bool is_ChargeRmsCm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for EnableBpm attribute.
*/
virtual bool is_EnableBpm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for EnableCm attribute.
*/
virtual bool is_EnableCm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Enable attribute.
*/
virtual bool is_Enable_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Names attribute.
*/
virtual bool is_Names_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Charge attribute.
*/
virtual bool is_Charge_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for ChargeRms attribute.
*/
virtual bool is_ChargeRms_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for ChargeBpmHistory attribute.
*/
virtual bool is_ChargeBpmHistory_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for ChargeCmHistory attribute.
*/
virtual bool is_ChargeCmHistory_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for ChargeHistory attribute.
*/
virtual bool is_ChargeHistory_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for StatBpm attribute.
*/
virtual bool is_StatBpm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for StatCm attribute.
*/
virtual bool is_StatCm_allowed(Tango::AttReqType type);
/**
* Read/Write allowed for Stat attribute.
*/
virtual bool is_Stat_allowed(Tango::AttReqType type);
/**
* Read allowed for ZPositionBpm attribute.
*/
virtual bool is_ZPositionBpm_allowed(Tango::AttReqType type);
/**
* Read allowed for ZPositionCm attribute.
*/
virtual bool is_ZPositionCm_allowed(Tango::AttReqType type);
/**
* Read allowed for ZPosition attribute.
*/
virtual bool is_ZPosition_allowed(Tango::AttReqType type);
/**
* Execution allowed for NormalizeBPM command.
*/
virtual bool is_NormalizeBPM_allowed(const CORBA::Any &any);
/**
* Execution allowed for InitParam command.
*/
virtual bool is_InitParam_allowed(const CORBA::Any &any);
/**
* Normalize BPM calib.
* @return
* @exception DevFailed
*/
void normalize_bpm();
/**
* Reload calib.
* @return
* @exception DevFailed
*/
void init_param();
/**
* Read the device properties from database
*/
void get_device_property();
//@}
// Here is the end of the automatic code generation part
//-------------------------------------------------------------
fbm_t *fbm_shm;
bool FBMStat[32];
void set_DevStat(void);
bpm_str_t fbm_bpm[FBM_NUM_BPM];
cm_str_t fbm_cm[FBM_NUM_CM];
long num_bpm, num_cm;
void load_parameters(void);
void string_explode(string str, string separator, vector<string>* results);
protected :
// Add your own data members here
//-----------------------------------------
Tango::DeviceProxy *devproxy;
Tango::DevString names_bpm[FBM_NUM_BPM];
Tango::DevString names_cm[FBM_NUM_CM];
Tango::DevString names[FBM_NUM_BPM+FBM_NUM_CM];
unsigned int bpm_cm_sorted[FBM_NUM_BPM+FBM_NUM_CM]; //1=bpm, 2=cm
};
} // namespace_ns
#endif // _FBM_H
static const char *ClassId = "$Id: FBMClass.cpp,v 1.3 2012-01-12 08:50:12 graziano Exp $";
static const char *CvsPath = "$Source: /home/cvsadm/cvsroot/fermi/servers/fbm/src/FBMClass.cpp,v $";
static const char *SvnPath = "$HeadURL: $";
static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/fbm/src/FBMClass.cpp,v 1.3 2012-01-12 08:50:12 graziano Exp $";
static const char *TagName = "$Name: $";
static const char *HttpServer= "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/";
//+=============================================================================
//
// file : FBMClass.cpp
//
// description : C++ source for the FBMClass. A singleton
// class derived from DeviceClass. It implements the
// command list and all properties and methods required
// by the FBM once per process.
//
// project : TANGO Device Server
//
// $Author: graziano $
//
// $Revision: 1.3 $
//
// $Log: FBMClass.cpp,v $
// Revision 1.3 2012-01-12 08:50:12 graziano
// added command normalize bpm
//
// Revision 1.2 2011/04/14 13:06:41 graziano
// fixed bug in history
// added charge rms
//
// Revision 1.1 2010/06/11 08:38:05 graziano
// first commit
//
//
// 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 <FBM.h>
#include <FBMClass.h>
//+----------------------------------------------------------------------------
/**
* Create FBMClass singleton and return it in a C function for Python usage
*/
//+----------------------------------------------------------------------------
extern "C" {
#ifdef WIN32
__declspec(dllexport)
#endif
Tango::DeviceClass *_create_FBM_class(const char *name) {
return FBM_ns::FBMClass::init(name);
}
}
namespace FBM_ns
{
//+----------------------------------------------------------------------------
//
// method : NormalizeBPMCmd::execute()
//
// description : method to trigger the execution of the command.
// PLEASE DO NOT MODIFY this method core without pogo
//
// in : - device : The device on which the command must be excuted
// - in_any : The command input data
//
// returns : The command output data (packed in the Any object)
//
//-----------------------------------------------------------------------------
CORBA::Any *NormalizeBPMCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any)