Skip to content
Snippets Groups Projects
Commit 6e1fc0d2 authored by Lorenzo Pivetta's avatar Lorenzo Pivetta
Browse files

Initial import

parent 5068d7a8
No related branches found
No related tags found
No related merge requests found
NAME_SRV = 651d-srv
CXXFLAGS =
LDFLAGS =
include ../Make-8.0.5.in
/*----- PROTECTED REGION ID(Mks651d::ClassFactory.cpp) ENABLED START -----*/
static const char *RcsId = "$Id: ClassFactory.cpp,v 1.2 2012-03-08 09:50:01 mdm Exp $";
//=============================================================================
//
// file : ClassFactory.cpp
//
// description : C++ source for the class_factory method of the DServer
// device class. This method is responsible for the creation of
// all class singleton for a device server. It is called
// at device server startup.
//
// project : Mks651d.
//
// $Author: mdm $
//
// $Revision: 1.2 $
// $Date: 2012-03-08 09:50:01 $
//
// SVN only:
// $HeadURL: $
//
// CVS only:
// $Source: /home/cvsadm/cvsroot/fermi/servers/651d/src/ClassFactory.cpp,v $
// $Log: ClassFactory.cpp,v $
// Revision 1.2 2012-03-08 09:50:01 mdm
// New version of server
//
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <tango.h>
#include <Mks651dClass.h>
// Add class header files if needed
/**
* Create Mks651d Class singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
// Add method class init if needed
add_class(Mks651d_ns::Mks651dClass::init("Mks651d"));
}
/*----- PROTECTED REGION END -----*/
This diff is collapsed.
/*----- PROTECTED REGION ID(Mks651d.h) ENABLED START -----*/
//=============================================================================
//
// file : Mks651d.h
//
// description : Include for the Mks651d class.
//
// project : Mks651d.
//
// $Author: mdm $
//
// $Revision: 1.2 $
// $Date: 2012-03-08 09:50:01 $
//
// SVN only:
// $HeadURL: $
//
// CVS only:
// $Source: /home/cvsadm/cvsroot/fermi/servers/651d/src/Mks651d.h,v $
// $Log: Mks651d.h,v $
// Revision 1.2 2012-03-08 09:50:01 mdm
// New version of server
//
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#ifndef MKS651D_H
#define MKS651D_H
#include <tango.h>
/*----- PROTECTED REGION END -----*/
/**
* Mks651d class Description:
*
*/
namespace Mks651d_ns
{
/*----- PROTECTED REGION ID(Mks651d::Additional Class Declarations) ENABLED START -----*/
// Additional Class Declarations
/*----- PROTECTED REGION END -----*/ // Mks651d::Additional Class Declarations
class Mks651d : public Tango::Device_4Impl
{
/*----- PROTECTED REGION ID(Mks651d::Data Members) ENABLED START -----*/
Tango::DeviceProxy* device_proxy;
omni_mutex proxy_mutex;
bool init_completed;
double current_back_off;
time_t last_exception_t;
/*----- PROTECTED REGION END -----*/ // Mks651d::Data Members
// Device property data members
public: // SerialDevice:
string serialDevice;
// Timeout:
Tango::DevULong timeout;
// MaxBackOff:
Tango::DevLong maxBackOff;
// ShowPressure:
Tango::DevBoolean showPressure;
// Attribute data members
public:
Tango::DevDouble *attr_Pressure_read;
Tango::DevDouble *attr_Position_read;
Tango::DevShort *attr_ControlType_read;
Tango::DevShort *attr_SensorType_read;
Tango::DevShort *attr_SensorVoltage_read;
Tango::DevShort *attr_SensorRange_read;
Tango::DevShort *attr_ControlMode_read;
Tango::DevShort *attr_ValveType_read;
Tango::DevShort *attr_AnalogSPRange_read;
Tango::DevShort *attr_SelectedSP_read;
Tango::DevShort *attr_PowerFailResponse_read;
// Constructors and destructors
public:
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
Mks651d(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
Mks651d(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
Mks651d(Tango::DeviceClass *cl,const char *s,const char *d);
/**
* The object destructor.
*/
~Mks651d() {delete_device();};
// Miscellaneous methods
public:
/**
* will be called at device destruction or at init command.
*/
void delete_device();
/**
* Initialize the device
*/
virtual void init_device();
/**
* Read the device properties from database
*/
void get_device_property();
/**
* Always executed method before execution command method.
*/
virtual void always_executed_hook();
// Attribute methods
public:
/**
* Method : Mks651d::read_attr_hardware()
* Description : Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* Pressure attribute related methods.
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_Pressure(Tango::Attribute &attr);
virtual bool is_Pressure_allowed(Tango::AttReqType type);
/**
* Position attribute related methods.
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_Position(Tango::Attribute &attr);
virtual bool is_Position_allowed(Tango::AttReqType type);
/**
* ControlType attribute related methods.
* Description: Control type
* 0 = self tuning
* 1 = PID
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_ControlType(Tango::Attribute &attr);
virtual void write_ControlType(Tango::WAttribute &attr);
virtual bool is_ControlType_allowed(Tango::AttReqType type);
/**
* SensorType attribute related methods.
* Description: Sensor type
* 0 = Absolute
* 1 = Differential
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_SensorType(Tango::Attribute &attr);
virtual void write_SensorType(Tango::WAttribute &attr);
virtual bool is_SensorType_allowed(Tango::AttReqType type);
/**
* SensorVoltage attribute related methods.
* Description: Sensor voltage range:
* 0 = 1 Volt
* 1 = 5 Volts
* 2 = 10 Volts
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_SensorVoltage(Tango::Attribute &attr);
virtual void write_SensorVoltage(Tango::WAttribute &attr);
virtual bool is_SensorVoltage_allowed(Tango::AttReqType type);
/**
* SensorRange attribute related methods.
* Description: Sensor range:
* 00 = 0.1
* 01 = 0.2
* 02 = 0.5
* 03 = 1
* 04 = 2
* 05 = 5
* 06 = 10
* 07 = 50
* 08 = 100
* 09 = 500
* 10 = 1000
* 11 = 5000
* 12 = 10000
* 13 = 1.3
* 14 = 2.66
* 15 = 13.33
* 16 = 133.3
* 17 = 1333
* 18 = 6666
* 19 = 13332
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_SensorRange(Tango::Attribute &attr);
virtual void write_SensorRange(Tango::WAttribute &attr);
virtual bool is_SensorRange_allowed(Tango::AttReqType type);
/**
* ControlMode attribute related methods.
* Description: Control type:
* 0 = direct
* 1 = reverse
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_ControlMode(Tango::Attribute &attr);
virtual void write_ControlMode(Tango::WAttribute &attr);
virtual bool is_ControlMode_allowed(Tango::AttReqType type);
/**
* ValveType attribute related methods.
* Description: Valve type:
* 1 = Std 253
* 2 = Fast 253
* 3 = 653
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_ValveType(Tango::Attribute &attr);
virtual bool is_ValveType_allowed(Tango::AttReqType type);
/**
* AnalogSPRange attribute related methods.
* Description: 0 = 5 Volts
* 1 = 10 Volts
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_AnalogSPRange(Tango::Attribute &attr);
virtual void write_AnalogSPRange(Tango::WAttribute &attr);
virtual bool is_AnalogSPRange_allowed(Tango::AttReqType type);
/**
* SelectedSP attribute related methods.
* Description: 0 = setpoint analog
* 1 = setpoint A
* 2 = setpoint B
* 3 = setpoint C
* 4 = setpoint D
* 5 = setpoint E
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_SelectedSP(Tango::Attribute &attr);
virtual bool is_SelectedSP_allowed(Tango::AttReqType type);
/**
* PowerFailResponse attribute related methods.
* Description: Power fail response:
* 0 = disabled
* 1 = open at power fail
* 2 = close at power fail
*
* Data type: Tango::DevShort
* Attr type: Scalar
*/
virtual void read_PowerFailResponse(Tango::Attribute &attr);
virtual void write_PowerFailResponse(Tango::WAttribute &attr);
virtual bool is_PowerFailResponse_allowed(Tango::AttReqType type);
/**
* Method : Mks651d::add_dynamic_attributes()
* Description : Add dynamic attributes if any.
*/
void add_dynamic_attributes();
// Command related methods
public:
/**
* Command Open related methods.
*/
void open();
virtual bool is_Open_allowed(const CORBA::Any &any);
/**
* Command Close related methods.
*/
void close();
virtual bool is_Close_allowed(const CORBA::Any &any);
/**
* Command Stop related methods.
*/
void stop();
virtual bool is_Stop_allowed(const CORBA::Any &any);
/**
* Command SelectSP related methods.
*/
void select_sp(Tango::DevShort argin);
virtual bool is_SelectSP_allowed(const CORBA::Any &any);
/**
* Command ReadSPLevel related methods.
*/
Tango::DevDouble read_splevel(Tango::DevShort argin);
virtual bool is_ReadSPLevel_allowed(const CORBA::Any &any);
/**
* Command WriteSPLevel related methods.
*/
void write_splevel(const Tango::DevVarDoubleArray *argin);
virtual bool is_WriteSPLevel_allowed(const CORBA::Any &any);
/**
* Command ReadSPType related methods.
*/
Tango::DevShort read_sptype(Tango::DevShort argin);
virtual bool is_ReadSPType_allowed(const CORBA::Any &any);
/**
* Command WriteSPType related methods.
*/
void write_sptype(const Tango::DevVarShortArray *argin);
virtual bool is_WriteSPType_allowed(const CORBA::Any &any);
/**
* Command ReadSoftStart related methods.
*/
Tango::DevDouble read_soft_start(Tango::DevShort argin);
virtual bool is_ReadSoftStart_allowed(const CORBA::Any &any);
/**
* Command WriteSoftStart related methods.
*/
void write_soft_start(const Tango::DevVarDoubleArray *argin);
virtual bool is_WriteSoftStart_allowed(const CORBA::Any &any);
/**
* Command ReadSPGain related methods.
*/
Tango::DevDouble read_spgain(Tango::DevShort argin);
virtual bool is_ReadSPGain_allowed(const CORBA::Any &any);
/**
* Command WriteSPGain related methods.
*/
void write_spgain(const Tango::DevVarDoubleArray *argin);
virtual bool is_WriteSPGain_allowed(const CORBA::Any &any);
/**
* Command ReadSPLead related methods.
*/
Tango::DevLong read_splead(Tango::DevShort argin);
virtual bool is_ReadSPLead_allowed(const CORBA::Any &any);
/**
* Command WriteSPLead related methods.
*/
void write_splead(const Tango::DevVarLongArray *argin);
virtual bool is_WriteSPLead_allowed(const CORBA::Any &any);
/**
* Command ReadThreshold related methods.
*/
Tango::DevDouble read_threshold(Tango::DevShort argin);
virtual bool is_ReadThreshold_allowed(const CORBA::Any &any);
/**
* Command WriteThreshold related methods.
*/
void write_threshold(const Tango::DevVarDoubleArray *argin);
virtual bool is_WriteThreshold_allowed(const CORBA::Any &any);
/**
* Command StartLearning related methods.
*/
void start_learning();
virtual bool is_StartLearning_allowed(const CORBA::Any &any);
/**
* Command StopLearning related methods.
*/
void stop_learning();
virtual bool is_StopLearning_allowed(const CORBA::Any &any);
/**
* Command LearnAnalog related methods.
*/
void learn_analog();
virtual bool is_LearnAnalog_allowed(const CORBA::Any &any);
/**
* Command CalibrateAdc related methods.
*/
void calibrate_adc(Tango::DevDouble argin);
virtual bool is_CalibrateAdc_allowed(const CORBA::Any &any);
/**
* Command ZeroSensor related methods.
*/
void zero_sensor();
virtual bool is_ZeroSensor_allowed(const CORBA::Any &any);
/**
* Command RemoveZero related methods.
*/
void remove_zero();
virtual bool is_RemoveZero_allowed(const CORBA::Any &any);
/**
* Command SetZero related methods.
*/
void set_zero(Tango::DevDouble argin);
virtual bool is_SetZero_allowed(const CORBA::Any &any);
/**
* Command LearnZero related methods.
*/
void learn_zero();
virtual bool is_LearnZero_allowed(const CORBA::Any &any);
/**
* Command DirectCommand related methods.
*/
Tango::DevString direct_command(Tango::DevString argin);
virtual bool is_DirectCommand_allowed(const CORBA::Any &any);
/*----- PROTECTED REGION ID(Mks651d::Additional Method prototypes) ENABLED START -----*/
virtual void update_state();
virtual bool update_state_allowed();
virtual std::string serial_in_out(std::string, bool);
virtual void exception_handler(Tango::DevFailed &, Tango::DevState, const std::string);
virtual void strip_last(std::string &, char, int);
virtual void strip_first(std::string &, char, int);
/*----- PROTECTED REGION END -----*/ // Mks651d::Additional Method prototypes
};
/*----- PROTECTED REGION ID(Mks651d::Additional Classes Definitions) ENABLED START -----*/
// Additional Classes definitions
/*----- PROTECTED REGION END -----*/ // Mks651d::Additional Classes Definitions
} // namespace
#endif // MKS651D_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* ThreadGuard.h
*
* Created on: Nov 30, 2011
* Author: mdm
*/
#ifndef THREADGUARD_H_
#define THREADGUARD_H_
namespace Mks651d_ns
{
class ThreadGuard
{
public:
ThreadGuard(omni_mutex& m) : mutex(m)
{
mutex.lock();
}
~ThreadGuard()
{
mutex.unlock();
}
private:
omni_mutex& mutex;
};
}
#endif /* THREADGUARD_H_ */
/*PROTECTED REGION ID(Mks651d::main.cpp) ENABLED START*/
static const char *RcsId = "$Id: main.cpp,v 1.2 2012-03-08 09:50:01 mdm Exp $";
//=============================================================================
//
// file : Mks651d.cpp
//
// description : C++ source for the Mks651d device server main.
// The main rule is to initialise (and create) the Tango
// system and to create the DServerClass singleton.
// The main should be the same for every Tango device server.
//
// project : Mks651d.
//
// $Author: mdm $
//
// $Revision: 1.2 $
// $Date: 2012-03-08 09:50:01 $
//
// SVN only:
// $HeadURL: $
//
// CVS only:
// $Source: /home/cvsadm/cvsroot/fermi/servers/651d/src/main.cpp,v $
// $Log: main.cpp,v $
// Revision 1.2 2012-03-08 09:50:01 mdm
// New version of server
//
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <tango.h>
int main(int argc,char *argv[])
{
Tango::Util *tg = NULL;
try
{
// Initialise the device server
//----------------------------------------
tg = Tango::Util::init(argc,argv);
// Create the device server singleton
// which will create everything
//----------------------------------------
tg->server_init(false);
// Run the endless loop
//----------------------------------------
cout << "Ready to accept request" << endl;
tg->server_run();
}
catch (bad_alloc)
{
cout << "Can't allocate memory to store device object !!!" << endl;
cout << "Exiting" << endl;
}
catch (CORBA::Exception &e)
{
Tango::Except::print_exception(e);
cout << "Received a CORBA_Exception" << endl;
cout << "Exiting" << endl;
}
if (tg!=NULL)
tg->server_cleanup();
return(0);
}
/*PROTECTED REGION END*/
//========================================================
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment