Select Git revision
SingleShotAO.h
-
Alexandre MALFREYT authored
refactor: improve clarity by removing redundancy in get_device_property() for default properties values
Alexandre MALFREYT authoredrefactor: improve clarity by removing redundancy in get_device_property() for default properties values
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
SingleShotAO.h 7.51 KiB
//=============================================================================
//
// file : SingleShotAO.h
//
// description : Include for the SingleShotAO class.
//
// project : SingleShotAO Generic Device
//
// $Author: pascal_verdier $
//
// $Revision: 13293 $
// $Date: 2009-04-07 12:53:56 +0200 (Tue, 07 Apr 2009) $
//
// SVN only:
// $HeadURL: $
//
// CVS only:
// $Source$
// $Log$
// Revision 3.5 2007/10/23 14:04:30 pascal_verdier
// Spelling mistakes correction
//
// Revision 3.4 2005/03/02 14:06:15 pascal_verdier
// namespace is different than class name.
//
// Revision 3.3 2004/10/25 14:12:00 pascal_verdier
// Minor changes.
//
// Revision 3.2 2004/09/06 09:27:05 pascal_verdier
// Modified for Tango 5 compatibility.
//
//
// copyleft : Synchrotron SOLEIL
// L'Orme des merisiers - Saint Aubin
// BP48 - 91192 Gif sur Yvette
// FRANCE
//
//=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#ifndef _SINGLESHOTAO_H
#define _SINGLESHOTAO_H
#include <tango.h>
//using namespace Tango;
#include <yat4tango/Logging.h>
#include <yat4tango/DeviceInfo.h>
#include "SingleShotAOManager.h"
/**
* @author $Author: pascal_verdier $
* @version $Revision: 13293 $
*/
// Add your own constant definitions here.
//-----------------------------------------------
namespace SingleShotAO_ns
{
/**
* Class Description:
* ADLink boards support for single shot AO operations [PCI-6208 and compatible boards]
*/
/*
* Device States Description:
* Tango::FAULT : Hardware / driver failure or fatal error occurred
* Tango::ON : Device ready to execute AO request
* Tango::INIT : Device initialization in progress
* Tango::MOVING : Ramp generation in progress
*/
class SingleShotAO: public TANGO_BASE_CLASS
{
public :
// Add your own data members here
//-----------------------------------------
// Here is the Start of the automatic code generation part
//-------------------------------------------------------------
/**
* @name attributes
* Attribute member data.
*/
//@{
Tango::DevDouble *attr_frequency_read;
Tango::DevDouble attr_frequency_write;
//@}
/**
* @name Device properties
* Device properties member data.
*/
//@{
/**
* The the board identifier in the cPCI crate [valid range is 0...7 - no default value] .
*/
Tango::DevShort boardNum;
/**
* The board type [MAO_xxxx - where <xxxx> is the ADlink board identifier - e.g. MAO_6208 - no default value]
*/
string boardType;
/**
* Whether to enable or disable the ramp generation on the board output channels. If false, the speedX and initialX dynamic attributes will not be created for every channel, and the changes will happen instantly. [true/false - default value is true]
*/
Tango::DevBoolean enableRamps;
/**
* Whether to write the memorized values to the board at the device initialization. [true/false - default value is false]
*/
Tango::DevBoolean outputMemorizedChannelsAtInit;
//@}
/**
* @name Device properties default values
* Device properties default values.
*/
//@{
/**
* Default value for boardNum property
*/
Tango::DevShort boardNum_default;
/**
* Default value for boardType property
*/
string boardType_default;
/**
* Default value for enableRamps property
*/
Tango::DevBoolean enableRamps_default;
/**
* Default value for outputMemorizedChannelsAtInit property
*/
Tango::DevBoolean outputMemorizedChannelsAtInit_default;
//@}
/**@name Constructors
* Miscellaneous constructors */
//@{
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
SingleShotAO(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
SingleShotAO(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
SingleShotAO(Tango::DeviceClass *cl,const char *s,const char *d);
//@}
/**@name Destructor
* Only one destructor is defined for this class */
//@{
/**
* The object destructor.
*/
~SingleShotAO() {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 before execution command method.
*/
virtual void always_executed_hook();
//@}
/**
* @name SingleShotAO methods prototypes
*/
//@{
/**
* Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* Extract real attribute values for frequency acquisition result.
*/
virtual void read_frequency(Tango::Attribute &attr);
/**
* Write frequency attribute values to hardware.
*/
virtual void write_frequency(Tango::WAttribute &attr);
/**
* Read/Write allowed for frequency attribute.
*/
virtual bool is_frequency_allowed(Tango::AttReqType type);
/**
* Execution allowed for Abort command.
*/
virtual bool is_Abort_allowed(const CORBA::Any &any);
/**
* This command gets the device state (stored in its <i>device_state</i> data member) and returns it to the caller.
* @return State Code
* @exception DevFailed
*/
virtual Tango::DevState dev_state();
/**
* This command gets the device status (stored in its <i>device_status</i> data member) and returns it to the caller.
* @return Status description
* @exception DevFailed
*/
virtual Tango::ConstDevString dev_status();
/**
* Aborts ramps in progress.
* @exception DevFailed
*/
void abort();
/**
* Read the device properties from database
*/
void get_device_property();
//@}
// Here is the end of the automatic code generation part
//-------------------------------------------------------------
//- read callback for dyn attr Channel<id>
void read_channel(yat4tango::DynamicAttributeReadCallbackData & cbd);
//- write callback for dyn attr Channel<id>
void write_channel(yat4tango::DynamicAttributeWriteCallbackData & cbd);
//- read callback for dyn attr Speed<id>
void read_speed(yat4tango::DynamicAttributeReadCallbackData & cbd);
//- write callback for dyn attr Speed<id>
void write_speed(yat4tango::DynamicAttributeWriteCallbackData & cbd);
//- read callback for dyn attr Initial<id>
void read_initial(yat4tango::DynamicAttributeReadCallbackData & cbd);
//- write callback for dyn attr Initial<id>
void write_initial(yat4tango::DynamicAttributeWriteCallbackData & cbd);
protected :
// Add your own data members here
//-----------------------------------------
//- the underlying single shot AO object
asl::SingleShotAO * m_ssao;
//- asl hw id
unsigned short boardTypeId;
//- are required device-properties specified?
bool critical_properties_missing;
//- isInitOk
bool isInitOk;
//- state
Tango::DevState m_state;
//- status
std::string m_currStatus;
//- dynamic attributes manager
yat4tango::DynamicAttributeManager * m_dyn_attr_manager;
//- frequency
double m_frequency;
//- thread safety
yat::Mutex m_lock;
//- manager for ramps
SingleShotAOManager * m_manager;
//- channel number
unsigned short m_nb_chan;
void _abort();
// set the write value of a dynamic attribute
// used to keep read and write values in sync
bool setDynamicAttributeWriteValue(const std::string& attrName, double value);
};
} // namespace_ns
#endif // _SINGLESHOTAO_H