From ca33b376b45a9614a077e8731d5624a81a9ce394 Mon Sep 17 00:00:00 2001 From: Sonia Minolli <sonia.minolli@synchrotron-soleil.fr> Date: Thu, 10 Apr 2014 13:25:24 +0000 Subject: [PATCH] Move frequency property to device attribute (TANGODEVIC-239) --- src/RetrigAO.cpp | 4813 +++++++++++++++++----------------- src/RetrigAO.h | 1126 ++++---- src/RetrigAOClass.cpp | 2010 +++++++------- src/RetrigAOClass.h | 800 +++--- src/RetrigAOStateMachine.cpp | 744 +++--- src/TangoClassID.txt | 11 + 6 files changed, 4854 insertions(+), 4650 deletions(-) create mode 100644 src/TangoClassID.txt diff --git a/src/RetrigAO.cpp b/src/RetrigAO.cpp index ed2f563..3c710dc 100644 --- a/src/RetrigAO.cpp +++ b/src/RetrigAO.cpp @@ -1,2389 +1,2424 @@ -static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/InputOutput/ADLINK/RetrigAO/src/RetrigAO.cpp,v 1.15 2010-03-26 09:41:54 vince_soleil Exp $"; -//+============================================================================= -// -// file : RetrigAO.cpp -// -// description : C++ source for the RetrigAO and its commands. -// The class is derived from Device. It represents the -// CORBA servant object which will be accessed from the -// network. All commands which can be executed on the -// RetrigAO are implemented in this file. -// -// project : TANGO Device Server -// -// $Author: vince_soleil $ -// -// $Revision: 1.15 $ -// -// $Log: not supported by cvs2svn $ -// Revision 1.14 2009/09/17 06:59:03 anoureddine -// - Add BufferDepth property and use it to memorize bufferDepth attribute in order to keep compatibility wilth previous version -// - call init_board() in stop() command -// -// Revision 1.13 2009/09/16 08:10:54 anoureddine -// - Transform bufferDepth property into attribute. -// - Generate code with pogo 5.2.10 -// -// Revision 1.12 2009/07/31 06:53:51 flanglois -// - support external sampling (conversionSource) -// -// Revision 1.11 2007/06/29 15:45:57 abeilleg -// bug fix on properties management. -// -// Revision 1.10 2007/06/25 10:19:05 abeilleg -// save data in files+bug fix on config cpy -// -// Revision 1.9 2007/05/10 12:20:21 abeilleg -// do stop only if running -// -// Revision 1.8 2006/11/24 10:04:56 abeilleg -// correction on bug zero forcing. -// -// Revision 1.7 2006/09/18 10:32:52 abeilleg -// added internal software support. -// -// Revision 1.6 2005/09/26 15:20:14 abeilleg -// zero forcing after stopping generation. -// -// Revision 1.5 2005/06/15 09:18:01 abeilleg -// attributes channelXEnable added. -// -// Revision 1.4 2005/01/25 10:11:06 abeilleg -// status changed -// -// Revision 1.3 2005/01/24 15:42:23 abeilleg -// following ASL modifications (states management). -// -// Revision 1.2 2004/12/21 13:09:03 abeilleg -// minor bug fixed. -// -// -// copyleft : Synchrotron SOLEIL -// L'Orme des Merisiers -// Saint-Aubin - BP 48 - -// -//-============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - - -//=================================================================== -// -// The following table gives the correspondence -// between commands and method name. -// -// Command name | Method name -// ---------------------------------------- -// State | dev_state() -// Status | dev_status() -// Start | start() -// Stop | stop() -// SetAOScaledData | set_aoscaled_data() -// -//=================================================================== -//#include "ADLinkContinuousAO.h" -#include <RetrigAO.h> -#include <RetrigAOClass.h> -#include <asl/ASLExceptionsHandler.h> -#include <TangoExceptionsHelper.h> -#include <asl/AOData.h> -#include <math.h> -#include <xstring.h> - -namespace RetrigAO_ns -{ - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::RetrigAO(string &s) -// -// description : constructor for simulated RetrigAO -// -// in : - cl : Pointer to the DeviceClass object -// - s : Device name -// -//----------------------------------------------------------------------------- -RetrigAO::RetrigAO(Tango::DeviceClass *cl,string &s):Tango::Device_4Impl(cl,s.c_str()) -{ - init_device(); -} - -RetrigAO::RetrigAO(Tango::DeviceClass *cl,const char *s):Tango::Device_4Impl(cl,s) -{ - init_device(); -} - -RetrigAO::RetrigAO(Tango::DeviceClass *cl,const char *s,const char *d) -:Tango::Device_4Impl(cl,s,d) -{ - init_device(); -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::delete_device() -// -// description : will be called at device destruction or at init command. -// -//----------------------------------------------------------------------------- -void RetrigAO::delete_device() -{ - // Delete device's allocated object - if(ao) - { - delete ao; - ao = 0; - } - if(ch0) - { - delete[] ch0; - ch0 = 0; - } - if(ch1) - { - delete[] ch1; - ch1 = 0; - } - if(ch2) - { - delete[] ch2; - ch2 = 0; - } - if(ch3) - { - delete[] ch3; - ch3 = 0; - } - if(ch4) - { - delete[] ch4; - ch4 = 0; - } - if(ch5) - { - delete[] ch5; - ch5 = 0; - } - if(ch6) - { - delete[] ch6; - ch6 = 0; - } - if(ch7) - { - delete[] ch7; - ch7 = 0; - } -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::init_device() -// -// description : will be called at device initialization. -// -//----------------------------------------------------------------------------- -void RetrigAO::init_device() -{ - INFO_STREAM << "RetrigAO::RetrigAO() create device " << device_name << endl; - - ao = 0; - ch0 = 0; - ch1 = 0; - ch2 = 0; - ch3 = 0; - ch4 = 0; - ch5 = 0; - ch6 = 0; - ch7 = 0; - // Initialise variables to default values - //-------------------------------------------- - get_device_property(); - - //- get the memorized value of bufferDepth (property) and put it into bufferDepth (attribute) - Tango::WAttribute &attr_bufferDepth = dev_attr->get_w_attr_by_name("bufferDepth"); - INFO_STREAM<<"bufferDepth = "<<bufferDepth<<std::endl; - attr_bufferDepth.set_write_value(bufferDepth); - write_bufferDepth(attr_bufferDepth); - - this->init_board(); - -} - - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::readDeviceProperies() -// -// description : Read the device properties from database. -// -//----------------------------------------------------------------------------- -void RetrigAO::get_device_property() -{ - // Initialize your default values here. - //------------------------------------------ - boardNum = 0; - frequency = 50000.0; //50 kHz - bufferDepth = 4096; - - string default_trig_mode = "POST"; - triggerMode = adl::ao_post; - - string default_trig_source = "DTRIG"; - triggerSource = adl::external_digital; - - string default_atrig_select = "BELOW"; - aTRIGSelection = adl::below_low_level; - - aTRIGLevel = 5.0; - - string default_dtrig_pol = "RISING"; - dTRIGPolarity = adl::ao_rising_edge ; - - aORefA = 10.0; - aORefB = 10.0; - - string default_pol = "BP"; - polarity = adl::bipolar; - - string default_aoref = "INTERN"; - aORefSource = adl::internal_reference; - - channel0Enable = 1; - channel1Enable = 0; - channel2Enable = 0; - channel3Enable = 0; - channel4Enable = 0; - channel5Enable = 0; - channel6Enable = 0; - channel7Enable = 0; - - double default_delay = 0.001638375; //secs - delay = 65535; // counts - - filePath = "\\\\DeviceServers\\configFiles\\RetrigAO\\"; - - std::string default_conv_src = "INTERNAL"; - conversionSource = adl::ao_internal_timer; - - // Read device properties from database.(Automatic code generation) - //------------------------------------------------------------- - Tango::DbData dev_prop; - dev_prop.push_back(Tango::DbDatum("BoardNum")); - dev_prop.push_back(Tango::DbDatum("Frequency")); - dev_prop.push_back(Tango::DbDatum("TriggerMode")); - dev_prop.push_back(Tango::DbDatum("TriggerSource")); - dev_prop.push_back(Tango::DbDatum("ATRIGSelection")); - dev_prop.push_back(Tango::DbDatum("ATRIGLevel")); - dev_prop.push_back(Tango::DbDatum("DTRIGPolarity")); - dev_prop.push_back(Tango::DbDatum("AORefA")); - dev_prop.push_back(Tango::DbDatum("AORefB")); - dev_prop.push_back(Tango::DbDatum("Polarity")); - dev_prop.push_back(Tango::DbDatum("AORefSource")); - dev_prop.push_back(Tango::DbDatum("Channel0Enable")); - dev_prop.push_back(Tango::DbDatum("Channel1Enable")); - dev_prop.push_back(Tango::DbDatum("Channel2Enable")); - dev_prop.push_back(Tango::DbDatum("Channel3Enable")); - dev_prop.push_back(Tango::DbDatum("Channel4Enable")); - dev_prop.push_back(Tango::DbDatum("Channel5Enable")); - dev_prop.push_back(Tango::DbDatum("Channel6Enable")); - dev_prop.push_back(Tango::DbDatum("Channel7Enable")); - dev_prop.push_back(Tango::DbDatum("Delay")); - dev_prop.push_back(Tango::DbDatum("BufferDepth")); - dev_prop.push_back(Tango::DbDatum("Channel0Waveform")); - dev_prop.push_back(Tango::DbDatum("Channel1Waveform")); - dev_prop.push_back(Tango::DbDatum("Channel2Waveform")); - dev_prop.push_back(Tango::DbDatum("Channel3Waveform")); - dev_prop.push_back(Tango::DbDatum("Channel4Waveform")); - dev_prop.push_back(Tango::DbDatum("Channel5Waveform")); - dev_prop.push_back(Tango::DbDatum("Channel6Waveform")); - dev_prop.push_back(Tango::DbDatum("Channel7Waveform")); - dev_prop.push_back(Tango::DbDatum("FilePath")); - dev_prop.push_back(Tango::DbDatum("ConversionSource")); - - // Call database and extract values - //-------------------------------------------- - if (Tango::Util::instance()->_UseDb==true) - get_db_device()->get_property(dev_prop); - Tango::DbDatum def_prop, cl_prop; - RetrigAOClass *ds_class = - (static_cast<RetrigAOClass *>(get_device_class())); - int i = -1; - - // Try to initialize BoardNum from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> boardNum; - else { - // Try to initialize BoardNum from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> boardNum; - } - // And try to extract BoardNum value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardNum; - - // Try to initialize Frequency from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> frequency; - else { - // Try to initialize Frequency from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> frequency; - } - // And try to extract Frequency value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> frequency; - - // Try to initialize TriggerMode from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> triggerMode; - else { - // Try to initialize TriggerMode from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> triggerMode; - } - // And try to extract TriggerMode value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> triggerMode; - - // Try to initialize TriggerSource from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> triggerSource; - else { - // Try to initialize TriggerSource from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> triggerSource; - } - // And try to extract TriggerSource value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> triggerSource; - - // Try to initialize ATRIGSelection from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> aTRIGSelection; - else { - // Try to initialize ATRIGSelection from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> aTRIGSelection; - } - // And try to extract ATRIGSelection value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> aTRIGSelection; - - // Try to initialize ATRIGLevel from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> aTRIGLevel; - else { - // Try to initialize ATRIGLevel from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> aTRIGLevel; - } - // And try to extract ATRIGLevel value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> aTRIGLevel; - - // Try to initialize DTRIGPolarity from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> dTRIGPolarity; - else { - // Try to initialize DTRIGPolarity from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> dTRIGPolarity; - } - // And try to extract DTRIGPolarity value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> dTRIGPolarity; - - // Try to initialize AORefA from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> aORefA; - else { - // Try to initialize AORefA from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> aORefA; - } - // And try to extract AORefA value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> aORefA; - - // Try to initialize AORefB from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> aORefB; - else { - // Try to initialize AORefB from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> aORefB; - } - // And try to extract AORefB value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> aORefB; - - // Try to initialize Polarity from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> polarity; - else { - // Try to initialize Polarity from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> polarity; - } - // And try to extract Polarity value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> polarity; - - // Try to initialize AORefSource from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> aORefSource; - else { - // Try to initialize AORefSource from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> aORefSource; - } - // And try to extract AORefSource value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> aORefSource; - - // Try to initialize Channel0Enable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel0Enable; - else { - // Try to initialize Channel0Enable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel0Enable; - } - // And try to extract Channel0Enable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel0Enable; - - // Try to initialize Channel1Enable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel1Enable; - else { - // Try to initialize Channel1Enable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel1Enable; - } - // And try to extract Channel1Enable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel1Enable; - - // Try to initialize Channel2Enable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel2Enable; - else { - // Try to initialize Channel2Enable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel2Enable; - } - // And try to extract Channel2Enable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel2Enable; - - // Try to initialize Channel3Enable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel3Enable; - else { - // Try to initialize Channel3Enable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel3Enable; - } - // And try to extract Channel3Enable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel3Enable; - - // Try to initialize Channel4Enable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel4Enable; - else { - // Try to initialize Channel4Enable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel4Enable; - } - // And try to extract Channel4Enable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel4Enable; - - // Try to initialize Channel5Enable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel5Enable; - else { - // Try to initialize Channel5Enable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel5Enable; - } - // And try to extract Channel5Enable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel5Enable; - - // Try to initialize Channel6Enable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel6Enable; - else { - // Try to initialize Channel6Enable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel6Enable; - } - // And try to extract Channel6Enable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel6Enable; - - // Try to initialize Channel7Enable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel7Enable; - else { - // Try to initialize Channel7Enable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel7Enable; - } - // And try to extract Channel7Enable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel7Enable; - - // Try to initialize Delay from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> delay; - else { - // Try to initialize Delay from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> delay; - } - // And try to extract Delay value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> delay; - - // Try to initialize BufferDepth from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> bufferDepth; - else { - // Try to initialize BufferDepth from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> bufferDepth; - } - // And try to extract BufferDepth value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> bufferDepth; - - // Try to initialize Channel0Waveform from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel0Waveform; - else { - // Try to initialize Channel0Waveform from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel0Waveform; - } - // And try to extract Channel0Waveform value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel0Waveform; - - // Try to initialize Channel1Waveform from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel1Waveform; - else { - // Try to initialize Channel1Waveform from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel1Waveform; - } - // And try to extract Channel1Waveform value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel1Waveform; - - // Try to initialize Channel2Waveform from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel2Waveform; - else { - // Try to initialize Channel2Waveform from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel2Waveform; - } - // And try to extract Channel2Waveform value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel2Waveform; - - // Try to initialize Channel3Waveform from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel3Waveform; - else { - // Try to initialize Channel3Waveform from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel3Waveform; - } - // And try to extract Channel3Waveform value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel3Waveform; - - // Try to initialize Channel4Waveform from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel4Waveform; - else { - // Try to initialize Channel4Waveform from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel4Waveform; - } - // And try to extract Channel4Waveform value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel4Waveform; - - // Try to initialize Channel5Waveform from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel5Waveform; - else { - // Try to initialize Channel5Waveform from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel5Waveform; - } - // And try to extract Channel5Waveform value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel5Waveform; - - // Try to initialize Channel6Waveform from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel6Waveform; - else { - // Try to initialize Channel6Waveform from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel6Waveform; - } - // And try to extract Channel6Waveform value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel6Waveform; - - // Try to initialize Channel7Waveform from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> channel7Waveform; - else { - // Try to initialize Channel7Waveform from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> channel7Waveform; - } - // And try to extract Channel7Waveform value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel7Waveform; - - // Try to initialize FilePath from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> filePath; - else { - // Try to initialize FilePath from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> filePath; - } - // And try to extract FilePath value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> filePath; - - // Try to initialize ConversionSource from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> conversionSource; - else { - // Try to initialize ConversionSource from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> conversionSource; - } - // And try to extract ConversionSource value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> conversionSource; - - - - // End of Automatic code generation - //------------------------------------------------------------- - Tango::DbData data_put; - - //------------------------------------------------------------- - if (dev_prop[0].is_empty()==false) - { - unsigned short bnum; - dev_prop[0] >> bnum; - //check value - if(bnum<0 || bnum>= 7)//num max of boards in chassis - { - WARN_STREAM<<"RetrigAO::get_device_property: the value of BoardNum is invalid" - <<"using default value "<<boardNum<<endl; - } - else - { - boardNum = bnum; - } - } - else - { - Tango::DbDatum property("BoardNum"); - property << boardNum; - data_put.push_back(property); - WARN_STREAM<<"BoardNum property is not set in database, loading default value in database:" - <<boardNum<<endl; - } - //------------------------------------------------------------- - if (dev_prop[1].is_empty()==false) - { - dev_prop[1] >> frequency; - } - else - { - Tango::DbDatum property("Frequency"); - property << frequency; - data_put.push_back(property); - WARN_STREAM<<"Frequency property is not set in database, loading default value in database:" - <<frequency<<endl; - } - //------------------------------------------------------------- - if (dev_prop[2].is_empty()==false) - { - string trig; - dev_prop[2] >> trig; - if(trig == "POST") - triggerMode = adl::ao_post; - else if(trig == "DELAY") - triggerMode = adl::ao_delay; - else - WARN_STREAM<<"RetrigAO::get_device_property: the value of TriggerMode is not valid" - <<"using default value "<<default_trig_mode<<endl; - } - else - { - Tango::DbDatum property("TriggerMode"); - property << default_trig_mode; - data_put.push_back(property); - WARN_STREAM<<"TriggerMode property is not set in database, loading default value in database:" - <<default_trig_mode<<endl; - } - //------------------------------------------------------------- - if (dev_prop[3].is_empty()==false) - { - string trig_src; - dev_prop[3] >> trig_src; - if(trig_src == "DTRIG") - triggerSource = adl::external_digital; - else if(trig_src == "ATRIG") - triggerSource = adl::external_analog; - else if(trig_src == "INTRIG") - triggerSource = adl::internal_software; - else - WARN_STREAM<<"RetrigAO::get_device_property: the value of TriggerSource is not valid" - <<"using default value "<<default_trig_source<<endl; - - } - else - { - Tango::DbDatum property("TriggerSource"); - property << default_trig_source; - data_put.push_back(property); - WARN_STREAM<<"TriggerSource property is not set in database, loading default value in database:" - <<default_trig_source<<endl; - } - //------------------------------------------------------------- - if (dev_prop[4].is_empty()==false) - { - string atrig_select; - dev_prop[4] >> atrig_select; - if(atrig_select == "BELOW") - aTRIGSelection = adl::below_low_level; - else if(atrig_select == "ABOVE") - aTRIGSelection = adl::above_high_level; - else - WARN_STREAM<<"RetrigAO::get_device_property: the value of ATRIGSelection is not valid" - <<"using default value "<<default_atrig_select<<endl; - } - else - { - Tango::DbDatum property("ATRIGSelection"); - property << default_atrig_select; - data_put.push_back(property); - WARN_STREAM<<"ATRIGSelection property is not set in database, loading default value in database:" - <<default_atrig_select<<endl; - } - //------------------------------------------------------------- - if (dev_prop[5].is_empty()==false) - { - dev_prop[5] >> aTRIGLevel; - } - else - { - Tango::DbDatum property("ATRIGLevel"); - property << aTRIGLevel; - data_put.push_back(property); - WARN_STREAM<<"ATRIGLevel property is not set in database, loading default value in database:" - <<aTRIGLevel<<endl; - } - //------------------------------------------------------------- - if (dev_prop[6].is_empty()==false) - { - string dtrig_pol; - dev_prop[6] >> dtrig_pol; - if(dtrig_pol == "RISING") - dTRIGPolarity = adl::ao_rising_edge; - else if(dtrig_pol == "FALLING") - dTRIGPolarity = adl::ao_falling_edge; - else - WARN_STREAM<<"RetrigAO::get_device_property: the value of DTRIGPolarity is not valid" - <<"using default value "<<default_dtrig_pol<<endl; - } - else - { - Tango::DbDatum property("DTRIGPolarity"); - property << default_dtrig_pol; - data_put.push_back(property); - WARN_STREAM<<"DTRIGPolarity property is not set in database, loading default value in database:" - <<default_dtrig_pol<<endl; - } - //------------------------------------------------------------- - if (dev_prop[7].is_empty()==false) - { - double ref; - dev_prop[7] >> ref; - if(ref >= -10.0 || ref <= 10.0) - aORefA = ref; - else - WARN_STREAM<<"RetrigAO::get_device_property: the value of AORefA is not valid" - <<"using default value "<<aORefA<<endl; - } - else - { - Tango::DbDatum property("AORefA"); - property << aORefA; - data_put.push_back(property); - WARN_STREAM<<"AORefA property is not set in database, loading default value in database:" - <<aORefA<<endl; - } - //------------------------------------------------------------- - if (dev_prop[8].is_empty()==false) - { - double ref; - dev_prop[8] >> ref; - if(ref >= -10.0 || ref <= 10.0) - aORefB = ref; - else - WARN_STREAM<<"RetrigAO::get_device_property: the value of AORefB is not valid" - <<"using default value "<<aORefB<<endl; - } - else - { - Tango::DbDatum property("AORefB"); - property << aORefB; - data_put.push_back(property); - WARN_STREAM<<"AORefB property is not set in database, loading default value in database:" - <<aORefB<<endl; - } - //------------------------------------------------------------- - if (dev_prop[9].is_empty()==false) - { - string pol; - dev_prop[9] >> pol; - if(pol == "BP") - polarity = adl::bipolar; - else if(pol == "UP") - polarity = adl::unipolar; - else - WARN_STREAM<<"RetrigAO::get_device_property: the value of Polarity is not valid" - <<"using default value "<<default_pol<<endl; - } - else - { - Tango::DbDatum property("Polarity"); - property << default_pol; - data_put.push_back(property); - WARN_STREAM<<"Polarity property is not set in database, loading default value in database:" - <<default_pol<<endl; - } - //------------------------------------------------------------- - if (dev_prop[10].is_empty()==false) - { - string aoref; - dev_prop[10] >> aoref; - if(aoref == "INTERN") - aORefSource = adl::internal_reference; - else if(aoref == "EXTERN") - aORefSource = adl::external_reference; - else - WARN_STREAM<<"RetrigAO::get_device_property: the value of AORefSource is not valid" - <<"using default value "<<default_aoref<<endl; - } - else - { - Tango::DbDatum property("AORefSource"); - property << default_aoref; - data_put.push_back(property); - WARN_STREAM<<"AORefSource property is not set in database, loading default value in database:" - <<default_aoref<<endl; - } - //------------------------------------------------------------- - if (dev_prop[11].is_empty()==false) - { - dev_prop[11] >> channel0Enable; - } - else - { - Tango::DbDatum property("Channel0Enable"); - property << channel0Enable; - data_put.push_back(property); - WARN_STREAM<<"Channel0Enable property is not set in database, loading default value in database:" - <<channel0Enable<<endl; - } - //------------------------------------------------------------- - if (dev_prop[12].is_empty()==false) - { - dev_prop[12] >> channel1Enable; - } - else - { - Tango::DbDatum property("Channel1Enable"); - property << channel1Enable; - data_put.push_back(property); - WARN_STREAM<<"Channel1Enable property is not set in database, loading default value in database:" - <<channel1Enable<<endl; - } - //------------------------------------------------------------- - if (dev_prop[13].is_empty()==false) - { - dev_prop[13] >> channel2Enable; - } - else - { - Tango::DbDatum property("Channel2Enable"); - property << channel2Enable; - data_put.push_back(property); - WARN_STREAM<<"Channel2Enable property is not set in database, loading default value in database:" - <<channel2Enable<<endl; - } - //------------------------------------------------------------- - if (dev_prop[14].is_empty()==false) - { - dev_prop[14] >> channel3Enable; - } - else - { - Tango::DbDatum property("Channel3Enable"); - property << channel3Enable; - data_put.push_back(property); - WARN_STREAM<<"Channel3Enable property is not set in database, loading default value in database:" - <<channel3Enable<<endl; - } - //------------------------------------------------------------- - if (dev_prop[15].is_empty()==false) - { - dev_prop[15] >> channel4Enable; - } - else - { - Tango::DbDatum property("Channel4Enable"); - property << channel4Enable; - data_put.push_back(property); - WARN_STREAM<<"Channel4Enable property is not set in database, loading default value in database:" - <<channel4Enable<<endl; - } - //------------------------------------------------------------- - if (dev_prop[16].is_empty()==false) - { - dev_prop[16] >> channel5Enable; - } - else - { - Tango::DbDatum property("Channel5Enable"); - property << channel5Enable; - data_put.push_back(property); - WARN_STREAM<<"Channel5Enable property is not set in database, loading default value in database:" - <<channel5Enable<<endl; - } - //------------------------------------------------------------- - if (dev_prop[17].is_empty()==false) - { - dev_prop[17] >> channel6Enable; - } - else - { - Tango::DbDatum property("Channel6Enable"); - property << channel6Enable; - data_put.push_back(property); - WARN_STREAM<<"Channel6Enable property is not set in database, loading default value in database:" - <<channel6Enable<<endl; - } - //------------------------------------------------------------- - if (dev_prop[18].is_empty()==false) - { - dev_prop[18] >> channel7Enable; - } - else - { - Tango::DbDatum property("Channel7Enable"); - property << channel7Enable; - data_put.push_back(property); - WARN_STREAM<<"Channel7Enable property is not set in database, loading default value in database:" - <<channel7Enable<<endl; - } - //------------------------------------------------------------- - if (dev_prop[19].is_empty()==false) - { - double delay_secs; - dev_prop[19] >> delay_secs; - if(delay_secs * (double)AD2502_CLOCK_FREQ < 1 || delay_secs * (double)AD2502_CLOCK_FREQ >65535) - { - WARN_STREAM<<"Delay property is not set in database, loading default value in database:" - <<delay<<endl; - } - else - { - delay = delay_secs * (double)AD2502_CLOCK_FREQ; - } - } - else - { - Tango::DbDatum property("Delay"); - property << default_delay; - data_put.push_back(property); - WARN_STREAM<<"Delay property is not set in database, loading default value in database:" - <<default_delay<<endl; - } - //------------------------------------------------------------- - if (dev_prop[20].is_empty()==false) - { - dev_prop[20] >> bufferDepth; - } - else - { - Tango::DbDatum property("BufferDepth"); - property << bufferDepth; - data_put.push_back(property); - WARN_STREAM<<"BufferDepth property is not set in database, loading default value in database:" - <<bufferDepth<<endl; - } - //------------------------------------------------------------- - if (dev_prop[29].is_empty()==false) - { - dev_prop[29] >> filePath; - } - - //------------------------------------------------------------- - if (dev_prop[30].is_empty()==false) - { - string conv; - dev_prop[30] >> conv; - if(conv == "INTERNAL") - conversionSource = adl::ao_internal_timer; - else if(conv == "EXTSAMPLING") - conversionSource = adl::ao_external_afio; - else - WARN_STREAM<<"ContinuousAO::get_device_property: the value of conversionSource is not valid" - <<"using default value "<<default_conv_src<<endl; - } - else - { - Tango::DbDatum property("ConversionSource"); - property << default_conv_src; - data_put.push_back(property); - WARN_STREAM<<"ConversionSource property is not set in database, loading default value in database:"<<default_conv_src<<endl; - } - //-----------------------attribute persistancy------------------ - /* if (data[21].is_empty()==false) data[21] >> channel0Waveform; - if (data[22].is_empty()==false) data[22] >> channel1Waveform; - if (data[23].is_empty()==false) data[23] >> channel2Waveform; - if (data[24].is_empty()==false) data[24] >> channel3Waveform; - if (data[25].is_empty()==false) data[25] >> channel4Waveform; - if (data[26].is_empty()==false) data[26] >> channel5Waveform; - if (data[27].is_empty()==false) data[27] >> channel6Waveform; - if (data[28].is_empty()==false) data[28] >> channel7Waveform;*/ - - //update database for not initiliazed properties - get_db_device()->put_property(data_put); -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::always_executed_hook() -// -// description : method always executed before any command is executed -// -//----------------------------------------------------------------------------- -void RetrigAO::always_executed_hook() -{ - this->set_internal_state(); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_attr_hardware() -// -// description : Hardware acquisition for attributes. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_attr_hardware(vector<long> &attr_list) -{ - DEBUG_STREAM << "In read_attr_hardware for " << attr_list.size(); - DEBUG_STREAM << " attribute(s)" << endl; - - // Add your own code here - //--------------------------------- - ao->lock_data(); - - this->err_ctr = ao->err_ctr; - - ao->unlock_data(); - -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_bufferDepth -// -// description : Extract real attribute values for bufferDepth acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_bufferDepth(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_bufferDepth(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&bufferDepth); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::write_bufferDepth -// -// description : Write bufferDepth attribute values to hardware. -// -//----------------------------------------------------------------------------- -void RetrigAO::write_bufferDepth(Tango::WAttribute &attr) -{ - DEBUG_STREAM << "RetrigAO::write_bufferDepth(Tango::WAttribute &attr) entering... "<< endl; - attr.get_write_value(bufferDepth); - store_value_as_property(bufferDepth, "BufferDepth"); - this->init_board(); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_errorCounter -// -// description : Extract real attribute values for errorCounter acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_errorCounter(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_errorCounter(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&err_ctr); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_useBoardFifo -// -// description : Extract real attribute values for useBoardFifo acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_useBoardFifo(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_useBoardFifo(Tango::Attribute &attr) entering... "<< endl; - // the information about data loading on fifo in available only after Start command. - if(this->get_state() == Tango::RUNNING) - attr.set_value(&use_fifo); - else - attr.set_quality(Tango::ATTR_INVALID); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel0Enable -// -// description : Extract real attribute values for channel0Enable acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel0Enable(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel0Enable(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&channel0Enable); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel1Enable -// -// description : Extract real attribute values for channel1Enable acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel1Enable(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel1Enable(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&channel1Enable); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel2Enable -// -// description : Extract real attribute values for channel2Enable acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel2Enable(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel2Enable(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&channel2Enable); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel3Enable -// -// description : Extract real attribute values for channel3Enable acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel3Enable(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel3Enable(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&channel3Enable); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel4Enable -// -// description : Extract real attribute values for channel4Enable acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel4Enable(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel4Enable(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&channel4Enable); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel5Enable -// -// description : Extract real attribute values for channel5Enable acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel5Enable(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel5Enable(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&channel5Enable); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel6Enable -// -// description : Extract real attribute values for channel6Enable acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel6Enable(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel6Enable(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&channel6Enable); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel7Enable -// -// description : Extract real attribute values for channel7Enable acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel7Enable(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel7Enable(Tango::Attribute &attr) entering... "<< endl; - attr.set_value(&channel7Enable); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel0 -// -// description : Extract real attribute values for channel0 acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel0(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel0(Tango::Attribute &attr) entering... "<< endl; - if(channel0Enable) - attr.set_value(ch0, bufferDepth); - else - attr.set_quality(Tango::ATTR_INVALID); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel1 -// -// description : Extract real attribute values for channel1 acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel1(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel1(Tango::Attribute &attr) entering... "<< endl; - if(channel1Enable) - attr.set_value(ch1, bufferDepth); - else - attr.set_quality(Tango::ATTR_INVALID); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel2 -// -// description : Extract real attribute values for channel2 acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel2(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel2(Tango::Attribute &attr) entering... "<< endl; - if(channel2Enable) - attr.set_value(ch2, bufferDepth); - else - attr.set_quality(Tango::ATTR_INVALID); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel3 -// -// description : Extract real attribute values for channel3 acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel3(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel3(Tango::Attribute &attr) entering... "<< endl; - if(channel3Enable) - attr.set_value(ch3, bufferDepth); - else - attr.set_quality(Tango::ATTR_INVALID); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel4 -// -// description : Extract real attribute values for channel4 acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel4(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel4(Tango::Attribute &attr) entering... "<< endl; - if(channel4Enable) - attr.set_value(ch4, bufferDepth); - else - attr.set_quality(Tango::ATTR_INVALID); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel5 -// -// description : Extract real attribute values for channel5 acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel5(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel5(Tango::Attribute &attr) entering... "<< endl; - if(channel5Enable) - attr.set_value(ch5, bufferDepth); - else - attr.set_quality(Tango::ATTR_INVALID); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel6 -// -// description : Extract real attribute values for channel6 acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel6(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel6(Tango::Attribute &attr) entering... "<< endl; - if(channel6Enable) - attr.set_value(ch6, bufferDepth); - else - attr.set_quality(Tango::ATTR_INVALID); -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::read_channel7 -// -// description : Extract real attribute values for channel7 acquisition result. -// -//----------------------------------------------------------------------------- -void RetrigAO::read_channel7(Tango::Attribute &attr) -{ - DEBUG_STREAM << "RetrigAO::read_channel7(Tango::Attribute &attr) entering... "<< endl; - - if(channel7Enable) - attr.set_value(ch7, bufferDepth); - else - attr.set_quality(Tango::ATTR_INVALID); -} - - -//+------------------------------------------------------------------ -/** - * method: RetrigAO::start - * - * description: method to execute "Start" - * start the generation. - * - * - */ -//+------------------------------------------------------------------ -void RetrigAO::start() -{ - DEBUG_STREAM << "RetrigAO::start(): entering... !" << endl; - - // give the configuration - _ASL_TRY_ACTION - ( - ao->configure(this->config), - "configure", - "RetrigAO::start", - this->set_internal_state() - ); - - _ASL_TRY_ACTION - ( - ao->start(), - "start", - "RetrigAO::start", - this->set_internal_state() - ); - - // get if the output data have been loaded in the onboard FIFO. - // depends on the size of the buffer. - this->use_fifo = ao->use_board_fifo(); - -} - -//+------------------------------------------------------------------ -/** - * method: RetrigAO::stop - * - * description: method to execute "Stop" - * stop the generation. - * - * - */ -//+------------------------------------------------------------------ -void RetrigAO::stop() -{ - DEBUG_STREAM << "RetrigAO::stop(): entering... !" << endl; - - /*_ASL_TRY_ACTION - ( - ao->stop(), - "stop", - "RetrigAO::stop", - this->set_internal_state() - );*/ - if(this->get_state() == Tango::RUNNING) - this->stop_with_zero_forcing(); - -} -//+------------------------------------------------------------------ -/** - * method: RetrigAO::stop_with_zero_forcing - * - * description: method to execute "Stop" - * stop the generation and force the output to be 0 volts. - * - * - */ -//+------------------------------------------------------------------ -void RetrigAO::stop_with_zero_forcing() -{ - DEBUG_STREAM << "RetrigAO::stop(): entering... !" << endl; - - // save the configuration - //this->config = ao->configuration(); - - _ASL_TRY_ACTION - ( - ao->stop(), - "stop", - "RetrigAO::stop_with_zero_forcing", - this->set_internal_state() - ); - - // get the current configuration - this->stop_config = ao->configuration(); - - // set buffer with 0 volts - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - (data)[i] = 0; - - if(channel0Enable) - this->stop_config.set_channel_periodic_data(0, data); - if(channel1Enable) - this->stop_config.set_channel_periodic_data(1, data); - if(channel2Enable) - this->stop_config.set_channel_periodic_data(2, data); - if(channel3Enable) - this->stop_config.set_channel_periodic_data(3, data); - if(channel4Enable) - this->stop_config.set_channel_periodic_data(4, data); - if(channel5Enable) - this->stop_config.set_channel_periodic_data(5, data); - if(channel6Enable) - this->stop_config.set_channel_periodic_data(6, data); - if(channel7Enable) - this->stop_config.set_channel_periodic_data(7, data); - - // configure trigger mode (no trigger to generate immediatly) - this->stop_config.disable_retrigger(); - this->stop_config.set_trigger_source(adl::internal_software); - - // give the configuration the new channel - _ASL_TRY_ACTION - ( - ao->configure(this->stop_config), - "configure", - "RetrigAO::stop_with_zero_forcing", - this->set_internal_state() - ); - - _ASL_TRY_ACTION - ( - ao->start(), - "start", - "RetrigAO::stop_with_zero_forcing", - this->set_internal_state() - ); - - _ASL_TRY_ACTION - ( - ao->stop(), - "stop", - "RetrigAO::stop_with_zero_forcing", - this->set_internal_state() - ); - - //correction bug: aftera stop, start doesn't work !! - this->init_board(); -} - -//+------------------------------------------------------------------ -/** - * method: RetrigAI::init_board - */ -//+------------------------------------------------------------------ -void RetrigAO::init_board(void) -{ - - this->delete_device(); - //- create a continuous analog output daq - ao = new ADLinkContinuousAO(this); - - //- check memory allocation - if (ao == 0) - { - this->set_internal_state(); - Tango::Except::throw_exception( - (const char*)("OUT_OF_MEMORY"), - (const char*)("out of memory error"), - (const char*)("RetrigAO::init_device") - ); - } - - asl::ContinuousAOConfig _config; - ch0 = new double[bufferDepth]; - ch1 = new double[bufferDepth]; - ch2 = new double[bufferDepth]; - ch3 = new double[bufferDepth]; - ch4 = new double[bufferDepth]; - ch5 = new double[bufferDepth]; - ch6 = new double[bufferDepth]; - ch7 = new double[bufferDepth]; - if(ch0 == 0 || ch1 == 0 || ch2 == 0 || ch3 == 0 || ch4 == 0 || ch5 == 0 ||ch6 == 0 || ch7 == 0) - { - this->set_internal_state(); - this->delete_device(); - Tango::Except::throw_exception( - (const char*)("OUT_OF_MEMORY"), - (const char*)("out of memory error"), - (const char*)("RetrigAO::init_device") - ); - } - - - // default waveform for group A (channel 0 to 3) - asl::AOScaledData default_waveformA(bufferDepth); - double max_valA; - if(aORefSource == adl::external_reference) - max_valA = aORefA ; - else - max_valA = 10.0; - - // fill buffer with a sin signal - for (unsigned long i = 0; i < bufferDepth; i++) - { - (default_waveformA)[i] = ::sin((double)i * 2. * 3.14159 / (double) bufferDepth) * max_valA; - } - - ACE_OS::memcpy(this->ch0, default_waveformA.base(), default_waveformA.size()); - ACE_OS::memcpy(this->ch1, default_waveformA.base(), default_waveformA.size()); - ACE_OS::memcpy(this->ch2, default_waveformA.base(), default_waveformA.size()); - ACE_OS::memcpy(this->ch3, default_waveformA.base(), default_waveformA.size()); - - // default waveform for group B (channel 4 to 7) - asl::AOScaledData default_waveformB(bufferDepth); - double max_valB; - if(aORefSource == adl::external_reference) - max_valB = aORefB; - else - max_valB = 10.0; - - // fill buffer with a square signal - for (i = 0; i < bufferDepth/2; i++) - { - default_waveformB[i] = max_valB - 0.01; - } - for (i = bufferDepth/2; i < bufferDepth; i++) - { - default_waveformB[i] = -max_valB + 0.01; - } - ACE_OS::memcpy(this->ch4, default_waveformB.base(), default_waveformB.size()); - ACE_OS::memcpy(this->ch5, default_waveformB.base(), default_waveformB.size()); - ACE_OS::memcpy(this->ch6, default_waveformB.base(), default_waveformB.size()); - ACE_OS::memcpy(this->ch7, default_waveformB.base(), default_waveformB.size()); - - //--------------------------channels config------------------------------------ - asl::ActiveAOChannel ac; - - // configure all channels - ac.polarity = (adl::OutputPolarity)polarity; - ac.volt_ref_src = (adl::VoltageReferenceSource)aORefSource; - ac.volt_ref = 10.0; - - //------active/config. channel 0--------- - if(channel0Enable) - { - ac.id = 0; - if(aORefSource == adl::external_reference) - ac.volt_ref = aORefA; - _config.add_active_channel(ac); - - for (int i = 0; i < bufferDepth; i++) - ch0[i] = 0; - - this->load_waveform(ch0,"Channel0Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = ch0[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(0, data); - - /* - if(channel0Waveform.empty()) - { - WARN_STREAM<<"No waveform is saved in database for channel 0, using a default one"<<endl; - _config.set_channel_periodic_data(0, default_waveformA); - } - else if(channel0Waveform.size() != bufferDepth) - { - WARN_STREAM<<"The waveform saved in database for channel 0 has a different size from property BufferDepth, "<< - "using default waveform"<<endl; - _config.set_channel_periodic_data(0, default_waveformA); - } - else //put waveform of the Tango database in ch0 - { - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = channel0Waveform[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(0, data); - //cpy data in the attribute of the device - ::memcpy(ch0, data.base(), data.size()); - }*/ - - } - //------active/config. channel 1--------- - if(channel1Enable) - { - ac.id = 1; - if(aORefSource == adl::external_reference) - ac.volt_ref = aORefA; - _config.add_active_channel(ac); - - for (int i = 0; i < bufferDepth; i++) - ch1[i] = 0; - - this->load_waveform(ch1,"Channel1Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = ch1[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(1, data); - /*if(channel1Waveform.empty()) - { - WARN_STREAM<<"No waveform is saved in database for channel 1, using a default one"<<endl; - _config.set_channel_periodic_data(1, default_waveformA); - } - else if(channel1Waveform.size() != bufferDepth) - { - WARN_STREAM<<"The waveform saved in database for channel 1 has a different size from property BufferDepth, "<< - "using default waveform"<<endl; - _config.set_channel_periodic_data(1, default_waveformA); - } - else //put waveform of the Tango database in ch1 - { - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = channel1Waveform[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(1, data); - //cpy data in the attribute of the device - ::memcpy(ch1, data.base(), data.size()); - }*/ - } - //------active/config. channel 2--------- - if(channel2Enable) - { - ac.id = 2; - if(aORefSource == adl::external_reference) - ac.volt_ref = aORefA; - _config.add_active_channel(ac); - - for (int i = 0; i < bufferDepth; i++) - ch2[i] = 0; - - this->load_waveform(ch2,"Channel2Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = ch2[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(2, data); - - /* if(channel2Waveform.empty()) - { - WARN_STREAM<<"No waveform is saved in database for channel 2, using a default one"<<endl; - _config.set_channel_periodic_data(2, default_waveformA); - } - else if(channel2Waveform.size() != bufferDepth) - { - WARN_STREAM<<"The waveform saved in database for channel 2 has a different size from property BufferDepth, "<< - "using default waveform"<<endl; - _config.set_channel_periodic_data(2, default_waveformA); - } - else //put waveform of the Tango database in ch2 - { - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = channel2Waveform[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(2, data); - //cpy data in the attribute of the device - ::memcpy(ch2, data.base(), data.size()); - }*/ - } - //------active/config. channel 3--------- - if(channel3Enable) - { - ac.id = 3; - if(aORefSource == adl::external_reference) - ac.volt_ref = aORefA; - _config.add_active_channel(ac); - - for (int i = 0; i < bufferDepth; i++) - ch3[i] = 0; - this->load_waveform(ch3,"Channel3Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = ch3[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(3, data); - - /*if(channel3Waveform.empty()) - { - WARN_STREAM<<"No waveform is saved in database for channel 3, using a default one"<<endl; - _config.set_channel_periodic_data(3, default_waveformA); - } - else if(channel3Waveform.size() != bufferDepth) - { - WARN_STREAM<<"The waveform saved in database for channel 3 has a different size from property BufferDepth, "<< - "using default waveform"<<endl; - _config.set_channel_periodic_data(3, default_waveformA); - } - else //put waveform of the Tango database in ch3 - { - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = channel3Waveform[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(3, data); - //cpy data in the attribute of the device - ::memcpy(ch3, data.base(), data.size()); - }*/ - } - //------active/config. channel 4--------- - if(channel4Enable) - { - ac.id = 4; - if(aORefSource == adl::external_reference) - ac.volt_ref = aORefB; - _config.add_active_channel(ac); - - for (int i = 0; i < bufferDepth; i++) - ch4[i] = 0; - - this->load_waveform(ch4,"Channel4Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = ch4[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(4, data); - - /*if(channel4Waveform.empty()) - { - WARN_STREAM<<"No waveform is saved in database for channel 4, using a default one"<<endl; - _config.set_channel_periodic_data(4, default_waveformB); - } - else if(channel4Waveform.size() != bufferDepth) - { - WARN_STREAM<<"The waveform saved in database for channel 4 has a different size from property BufferDepth, "<< - "using default waveform"<<endl; - _config.set_channel_periodic_data(4, default_waveformB); - } - else //put waveform of the Tango database in ch4 - { - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = channel4Waveform[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(4, data); - //cpy data in the attribute of the device - ::memcpy(ch4, data.base(), data.size()); - }*/ - } - //------active/config. channel 5--------- - if(channel5Enable) - { - ac.id = 5; - if(aORefSource == adl::external_reference) - ac.volt_ref = aORefB; - _config.add_active_channel(ac); - - for (int i = 0; i < bufferDepth; i++) - ch5[i] = 0; - - this->load_waveform(ch5,"Channel5Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = ch5[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(5, data); - - /* if(channel5Waveform.empty()) - { - WARN_STREAM<<"No waveform is saved in database for channel 5, using a default one"<<endl; - _config.set_channel_periodic_data(5, default_waveformB); - } - else if(channel5Waveform.size() != bufferDepth) - { - WARN_STREAM<<"The waveform saved in database for channel 5 has a different size from property BufferDepth, "<< - "using default waveform"<<endl; - _config.set_channel_periodic_data(5, default_waveformB); - } - else //put waveform of the Tango database in ch5 - { - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = channel5Waveform[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(5, data); - //cpy data in the attribute of the device - ::memcpy(ch5, data.base(), data.size()); - }*/ - } - //------active/config. channel 6--------- - if(channel6Enable) - { - ac.id = 6; - if(aORefSource == adl::external_reference) - ac.volt_ref = aORefB; - _config.add_active_channel(ac); - - for (int i = 0; i < bufferDepth; i++) - ch6[i] = 0; - - this->load_waveform(ch6,"Channel6Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = ch6[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(6, data); - /*if(channel6Waveform.empty()) - { - WARN_STREAM<<"No waveform is saved in database for channel 6, using a default one"<<endl; - _config.set_channel_periodic_data(6, default_waveformB); - } - else if(channel6Waveform.size() != bufferDepth) - { - WARN_STREAM<<"The waveform saved in database for channel 6 has a different size from property BufferDepth, "<< - "using default waveform"<<endl; - _config.set_channel_periodic_data(6, default_waveformB); - } - else //put waveform of the Tango database in ch6 - { - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = channel6Waveform[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(6, data); - //cpy data in the attribute of the device - ::memcpy(ch6, data.base(), data.size()); - }*/ - } - //------active/config. channel 7--------- - if(channel7Enable) - { - ac.id = 7; - if(aORefSource == adl::external_reference) - ac.volt_ref = aORefB; - _config.add_active_channel(ac); - - for (int i = 0; i < bufferDepth; i++) - ch7[i] = 0; - - this->load_waveform(ch7,"Channel7Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = ch7[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(7, data); - - /* if(channel7Waveform.empty()) - { - WARN_STREAM<<"No waveform is saved in database for channel 7, using a default one"<<endl; - _config.set_channel_periodic_data(7, default_waveformB); - } - else if(channel7Waveform.size() != bufferDepth) - { - WARN_STREAM<<"The waveform saved in database for channel 7 has a different size from property BufferDepth, "<< - "using default waveform"<<endl; - _config.set_channel_periodic_data(7, default_waveformB); - } - else //put waveform of the Tango database in ch7 - { - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = channel7Waveform[i]; - // put the waveform in the configuration - _config.set_channel_periodic_data(7, data); - //cpy data in the attribute of the device - }*/ - } - //--------------------------------trigger config--------------------------------- - _config.enable_retrigger(); - - _config.set_trigger_source((adl::AIOTriggerSource)triggerSource); - _config.set_trigger_mode((adl::AOTriggerMode)triggerMode); - _config.set_nb_waveforms(1); - - if(triggerMode == adl::ao_delay) - { - //cout<<"delay: "<<delay<<endl; - _config.set_delay_counter(delay); - } - if(triggerSource == adl::external_digital) - { - _config.set_trigger_polarity((adl::AOTriggerPolarity)dTRIGPolarity); - } - else if(triggerSource == adl::external_analog) - { - _config.set_analog_trigger_source(adl::analog_trigger_ext); - _config.set_analog_trigger_condition((adl::AnalogTriggerCondition)aTRIGSelection); - unsigned short level; - if(aTRIGLevel>=0) - level = (aTRIGLevel / 0.078125) + 127; - else // v < 0 - level = (-aTRIGLevel / 0.078125); - _config.set_analog_low_level_condition(level); - _config.set_analog_high_level_condition(level); - } - - _config.set_output_rate(frequency); - - // configure the conversion source (sampling timer) - _config.set_conversion_source((adl::AOConversionSource)conversionSource); - - //when stop command will be call, the waveform will be generated until its end before stopping - //config.set_stop_mode (adl::wait_end_waveform); - - DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl; - _ASL_TRY_ACTION - ( - ao->init(adl::DAQ2502, boardNum), - "init", - "RetrigAO::init_device", - this->set_internal_state() - ); - - this->config = _config; - /*DEBUG_STREAM<<"RetrigAO::init_device : config acq"<<std::endl; - _ASL_TRY_ACTION - ( - ao->configure(_config), - "configure", - "RetrigAO::init_device", - this->set_internal_state() - ); */ -} -//+------------------------------------------------------------------ -/** - * method: RetrigAO::set_aoscaled_data - * - * description: method to execute "SetAOScaledData" - * Give one period of the signal to generated of a specified channel in volts. - * - * @param argin The channel number ,in string). The output data in volts ,in double) - * - */ -//+------------------------------------------------------------------ -void RetrigAO::set_aoscaled_data(const Tango::DevVarDoubleStringArray *argin) -{ - DEBUG_STREAM << "RetrigAO::set_aoscaled_data(): entering... !" << endl; - - if((*argin).svalue.length() != 1) - { - Tango::Except::throw_exception( - (const char*)("OPERATION_NOT_ALLOWED"), - (const char*)("The size of the string argument must be 1"), - (const char*)("RetrigAO::set_aoscaled_data") - ); - } - Tango::DevVarStringArray chan_dvsa = (*argin).svalue; - string chan_s = chan_dvsa[0]; - char chan = chan_s[0]; - if(chan < '0' || chan > '7') - { - Tango::Except::throw_exception( - (const char*)("OPERATION_NOT_ALLOWED"), - (const char*)("The string argument must be between 0 and 7"), - (const char*)("RetrigAO::set_aoscaled_data") - ); - } - if((*argin).dvalue.length() != bufferDepth) - { - Tango::Except::throw_exception( - (const char*)("OPERATION_NOT_ALLOWED"), - (const char*)("The depth of the given buffer must be the same as specified in Device Properties"), - (const char*)("RetrigAO::set_aoscaled_data") - ); - } - - // stop the current generation - _ASL_TRY_ACTION - ( - ao->stop(), - "stop", - "RetrigAO::set_aoscaled_data", - this->set_internal_state() - ); - - // get the configuration - //asl::ContinuousAOConfig _config = ao->configuration(); - - //--------------------------------trigger config--------------------------------- - /* _config.enable_retrigger(); - - _config.set_trigger_source((adl::AIOTriggerSource)triggerSource); - _config.set_trigger_mode((adl::AOTriggerMode)triggerMode); - _config.set_nb_waveforms(1); - - if(triggerMode == adl::ao_delay) - { - //cout<<"delay: "<<delay<<endl; - _config.set_delay_counter(delay); - } - if(triggerSource == adl::external_digital) - { - _config.set_trigger_polarity((adl::AOTriggerPolarity)dTRIGPolarity); - } - else if(triggerSource == adl::external_analog) - { - _config.set_analog_trigger_source(adl::analog_trigger_ext); - _config.set_analog_trigger_condition((adl::AnalogTriggerCondition)aTRIGSelection); - unsigned short level; - if(aTRIGLevel>=0) - level = (aTRIGLevel / 0.078125) + 127; - else // v < 0 - level = (-aTRIGLevel / 0.078125); - _config.set_analog_low_level_condition(level); - _config.set_analog_high_level_condition(level); - } - - _config.set_output_rate(frequency);*/ - - // copy the input data in a buffer of type asl::AOScaledData - asl::AOScaledData data(bufferDepth); - ::memcpy(data.base(), (*argin).dvalue.get_buffer(), ((*argin).dvalue.length())*sizeof(double)); - - //NB: if a chan hasn't been enable with properties, 'ao' will do nothing - // cout << "RetrigAO::set_aoscaled_data - set periodic channel : " <<chan - '0'<< endl; - this->config.set_channel_periodic_data(chan - '0', data); - - // copy the new data in the attributes of the device. - switch(chan) - { - case '0': - ::memcpy(ch0, data.base(), data.size()); - //save the waveform in the database - this->save_waveform(ch0, "Channel0Waveform"); - break; - case '1': - ::memcpy(ch1, data.base(), data.size()); - //save the waveform in the database - this->save_waveform(ch1, "Channel1Waveform"); - break; - case '2': - ::memcpy(ch2, data.base(), data.size()); - //save the waveform in the database - this->save_waveform(ch2, "Channel2Waveform"); - break; - case '3': - ::memcpy(ch3, data.base(), data.size()); - //save the waveform in the database - this->save_waveform(ch3, "Channel3Waveform"); - break; - case '4': - ::memcpy(ch4, data.base(), data.size()); - //save the waveform in the database - this->save_waveform(ch4, "Channel4Waveform"); - break; - case '5': - ::memcpy(ch5, data.base(), data.size()); - //save the waveform in the database - this->save_waveform(ch5, "Channel5Waveform"); - break; - case '6': - ::memcpy(ch6, data.base(), data.size()); - //save the waveform in the database - this->save_waveform(ch6, "Channel6Waveform"); - break; - case '7': - ::memcpy(ch7, data.base(), data.size()); - //save the waveform in the database - this->save_waveform(ch7, "Channel7Waveform"); - break; - default: - Tango::Except::throw_exception( - (const char*)("OPERATION_NOT_ALLOWED"), - (const char*)("The string argument must be between 0 and 7"), - (const char*)("RetrigAO::set_aoscaled_data") - ); - break; - } - - // this->config = _config; - /* DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl; - _ASL_TRY_ACTION - ( - ao->init(adl::DAQ2502, boardNum), - "init", - "RetrigAO::init_device", - this->set_internal_state() - ); - - // give the configuration the new channel - _ASL_TRY_ACTION - ( - ao->configure(_config), - "configure", - "RetrigAO::set_aoscaled_data", - this->set_internal_state() - );*/ - -} -//+------------------------------------------------------------------ -/** -* method: RetrigAO::set_internal_state -*/ -//+------------------------------------------------------------------ -void RetrigAO::set_internal_state(void) -{ - if(ao == 0) - { - this->set_state(Tango::UNKNOWN); - this->set_status("The acquisition was not initialized properly"); - } - else - { - switch(ao->state()) - { - case asl::ContinuousAO::STANDBY: - this->set_state(Tango::STANDBY); - this->set_status("The generation is stopped"); - break; - case asl::ContinuousAO::RUNNING: - case asl::ContinuousAO::ABORTING: - this->set_state(Tango::RUNNING); - this->set_status("The generation is running"); - break; - case asl::ContinuousAO::FAULT: - this->set_state(Tango::FAULT); - this->set_status("An error has occured"); - break; - case asl::ContinuousAO::UNKNOWN: - default: - this->set_state(Tango::UNKNOWN); - this->set_status("The generation is in an unknown state"); - break; - } - } -} -//+------------------------------------------------------------------ -/** -* method: RetrigAO::save_waveform -* Save a waveform in tango database -*/ -//+------------------------------------------------------------------ -void RetrigAO::save_waveform(double* waveform, string wfm_channel) -{ - // cpy the waveform in a double vector - /* vector<double> vec; - for(int i=0; i<bufferDepth; i++) - vec.push_back(waveform[i]); - - //put the vector in a DBDatum - Tango::DbDatum dbdatum(wfm_channel); - dbdatum << vec; - - // put it in a DbData - Tango::DbData db_data; - db_data.push_back(dbdatum); - - // put the waveform in the database - _DEV_TRY - ( - get_db_device()->put_property(db_data), - "put_property", - "ContinuousAO::save_waveform", - );*/ - // save temporaly in file because of slow tangodb - string device_name = this->get_name(); - long idx = 0; - while( (idx =device_name.find("/", idx)) != string::npos) - { - device_name.replace( idx,1, "#"); - cout << "device name: " << device_name <<endl; - } - cout << "filePath: " << filePath <<endl; - string file_name = filePath + device_name +"_"+wfm_channel+ ".dat"; - INFO_STREAM << "Saving "<<wfm_channel<<" in file "<<file_name<< endl; - try - { - //create file if not existant - {ofstream file(file_name.c_str(), ios::in);} - - ofstream file(file_name.c_str()); - if(!file) - { - ERROR_STREAM<<"Cannot open file, check if path if correctly set! (save_waveform)"<<endl; - Tango::Except::throw_exception ( - (const char *)"TANGO_NON_SUPPORTED_FEATURE_ERROR", - (const char *)"Cannot open file, check if path if correctly set!", - (const char *)"RetrigAO::save_waveform"); - } - - for(int i=0; i<this->bufferDepth; i++) - file<<waveform[i] << endl; - - file.close(); - - } - catch(...) - { - ERROR_STREAM<<"Cannot write data to file (save_waveform)"<<endl; - Tango::Except::throw_exception ( - (const char *)"TANGO_NON_SUPPORTED_FEATURE_ERROR", - (const char *)"Cannot write data to file", - (const char *)"RetrigAO::save_waveform"); - } - INFO_STREAM <<wfm_channel<<"saved in file "<<file_name<< endl; -} - -//+------------------------------------------------------------------ -/** -* method: RetrigAO::save_waveform -* load a waveform from tango database -*/ -//+------------------------------------------------------------------ -void RetrigAO::load_waveform(double* waveform, string wfm_channel) -{ - // saved temporaly in file because of slow tangodb - string device_name = this->get_name(); - long idx = 0; - while( (idx =device_name.find("/", idx)) != string::npos) - { - device_name.replace( idx,1, "#"); - cout << "device name: " << device_name <<endl; - } - string file_name = filePath + device_name +"_"+wfm_channel+ ".dat"; - INFO_STREAM << "Getting data "<<wfm_channel<<" in file "<<file_name<< endl; - - ifstream file (file_name.c_str()); - string fileline; - if(! file.fail() ) // file has been found - { - for(int i=0; i<this->bufferDepth; i++) - { - getline(file, fileline); - waveform[i] = XString<double>::convertFromString(fileline); - } - file.close(); - - } - else - { - INFO_STREAM<<"RetrigAO::load_waveform - cannot retrieve table file, default tables loaded" <<std::endl; - } - INFO_STREAM << "Data retrieved"<<wfm_channel<<" in file "<<file_name<< endl; -} - -/*------------------------------------------------------------------------- -/ store_value_as_property : template -/-------------------------------------------------------------------------*/ -template <class T> -void RetrigAO::store_value_as_property (T value, string property_name) -{ - Tango::DbDatum current_value(property_name); - current_value << value; - Tango::DbData db_data; - db_data.push_back(current_value); - try - { - get_db_device()->put_property(db_data); - } - catch(Tango::DevFailed &e) - { - string message= "Error in storing " + property_name + " in Configuration DataBase "; - LOG_ERROR((message)); - Tango::Except::print_exception(e); - } -} - -//////////////////////////////////////////////////////////////////////////// -/// create_property_if_empty : DbData -/////////////////////////////////////////////////////////////////////////// -template <class T> -void RetrigAO::create_property_if_empty(Tango::DbData& dev_prop,T value,string property_name) -{ - int iPropertyIndex = FindIndexFromPropertyName(dev_prop,property_name); - if (iPropertyIndex == -1) return; - if (dev_prop[iPropertyIndex].is_empty()) - { - Tango::DbDatum current_value(dev_prop[iPropertyIndex].name); - current_value << value; - Tango::DbData db_data; - db_data.push_back(current_value); - - try - { - get_db_device()->put_property(db_data); - } - catch(Tango::DevFailed &e) - { - string message= "Error in storing " + property_name + " in Configuration DataBase "; - LOG_ERROR((message)); - Tango::Except::print_exception(e); - } - } -} - - -//////////////////////////////////////////////////////////////////////////// -/// FindIndexFromPropertyName : used in create_property_if_empty -/////////////////////////////////////////////////////////////////////////// -int RetrigAO::FindIndexFromPropertyName(Tango::DbData& dev_prop, string property_name) -{ - size_t iNbProperties = dev_prop.size(); - unsigned int i; - for (i=0;i<iNbProperties;i++) - { - std::string sPropertyName(dev_prop[i].name); - if (sPropertyName == property_name) return i; - } - if (i == iNbProperties) return -1; - return i; -} - - - - - - -} // namespace +static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/InputOutput/ADLINK/RetrigAO/src/RetrigAO.cpp,v 1.15 2010-03-26 09:41:54 vince_soleil Exp $"; +//+============================================================================= +// +// file : RetrigAO.cpp +// +// description : C++ source for the RetrigAO and its commands. +// The class is derived from Device. It represents the +// CORBA servant object which will be accessed from the +// network. All commands which can be executed on the +// RetrigAO are implemented in this file. +// +// project : TANGO Device Server +// +// $Author: vince_soleil $ +// +// $Revision: 1.15 $ +// +// $Log: not supported by cvs2svn $ +// Revision 1.14 2009/09/17 06:59:03 anoureddine +// - Add BufferDepth property and use it to memorize bufferDepth attribute in order to keep compatibility wilth previous version +// - call init_board() in stop() command +// +// Revision 1.13 2009/09/16 08:10:54 anoureddine +// - Transform bufferDepth property into attribute. +// - Generate code with pogo 5.2.10 +// +// Revision 1.12 2009/07/31 06:53:51 flanglois +// - support external sampling (conversionSource) +// +// Revision 1.11 2007/06/29 15:45:57 abeilleg +// bug fix on properties management. +// +// Revision 1.10 2007/06/25 10:19:05 abeilleg +// save data in files+bug fix on config cpy +// +// Revision 1.9 2007/05/10 12:20:21 abeilleg +// do stop only if running +// +// Revision 1.8 2006/11/24 10:04:56 abeilleg +// correction on bug zero forcing. +// +// Revision 1.7 2006/09/18 10:32:52 abeilleg +// added internal software support. +// +// Revision 1.6 2005/09/26 15:20:14 abeilleg +// zero forcing after stopping generation. +// +// Revision 1.5 2005/06/15 09:18:01 abeilleg +// attributes channelXEnable added. +// +// Revision 1.4 2005/01/25 10:11:06 abeilleg +// status changed +// +// Revision 1.3 2005/01/24 15:42:23 abeilleg +// following ASL modifications (states management). +// +// Revision 1.2 2004/12/21 13:09:03 abeilleg +// minor bug fixed. +// +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 + +// +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + + +//=================================================================== +// +// The following table gives the correspondence +// between commands and method name. +// +// Command name | Method name +// ---------------------------------------- +// State | dev_state() +// Status | dev_status() +// Start | start() +// Stop | stop() +// SetAOScaledData | set_aoscaled_data() +// +//=================================================================== +//#include "ADLinkContinuousAO.h" +#include <RetrigAO.h> +#include <RetrigAOClass.h> +#include <asl/ASLExceptionsHandler.h> +#include <TangoExceptionsHelper.h> +#include <asl/AOData.h> +#include <math.h> +#include <xstring.h> + +namespace RetrigAO_ns +{ + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::RetrigAO(string &s) +// +// description : constructor for simulated RetrigAO +// +// in : - cl : Pointer to the DeviceClass object +// - s : Device name +// +//----------------------------------------------------------------------------- +RetrigAO::RetrigAO(Tango::DeviceClass *cl,string &s):Tango::Device_4Impl(cl,s.c_str()) +{ + init_device(); +} + +RetrigAO::RetrigAO(Tango::DeviceClass *cl,const char *s):Tango::Device_4Impl(cl,s) +{ + init_device(); +} + +RetrigAO::RetrigAO(Tango::DeviceClass *cl,const char *s,const char *d) +:Tango::Device_4Impl(cl,s,d) +{ + init_device(); +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::delete_device() +// +// description : will be called at device destruction or at init command. +// +//----------------------------------------------------------------------------- +void RetrigAO::delete_device() +{ + // Delete device's allocated object + if(ao) + { + delete ao; + ao = 0; + } + if(ch0) + { + delete[] ch0; + ch0 = 0; + } + if(ch1) + { + delete[] ch1; + ch1 = 0; + } + if(ch2) + { + delete[] ch2; + ch2 = 0; + } + if(ch3) + { + delete[] ch3; + ch3 = 0; + } + if(ch4) + { + delete[] ch4; + ch4 = 0; + } + if(ch5) + { + delete[] ch5; + ch5 = 0; + } + if(ch6) + { + delete[] ch6; + ch6 = 0; + } + if(ch7) + { + delete[] ch7; + ch7 = 0; + } +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::init_device() +// +// description : will be called at device initialization. +// +//----------------------------------------------------------------------------- +void RetrigAO::init_device() +{ + INFO_STREAM << "RetrigAO::RetrigAO() create device " << device_name << endl; + + ao = 0; + ch0 = 0; + ch1 = 0; + ch2 = 0; + ch3 = 0; + ch4 = 0; + ch5 = 0; + ch6 = 0; + ch7 = 0; + // Initialise variables to default values + //-------------------------------------------- + get_device_property(); + + //- get the memorized value of bufferDepth (property) and put it into bufferDepth (attribute) + Tango::WAttribute &attr_bufferDepth = dev_attr->get_w_attr_by_name("bufferDepth"); + INFO_STREAM<<"bufferDepth = "<<bufferDepth<<std::endl; + attr_bufferDepth.set_write_value(bufferDepth); + write_bufferDepth(attr_bufferDepth); + + //- get the memorized value of frequency (property) and put it into frequency (attribute) + Tango::WAttribute &attr_frequency = dev_attr->get_w_attr_by_name("frequency"); + INFO_STREAM<<"frequency = "<<frequency<<std::endl; + attr_frequency.set_write_value(frequency); + write_frequency(attr_frequency); + + this->init_board(); + +} + + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::readDeviceProperies() +// +// description : Read the device properties from database. +// +//----------------------------------------------------------------------------- +void RetrigAO::get_device_property() +{ + // Initialize your default values here. + //------------------------------------------ + boardNum = 0; + frequency = 50000.0; //50 kHz + bufferDepth = 4096; + + string default_trig_mode = "POST"; + triggerMode = adl::ao_post; + + string default_trig_source = "DTRIG"; + triggerSource = adl::external_digital; + + string default_atrig_select = "BELOW"; + aTRIGSelection = adl::below_low_level; + + aTRIGLevel = 5.0; + + string default_dtrig_pol = "RISING"; + dTRIGPolarity = adl::ao_rising_edge ; + + aORefA = 10.0; + aORefB = 10.0; + + string default_pol = "BP"; + polarity = adl::bipolar; + + string default_aoref = "INTERN"; + aORefSource = adl::internal_reference; + + channel0Enable = 1; + channel1Enable = 0; + channel2Enable = 0; + channel3Enable = 0; + channel4Enable = 0; + channel5Enable = 0; + channel6Enable = 0; + channel7Enable = 0; + + double default_delay = 0.001638375; //secs + delay = 65535; // counts + + filePath = "\\\\DeviceServers\\configFiles\\RetrigAO\\"; + + std::string default_conv_src = "INTERNAL"; + conversionSource = adl::ao_internal_timer; + + // Read device properties from database.(Automatic code generation) + //------------------------------------------------------------- + Tango::DbData dev_prop; + dev_prop.push_back(Tango::DbDatum("BoardNum")); + dev_prop.push_back(Tango::DbDatum("Frequency")); + dev_prop.push_back(Tango::DbDatum("TriggerMode")); + dev_prop.push_back(Tango::DbDatum("TriggerSource")); + dev_prop.push_back(Tango::DbDatum("ATRIGSelection")); + dev_prop.push_back(Tango::DbDatum("ATRIGLevel")); + dev_prop.push_back(Tango::DbDatum("DTRIGPolarity")); + dev_prop.push_back(Tango::DbDatum("AORefA")); + dev_prop.push_back(Tango::DbDatum("AORefB")); + dev_prop.push_back(Tango::DbDatum("Polarity")); + dev_prop.push_back(Tango::DbDatum("AORefSource")); + dev_prop.push_back(Tango::DbDatum("Channel0Enable")); + dev_prop.push_back(Tango::DbDatum("Channel1Enable")); + dev_prop.push_back(Tango::DbDatum("Channel2Enable")); + dev_prop.push_back(Tango::DbDatum("Channel3Enable")); + dev_prop.push_back(Tango::DbDatum("Channel4Enable")); + dev_prop.push_back(Tango::DbDatum("Channel5Enable")); + dev_prop.push_back(Tango::DbDatum("Channel6Enable")); + dev_prop.push_back(Tango::DbDatum("Channel7Enable")); + dev_prop.push_back(Tango::DbDatum("Delay")); + dev_prop.push_back(Tango::DbDatum("BufferDepth")); + dev_prop.push_back(Tango::DbDatum("Channel0Waveform")); + dev_prop.push_back(Tango::DbDatum("Channel1Waveform")); + dev_prop.push_back(Tango::DbDatum("Channel2Waveform")); + dev_prop.push_back(Tango::DbDatum("Channel3Waveform")); + dev_prop.push_back(Tango::DbDatum("Channel4Waveform")); + dev_prop.push_back(Tango::DbDatum("Channel5Waveform")); + dev_prop.push_back(Tango::DbDatum("Channel6Waveform")); + dev_prop.push_back(Tango::DbDatum("Channel7Waveform")); + dev_prop.push_back(Tango::DbDatum("FilePath")); + dev_prop.push_back(Tango::DbDatum("ConversionSource")); + + // Call database and extract values + //-------------------------------------------- + if (Tango::Util::instance()->_UseDb==true) + get_db_device()->get_property(dev_prop); + Tango::DbDatum def_prop, cl_prop; + RetrigAOClass *ds_class = + (static_cast<RetrigAOClass *>(get_device_class())); + int i = -1; + + // Try to initialize BoardNum from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> boardNum; + else { + // Try to initialize BoardNum from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> boardNum; + } + // And try to extract BoardNum value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> boardNum; + + // Try to initialize Frequency from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> frequency; + else { + // Try to initialize Frequency from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> frequency; + } + // And try to extract Frequency value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> frequency; + + // Try to initialize TriggerMode from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> triggerMode; + else { + // Try to initialize TriggerMode from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> triggerMode; + } + // And try to extract TriggerMode value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> triggerMode; + + // Try to initialize TriggerSource from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> triggerSource; + else { + // Try to initialize TriggerSource from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> triggerSource; + } + // And try to extract TriggerSource value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> triggerSource; + + // Try to initialize ATRIGSelection from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> aTRIGSelection; + else { + // Try to initialize ATRIGSelection from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> aTRIGSelection; + } + // And try to extract ATRIGSelection value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> aTRIGSelection; + + // Try to initialize ATRIGLevel from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> aTRIGLevel; + else { + // Try to initialize ATRIGLevel from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> aTRIGLevel; + } + // And try to extract ATRIGLevel value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> aTRIGLevel; + + // Try to initialize DTRIGPolarity from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> dTRIGPolarity; + else { + // Try to initialize DTRIGPolarity from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> dTRIGPolarity; + } + // And try to extract DTRIGPolarity value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> dTRIGPolarity; + + // Try to initialize AORefA from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> aORefA; + else { + // Try to initialize AORefA from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> aORefA; + } + // And try to extract AORefA value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> aORefA; + + // Try to initialize AORefB from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> aORefB; + else { + // Try to initialize AORefB from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> aORefB; + } + // And try to extract AORefB value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> aORefB; + + // Try to initialize Polarity from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> polarity; + else { + // Try to initialize Polarity from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> polarity; + } + // And try to extract Polarity value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> polarity; + + // Try to initialize AORefSource from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> aORefSource; + else { + // Try to initialize AORefSource from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> aORefSource; + } + // And try to extract AORefSource value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> aORefSource; + + // Try to initialize Channel0Enable from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel0Enable; + else { + // Try to initialize Channel0Enable from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel0Enable; + } + // And try to extract Channel0Enable value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel0Enable; + + // Try to initialize Channel1Enable from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel1Enable; + else { + // Try to initialize Channel1Enable from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel1Enable; + } + // And try to extract Channel1Enable value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel1Enable; + + // Try to initialize Channel2Enable from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel2Enable; + else { + // Try to initialize Channel2Enable from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel2Enable; + } + // And try to extract Channel2Enable value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel2Enable; + + // Try to initialize Channel3Enable from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel3Enable; + else { + // Try to initialize Channel3Enable from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel3Enable; + } + // And try to extract Channel3Enable value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel3Enable; + + // Try to initialize Channel4Enable from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel4Enable; + else { + // Try to initialize Channel4Enable from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel4Enable; + } + // And try to extract Channel4Enable value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel4Enable; + + // Try to initialize Channel5Enable from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel5Enable; + else { + // Try to initialize Channel5Enable from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel5Enable; + } + // And try to extract Channel5Enable value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel5Enable; + + // Try to initialize Channel6Enable from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel6Enable; + else { + // Try to initialize Channel6Enable from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel6Enable; + } + // And try to extract Channel6Enable value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel6Enable; + + // Try to initialize Channel7Enable from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel7Enable; + else { + // Try to initialize Channel7Enable from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel7Enable; + } + // And try to extract Channel7Enable value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel7Enable; + + // Try to initialize Delay from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> delay; + else { + // Try to initialize Delay from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> delay; + } + // And try to extract Delay value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> delay; + + // Try to initialize BufferDepth from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> bufferDepth; + else { + // Try to initialize BufferDepth from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> bufferDepth; + } + // And try to extract BufferDepth value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> bufferDepth; + + // Try to initialize Channel0Waveform from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel0Waveform; + else { + // Try to initialize Channel0Waveform from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel0Waveform; + } + // And try to extract Channel0Waveform value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel0Waveform; + + // Try to initialize Channel1Waveform from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel1Waveform; + else { + // Try to initialize Channel1Waveform from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel1Waveform; + } + // And try to extract Channel1Waveform value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel1Waveform; + + // Try to initialize Channel2Waveform from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel2Waveform; + else { + // Try to initialize Channel2Waveform from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel2Waveform; + } + // And try to extract Channel2Waveform value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel2Waveform; + + // Try to initialize Channel3Waveform from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel3Waveform; + else { + // Try to initialize Channel3Waveform from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel3Waveform; + } + // And try to extract Channel3Waveform value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel3Waveform; + + // Try to initialize Channel4Waveform from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel4Waveform; + else { + // Try to initialize Channel4Waveform from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel4Waveform; + } + // And try to extract Channel4Waveform value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel4Waveform; + + // Try to initialize Channel5Waveform from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel5Waveform; + else { + // Try to initialize Channel5Waveform from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel5Waveform; + } + // And try to extract Channel5Waveform value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel5Waveform; + + // Try to initialize Channel6Waveform from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel6Waveform; + else { + // Try to initialize Channel6Waveform from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel6Waveform; + } + // And try to extract Channel6Waveform value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel6Waveform; + + // Try to initialize Channel7Waveform from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> channel7Waveform; + else { + // Try to initialize Channel7Waveform from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> channel7Waveform; + } + // And try to extract Channel7Waveform value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> channel7Waveform; + + // Try to initialize FilePath from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> filePath; + else { + // Try to initialize FilePath from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> filePath; + } + // And try to extract FilePath value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> filePath; + + // Try to initialize ConversionSource from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> conversionSource; + else { + // Try to initialize ConversionSource from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> conversionSource; + } + // And try to extract ConversionSource value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> conversionSource; + + + + // End of Automatic code generation + //------------------------------------------------------------- + Tango::DbData data_put; + + //------------------------------------------------------------- + if (dev_prop[0].is_empty()==false) + { + unsigned short bnum; + dev_prop[0] >> bnum; + //check value + if(bnum<0 || bnum>= 7)//num max of boards in chassis + { + WARN_STREAM<<"RetrigAO::get_device_property: the value of BoardNum is invalid" + <<"using default value "<<boardNum<<endl; + } + else + { + boardNum = bnum; + } + } + else + { + Tango::DbDatum property("BoardNum"); + property << boardNum; + data_put.push_back(property); + WARN_STREAM<<"BoardNum property is not set in database, loading default value in database:" + <<boardNum<<endl; + } + //------------------------------------------------------------- + if (dev_prop[1].is_empty()==false) + { + dev_prop[1] >> frequency; + } + else + { + Tango::DbDatum property("Frequency"); + property << frequency; + data_put.push_back(property); + WARN_STREAM<<"Frequency property is not set in database, loading default value in database:" + <<frequency<<endl; + } + //------------------------------------------------------------- + if (dev_prop[2].is_empty()==false) + { + string trig; + dev_prop[2] >> trig; + if(trig == "POST") + triggerMode = adl::ao_post; + else if(trig == "DELAY") + triggerMode = adl::ao_delay; + else + WARN_STREAM<<"RetrigAO::get_device_property: the value of TriggerMode is not valid" + <<"using default value "<<default_trig_mode<<endl; + } + else + { + Tango::DbDatum property("TriggerMode"); + property << default_trig_mode; + data_put.push_back(property); + WARN_STREAM<<"TriggerMode property is not set in database, loading default value in database:" + <<default_trig_mode<<endl; + } + //------------------------------------------------------------- + if (dev_prop[3].is_empty()==false) + { + string trig_src; + dev_prop[3] >> trig_src; + if(trig_src == "DTRIG") + triggerSource = adl::external_digital; + else if(trig_src == "ATRIG") + triggerSource = adl::external_analog; + else if(trig_src == "INTRIG") + triggerSource = adl::internal_software; + else + WARN_STREAM<<"RetrigAO::get_device_property: the value of TriggerSource is not valid" + <<"using default value "<<default_trig_source<<endl; + + } + else + { + Tango::DbDatum property("TriggerSource"); + property << default_trig_source; + data_put.push_back(property); + WARN_STREAM<<"TriggerSource property is not set in database, loading default value in database:" + <<default_trig_source<<endl; + } + //------------------------------------------------------------- + if (dev_prop[4].is_empty()==false) + { + string atrig_select; + dev_prop[4] >> atrig_select; + if(atrig_select == "BELOW") + aTRIGSelection = adl::below_low_level; + else if(atrig_select == "ABOVE") + aTRIGSelection = adl::above_high_level; + else + WARN_STREAM<<"RetrigAO::get_device_property: the value of ATRIGSelection is not valid" + <<"using default value "<<default_atrig_select<<endl; + } + else + { + Tango::DbDatum property("ATRIGSelection"); + property << default_atrig_select; + data_put.push_back(property); + WARN_STREAM<<"ATRIGSelection property is not set in database, loading default value in database:" + <<default_atrig_select<<endl; + } + //------------------------------------------------------------- + if (dev_prop[5].is_empty()==false) + { + dev_prop[5] >> aTRIGLevel; + } + else + { + Tango::DbDatum property("ATRIGLevel"); + property << aTRIGLevel; + data_put.push_back(property); + WARN_STREAM<<"ATRIGLevel property is not set in database, loading default value in database:" + <<aTRIGLevel<<endl; + } + //------------------------------------------------------------- + if (dev_prop[6].is_empty()==false) + { + string dtrig_pol; + dev_prop[6] >> dtrig_pol; + if(dtrig_pol == "RISING") + dTRIGPolarity = adl::ao_rising_edge; + else if(dtrig_pol == "FALLING") + dTRIGPolarity = adl::ao_falling_edge; + else + WARN_STREAM<<"RetrigAO::get_device_property: the value of DTRIGPolarity is not valid" + <<"using default value "<<default_dtrig_pol<<endl; + } + else + { + Tango::DbDatum property("DTRIGPolarity"); + property << default_dtrig_pol; + data_put.push_back(property); + WARN_STREAM<<"DTRIGPolarity property is not set in database, loading default value in database:" + <<default_dtrig_pol<<endl; + } + //------------------------------------------------------------- + if (dev_prop[7].is_empty()==false) + { + double ref; + dev_prop[7] >> ref; + if(ref >= -10.0 || ref <= 10.0) + aORefA = ref; + else + WARN_STREAM<<"RetrigAO::get_device_property: the value of AORefA is not valid" + <<"using default value "<<aORefA<<endl; + } + else + { + Tango::DbDatum property("AORefA"); + property << aORefA; + data_put.push_back(property); + WARN_STREAM<<"AORefA property is not set in database, loading default value in database:" + <<aORefA<<endl; + } + //------------------------------------------------------------- + if (dev_prop[8].is_empty()==false) + { + double ref; + dev_prop[8] >> ref; + if(ref >= -10.0 || ref <= 10.0) + aORefB = ref; + else + WARN_STREAM<<"RetrigAO::get_device_property: the value of AORefB is not valid" + <<"using default value "<<aORefB<<endl; + } + else + { + Tango::DbDatum property("AORefB"); + property << aORefB; + data_put.push_back(property); + WARN_STREAM<<"AORefB property is not set in database, loading default value in database:" + <<aORefB<<endl; + } + //------------------------------------------------------------- + if (dev_prop[9].is_empty()==false) + { + string pol; + dev_prop[9] >> pol; + if(pol == "BP") + polarity = adl::bipolar; + else if(pol == "UP") + polarity = adl::unipolar; + else + WARN_STREAM<<"RetrigAO::get_device_property: the value of Polarity is not valid" + <<"using default value "<<default_pol<<endl; + } + else + { + Tango::DbDatum property("Polarity"); + property << default_pol; + data_put.push_back(property); + WARN_STREAM<<"Polarity property is not set in database, loading default value in database:" + <<default_pol<<endl; + } + //------------------------------------------------------------- + if (dev_prop[10].is_empty()==false) + { + string aoref; + dev_prop[10] >> aoref; + if(aoref == "INTERN") + aORefSource = adl::internal_reference; + else if(aoref == "EXTERN") + aORefSource = adl::external_reference; + else + WARN_STREAM<<"RetrigAO::get_device_property: the value of AORefSource is not valid" + <<"using default value "<<default_aoref<<endl; + } + else + { + Tango::DbDatum property("AORefSource"); + property << default_aoref; + data_put.push_back(property); + WARN_STREAM<<"AORefSource property is not set in database, loading default value in database:" + <<default_aoref<<endl; + } + //------------------------------------------------------------- + if (dev_prop[11].is_empty()==false) + { + dev_prop[11] >> channel0Enable; + } + else + { + Tango::DbDatum property("Channel0Enable"); + property << channel0Enable; + data_put.push_back(property); + WARN_STREAM<<"Channel0Enable property is not set in database, loading default value in database:" + <<channel0Enable<<endl; + } + //------------------------------------------------------------- + if (dev_prop[12].is_empty()==false) + { + dev_prop[12] >> channel1Enable; + } + else + { + Tango::DbDatum property("Channel1Enable"); + property << channel1Enable; + data_put.push_back(property); + WARN_STREAM<<"Channel1Enable property is not set in database, loading default value in database:" + <<channel1Enable<<endl; + } + //------------------------------------------------------------- + if (dev_prop[13].is_empty()==false) + { + dev_prop[13] >> channel2Enable; + } + else + { + Tango::DbDatum property("Channel2Enable"); + property << channel2Enable; + data_put.push_back(property); + WARN_STREAM<<"Channel2Enable property is not set in database, loading default value in database:" + <<channel2Enable<<endl; + } + //------------------------------------------------------------- + if (dev_prop[14].is_empty()==false) + { + dev_prop[14] >> channel3Enable; + } + else + { + Tango::DbDatum property("Channel3Enable"); + property << channel3Enable; + data_put.push_back(property); + WARN_STREAM<<"Channel3Enable property is not set in database, loading default value in database:" + <<channel3Enable<<endl; + } + //------------------------------------------------------------- + if (dev_prop[15].is_empty()==false) + { + dev_prop[15] >> channel4Enable; + } + else + { + Tango::DbDatum property("Channel4Enable"); + property << channel4Enable; + data_put.push_back(property); + WARN_STREAM<<"Channel4Enable property is not set in database, loading default value in database:" + <<channel4Enable<<endl; + } + //------------------------------------------------------------- + if (dev_prop[16].is_empty()==false) + { + dev_prop[16] >> channel5Enable; + } + else + { + Tango::DbDatum property("Channel5Enable"); + property << channel5Enable; + data_put.push_back(property); + WARN_STREAM<<"Channel5Enable property is not set in database, loading default value in database:" + <<channel5Enable<<endl; + } + //------------------------------------------------------------- + if (dev_prop[17].is_empty()==false) + { + dev_prop[17] >> channel6Enable; + } + else + { + Tango::DbDatum property("Channel6Enable"); + property << channel6Enable; + data_put.push_back(property); + WARN_STREAM<<"Channel6Enable property is not set in database, loading default value in database:" + <<channel6Enable<<endl; + } + //------------------------------------------------------------- + if (dev_prop[18].is_empty()==false) + { + dev_prop[18] >> channel7Enable; + } + else + { + Tango::DbDatum property("Channel7Enable"); + property << channel7Enable; + data_put.push_back(property); + WARN_STREAM<<"Channel7Enable property is not set in database, loading default value in database:" + <<channel7Enable<<endl; + } + //------------------------------------------------------------- + if (dev_prop[19].is_empty()==false) + { + double delay_secs; + dev_prop[19] >> delay_secs; + if(delay_secs * (double)AD2502_CLOCK_FREQ < 1 || delay_secs * (double)AD2502_CLOCK_FREQ >65535) + { + WARN_STREAM<<"Delay property is not set in database, loading default value in database:" + <<delay<<endl; + } + else + { + delay = delay_secs * (double)AD2502_CLOCK_FREQ; + } + } + else + { + Tango::DbDatum property("Delay"); + property << default_delay; + data_put.push_back(property); + WARN_STREAM<<"Delay property is not set in database, loading default value in database:" + <<default_delay<<endl; + } + //------------------------------------------------------------- + if (dev_prop[20].is_empty()==false) + { + dev_prop[20] >> bufferDepth; + } + else + { + Tango::DbDatum property("BufferDepth"); + property << bufferDepth; + data_put.push_back(property); + WARN_STREAM<<"BufferDepth property is not set in database, loading default value in database:" + <<bufferDepth<<endl; + } + //------------------------------------------------------------- + if (dev_prop[29].is_empty()==false) + { + dev_prop[29] >> filePath; + } + + //------------------------------------------------------------- + if (dev_prop[30].is_empty()==false) + { + string conv; + dev_prop[30] >> conv; + if(conv == "INTERNAL") + conversionSource = adl::ao_internal_timer; + else if(conv == "EXTSAMPLING") + conversionSource = adl::ao_external_afio; + else + WARN_STREAM<<"ContinuousAO::get_device_property: the value of conversionSource is not valid" + <<"using default value "<<default_conv_src<<endl; + } + else + { + Tango::DbDatum property("ConversionSource"); + property << default_conv_src; + data_put.push_back(property); + WARN_STREAM<<"ConversionSource property is not set in database, loading default value in database:"<<default_conv_src<<endl; + } + //-----------------------attribute persistancy------------------ + /* if (data[21].is_empty()==false) data[21] >> channel0Waveform; + if (data[22].is_empty()==false) data[22] >> channel1Waveform; + if (data[23].is_empty()==false) data[23] >> channel2Waveform; + if (data[24].is_empty()==false) data[24] >> channel3Waveform; + if (data[25].is_empty()==false) data[25] >> channel4Waveform; + if (data[26].is_empty()==false) data[26] >> channel5Waveform; + if (data[27].is_empty()==false) data[27] >> channel6Waveform; + if (data[28].is_empty()==false) data[28] >> channel7Waveform;*/ + + //update database for not initiliazed properties + get_db_device()->put_property(data_put); +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::always_executed_hook() +// +// description : method always executed before any command is executed +// +//----------------------------------------------------------------------------- +void RetrigAO::always_executed_hook() +{ + this->set_internal_state(); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_attr_hardware() +// +// description : Hardware acquisition for attributes. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_attr_hardware(vector<long> &attr_list) +{ + DEBUG_STREAM << "In read_attr_hardware for " << attr_list.size(); + DEBUG_STREAM << " attribute(s)" << endl; + + // Add your own code here + //--------------------------------- + ao->lock_data(); + + this->err_ctr = ao->err_ctr; + + ao->unlock_data(); + +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_frequency +// +// description : Extract real attribute values for Frequency acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_frequency(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_frequency(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&frequency); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::write_frequency +// +// description : Write Frequency attribute values to hardware. +// +//----------------------------------------------------------------------------- +void RetrigAO::write_frequency(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "RetrigAO::write_frequency(Tango::WAttribute &attr) entering... "<< endl; + attr.get_write_value(frequency); + store_value_as_property(frequency, "Frequency"); + this->init_board(); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_bufferDepth +// +// description : Extract real attribute values for bufferDepth acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_bufferDepth(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_bufferDepth(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&bufferDepth); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::write_bufferDepth +// +// description : Write bufferDepth attribute values to hardware. +// +//----------------------------------------------------------------------------- +void RetrigAO::write_bufferDepth(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "RetrigAO::write_bufferDepth(Tango::WAttribute &attr) entering... "<< endl; + attr.get_write_value(bufferDepth); + store_value_as_property(bufferDepth, "BufferDepth"); + this->init_board(); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_errorCounter +// +// description : Extract real attribute values for errorCounter acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_errorCounter(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_errorCounter(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&err_ctr); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_useBoardFifo +// +// description : Extract real attribute values for useBoardFifo acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_useBoardFifo(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_useBoardFifo(Tango::Attribute &attr) entering... "<< endl; + // the information about data loading on fifo in available only after Start command. + if(this->get_state() == Tango::RUNNING) + attr.set_value(&use_fifo); + else + attr.set_quality(Tango::ATTR_INVALID); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel0Enable +// +// description : Extract real attribute values for channel0Enable acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel0Enable(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel0Enable(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&channel0Enable); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel1Enable +// +// description : Extract real attribute values for channel1Enable acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel1Enable(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel1Enable(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&channel1Enable); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel2Enable +// +// description : Extract real attribute values for channel2Enable acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel2Enable(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel2Enable(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&channel2Enable); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel3Enable +// +// description : Extract real attribute values for channel3Enable acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel3Enable(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel3Enable(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&channel3Enable); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel4Enable +// +// description : Extract real attribute values for channel4Enable acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel4Enable(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel4Enable(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&channel4Enable); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel5Enable +// +// description : Extract real attribute values for channel5Enable acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel5Enable(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel5Enable(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&channel5Enable); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel6Enable +// +// description : Extract real attribute values for channel6Enable acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel6Enable(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel6Enable(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&channel6Enable); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel7Enable +// +// description : Extract real attribute values for channel7Enable acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel7Enable(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel7Enable(Tango::Attribute &attr) entering... "<< endl; + attr.set_value(&channel7Enable); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel0 +// +// description : Extract real attribute values for channel0 acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel0(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel0(Tango::Attribute &attr) entering... "<< endl; + if(channel0Enable) + attr.set_value(ch0, bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel1 +// +// description : Extract real attribute values for channel1 acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel1(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel1(Tango::Attribute &attr) entering... "<< endl; + if(channel1Enable) + attr.set_value(ch1, bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel2 +// +// description : Extract real attribute values for channel2 acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel2(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel2(Tango::Attribute &attr) entering... "<< endl; + if(channel2Enable) + attr.set_value(ch2, bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel3 +// +// description : Extract real attribute values for channel3 acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel3(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel3(Tango::Attribute &attr) entering... "<< endl; + if(channel3Enable) + attr.set_value(ch3, bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel4 +// +// description : Extract real attribute values for channel4 acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel4(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel4(Tango::Attribute &attr) entering... "<< endl; + if(channel4Enable) + attr.set_value(ch4, bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel5 +// +// description : Extract real attribute values for channel5 acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel5(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel5(Tango::Attribute &attr) entering... "<< endl; + if(channel5Enable) + attr.set_value(ch5, bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel6 +// +// description : Extract real attribute values for channel6 acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel6(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel6(Tango::Attribute &attr) entering... "<< endl; + if(channel6Enable) + attr.set_value(ch6, bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::read_channel7 +// +// description : Extract real attribute values for channel7 acquisition result. +// +//----------------------------------------------------------------------------- +void RetrigAO::read_channel7(Tango::Attribute &attr) +{ + DEBUG_STREAM << "RetrigAO::read_channel7(Tango::Attribute &attr) entering... "<< endl; + + if(channel7Enable) + attr.set_value(ch7, bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); +} + + +//+------------------------------------------------------------------ +/** + * method: RetrigAO::start + * + * description: method to execute "Start" + * start the generation. + * + * + */ +//+------------------------------------------------------------------ +void RetrigAO::start() +{ + DEBUG_STREAM << "RetrigAO::start(): entering... !" << endl; + + // give the configuration + _ASL_TRY_ACTION + ( + ao->configure(this->config), + "configure", + "RetrigAO::start", + this->set_internal_state() + ); + + _ASL_TRY_ACTION + ( + ao->start(), + "start", + "RetrigAO::start", + this->set_internal_state() + ); + + // get if the output data have been loaded in the onboard FIFO. + // depends on the size of the buffer. + this->use_fifo = ao->use_board_fifo(); + +} + +//+------------------------------------------------------------------ +/** + * method: RetrigAO::stop + * + * description: method to execute "Stop" + * stop the generation. + * + * + */ +//+------------------------------------------------------------------ +void RetrigAO::stop() +{ + DEBUG_STREAM << "RetrigAO::stop(): entering... !" << endl; + + /*_ASL_TRY_ACTION + ( + ao->stop(), + "stop", + "RetrigAO::stop", + this->set_internal_state() + );*/ + if(this->get_state() == Tango::RUNNING) + this->stop_with_zero_forcing(); + +} +//+------------------------------------------------------------------ +/** + * method: RetrigAO::stop_with_zero_forcing + * + * description: method to execute "Stop" + * stop the generation and force the output to be 0 volts. + * + * + */ +//+------------------------------------------------------------------ +void RetrigAO::stop_with_zero_forcing() +{ + DEBUG_STREAM << "RetrigAO::stop(): entering... !" << endl; + + // save the configuration + //this->config = ao->configuration(); + + _ASL_TRY_ACTION + ( + ao->stop(), + "stop", + "RetrigAO::stop_with_zero_forcing", + this->set_internal_state() + ); + + // get the current configuration + this->stop_config = ao->configuration(); + + // set buffer with 0 volts + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + (data)[i] = 0; + + if(channel0Enable) + this->stop_config.set_channel_periodic_data(0, data); + if(channel1Enable) + this->stop_config.set_channel_periodic_data(1, data); + if(channel2Enable) + this->stop_config.set_channel_periodic_data(2, data); + if(channel3Enable) + this->stop_config.set_channel_periodic_data(3, data); + if(channel4Enable) + this->stop_config.set_channel_periodic_data(4, data); + if(channel5Enable) + this->stop_config.set_channel_periodic_data(5, data); + if(channel6Enable) + this->stop_config.set_channel_periodic_data(6, data); + if(channel7Enable) + this->stop_config.set_channel_periodic_data(7, data); + + // configure trigger mode (no trigger to generate immediatly) + this->stop_config.disable_retrigger(); + this->stop_config.set_trigger_source(adl::internal_software); + + // give the configuration the new channel + _ASL_TRY_ACTION + ( + ao->configure(this->stop_config), + "configure", + "RetrigAO::stop_with_zero_forcing", + this->set_internal_state() + ); + + _ASL_TRY_ACTION + ( + ao->start(), + "start", + "RetrigAO::stop_with_zero_forcing", + this->set_internal_state() + ); + + _ASL_TRY_ACTION + ( + ao->stop(), + "stop", + "RetrigAO::stop_with_zero_forcing", + this->set_internal_state() + ); + + //correction bug: aftera stop, start doesn't work !! + this->init_board(); +} + +//+------------------------------------------------------------------ +/** + * method: RetrigAI::init_board + */ +//+------------------------------------------------------------------ +void RetrigAO::init_board(void) +{ + + this->delete_device(); + //- create a continuous analog output daq + ao = new ADLinkContinuousAO(this); + + //- check memory allocation + if (ao == 0) + { + this->set_internal_state(); + Tango::Except::throw_exception( + (const char*)("OUT_OF_MEMORY"), + (const char*)("out of memory error"), + (const char*)("RetrigAO::init_device") + ); + } + + asl::ContinuousAOConfig _config; + ch0 = new double[bufferDepth]; + ch1 = new double[bufferDepth]; + ch2 = new double[bufferDepth]; + ch3 = new double[bufferDepth]; + ch4 = new double[bufferDepth]; + ch5 = new double[bufferDepth]; + ch6 = new double[bufferDepth]; + ch7 = new double[bufferDepth]; + if(ch0 == 0 || ch1 == 0 || ch2 == 0 || ch3 == 0 || ch4 == 0 || ch5 == 0 ||ch6 == 0 || ch7 == 0) + { + this->set_internal_state(); + this->delete_device(); + Tango::Except::throw_exception( + (const char*)("OUT_OF_MEMORY"), + (const char*)("out of memory error"), + (const char*)("RetrigAO::init_device") + ); + } + + + // default waveform for group A (channel 0 to 3) + asl::AOScaledData default_waveformA(bufferDepth); + double max_valA; + if(aORefSource == adl::external_reference) + max_valA = aORefA ; + else + max_valA = 10.0; + + // fill buffer with a sin signal + for (unsigned long i = 0; i < bufferDepth; i++) + { + (default_waveformA)[i] = ::sin((double)i * 2. * 3.14159 / (double) bufferDepth) * max_valA; + } + + ACE_OS::memcpy(this->ch0, default_waveformA.base(), default_waveformA.size()); + ACE_OS::memcpy(this->ch1, default_waveformA.base(), default_waveformA.size()); + ACE_OS::memcpy(this->ch2, default_waveformA.base(), default_waveformA.size()); + ACE_OS::memcpy(this->ch3, default_waveformA.base(), default_waveformA.size()); + + // default waveform for group B (channel 4 to 7) + asl::AOScaledData default_waveformB(bufferDepth); + double max_valB; + if(aORefSource == adl::external_reference) + max_valB = aORefB; + else + max_valB = 10.0; + + // fill buffer with a square signal + for (i = 0; i < bufferDepth/2; i++) + { + default_waveformB[i] = max_valB - 0.01; + } + for (i = bufferDepth/2; i < bufferDepth; i++) + { + default_waveformB[i] = -max_valB + 0.01; + } + ACE_OS::memcpy(this->ch4, default_waveformB.base(), default_waveformB.size()); + ACE_OS::memcpy(this->ch5, default_waveformB.base(), default_waveformB.size()); + ACE_OS::memcpy(this->ch6, default_waveformB.base(), default_waveformB.size()); + ACE_OS::memcpy(this->ch7, default_waveformB.base(), default_waveformB.size()); + + //--------------------------channels config------------------------------------ + asl::ActiveAOChannel ac; + + // configure all channels + ac.polarity = (adl::OutputPolarity)polarity; + ac.volt_ref_src = (adl::VoltageReferenceSource)aORefSource; + ac.volt_ref = 10.0; + + //------active/config. channel 0--------- + if(channel0Enable) + { + ac.id = 0; + if(aORefSource == adl::external_reference) + ac.volt_ref = aORefA; + _config.add_active_channel(ac); + + for (int i = 0; i < bufferDepth; i++) + ch0[i] = 0; + + this->load_waveform(ch0,"Channel0Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = ch0[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(0, data); + + /* + if(channel0Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 0, using a default one"<<endl; + _config.set_channel_periodic_data(0, default_waveformA); + } + else if(channel0Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 0 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + _config.set_channel_periodic_data(0, default_waveformA); + } + else //put waveform of the Tango database in ch0 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel0Waveform[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(0, data); + //cpy data in the attribute of the device + ::memcpy(ch0, data.base(), data.size()); + }*/ + + } + //------active/config. channel 1--------- + if(channel1Enable) + { + ac.id = 1; + if(aORefSource == adl::external_reference) + ac.volt_ref = aORefA; + _config.add_active_channel(ac); + + for (int i = 0; i < bufferDepth; i++) + ch1[i] = 0; + + this->load_waveform(ch1,"Channel1Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = ch1[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(1, data); + /*if(channel1Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 1, using a default one"<<endl; + _config.set_channel_periodic_data(1, default_waveformA); + } + else if(channel1Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 1 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + _config.set_channel_periodic_data(1, default_waveformA); + } + else //put waveform of the Tango database in ch1 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel1Waveform[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(1, data); + //cpy data in the attribute of the device + ::memcpy(ch1, data.base(), data.size()); + }*/ + } + //------active/config. channel 2--------- + if(channel2Enable) + { + ac.id = 2; + if(aORefSource == adl::external_reference) + ac.volt_ref = aORefA; + _config.add_active_channel(ac); + + for (int i = 0; i < bufferDepth; i++) + ch2[i] = 0; + + this->load_waveform(ch2,"Channel2Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = ch2[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(2, data); + + /* if(channel2Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 2, using a default one"<<endl; + _config.set_channel_periodic_data(2, default_waveformA); + } + else if(channel2Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 2 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + _config.set_channel_periodic_data(2, default_waveformA); + } + else //put waveform of the Tango database in ch2 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel2Waveform[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(2, data); + //cpy data in the attribute of the device + ::memcpy(ch2, data.base(), data.size()); + }*/ + } + //------active/config. channel 3--------- + if(channel3Enable) + { + ac.id = 3; + if(aORefSource == adl::external_reference) + ac.volt_ref = aORefA; + _config.add_active_channel(ac); + + for (int i = 0; i < bufferDepth; i++) + ch3[i] = 0; + this->load_waveform(ch3,"Channel3Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = ch3[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(3, data); + + /*if(channel3Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 3, using a default one"<<endl; + _config.set_channel_periodic_data(3, default_waveformA); + } + else if(channel3Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 3 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + _config.set_channel_periodic_data(3, default_waveformA); + } + else //put waveform of the Tango database in ch3 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel3Waveform[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(3, data); + //cpy data in the attribute of the device + ::memcpy(ch3, data.base(), data.size()); + }*/ + } + //------active/config. channel 4--------- + if(channel4Enable) + { + ac.id = 4; + if(aORefSource == adl::external_reference) + ac.volt_ref = aORefB; + _config.add_active_channel(ac); + + for (int i = 0; i < bufferDepth; i++) + ch4[i] = 0; + + this->load_waveform(ch4,"Channel4Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = ch4[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(4, data); + + /*if(channel4Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 4, using a default one"<<endl; + _config.set_channel_periodic_data(4, default_waveformB); + } + else if(channel4Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 4 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + _config.set_channel_periodic_data(4, default_waveformB); + } + else //put waveform of the Tango database in ch4 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel4Waveform[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(4, data); + //cpy data in the attribute of the device + ::memcpy(ch4, data.base(), data.size()); + }*/ + } + //------active/config. channel 5--------- + if(channel5Enable) + { + ac.id = 5; + if(aORefSource == adl::external_reference) + ac.volt_ref = aORefB; + _config.add_active_channel(ac); + + for (int i = 0; i < bufferDepth; i++) + ch5[i] = 0; + + this->load_waveform(ch5,"Channel5Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = ch5[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(5, data); + + /* if(channel5Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 5, using a default one"<<endl; + _config.set_channel_periodic_data(5, default_waveformB); + } + else if(channel5Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 5 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + _config.set_channel_periodic_data(5, default_waveformB); + } + else //put waveform of the Tango database in ch5 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel5Waveform[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(5, data); + //cpy data in the attribute of the device + ::memcpy(ch5, data.base(), data.size()); + }*/ + } + //------active/config. channel 6--------- + if(channel6Enable) + { + ac.id = 6; + if(aORefSource == adl::external_reference) + ac.volt_ref = aORefB; + _config.add_active_channel(ac); + + for (int i = 0; i < bufferDepth; i++) + ch6[i] = 0; + + this->load_waveform(ch6,"Channel6Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = ch6[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(6, data); + /*if(channel6Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 6, using a default one"<<endl; + _config.set_channel_periodic_data(6, default_waveformB); + } + else if(channel6Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 6 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + _config.set_channel_periodic_data(6, default_waveformB); + } + else //put waveform of the Tango database in ch6 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel6Waveform[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(6, data); + //cpy data in the attribute of the device + ::memcpy(ch6, data.base(), data.size()); + }*/ + } + //------active/config. channel 7--------- + if(channel7Enable) + { + ac.id = 7; + if(aORefSource == adl::external_reference) + ac.volt_ref = aORefB; + _config.add_active_channel(ac); + + for (int i = 0; i < bufferDepth; i++) + ch7[i] = 0; + + this->load_waveform(ch7,"Channel7Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = ch7[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(7, data); + + /* if(channel7Waveform.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel 7, using a default one"<<endl; + _config.set_channel_periodic_data(7, default_waveformB); + } + else if(channel7Waveform.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel 7 has a different size from property BufferDepth, "<< + "using default waveform"<<endl; + _config.set_channel_periodic_data(7, default_waveformB); + } + else //put waveform of the Tango database in ch7 + { + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = channel7Waveform[i]; + // put the waveform in the configuration + _config.set_channel_periodic_data(7, data); + //cpy data in the attribute of the device + }*/ + } + //--------------------------------trigger config--------------------------------- + _config.enable_retrigger(); + + _config.set_trigger_source((adl::AIOTriggerSource)triggerSource); + _config.set_trigger_mode((adl::AOTriggerMode)triggerMode); + _config.set_nb_waveforms(1); + + if(triggerMode == adl::ao_delay) + { + //cout<<"delay: "<<delay<<endl; + _config.set_delay_counter(delay); + } + if(triggerSource == adl::external_digital) + { + _config.set_trigger_polarity((adl::AOTriggerPolarity)dTRIGPolarity); + } + else if(triggerSource == adl::external_analog) + { + _config.set_analog_trigger_source(adl::analog_trigger_ext); + _config.set_analog_trigger_condition((adl::AnalogTriggerCondition)aTRIGSelection); + unsigned short level; + if(aTRIGLevel>=0) + level = (aTRIGLevel / 0.078125) + 127; + else // v < 0 + level = (-aTRIGLevel / 0.078125); + _config.set_analog_low_level_condition(level); + _config.set_analog_high_level_condition(level); + } + + _config.set_output_rate(frequency); + + // configure the conversion source (sampling timer) + _config.set_conversion_source((adl::AOConversionSource)conversionSource); + + //when stop command will be call, the waveform will be generated until its end before stopping + //config.set_stop_mode (adl::wait_end_waveform); + + DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl; + _ASL_TRY_ACTION + ( + ao->init(adl::DAQ2502, boardNum), + "init", + "RetrigAO::init_device", + this->set_internal_state() + ); + + this->config = _config; + /*DEBUG_STREAM<<"RetrigAO::init_device : config acq"<<std::endl; + _ASL_TRY_ACTION + ( + ao->configure(_config), + "configure", + "RetrigAO::init_device", + this->set_internal_state() + ); */ +} +//+------------------------------------------------------------------ +/** + * method: RetrigAO::set_aoscaled_data + * + * description: method to execute "SetAOScaledData" + * Give one period of the signal to generated of a specified channel in volts. + * + * @param argin The channel number ,in string). The output data in volts ,in double) + * + */ +//+------------------------------------------------------------------ +void RetrigAO::set_aoscaled_data(const Tango::DevVarDoubleStringArray *argin) +{ + DEBUG_STREAM << "RetrigAO::set_aoscaled_data(): entering... !" << endl; + + if((*argin).svalue.length() != 1) + { + Tango::Except::throw_exception( + (const char*)("OPERATION_NOT_ALLOWED"), + (const char*)("The size of the string argument must be 1"), + (const char*)("RetrigAO::set_aoscaled_data") + ); + } + Tango::DevVarStringArray chan_dvsa = (*argin).svalue; + string chan_s = chan_dvsa[0]; + char chan = chan_s[0]; + if(chan < '0' || chan > '7') + { + Tango::Except::throw_exception( + (const char*)("OPERATION_NOT_ALLOWED"), + (const char*)("The string argument must be between 0 and 7"), + (const char*)("RetrigAO::set_aoscaled_data") + ); + } + if((*argin).dvalue.length() != bufferDepth) + { + Tango::Except::throw_exception( + (const char*)("OPERATION_NOT_ALLOWED"), + (const char*)("The depth of the given buffer must be the same as specified in Device Properties"), + (const char*)("RetrigAO::set_aoscaled_data") + ); + } + + // stop the current generation + _ASL_TRY_ACTION + ( + ao->stop(), + "stop", + "RetrigAO::set_aoscaled_data", + this->set_internal_state() + ); + + // get the configuration + //asl::ContinuousAOConfig _config = ao->configuration(); + + //--------------------------------trigger config--------------------------------- + /* _config.enable_retrigger(); + + _config.set_trigger_source((adl::AIOTriggerSource)triggerSource); + _config.set_trigger_mode((adl::AOTriggerMode)triggerMode); + _config.set_nb_waveforms(1); + + if(triggerMode == adl::ao_delay) + { + //cout<<"delay: "<<delay<<endl; + _config.set_delay_counter(delay); + } + if(triggerSource == adl::external_digital) + { + _config.set_trigger_polarity((adl::AOTriggerPolarity)dTRIGPolarity); + } + else if(triggerSource == adl::external_analog) + { + _config.set_analog_trigger_source(adl::analog_trigger_ext); + _config.set_analog_trigger_condition((adl::AnalogTriggerCondition)aTRIGSelection); + unsigned short level; + if(aTRIGLevel>=0) + level = (aTRIGLevel / 0.078125) + 127; + else // v < 0 + level = (-aTRIGLevel / 0.078125); + _config.set_analog_low_level_condition(level); + _config.set_analog_high_level_condition(level); + } + + _config.set_output_rate(frequency);*/ + + // copy the input data in a buffer of type asl::AOScaledData + asl::AOScaledData data(bufferDepth); + ::memcpy(data.base(), (*argin).dvalue.get_buffer(), ((*argin).dvalue.length())*sizeof(double)); + + //NB: if a chan hasn't been enable with properties, 'ao' will do nothing + // cout << "RetrigAO::set_aoscaled_data - set periodic channel : " <<chan - '0'<< endl; + this->config.set_channel_periodic_data(chan - '0', data); + + // copy the new data in the attributes of the device. + switch(chan) + { + case '0': + ::memcpy(ch0, data.base(), data.size()); + //save the waveform in the database + this->save_waveform(ch0, "Channel0Waveform"); + break; + case '1': + ::memcpy(ch1, data.base(), data.size()); + //save the waveform in the database + this->save_waveform(ch1, "Channel1Waveform"); + break; + case '2': + ::memcpy(ch2, data.base(), data.size()); + //save the waveform in the database + this->save_waveform(ch2, "Channel2Waveform"); + break; + case '3': + ::memcpy(ch3, data.base(), data.size()); + //save the waveform in the database + this->save_waveform(ch3, "Channel3Waveform"); + break; + case '4': + ::memcpy(ch4, data.base(), data.size()); + //save the waveform in the database + this->save_waveform(ch4, "Channel4Waveform"); + break; + case '5': + ::memcpy(ch5, data.base(), data.size()); + //save the waveform in the database + this->save_waveform(ch5, "Channel5Waveform"); + break; + case '6': + ::memcpy(ch6, data.base(), data.size()); + //save the waveform in the database + this->save_waveform(ch6, "Channel6Waveform"); + break; + case '7': + ::memcpy(ch7, data.base(), data.size()); + //save the waveform in the database + this->save_waveform(ch7, "Channel7Waveform"); + break; + default: + Tango::Except::throw_exception( + (const char*)("OPERATION_NOT_ALLOWED"), + (const char*)("The string argument must be between 0 and 7"), + (const char*)("RetrigAO::set_aoscaled_data") + ); + break; + } + + // this->config = _config; + /* DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl; + _ASL_TRY_ACTION + ( + ao->init(adl::DAQ2502, boardNum), + "init", + "RetrigAO::init_device", + this->set_internal_state() + ); + + // give the configuration the new channel + _ASL_TRY_ACTION + ( + ao->configure(_config), + "configure", + "RetrigAO::set_aoscaled_data", + this->set_internal_state() + );*/ + +} +//+------------------------------------------------------------------ +/** +* method: RetrigAO::set_internal_state +*/ +//+------------------------------------------------------------------ +void RetrigAO::set_internal_state(void) +{ + if(ao == 0) + { + this->set_state(Tango::UNKNOWN); + this->set_status("The acquisition was not initialized properly"); + } + else + { + switch(ao->state()) + { + case asl::ContinuousAO::STANDBY: + this->set_state(Tango::STANDBY); + this->set_status("The generation is stopped"); + break; + case asl::ContinuousAO::RUNNING: + case asl::ContinuousAO::ABORTING: + this->set_state(Tango::RUNNING); + this->set_status("The generation is running"); + break; + case asl::ContinuousAO::FAULT: + this->set_state(Tango::FAULT); + this->set_status("An error has occured"); + break; + case asl::ContinuousAO::UNKNOWN: + default: + this->set_state(Tango::UNKNOWN); + this->set_status("The generation is in an unknown state"); + break; + } + } +} +//+------------------------------------------------------------------ +/** +* method: RetrigAO::save_waveform +* Save a waveform in tango database +*/ +//+------------------------------------------------------------------ +void RetrigAO::save_waveform(double* waveform, string wfm_channel) +{ + // cpy the waveform in a double vector + /* vector<double> vec; + for(int i=0; i<bufferDepth; i++) + vec.push_back(waveform[i]); + + //put the vector in a DBDatum + Tango::DbDatum dbdatum(wfm_channel); + dbdatum << vec; + + // put it in a DbData + Tango::DbData db_data; + db_data.push_back(dbdatum); + + // put the waveform in the database + _DEV_TRY + ( + get_db_device()->put_property(db_data), + "put_property", + "ContinuousAO::save_waveform", + );*/ + // save temporaly in file because of slow tangodb + string device_name = this->get_name(); + long idx = 0; + while( (idx =device_name.find("/", idx)) != string::npos) + { + device_name.replace( idx,1, "#"); + cout << "device name: " << device_name <<endl; + } + cout << "filePath: " << filePath <<endl; + string file_name = filePath + device_name +"_"+wfm_channel+ ".dat"; + INFO_STREAM << "Saving "<<wfm_channel<<" in file "<<file_name<< endl; + try + { + //create file if not existant + {ofstream file(file_name.c_str(), ios::in);} + + ofstream file(file_name.c_str()); + if(!file) + { + ERROR_STREAM<<"Cannot open file, check if path if correctly set! (save_waveform)"<<endl; + Tango::Except::throw_exception ( + (const char *)"TANGO_NON_SUPPORTED_FEATURE_ERROR", + (const char *)"Cannot open file, check if path if correctly set!", + (const char *)"RetrigAO::save_waveform"); + } + + for(int i=0; i<this->bufferDepth; i++) + file<<waveform[i] << endl; + + file.close(); + + } + catch(...) + { + ERROR_STREAM<<"Cannot write data to file (save_waveform)"<<endl; + Tango::Except::throw_exception ( + (const char *)"TANGO_NON_SUPPORTED_FEATURE_ERROR", + (const char *)"Cannot write data to file", + (const char *)"RetrigAO::save_waveform"); + } + INFO_STREAM <<wfm_channel<<"saved in file "<<file_name<< endl; +} + +//+------------------------------------------------------------------ +/** +* method: RetrigAO::save_waveform +* load a waveform from tango database +*/ +//+------------------------------------------------------------------ +void RetrigAO::load_waveform(double* waveform, string wfm_channel) +{ + // saved temporaly in file because of slow tangodb + string device_name = this->get_name(); + long idx = 0; + while( (idx =device_name.find("/", idx)) != string::npos) + { + device_name.replace( idx,1, "#"); + cout << "device name: " << device_name <<endl; + } + string file_name = filePath + device_name +"_"+wfm_channel+ ".dat"; + INFO_STREAM << "Getting data "<<wfm_channel<<" in file "<<file_name<< endl; + + ifstream file (file_name.c_str()); + string fileline; + if(! file.fail() ) // file has been found + { + for(int i=0; i<this->bufferDepth; i++) + { + getline(file, fileline); + waveform[i] = XString<double>::convertFromString(fileline); + } + file.close(); + + } + else + { + INFO_STREAM<<"RetrigAO::load_waveform - cannot retrieve table file, default tables loaded" <<std::endl; + } + INFO_STREAM << "Data retrieved"<<wfm_channel<<" in file "<<file_name<< endl; +} + +/*------------------------------------------------------------------------- +/ store_value_as_property : template +/-------------------------------------------------------------------------*/ +template <class T> +void RetrigAO::store_value_as_property (T value, string property_name) +{ + Tango::DbDatum current_value(property_name); + current_value << value; + Tango::DbData db_data; + db_data.push_back(current_value); + try + { + get_db_device()->put_property(db_data); + } + catch(Tango::DevFailed &e) + { + string message= "Error in storing " + property_name + " in Configuration DataBase "; + LOG_ERROR((message)); + Tango::Except::print_exception(e); + } +} + +//////////////////////////////////////////////////////////////////////////// +/// create_property_if_empty : DbData +/////////////////////////////////////////////////////////////////////////// +template <class T> +void RetrigAO::create_property_if_empty(Tango::DbData& dev_prop,T value,string property_name) +{ + int iPropertyIndex = FindIndexFromPropertyName(dev_prop,property_name); + if (iPropertyIndex == -1) return; + if (dev_prop[iPropertyIndex].is_empty()) + { + Tango::DbDatum current_value(dev_prop[iPropertyIndex].name); + current_value << value; + Tango::DbData db_data; + db_data.push_back(current_value); + + try + { + get_db_device()->put_property(db_data); + } + catch(Tango::DevFailed &e) + { + string message= "Error in storing " + property_name + " in Configuration DataBase "; + LOG_ERROR((message)); + Tango::Except::print_exception(e); + } + } +} + + +//////////////////////////////////////////////////////////////////////////// +/// FindIndexFromPropertyName : used in create_property_if_empty +/////////////////////////////////////////////////////////////////////////// +int RetrigAO::FindIndexFromPropertyName(Tango::DbData& dev_prop, string property_name) +{ + size_t iNbProperties = dev_prop.size(); + unsigned int i; + for (i=0;i<iNbProperties;i++) + { + std::string sPropertyName(dev_prop[i].name); + if (sPropertyName == property_name) return i; + } + if (i == iNbProperties) return -1; + return i; +} + + + + + + + +} // namespace diff --git a/src/RetrigAO.h b/src/RetrigAO.h index 15e97bb..53015b0 100644 --- a/src/RetrigAO.h +++ b/src/RetrigAO.h @@ -1,556 +1,570 @@ -//============================================================================= -// -// file : RetrigAO.h -// -// description : Include for the RetrigAO class. -// -// project : Retriggered Continuous Anolog Output -// -// $Author: vince_soleil $ -// -// $Revision: 1.11 $ -// -// $Log: not supported by cvs2svn $ -// Revision 1.10 2010/03/11 11:10:25 anoureddine -// deplace #include <tango.h> due to conflict between tang7/ACE -// -// Revision 1.9 2009/09/29 07:56:13 anoureddine -// - Add BufferDepth property and use it to memorize bufferDepth attribute in order to keep compatibility wilth previous version -// - call init_board() in stop() command -// -// Revision 1.8 2009/09/16 08:10:54 anoureddine -// - Transform bufferDepth property into attribute. -// - Generate code with pogo 5.2.10 -// -// Revision 1.7 2009/07/31 06:53:51 flanglois -// - support external sampling (conversionSource) -// -// Revision 1.6 2007/06/25 10:19:06 abeilleg -// save data in files+bug fix on config cpy -// -// Revision 1.5 2006/09/18 10:32:52 abeilleg -// added internal software support. -// -// Revision 1.4 2005/09/26 15:20:14 abeilleg -// zero forcing after stopping generation. -// -// Revision 1.3 2005/06/15 09:18:01 abeilleg -// attributes channelXEnable added. -// -// Revision 1.2 2005/01/24 15:42:47 abeilleg -// following ASL modifications (states management). -// -// Revision 1.1.1.1 2004/12/06 10:23:38 syldup -// initial import -// -// -// copyleft : Synchrotron SOLEIL -// L'Orme des Merisiers -// Saint-Aubin - BP 48 - -// -//============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= -#ifndef _RETRIGAO_H -#define _RETRIGAO_H - -#include <tango.h> -#include <ADLinkContinuousAO.h> - - -//using namespace Tango; -//class ADLinkContinuousAO; -/** - * @author $Author: vince_soleil $ - * @version $Revision: 1.11 $ $ - */ - - // Add your own constants definitions here. - //----------------------------------------------- - - -namespace RetrigAO_ns -{ - -/** - * Class Description: - * Perform continuous anolog ouput (waveform generation) on the selected outputs. - */ - -/* - * Device States Description: -* Tango::UNKNOWN : -* Tango::STANDBY : -* Tango::RUNNING : -* Tango::FAULT : - */ - - -class RetrigAO: 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::DevUShort *attr_bufferDepth_read; - Tango::DevUShort attr_bufferDepth_write; - Tango::DevDouble *attr_errorCounter_read; - Tango::DevShort *attr_useBoardFifo_read; - Tango::DevShort *attr_channel0Enable_read; - Tango::DevShort *attr_channel1Enable_read; - Tango::DevShort *attr_channel2Enable_read; - Tango::DevShort *attr_channel3Enable_read; - Tango::DevShort *attr_channel4Enable_read; - Tango::DevShort *attr_channel5Enable_read; - Tango::DevShort *attr_channel6Enable_read; - Tango::DevShort *attr_channel7Enable_read; - Tango::DevDouble *attr_channel0_read; - Tango::DevDouble *attr_channel1_read; - Tango::DevDouble *attr_channel2_read; - Tango::DevDouble *attr_channel3_read; - Tango::DevDouble *attr_channel4_read; - Tango::DevDouble *attr_channel5_read; - Tango::DevDouble *attr_channel6_read; - Tango::DevDouble *attr_channel7_read; -//@} - -/** - * @name Device properties - * Device properties member data. - */ -//@{ -/** - * The number of the board in the chassis cPCI. - */ - Tango::DevUShort boardNum; -/** - * The output frequency (the rate the samples are outputed). - */ - Tango::DevDouble frequency; -/** - * Trigger mode: POST trigger or DELAY trigger. - */ - Tango::DevUShort triggerMode; -/** - * The trigger source.The possible values are internal trigger INTRIG, digital trigger - * DTRIG or analog trigger ATRIG. - */ - Tango::DevUShort triggerSource; -/** - * select the type of analog trigger. Can be BELOW (trigger occurs below ATRIGLevel) - * or can be ABOVE (trigger occurs above ATRIGLevel). - */ - Tango::DevUShort aTRIGSelection; -/** - * The analog trigger level in volts. - */ - Tango::DevDouble aTRIGLevel; -/** - * The edges on which the trigger are detected. Can be RISING or FALLING. - */ - Tango::DevUShort dTRIGPolarity; -/** - * The value of the reference voltage gave on pin AORefA. - */ - Tango::DevDouble aORefA; -/** - * The value of the reference voltage gave on pin AORefB. - */ - Tango::DevDouble aORefB; -/** - * BP for unipolar outputs or UP for bipolar outputs. - */ - Tango::DevUShort polarity; -/** - * Select the internal reference (10.0 volts) with INTERN or the external references - * AORefA and AORefB with EXTERN. - */ - Tango::DevUShort aORefSource; -/** - * 1 if enable channel 0, 0 otherwise. - */ - Tango::DevShort channel0Enable; -/** - * 1 if enable channel 1, 0 otherwise. - */ - Tango::DevShort channel1Enable; -/** - * 1 if enable channel 2, 0 otherwise. - */ - Tango::DevShort channel2Enable; -/** - * 1 if enable channel 3, 0 otherwise. - */ - Tango::DevShort channel3Enable; -/** - * 1 if enable channel 4, 0 otherwise. - */ - Tango::DevShort channel4Enable; -/** - * 1 if enable channel 5, 0 otherwise. - */ - Tango::DevShort channel5Enable; -/** - * 1 if enable channel 6, 0 otherwise. - */ - Tango::DevShort channel6Enable; -/** - * 1 if enable channel 7, 0 otherwise. - */ - Tango::DevShort channel7Enable; -/** - * If trigger mode is delay, configure the delay in seconds. - */ - Tango::DevUShort delay; -/** - * The buffer depth for <b>one channel</b> - */ - Tango::DevUShort bufferDepth; -/** - * The waveform for channel 0 (attribute persistency). - */ - vector<double> channel0Waveform; -/** - * The waveform for channel 1 (attribute persistency). - */ - vector<double> channel1Waveform; -/** - * The waveform for channel 2 (attribute persistency). - */ - vector<double> channel2Waveform; -/** - * The waveform for channel 3 (attribute persistency). - */ - vector<double> channel3Waveform; -/** - * The waveform for channel 4 (attribute persistency). - */ - vector<double> channel4Waveform; -/** - * The waveform for channel 5 (attribute persistency). - */ - vector<double> channel5Waveform; -/** - * The waveform for channel 6 (attribute persistency). - */ - vector<double> channel6Waveform; -/** - * The waveform for channel 7 (attribute persistency). - */ - vector<double> channel7Waveform; -/** - * The path to waveforms persistancy files - */ - string filePath; -/** - * Set the AO conversion signal source (i.e. DAC sampling source). - * Use one of the following: INTERNAL, EXTSAMPLING. - */ - Tango::DevUShort conversionSource; -//@} - -/**@name Constructors - * Miscellaneous constructors */ -//@{ -/** - * Constructs a newly allocated Command object. - * - * @param cl Class. - * @param s Device Name - */ - RetrigAO(Tango::DeviceClass *cl,string &s); -/** - * Constructs a newly allocated Command object. - * - * @param cl Class. - * @param s Device Name - */ - RetrigAO(Tango::DeviceClass *cl,const char *s); -/** - * Constructs a newly allocated Command object. - * - * @param cl Class. - * @param s Device name - * @param d Device description. - */ - RetrigAO(Tango::DeviceClass *cl,const char *s,const char *d); -//@} - -/**@name Destructor - * Only one desctructor is defined for this class */ -//@{ -/** - * The object desctructor. - */ - ~RetrigAO() { 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 RetrigAO methods prototypes - */ - -//@{ -/** - * Hardware acquisition for attributes. - */ - virtual void read_attr_hardware(vector<long> &attr_list); -/** - * Extract real attribute values for bufferDepth acquisition result. - */ - virtual void read_bufferDepth(Tango::Attribute &attr); -/** - * Write bufferDepth attribute values to hardware. - */ - virtual void write_bufferDepth(Tango::WAttribute &attr); -/** - * Extract real attribute values for errorCounter acquisition result. - */ - virtual void read_errorCounter(Tango::Attribute &attr); -/** - * Extract real attribute values for useBoardFifo acquisition result. - */ - virtual void read_useBoardFifo(Tango::Attribute &attr); -/** - * Extract real attribute values for channel0Enable acquisition result. - */ - virtual void read_channel0Enable(Tango::Attribute &attr); -/** - * Extract real attribute values for channel1Enable acquisition result. - */ - virtual void read_channel1Enable(Tango::Attribute &attr); -/** - * Extract real attribute values for channel2Enable acquisition result. - */ - virtual void read_channel2Enable(Tango::Attribute &attr); -/** - * Extract real attribute values for channel3Enable acquisition result. - */ - virtual void read_channel3Enable(Tango::Attribute &attr); -/** - * Extract real attribute values for channel4Enable acquisition result. - */ - virtual void read_channel4Enable(Tango::Attribute &attr); -/** - * Extract real attribute values for channel5Enable acquisition result. - */ - virtual void read_channel5Enable(Tango::Attribute &attr); -/** - * Extract real attribute values for channel6Enable acquisition result. - */ - virtual void read_channel6Enable(Tango::Attribute &attr); -/** - * Extract real attribute values for channel7Enable acquisition result. - */ - virtual void read_channel7Enable(Tango::Attribute &attr); -/** - * Extract real attribute values for channel0 acquisition result. - */ - virtual void read_channel0(Tango::Attribute &attr); -/** - * Extract real attribute values for channel1 acquisition result. - */ - virtual void read_channel1(Tango::Attribute &attr); -/** - * Extract real attribute values for channel2 acquisition result. - */ - virtual void read_channel2(Tango::Attribute &attr); -/** - * Extract real attribute values for channel3 acquisition result. - */ - virtual void read_channel3(Tango::Attribute &attr); -/** - * Extract real attribute values for channel4 acquisition result. - */ - virtual void read_channel4(Tango::Attribute &attr); -/** - * Extract real attribute values for channel5 acquisition result. - */ - virtual void read_channel5(Tango::Attribute &attr); -/** - * Extract real attribute values for channel6 acquisition result. - */ - virtual void read_channel6(Tango::Attribute &attr); -/** - * Extract real attribute values for channel7 acquisition result. - */ - virtual void read_channel7(Tango::Attribute &attr); -/** - * Read/Write allowed for bufferDepth attribute. - */ - virtual bool is_bufferDepth_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for errorCounter attribute. - */ - virtual bool is_errorCounter_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for useBoardFifo attribute. - */ - virtual bool is_useBoardFifo_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel0Enable attribute. - */ - virtual bool is_channel0Enable_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel1Enable attribute. - */ - virtual bool is_channel1Enable_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel2Enable attribute. - */ - virtual bool is_channel2Enable_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel3Enable attribute. - */ - virtual bool is_channel3Enable_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel4Enable attribute. - */ - virtual bool is_channel4Enable_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel5Enable attribute. - */ - virtual bool is_channel5Enable_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel6Enable attribute. - */ - virtual bool is_channel6Enable_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel7Enable attribute. - */ - virtual bool is_channel7Enable_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel0 attribute. - */ - virtual bool is_channel0_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel1 attribute. - */ - virtual bool is_channel1_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel2 attribute. - */ - virtual bool is_channel2_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel3 attribute. - */ - virtual bool is_channel3_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel4 attribute. - */ - virtual bool is_channel4_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel5 attribute. - */ - virtual bool is_channel5_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel6 attribute. - */ - virtual bool is_channel6_allowed(Tango::AttReqType type); -/** - * Read/Write allowed for channel7 attribute. - */ - virtual bool is_channel7_allowed(Tango::AttReqType type); -/** - * Execution allowed for Start command. - */ - virtual bool is_Start_allowed(const CORBA::Any &any); -/** - * Execution allowed for Stop command. - */ - virtual bool is_Stop_allowed(const CORBA::Any &any); -/** - * Execution allowed for SetAOScaledData command. - */ - virtual bool is_SetAOScaledData_allowed(const CORBA::Any &any); -/** - * start the generation. - * @exception DevFailed - */ - void start(); -/** - * stop the generation. - * @exception DevFailed - */ - void stop(); -/** - * Give one period of the signal to generated of a specified channel in volts. - * @param argin The channel number ,in string). The output data in volts ,in double) - * @exception DevFailed - */ - void set_aoscaled_data(const Tango::DevVarDoubleStringArray *); - -/** - * 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 - //----------------------------------------- - ADLinkContinuousAO* ao; - void set_internal_state(void); - void stop_with_zero_forcing(); - double* ch0; - double* ch1; - double* ch2; - double* ch3; - double* ch4; - double* ch5; - double* ch6; - double* ch7; - double err_ctr; - short use_fifo; - //- Store the values into the property - //- Properties stuff - int FindIndexFromPropertyName(Tango::DbData& dev_prop, string property_name); - template <class T> - void create_property_if_empty(Tango::DbData& dev_prop,T value, string property_name); - template <class T> - void store_value_as_property(T value, string property_name); - - void save_waveform(double* waveform, string wfm_channel); - void load_waveform(double* waveform, string wfm_channel); - - void init_board(void); - asl::ContinuousAOConfig config; - asl::ContinuousAOConfig stop_config; -}; - -} // namespace - -#endif // _RETRIGAO_H +//============================================================================= +// +// file : RetrigAO.h +// +// description : Include for the RetrigAO class. +// +// project : Retriggered Continuous Anolog Output +// +// $Author: vince_soleil $ +// +// $Revision: 1.11 $ +// +// $Log: not supported by cvs2svn $ +// Revision 1.10 2010/03/11 11:10:25 anoureddine +// deplace #include <tango.h> due to conflict between tang7/ACE +// +// Revision 1.9 2009/09/29 07:56:13 anoureddine +// - Add BufferDepth property and use it to memorize bufferDepth attribute in order to keep compatibility wilth previous version +// - call init_board() in stop() command +// +// Revision 1.8 2009/09/16 08:10:54 anoureddine +// - Transform bufferDepth property into attribute. +// - Generate code with pogo 5.2.10 +// +// Revision 1.7 2009/07/31 06:53:51 flanglois +// - support external sampling (conversionSource) +// +// Revision 1.6 2007/06/25 10:19:06 abeilleg +// save data in files+bug fix on config cpy +// +// Revision 1.5 2006/09/18 10:32:52 abeilleg +// added internal software support. +// +// Revision 1.4 2005/09/26 15:20:14 abeilleg +// zero forcing after stopping generation. +// +// Revision 1.3 2005/06/15 09:18:01 abeilleg +// attributes channelXEnable added. +// +// Revision 1.2 2005/01/24 15:42:47 abeilleg +// following ASL modifications (states management). +// +// Revision 1.1.1.1 2004/12/06 10:23:38 syldup +// initial import +// +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 + +// +//============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= +#ifndef _RETRIGAO_H +#define _RETRIGAO_H + +#include <tango.h> +#include <ADLinkContinuousAO.h> + + +//using namespace Tango; +//class ADLinkContinuousAO; +/** + * @author $Author: vince_soleil $ + * @version $Revision: 1.11 $ $ + */ + + // Add your own constants definitions here. + //----------------------------------------------- + + +namespace RetrigAO_ns +{ + +/** + * Class Description: + * Perform continuous anolog ouput (waveform generation) on the selected outputs. + */ + +/* + * Device States Description: +* Tango::UNKNOWN : +* Tango::STANDBY : +* Tango::RUNNING : +* Tango::FAULT : + */ + + +class RetrigAO: 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::DevUShort *attr_bufferDepth_read; + Tango::DevUShort attr_bufferDepth_write; + Tango::DevDouble *attr_errorCounter_read; + Tango::DevShort *attr_useBoardFifo_read; + Tango::DevShort *attr_channel0Enable_read; + Tango::DevShort *attr_channel1Enable_read; + Tango::DevShort *attr_channel2Enable_read; + Tango::DevShort *attr_channel3Enable_read; + Tango::DevShort *attr_channel4Enable_read; + Tango::DevShort *attr_channel5Enable_read; + Tango::DevShort *attr_channel6Enable_read; + Tango::DevShort *attr_channel7Enable_read; + Tango::DevDouble *attr_Frequency_read; + Tango::DevDouble attr_Frequency_write; + Tango::DevDouble *attr_channel0_read; + Tango::DevDouble *attr_channel1_read; + Tango::DevDouble *attr_channel2_read; + Tango::DevDouble *attr_channel3_read; + Tango::DevDouble *attr_channel4_read; + Tango::DevDouble *attr_channel5_read; + Tango::DevDouble *attr_channel6_read; + Tango::DevDouble *attr_channel7_read; +//@} + +/** + * @name Device properties + * Device properties member data. + */ +//@{ +/** + * The number of the board in the chassis cPCI. + */ + Tango::DevUShort boardNum; +/** + * The output frequency (the rate the samples are outputed). + */ + Tango::DevDouble frequency; +/** + * Trigger mode: POST trigger or DELAY trigger. + */ + Tango::DevUShort triggerMode; +/** + * The trigger source.The possible values are internal trigger INTRIG, digital trigger + * DTRIG or analog trigger ATRIG. + */ + Tango::DevUShort triggerSource; +/** + * select the type of analog trigger. Can be BELOW (trigger occurs below ATRIGLevel) + * or can be ABOVE (trigger occurs above ATRIGLevel). + */ + Tango::DevUShort aTRIGSelection; +/** + * The analog trigger level in volts. + */ + Tango::DevDouble aTRIGLevel; +/** + * The edges on which the trigger are detected. Can be RISING or FALLING. + */ + Tango::DevUShort dTRIGPolarity; +/** + * The value of the reference voltage gave on pin AORefA. + */ + Tango::DevDouble aORefA; +/** + * The value of the reference voltage gave on pin AORefB. + */ + Tango::DevDouble aORefB; +/** + * BP for unipolar outputs or UP for bipolar outputs. + */ + Tango::DevUShort polarity; +/** + * Select the internal reference (10.0 volts) with INTERN or the external references + * AORefA and AORefB with EXTERN. + */ + Tango::DevUShort aORefSource; +/** + * 1 if enable channel 0, 0 otherwise. + */ + Tango::DevShort channel0Enable; +/** + * 1 if enable channel 1, 0 otherwise. + */ + Tango::DevShort channel1Enable; +/** + * 1 if enable channel 2, 0 otherwise. + */ + Tango::DevShort channel2Enable; +/** + * 1 if enable channel 3, 0 otherwise. + */ + Tango::DevShort channel3Enable; +/** + * 1 if enable channel 4, 0 otherwise. + */ + Tango::DevShort channel4Enable; +/** + * 1 if enable channel 5, 0 otherwise. + */ + Tango::DevShort channel5Enable; +/** + * 1 if enable channel 6, 0 otherwise. + */ + Tango::DevShort channel6Enable; +/** + * 1 if enable channel 7, 0 otherwise. + */ + Tango::DevShort channel7Enable; +/** + * If trigger mode is delay, configure the delay in seconds. + */ + Tango::DevUShort delay; +/** + * The buffer depth for <b>one channel</b> + */ + Tango::DevUShort bufferDepth; +/** + * The waveform for channel 0 (attribute persistency). + */ + vector<double> channel0Waveform; +/** + * The waveform for channel 1 (attribute persistency). + */ + vector<double> channel1Waveform; +/** + * The waveform for channel 2 (attribute persistency). + */ + vector<double> channel2Waveform; +/** + * The waveform for channel 3 (attribute persistency). + */ + vector<double> channel3Waveform; +/** + * The waveform for channel 4 (attribute persistency). + */ + vector<double> channel4Waveform; +/** + * The waveform for channel 5 (attribute persistency). + */ + vector<double> channel5Waveform; +/** + * The waveform for channel 6 (attribute persistency). + */ + vector<double> channel6Waveform; +/** + * The waveform for channel 7 (attribute persistency). + */ + vector<double> channel7Waveform; +/** + * The path to waveforms persistancy files + */ + string filePath; +/** + * Set the AO conversion signal source (i.e. DAC sampling source). + * Use one of the following: INTERNAL, EXTSAMPLING. + */ + Tango::DevUShort conversionSource; +//@} + +/**@name Constructors + * Miscellaneous constructors */ +//@{ +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device Name + */ + RetrigAO(Tango::DeviceClass *cl,string &s); +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device Name + */ + RetrigAO(Tango::DeviceClass *cl,const char *s); +/** + * Constructs a newly allocated Command object. + * + * @param cl Class. + * @param s Device name + * @param d Device description. + */ + RetrigAO(Tango::DeviceClass *cl,const char *s,const char *d); +//@} + +/**@name Destructor + * Only one desctructor is defined for this class */ +//@{ +/** + * The object desctructor. + */ + ~RetrigAO() { 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 RetrigAO methods prototypes + */ + +//@{ +/** + * Hardware acquisition for attributes. + */ + virtual void read_attr_hardware(vector<long> &attr_list); +/** + * Extract real attribute values for bufferDepth acquisition result. + */ + virtual void read_bufferDepth(Tango::Attribute &attr); +/** + * Write bufferDepth attribute values to hardware. + */ + virtual void write_bufferDepth(Tango::WAttribute &attr); +/** + * Extract real attribute values for errorCounter acquisition result. + */ + virtual void read_errorCounter(Tango::Attribute &attr); +/** + * Extract real attribute values for useBoardFifo acquisition result. + */ + virtual void read_useBoardFifo(Tango::Attribute &attr); +/** + * Extract real attribute values for channel0Enable acquisition result. + */ + virtual void read_channel0Enable(Tango::Attribute &attr); +/** + * Extract real attribute values for channel1Enable acquisition result. + */ + virtual void read_channel1Enable(Tango::Attribute &attr); +/** + * Extract real attribute values for channel2Enable acquisition result. + */ + virtual void read_channel2Enable(Tango::Attribute &attr); +/** + * Extract real attribute values for channel3Enable acquisition result. + */ + virtual void read_channel3Enable(Tango::Attribute &attr); +/** + * Extract real attribute values for channel4Enable acquisition result. + */ + virtual void read_channel4Enable(Tango::Attribute &attr); +/** + * Extract real attribute values for channel5Enable acquisition result. + */ + virtual void read_channel5Enable(Tango::Attribute &attr); +/** + * Extract real attribute values for channel6Enable acquisition result. + */ + virtual void read_channel6Enable(Tango::Attribute &attr); +/** + * Extract real attribute values for channel7Enable acquisition result. + */ + virtual void read_channel7Enable(Tango::Attribute &attr); +/** + * 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); +/** + * Extract real attribute values for channel0 acquisition result. + */ + virtual void read_channel0(Tango::Attribute &attr); +/** + * Extract real attribute values for channel1 acquisition result. + */ + virtual void read_channel1(Tango::Attribute &attr); +/** + * Extract real attribute values for channel2 acquisition result. + */ + virtual void read_channel2(Tango::Attribute &attr); +/** + * Extract real attribute values for channel3 acquisition result. + */ + virtual void read_channel3(Tango::Attribute &attr); +/** + * Extract real attribute values for channel4 acquisition result. + */ + virtual void read_channel4(Tango::Attribute &attr); +/** + * Extract real attribute values for channel5 acquisition result. + */ + virtual void read_channel5(Tango::Attribute &attr); +/** + * Extract real attribute values for channel6 acquisition result. + */ + virtual void read_channel6(Tango::Attribute &attr); +/** + * Extract real attribute values for channel7 acquisition result. + */ + virtual void read_channel7(Tango::Attribute &attr); +/** + * Read/Write allowed for bufferDepth attribute. + */ + virtual bool is_bufferDepth_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for errorCounter attribute. + */ + virtual bool is_errorCounter_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for useBoardFifo attribute. + */ + virtual bool is_useBoardFifo_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel0Enable attribute. + */ + virtual bool is_channel0Enable_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel1Enable attribute. + */ + virtual bool is_channel1Enable_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel2Enable attribute. + */ + virtual bool is_channel2Enable_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel3Enable attribute. + */ + virtual bool is_channel3Enable_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel4Enable attribute. + */ + virtual bool is_channel4Enable_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel5Enable attribute. + */ + virtual bool is_channel5Enable_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel6Enable attribute. + */ + virtual bool is_channel6Enable_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel7Enable attribute. + */ + virtual bool is_channel7Enable_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for Frequency attribute. + */ + virtual bool is_frequency_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel0 attribute. + */ + virtual bool is_channel0_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel1 attribute. + */ + virtual bool is_channel1_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel2 attribute. + */ + virtual bool is_channel2_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel3 attribute. + */ + virtual bool is_channel3_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel4 attribute. + */ + virtual bool is_channel4_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel5 attribute. + */ + virtual bool is_channel5_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel6 attribute. + */ + virtual bool is_channel6_allowed(Tango::AttReqType type); +/** + * Read/Write allowed for channel7 attribute. + */ + virtual bool is_channel7_allowed(Tango::AttReqType type); +/** + * Execution allowed for Start command. + */ + virtual bool is_Start_allowed(const CORBA::Any &any); +/** + * Execution allowed for Stop command. + */ + virtual bool is_Stop_allowed(const CORBA::Any &any); +/** + * Execution allowed for SetAOScaledData command. + */ + virtual bool is_SetAOScaledData_allowed(const CORBA::Any &any); +/** + * start the generation. + * @exception DevFailed + */ + void start(); +/** + * stop the generation. + * @exception DevFailed + */ + void stop(); +/** + * Give one period of the signal to generated of a specified channel in volts. + * @param argin The channel number ,in string). The output data in volts ,in double) + * @exception DevFailed + */ + void set_aoscaled_data(const Tango::DevVarDoubleStringArray *); + +/** + * 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 + //----------------------------------------- + ADLinkContinuousAO* ao; + void set_internal_state(void); + void stop_with_zero_forcing(); + double* ch0; + double* ch1; + double* ch2; + double* ch3; + double* ch4; + double* ch5; + double* ch6; + double* ch7; + double err_ctr; + short use_fifo; + //- Store the values into the property + //- Properties stuff + int FindIndexFromPropertyName(Tango::DbData& dev_prop, string property_name); + template <class T> + void create_property_if_empty(Tango::DbData& dev_prop,T value, string property_name); + template <class T> + void store_value_as_property(T value, string property_name); + + void save_waveform(double* waveform, string wfm_channel); + void load_waveform(double* waveform, string wfm_channel); + + void init_board(void); + asl::ContinuousAOConfig config; + asl::ContinuousAOConfig stop_config; +}; + +} // namespace + +#endif // _RETRIGAO_H diff --git a/src/RetrigAOClass.cpp b/src/RetrigAOClass.cpp index 3450000..28b24a6 100644 --- a/src/RetrigAOClass.cpp +++ b/src/RetrigAOClass.cpp @@ -1,950 +1,1060 @@ -static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/InputOutput/ADLINK/RetrigAO/src/RetrigAOClass.cpp,v 1.4 2010-03-26 09:41:54 vince_soleil Exp $"; - -static const char *TagName = "$Name: not supported by cvs2svn $"; - -static const char *FileName= "$Source: /users/chaize/newsvn/cvsroot/InputOutput/ADLINK/RetrigAO/src/RetrigAOClass.cpp,v $"; - -static const char *HttpServer= "http://controle/DeviceServer/doc/"; - -static const char *RCSfile = "$RCSfile: RetrigAOClass.cpp,v $"; -//+============================================================================= -// -// file : RetrigAOClass.cpp -// -// description : C++ source for the RetrigAOClass. A singleton -// class derived from DeviceClass. It implements the -// command list and all properties and methods required -// by the RetrigAO once per process. -// -// project : TANGO Device Server -// -// $Author: vince_soleil $ -// -// $Revision: 1.4 $ -// -// $Log: not supported by cvs2svn $ -// Revision 1.3 2009/09/16 08:10:54 anoureddine -// - Transform bufferDepth property into attribute. -// - Generate code with pogo 5.2.10 -// -// Revision 1.2 2005/06/15 09:18:01 abeilleg -// attributes channelXEnable added. -// -// Revision 1.1.1.1 2004/12/06 10:23:38 syldup -// initial import -// -// -// copyleft : Synchrotron SOLEIL -// L'Orme des Merisiers -// Saint-Aubin - BP 48/ -//-============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - - -//#include <tango.h> - -#include <RetrigAO.h> -#include <RetrigAOClass.h> - - -namespace RetrigAO_ns -{ - - -// -// method : StartCmd::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 *StartCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) -{ - - cout2 << "StartCmd::execute(): arrived" << endl; - - ((static_cast<RetrigAO *>(device))->start()); - return new CORBA::Any(); -} - - - -// -// method : StopCmd::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 *StopCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) -{ - - cout2 << "StopCmd::execute(): arrived" << endl; - - ((static_cast<RetrigAO *>(device))->stop()); - return new CORBA::Any(); -} - - -//+---------------------------------------------------------------------------- -// -// method : SetAOScaledDataCmd::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 *SetAOScaledDataCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) -{ - - cout2 << "SetAOScaledDataCmd::execute(): arrived" << endl; - - const Tango::DevVarDoubleStringArray *argin; - extract(in_any, argin); - - ((static_cast<RetrigAO *>(device))->set_aoscaled_data(argin)); - return new CORBA::Any(); -} - -// -//---------------------------------------------------------------- -// Initialize pointer for singleton pattern -//---------------------------------------------------------------- -// -RetrigAOClass *RetrigAOClass::_instance = NULL; - -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::RetrigAOClass(string &s) -// -// description : constructor for the RetrigAOClass -// -// in : - s : The class name -// -//----------------------------------------------------------------------------- -RetrigAOClass::RetrigAOClass(string &s):DeviceClass(s) -{ - - cout2 << "Entering RetrigAOClass constructor" << endl; - set_default_property(); - get_class_property(); - write_class_property(); - - cout2 << "Leaving RetrigAOClass constructor" << endl; - -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::~RetrigAOClass() -// -// description : destructor for the RetrigAOClass -// -//----------------------------------------------------------------------------- -RetrigAOClass::~RetrigAOClass() -{ - _instance = NULL; -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::instance -// -// description : Create the object if not already done. Otherwise, just -// return a pointer to the object -// -// in : - name : The class name -// -//----------------------------------------------------------------------------- -RetrigAOClass *RetrigAOClass::init(const char *name) -{ - if (_instance == NULL) - { - try - { - string s(name); - _instance = new RetrigAOClass(s); - } - catch (bad_alloc) - { - throw; - } - } - return _instance; -} - -RetrigAOClass *RetrigAOClass::instance() -{ - if (_instance == NULL) - { - cerr << "Class is not initialised !!" << endl; - exit(-1); - } - return _instance; -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::command_factory -// -// description : Create the command object(s) and store them in the -// command list -// -//----------------------------------------------------------------------------- -void RetrigAOClass::command_factory() -{ - command_list.push_back(new StartCmd("Start", - Tango::DEV_VOID, Tango::DEV_VOID, - "", - "", - Tango::OPERATOR)); - command_list.push_back(new StopCmd("Stop", - Tango::DEV_VOID, Tango::DEV_VOID, - "", - "", - Tango::OPERATOR)); - command_list.push_back(new SetAOScaledDataCmd("SetAOScaledData", - Tango::DEVVAR_DOUBLESTRINGARRAY, Tango::DEV_VOID, - "The channel number ,in string). The output data in volts ,in double)", - "", - Tango::OPERATOR)); - - // add polling if any - for (unsigned int i=0 ; i<command_list.size(); i++) - { - } -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::get_class_property -// -// description : Get the class property for specified name. -// -// in : string name : The property name -// -//+---------------------------------------------------------------------------- -Tango::DbDatum RetrigAOClass::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 : RetrigAOClass::get_default_device_property() -// -// description : Return the default value for device property. -// -//----------------------------------------------------------------------------- -Tango::DbDatum RetrigAOClass::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 : RetrigAOClass::get_default_class_property() -// -// description : Return the default value for class property. -// -//----------------------------------------------------------------------------- -Tango::DbDatum RetrigAOClass::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 : RetrigAOClass::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 RetrigAOClass::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 RetrigAO(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: RetrigAOClass::attribute_factory(vector<Tango::Attr *> &att_list) -//----------------------------------------------------------------------------- -void RetrigAOClass::attribute_factory(vector<Tango::Attr *> &att_list) -{ - // Attribute : bufferDepth - bufferDepthAttrib *buffer_depth = new bufferDepthAttrib(); - Tango::UserDefaultAttrProp buffer_depth_prop; - buffer_depth_prop.set_label("buffer Depth"); - buffer_depth_prop.set_description("The buffer depth for <b>one channel</b>"); - buffer_depth->set_default_properties(buffer_depth_prop); - buffer_depth->set_memorized(); - buffer_depth->set_memorized_init(true); - att_list.push_back(buffer_depth); - - // Attribute : errorCounter - errorCounterAttrib *error_counter = new errorCounterAttrib(); - att_list.push_back(error_counter); - - // Attribute : useBoardFifo - useBoardFifoAttrib *use_board_fifo = new useBoardFifoAttrib(); - att_list.push_back(use_board_fifo); - - // Attribute : channel0Enable - channel0EnableAttrib *channel0_enable = new channel0EnableAttrib(); - att_list.push_back(channel0_enable); - - // Attribute : channel1Enable - channel1EnableAttrib *channel1_enable = new channel1EnableAttrib(); - att_list.push_back(channel1_enable); - - // Attribute : channel2Enable - channel2EnableAttrib *channel2_enable = new channel2EnableAttrib(); - att_list.push_back(channel2_enable); - - // Attribute : channel3Enable - channel3EnableAttrib *channel3_enable = new channel3EnableAttrib(); - att_list.push_back(channel3_enable); - - // Attribute : channel4Enable - channel4EnableAttrib *channel4_enable = new channel4EnableAttrib(); - att_list.push_back(channel4_enable); - - // Attribute : channel5Enable - channel5EnableAttrib *channel5_enable = new channel5EnableAttrib(); - att_list.push_back(channel5_enable); - - // Attribute : channel6Enable - channel6EnableAttrib *channel6_enable = new channel6EnableAttrib(); - att_list.push_back(channel6_enable); - - // Attribute : channel7Enable - channel7EnableAttrib *channel7_enable = new channel7EnableAttrib(); - att_list.push_back(channel7_enable); - - // Attribute : channel0 - channel0Attrib *channel0 = new channel0Attrib(); - att_list.push_back(channel0); - - // Attribute : channel1 - channel1Attrib *channel1 = new channel1Attrib(); - att_list.push_back(channel1); - - // Attribute : channel2 - channel2Attrib *channel2 = new channel2Attrib(); - att_list.push_back(channel2); - - // Attribute : channel3 - channel3Attrib *channel3 = new channel3Attrib(); - att_list.push_back(channel3); - - // Attribute : channel4 - channel4Attrib *channel4 = new channel4Attrib(); - att_list.push_back(channel4); - - // Attribute : channel5 - channel5Attrib *channel5 = new channel5Attrib(); - att_list.push_back(channel5); - - // Attribute : channel6 - channel6Attrib *channel6 = new channel6Attrib(); - att_list.push_back(channel6); - - // Attribute : channel7 - channel7Attrib *channel7 = new channel7Attrib(); - att_list.push_back(channel7); - - // End of Automatic code generation - //------------------------------------------------------------- -} - - - - - - - - - - -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::get_class_property() -// -// description : Read the class properties from database. -// -//----------------------------------------------------------------------------- -void RetrigAOClass::get_class_property() -{ - // Initialize your default values here (if not done with POGO). - //------------------------------------------------------------------ - - // Read class properties from database.(Automatic code generation) - //------------------------------------------------------------------ - - // Call database and extract values - //-------------------------------------------- - if (Tango::Util::instance()->_UseDb==true) - get_db_class()->get_property(cl_prop); - Tango::DbDatum def_prop; - int i = -1; - - - // End of Automatic code generation - //------------------------------------------------------------------ - -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::set_default_property -// -// description: Set default property (class and device) for wizard. -// For each property, add to wizard property name and description -// If default value has been set, add it to wizard property and -// store it in a DbDatum. -// -//----------------------------------------------------------------------------- -void RetrigAOClass::set_default_property() -{ - string prop_name; - string prop_desc; - string prop_def; - - vector<string> vect_data; - // Set Default Class Properties - // Set Default Device Properties - prop_name = "BoardNum"; - prop_desc = "The number of the board in the chassis cPCI."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Frequency"; - prop_desc = "The output frequency (the rate the samples are outputed)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "TriggerMode"; - prop_desc = "Trigger mode: POST trigger or DELAY trigger."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "TriggerSource"; - prop_desc = "The trigger source.The possible values are internal trigger INTRIG, digital trigger\nDTRIG or analog trigger ATRIG."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "ATRIGSelection"; - prop_desc = "select the type of analog trigger. Can be BELOW (trigger occurs below ATRIGLevel)\nor can be ABOVE (trigger occurs above ATRIGLevel)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "ATRIGLevel"; - prop_desc = "The analog trigger level in volts."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "DTRIGPolarity"; - prop_desc = "The edges on which the trigger are detected. Can be RISING or FALLING."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "AORefA"; - prop_desc = "The value of the reference voltage gave on pin AORefA."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "AORefB"; - prop_desc = "The value of the reference voltage gave on pin AORefB."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Polarity"; - prop_desc = "BP for unipolar outputs or UP for bipolar outputs."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "AORefSource"; - prop_desc = "Select the internal reference (10.0 volts) with INTERN or the external references\nAORefA and AORefB with EXTERN."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel0Enable"; - prop_desc = "1 if enable channel 0, 0 otherwise."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel1Enable"; - prop_desc = "1 if enable channel 1, 0 otherwise."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel2Enable"; - prop_desc = "1 if enable channel 2, 0 otherwise."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel3Enable"; - prop_desc = "1 if enable channel 3, 0 otherwise."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel4Enable"; - prop_desc = "1 if enable channel 4, 0 otherwise."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel5Enable"; - prop_desc = "1 if enable channel 5, 0 otherwise."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel6Enable"; - prop_desc = "1 if enable channel 6, 0 otherwise."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel7Enable"; - prop_desc = "1 if enable channel 7, 0 otherwise."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Delay"; - prop_desc = "If trigger mode is delay, configure the delay in seconds."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel0Waveform"; - prop_desc = "The waveform for channel 0 (attribute persistency)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel1Waveform"; - prop_desc = "The waveform for channel 1 (attribute persistency)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel2Waveform"; - prop_desc = "The waveform for channel 2 (attribute persistency)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel3Waveform"; - prop_desc = "The waveform for channel 3 (attribute persistency)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel4Waveform"; - prop_desc = "The waveform for channel 4 (attribute persistency)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel5Waveform"; - prop_desc = "The waveform for channel 5 (attribute persistency)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel6Waveform"; - prop_desc = "The waveform for channel 6 (attribute persistency)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "Channel7Waveform"; - prop_desc = "The waveform for channel 7 (attribute persistency)."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "FilePath"; - prop_desc = "The path to waveforms persistancy files"; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - - prop_name = "ConversionSource"; - prop_desc = "Set the AO conversion signal source (i.e. DAC sampling source).\nUse one of the following: INTERNAL, EXTSAMPLING."; - prop_def = ""; - if (prop_def.length()>0) - { - Tango::DbDatum data(prop_name); - data << vect_data ; - dev_def_prop.push_back(data); - add_wiz_dev_prop(prop_name, prop_desc, prop_def); - } - else - add_wiz_dev_prop(prop_name, prop_desc); - -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::write_class_property -// -// description : Set class description as property in database -// -//----------------------------------------------------------------------------- -void RetrigAOClass::write_class_property() -{ - // First time, check if database used - //-------------------------------------------- - if (Tango::Util::_UseDb == false) - return; - - Tango::DbData data; - string classname = get_name(); - string header; - string::size_type start, end; - - // Put title - Tango::DbDatum title("ProjectTitle"); - string str_title("Retriggered Continuous Anolog Output"); - title << str_title; - data.push_back(title); - - // Put Description - Tango::DbDatum description("Description"); - vector<string> str_desc; - str_desc.push_back("Perform continuous anolog ouput (waveform generation) on the selected outputs."); - description << str_desc; - data.push_back(description); - - // put cvs location - string rcsId(RcsId); - string filename(classname); - start = rcsId.find("/"); - if (start!=string::npos) - { - filename += "Class.cpp"; - end = rcsId.find(filename); - if (end>start) - { - string strloc = rcsId.substr(start, end-start); - // Check if specific repository - start = strloc.find("/cvsroot/"); - if (start!=string::npos && start>0) - { - string repository = strloc.substr(0, start); - if (repository.find("/segfs/")!=string::npos) - strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); - } - Tango::DbDatum cvs_loc("cvs_location"); - cvs_loc << strloc; - data.push_back(cvs_loc); - } - } - - // Get CVS tag revision - string tagname(TagName); - header = "$Name: "; - start = header.length(); - string endstr(" $"); - end = tagname.find(endstr); - if (end!=string::npos && end>start) - { - string strtag = tagname.substr(start, end-start); - Tango::DbDatum cvs_tag("cvs_tag"); - cvs_tag << strtag; - data.push_back(cvs_tag); - } - - // Get URL location - string httpServ(HttpServer); - if (httpServ.length()>0) - { - Tango::DbDatum db_doc_url("doc_url"); - db_doc_url << httpServ; - data.push_back(db_doc_url); - } - - // Put inheritance - Tango::DbDatum inher_datum("InheritedFrom"); - vector<string> inheritance; - inheritance.push_back("Device_4Impl"); - inher_datum << inheritance; - data.push_back(inher_datum); - - // Call database and and values - //-------------------------------------------- - get_db_class()->put_property(data); -} - -} // namespace +static const char *ClassId = "$Id: $"; +static const char *CvsPath = "$Source: $"; +static const char *SvnPath = "$HeadURL: $"; +static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/InputOutput/ADLINK/RetrigAO/src/RetrigAOClass.cpp,v 1.4 2010-03-26 09:41:54 vince_soleil Exp $"; + +static const char *TagName = "$Name: not supported by cvs2svn $"; + +static const char *FileName= "$Source: /users/chaize/newsvn/cvsroot/InputOutput/ADLINK/RetrigAO/src/RetrigAOClass.cpp,v $"; + +static const char *HttpServer= "http://controle/DeviceServer/doc/"; + +static const char *RCSfile = "$RCSfile: RetrigAOClass.cpp,v $"; +//+============================================================================= +// +// file : RetrigAOClass.cpp +// +// description : C++ source for the RetrigAOClass. A singleton +// class derived from DeviceClass. It implements the +// command list and all properties and methods required +// by the RetrigAO once per process. +// +// project : TANGO Device Server +// +// $Author: vince_soleil $ +// +// $Revision: 1.4 $ +// +// $Log: not supported by cvs2svn $ +// Revision 1.3 2009/09/16 08:10:54 anoureddine +// - Transform bufferDepth property into attribute. +// - Generate code with pogo 5.2.10 +// +// Revision 1.2 2005/06/15 09:18:01 abeilleg +// attributes channelXEnable added. +// +// Revision 1.1.1.1 2004/12/06 10:23:38 syldup +// initial import +// +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48/ +//-============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + + +//#include <tango.h> + +#include <RetrigAO.h> +#include <RetrigAOClass.h> + + +namespace RetrigAO_ns +{ + + +// +// method : StartCmd::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 *StartCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) +{ + + cout2 << "StartCmd::execute(): arrived" << endl; + + ((static_cast<RetrigAO *>(device))->start()); + return new CORBA::Any(); +} + + + +// +// method : StopCmd::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 *StopCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) +{ + + cout2 << "StopCmd::execute(): arrived" << endl; + + ((static_cast<RetrigAO *>(device))->stop()); + return new CORBA::Any(); +} + + +//+---------------------------------------------------------------------------- +// +// method : SetAOScaledDataCmd::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 *SetAOScaledDataCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any) +{ + + cout2 << "SetAOScaledDataCmd::execute(): arrived" << endl; + + const Tango::DevVarDoubleStringArray *argin; + extract(in_any, argin); + + ((static_cast<RetrigAO *>(device))->set_aoscaled_data(argin)); + return new CORBA::Any(); +} + +// +//---------------------------------------------------------------- +// Initialize pointer for singleton pattern +//---------------------------------------------------------------- +// +RetrigAOClass *RetrigAOClass::_instance = NULL; + +//+---------------------------------------------------------------------------- +// +// method : RetrigAOClass::RetrigAOClass(string &s) +// +// description : constructor for the RetrigAOClass +// +// in : - s : The class name +// +//----------------------------------------------------------------------------- +RetrigAOClass::RetrigAOClass(string &s):DeviceClass(s) +{ + + cout2 << "Entering RetrigAOClass constructor" << endl; + set_default_property(); + get_class_property(); + write_class_property(); + + cout2 << "Leaving RetrigAOClass constructor" << endl; + +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAOClass::~RetrigAOClass() +// +// description : destructor for the RetrigAOClass +// +//----------------------------------------------------------------------------- +RetrigAOClass::~RetrigAOClass() +{ + _instance = NULL; +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAOClass::instance +// +// description : Create the object if not already done. Otherwise, just +// return a pointer to the object +// +// in : - name : The class name +// +//----------------------------------------------------------------------------- +RetrigAOClass *RetrigAOClass::init(const char *name) +{ + if (_instance == NULL) + { + try + { + string s(name); + _instance = new RetrigAOClass(s); + } + catch (bad_alloc) + { + throw; + } + } + return _instance; +} + +RetrigAOClass *RetrigAOClass::instance() +{ + if (_instance == NULL) + { + cerr << "Class is not initialised !!" << endl; + exit(-1); + } + return _instance; +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAOClass::command_factory +// +// description : Create the command object(s) and store them in the +// command list +// +//----------------------------------------------------------------------------- +void RetrigAOClass::command_factory() +{ + command_list.push_back(new StartCmd("Start", + Tango::DEV_VOID, Tango::DEV_VOID, + "", + "", + Tango::OPERATOR)); + command_list.push_back(new StopCmd("Stop", + Tango::DEV_VOID, Tango::DEV_VOID, + "", + "", + Tango::OPERATOR)); + command_list.push_back(new SetAOScaledDataCmd("SetAOScaledData", + Tango::DEVVAR_DOUBLESTRINGARRAY, Tango::DEV_VOID, + "The channel number ,in string). The output data in volts ,in double)", + "", + Tango::OPERATOR)); + + // add polling if any + for (unsigned int i=0 ; i<command_list.size(); i++) + { + } +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAOClass::get_class_property +// +// description : Get the class property for specified name. +// +// in : string name : The property name +// +//+---------------------------------------------------------------------------- +Tango::DbDatum RetrigAOClass::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 : RetrigAOClass::get_default_device_property() +// +// description : Return the default value for device property. +// +//----------------------------------------------------------------------------- +Tango::DbDatum RetrigAOClass::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 : RetrigAOClass::get_default_class_property() +// +// description : Return the default value for class property. +// +//----------------------------------------------------------------------------- +Tango::DbDatum RetrigAOClass::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 : RetrigAOClass::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 RetrigAOClass::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 RetrigAO(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: RetrigAOClass::attribute_factory(vector<Tango::Attr *> &att_list) +//----------------------------------------------------------------------------- +void RetrigAOClass::attribute_factory(vector<Tango::Attr *> &att_list) +{ + // Attribute : bufferDepth + bufferDepthAttrib *buffer_depth = new bufferDepthAttrib(); + Tango::UserDefaultAttrProp buffer_depth_prop; + buffer_depth_prop.set_label("buffer Depth"); + buffer_depth_prop.set_description("The buffer depth for <b>one channel</b>"); + buffer_depth->set_default_properties(buffer_depth_prop); + buffer_depth->set_memorized(); + buffer_depth->set_memorized_init(true); + att_list.push_back(buffer_depth); + + // Attribute : errorCounter + errorCounterAttrib *error_counter = new errorCounterAttrib(); + att_list.push_back(error_counter); + + // Attribute : useBoardFifo + useBoardFifoAttrib *use_board_fifo = new useBoardFifoAttrib(); + att_list.push_back(use_board_fifo); + + // Attribute : channel0Enable + channel0EnableAttrib *channel0_enable = new channel0EnableAttrib(); + att_list.push_back(channel0_enable); + + // Attribute : channel1Enable + channel1EnableAttrib *channel1_enable = new channel1EnableAttrib(); + att_list.push_back(channel1_enable); + + // Attribute : channel2Enable + channel2EnableAttrib *channel2_enable = new channel2EnableAttrib(); + att_list.push_back(channel2_enable); + + // Attribute : channel3Enable + channel3EnableAttrib *channel3_enable = new channel3EnableAttrib(); + att_list.push_back(channel3_enable); + + // Attribute : channel4Enable + channel4EnableAttrib *channel4_enable = new channel4EnableAttrib(); + att_list.push_back(channel4_enable); + + // Attribute : channel5Enable + channel5EnableAttrib *channel5_enable = new channel5EnableAttrib(); + att_list.push_back(channel5_enable); + + // Attribute : channel6Enable + channel6EnableAttrib *channel6_enable = new channel6EnableAttrib(); + att_list.push_back(channel6_enable); + + // Attribute : channel7Enable + channel7EnableAttrib *channel7_enable = new channel7EnableAttrib(); + att_list.push_back(channel7_enable); + + // Attribute : frequency + frequencyAttrib *frequency = new frequencyAttrib(); + Tango::UserDefaultAttrProp frequency_prop; + frequency_prop.set_unit("Hz"); + frequency_prop.set_display_unit("Hz"); + frequency_prop.set_min_value("0"); + frequency_prop.set_description("The output frequency (the rate the samples are outputed)."); + frequency->set_default_properties(frequency_prop); + att_list.push_back(frequency); + + // Attribute : channel0 + channel0Attrib *channel0 = new channel0Attrib(); + att_list.push_back(channel0); + + // Attribute : channel1 + channel1Attrib *channel1 = new channel1Attrib(); + att_list.push_back(channel1); + + // Attribute : channel2 + channel2Attrib *channel2 = new channel2Attrib(); + att_list.push_back(channel2); + + // Attribute : channel3 + channel3Attrib *channel3 = new channel3Attrib(); + att_list.push_back(channel3); + + // Attribute : channel4 + channel4Attrib *channel4 = new channel4Attrib(); + att_list.push_back(channel4); + + // Attribute : channel5 + channel5Attrib *channel5 = new channel5Attrib(); + att_list.push_back(channel5); + + // Attribute : channel6 + channel6Attrib *channel6 = new channel6Attrib(); + att_list.push_back(channel6); + + // Attribute : channel7 + channel7Attrib *channel7 = new channel7Attrib(); + att_list.push_back(channel7); + + // End of Automatic code generation + //------------------------------------------------------------- +} + + + + + + + + + + +//+---------------------------------------------------------------------------- +// +// method : RetrigAOClass::get_class_property() +// +// description : Read the class properties from database. +// +//----------------------------------------------------------------------------- +void RetrigAOClass::get_class_property() +{ + // Initialize your default values here (if not done with POGO). + //------------------------------------------------------------------ + + // Read class properties from database.(Automatic code generation) + //------------------------------------------------------------------ + + // Call database and extract values + //-------------------------------------------- + if (Tango::Util::instance()->_UseDb==true) + get_db_class()->get_property(cl_prop); + Tango::DbDatum def_prop; + int i = -1; + + + // End of Automatic code generation + //------------------------------------------------------------------ + +} + +//+---------------------------------------------------------------------------- +// +// method : RetrigAOClass::set_default_property +// +// description: Set default property (class and device) for wizard. +// For each property, add to wizard property name and description +// If default value has been set, add it to wizard property and +// store it in a DbDatum. +// +//----------------------------------------------------------------------------- +void RetrigAOClass::set_default_property() +{ + string prop_name; + string prop_desc; + string prop_def; + + vector<string> vect_data; + // Set Default Class Properties + // Set Default Device Properties + prop_name = "BoardNum"; + prop_desc = "The number of the board in the chassis cPCI."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Frequency"; + prop_desc = "The output frequency (the rate the samples are outputed)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "TriggerMode"; + prop_desc = "Trigger mode: POST trigger or DELAY trigger."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "TriggerSource"; + prop_desc = "The trigger source.The possible values are internal trigger INTRIG, digital trigger\nDTRIG or analog trigger ATRIG."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "ATRIGSelection"; + prop_desc = "select the type of analog trigger. Can be BELOW (trigger occurs below ATRIGLevel)\nor can be ABOVE (trigger occurs above ATRIGLevel)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "ATRIGLevel"; + prop_desc = "The analog trigger level in volts."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "DTRIGPolarity"; + prop_desc = "The edges on which the trigger are detected. Can be RISING or FALLING."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "AORefA"; + prop_desc = "The value of the reference voltage gave on pin AORefA."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "AORefB"; + prop_desc = "The value of the reference voltage gave on pin AORefB."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Polarity"; + prop_desc = "BP for unipolar outputs or UP for bipolar outputs."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "AORefSource"; + prop_desc = "Select the internal reference (10.0 volts) with INTERN or the external references\nAORefA and AORefB with EXTERN."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel0Enable"; + prop_desc = "1 if enable channel 0, 0 otherwise."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel1Enable"; + prop_desc = "1 if enable channel 1, 0 otherwise."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel2Enable"; + prop_desc = "1 if enable channel 2, 0 otherwise."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel3Enable"; + prop_desc = "1 if enable channel 3, 0 otherwise."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel4Enable"; + prop_desc = "1 if enable channel 4, 0 otherwise."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel5Enable"; + prop_desc = "1 if enable channel 5, 0 otherwise."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel6Enable"; + prop_desc = "1 if enable channel 6, 0 otherwise."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel7Enable"; + prop_desc = "1 if enable channel 7, 0 otherwise."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Delay"; + prop_desc = "If trigger mode is delay, configure the delay in seconds."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "BufferDepth"; + prop_desc = "The buffer depth for <b>one channel</b>"; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel0Waveform"; + prop_desc = "The waveform for channel 0 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel1Waveform"; + prop_desc = "The waveform for channel 1 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel2Waveform"; + prop_desc = "The waveform for channel 2 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel3Waveform"; + prop_desc = "The waveform for channel 3 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel4Waveform"; + prop_desc = "The waveform for channel 4 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel5Waveform"; + prop_desc = "The waveform for channel 5 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel6Waveform"; + prop_desc = "The waveform for channel 6 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "Channel7Waveform"; + prop_desc = "The waveform for channel 7 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "FilePath"; + prop_desc = "The path to waveforms persistancy files"; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + + prop_name = "ConversionSource"; + prop_desc = "Set the AO conversion signal source (i.e. DAC sampling source).\nUse one of the following: INTERNAL, EXTSAMPLING."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAOClass::write_class_property +// +// description : Set class description as property in database +// +//----------------------------------------------------------------------------- +void RetrigAOClass::write_class_property() +{ + // First time, check if database used + //-------------------------------------------- + if (Tango::Util::_UseDb == false) + return; + + Tango::DbData data; + string classname = get_name(); + string header; + string::size_type start, end; + + // Put title + Tango::DbDatum title("ProjectTitle"); + string str_title("Retriggered Continuous Anolog Output"); + title << str_title; + data.push_back(title); + + // Put Description + Tango::DbDatum description("Description"); + vector<string> str_desc; + str_desc.push_back("Perform continuous anolog ouput (waveform generation) on the selected outputs."); + description << str_desc; + data.push_back(description); + + // put cvs or svn location + string filename(classname); + filename += "Class.cpp"; + + // Create a string with the class ID to + // get the string into the binary + string class_id(ClassId); + + // check for cvs information + string src_path(CvsPath); + start = src_path.find("/"); + if (start!=string::npos) + { + end = src_path.find(filename); + if (end>start) + { + string strloc = src_path.substr(start, end-start); + // Check if specific repository + start = strloc.find("/cvsroot/"); + if (start!=string::npos && start>0) + { + string repository = strloc.substr(0, start); + if (repository.find("/segfs/")!=string::npos) + strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); + } + Tango::DbDatum cvs_loc("cvs_location"); + cvs_loc << strloc; + data.push_back(cvs_loc); + } + } + // check for svn information + else + { + string src_path(SvnPath); + start = src_path.find("://"); + if (start!=string::npos) + { + end = src_path.find(filename); + if (end>start) + { + header = "$HeadURL: "; + start = header.length(); + string strloc = src_path.substr(start, (end-start)); + + Tango::DbDatum svn_loc("svn_location"); + svn_loc << strloc; + data.push_back(svn_loc); + } + } + } + + // Get CVS or SVN revision tag + + // CVS tag + string tagname(TagName); + header = "$Name: "; + start = header.length(); + string endstr(" $"); + + end = tagname.find(endstr); + if (end!=string::npos && end>start) + { + string strtag = tagname.substr(start, end-start); + Tango::DbDatum cvs_tag("cvs_tag"); + cvs_tag << strtag; + data.push_back(cvs_tag); + } + + // SVN tag + string svnpath(SvnPath); + header = "$HeadURL: "; + start = header.length(); + + end = svnpath.find(endstr); + if (end!=string::npos && end>start) + { + string strloc = svnpath.substr(start, end-start); + + string tagstr ("/tags/"); + start = strloc.find(tagstr); + if ( start!=string::npos ) + { + start = start + tagstr.length(); + end = strloc.find(filename); + string strtag = strloc.substr(start, end-start-1); + + Tango::DbDatum svn_tag("svn_tag"); + svn_tag << strtag; + data.push_back(svn_tag); + } + } + + // Get URL location + string httpServ(HttpServer); + if (httpServ.length()>0) + { + Tango::DbDatum db_doc_url("doc_url"); + db_doc_url << httpServ; + data.push_back(db_doc_url); + } + + // Put inheritance + Tango::DbDatum inher_datum("InheritedFrom"); + vector<string> inheritance; + inheritance.push_back("Device_4Impl"); + inher_datum << inheritance; + data.push_back(inher_datum); + + // Call database and and values + //-------------------------------------------- + get_db_class()->put_property(data); +} + +} // namespace diff --git a/src/RetrigAOClass.h b/src/RetrigAOClass.h index c0f154c..0800e41 100644 --- a/src/RetrigAOClass.h +++ b/src/RetrigAOClass.h @@ -1,390 +1,410 @@ -//============================================================================= -// -// file : RetrigAOClass.h -// -// description : Include for the RetrigAOClass root class. -// This class is represents the singleton class for -// the RetrigAO device class. -// It contains all properties and methods which the -// RetrigAO requires only once e.g. the commands. -// -// project : TANGO Device Server -// -// $Author: anoureddine $ -// -// $Revision: 1.2 $ -// -// $Log: not supported by cvs2svn $ -// Revision 1.1.1.1 2004/12/06 10:23:38 syldup -// initial import -// -// -// copyleft : Synchrotron SOLEIL -// L'Orme des Merisiers -// Saint-Aubin - BP 48 -//============================================================================= -// -// This file is generated by POGO -// (Program Obviously used to Generate tango Object) -// -// (c) - Software Engineering Group - ESRF -//============================================================================= - -#ifndef _RETRIGAOCLASS_H -#define _RETRIGAOCLASS_H - -#include <tango.h> -#include <RetrigAO.h> - -namespace RetrigAO_ns -{ -//===================================== -// Define classes for attributes -//===================================== -class channel7Attrib: public Tango::SpectrumAttr -{ -public: - channel7Attrib():SpectrumAttr("channel7", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; - ~channel7Attrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel7(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel7_allowed(ty);} -}; - -class channel6Attrib: public Tango::SpectrumAttr -{ -public: - channel6Attrib():SpectrumAttr("channel6", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; - ~channel6Attrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel6(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel6_allowed(ty);} -}; - -class channel5Attrib: public Tango::SpectrumAttr -{ -public: - channel5Attrib():SpectrumAttr("channel5", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; - ~channel5Attrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel5(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel5_allowed(ty);} -}; - -class channel4Attrib: public Tango::SpectrumAttr -{ -public: - channel4Attrib():SpectrumAttr("channel4", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; - ~channel4Attrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel4(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel4_allowed(ty);} -}; - -class channel3Attrib: public Tango::SpectrumAttr -{ -public: - channel3Attrib():SpectrumAttr("channel3", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; - ~channel3Attrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel3(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel3_allowed(ty);} -}; - -class channel2Attrib: public Tango::SpectrumAttr -{ -public: - channel2Attrib():SpectrumAttr("channel2", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; - ~channel2Attrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel2(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel2_allowed(ty);} -}; - -class channel1Attrib: public Tango::SpectrumAttr -{ -public: - channel1Attrib():SpectrumAttr("channel1", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; - ~channel1Attrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel1(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel1_allowed(ty);} -}; - -class channel0Attrib: public Tango::SpectrumAttr -{ -public: - channel0Attrib():SpectrumAttr("channel0", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; - ~channel0Attrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel0(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel0_allowed(ty);} -}; - -class channel7EnableAttrib: public Tango::Attr -{ -public: - channel7EnableAttrib():Attr("channel7Enable", Tango::DEV_SHORT, Tango::READ) {}; - ~channel7EnableAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel7Enable(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel7Enable_allowed(ty);} -}; - -class channel6EnableAttrib: public Tango::Attr -{ -public: - channel6EnableAttrib():Attr("channel6Enable", Tango::DEV_SHORT, Tango::READ) {}; - ~channel6EnableAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel6Enable(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel6Enable_allowed(ty);} -}; - -class channel5EnableAttrib: public Tango::Attr -{ -public: - channel5EnableAttrib():Attr("channel5Enable", Tango::DEV_SHORT, Tango::READ) {}; - ~channel5EnableAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel5Enable(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel5Enable_allowed(ty);} -}; - -class channel4EnableAttrib: public Tango::Attr -{ -public: - channel4EnableAttrib():Attr("channel4Enable", Tango::DEV_SHORT, Tango::READ) {}; - ~channel4EnableAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel4Enable(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel4Enable_allowed(ty);} -}; - -class channel3EnableAttrib: public Tango::Attr -{ -public: - channel3EnableAttrib():Attr("channel3Enable", Tango::DEV_SHORT, Tango::READ) {}; - ~channel3EnableAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel3Enable(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel3Enable_allowed(ty);} -}; - -class channel2EnableAttrib: public Tango::Attr -{ -public: - channel2EnableAttrib():Attr("channel2Enable", Tango::DEV_SHORT, Tango::READ) {}; - ~channel2EnableAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel2Enable(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel2Enable_allowed(ty);} -}; - -class channel1EnableAttrib: public Tango::Attr -{ -public: - channel1EnableAttrib():Attr("channel1Enable", Tango::DEV_SHORT, Tango::READ) {}; - ~channel1EnableAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel1Enable(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel1Enable_allowed(ty);} -}; - -class channel0EnableAttrib: public Tango::Attr -{ -public: - channel0EnableAttrib():Attr("channel0Enable", Tango::DEV_SHORT, Tango::READ) {}; - ~channel0EnableAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_channel0Enable(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_channel0Enable_allowed(ty);} -}; - -class useBoardFifoAttrib: public Tango::Attr -{ -public: - useBoardFifoAttrib():Attr("useBoardFifo", Tango::DEV_SHORT, Tango::READ) {}; - ~useBoardFifoAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_useBoardFifo(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_useBoardFifo_allowed(ty);} -}; - -class errorCounterAttrib: public Tango::Attr -{ -public: - errorCounterAttrib():Attr("errorCounter", Tango::DEV_DOUBLE, Tango::READ) {}; - ~errorCounterAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_errorCounter(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_errorCounter_allowed(ty);} -}; - -class bufferDepthAttrib: public Tango::Attr -{ -public: - bufferDepthAttrib():Attr("bufferDepth", Tango::DEV_USHORT, Tango::READ_WRITE) {}; - ~bufferDepthAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<RetrigAO *>(dev))->read_bufferDepth(att);} - virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) - {(static_cast<RetrigAO *>(dev))->write_bufferDepth(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<RetrigAO *>(dev))->is_bufferDepth_allowed(ty);} -}; - -//========================================= -// Define classes for commands -//========================================= -class SetAOScaledDataCmd : public Tango::Command -{ -public: - SetAOScaledDataCmd(const char *name, - Tango::CmdArgType in, - Tango::CmdArgType out, - const char *in_desc, - const char *out_desc, - Tango::DispLevel level) - :Command(name,in,out,in_desc,out_desc, level) {}; - - SetAOScaledDataCmd(const char *name, - Tango::CmdArgType in, - Tango::CmdArgType out) - :Command(name,in,out) {}; - ~SetAOScaledDataCmd() {}; - - virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); - virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) - {return (static_cast<RetrigAO *>(dev))->is_SetAOScaledData_allowed(any);} -}; - - - -class StopCmd : public Tango::Command -{ -public: - StopCmd(const char *name, - Tango::CmdArgType in, - Tango::CmdArgType out, - const char *in_desc, - const char *out_desc, - Tango::DispLevel level) - :Command(name,in,out,in_desc,out_desc, level) {}; - - StopCmd(const char *name, - Tango::CmdArgType in, - Tango::CmdArgType out) - :Command(name,in,out) {}; - ~StopCmd() {}; - - virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); - virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) - {return (static_cast<RetrigAO *>(dev))->is_Stop_allowed(any);} -}; - - - -class StartCmd : public Tango::Command -{ -public: - StartCmd(const char *name, - Tango::CmdArgType in, - Tango::CmdArgType out, - const char *in_desc, - const char *out_desc, - Tango::DispLevel level) - :Command(name,in,out,in_desc,out_desc, level) {}; - - StartCmd(const char *name, - Tango::CmdArgType in, - Tango::CmdArgType out) - :Command(name,in,out) {}; - ~StartCmd() {}; - - virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); - virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) - {return (static_cast<RetrigAO *>(dev))->is_Start_allowed(any);} -}; - - - -// -// The RetrigAOClass singleton definition -// - -class RetrigAOClass : public Tango::DeviceClass -{ -public: -// properties member data - -// add your own data members here -//------------------------------------ - -public: - Tango::DbData cl_prop; - Tango::DbData cl_def_prop; - Tango::DbData dev_def_prop; - -// Method prototypes - static RetrigAOClass *init(const char *); - static RetrigAOClass *instance(); - ~RetrigAOClass(); - Tango::DbDatum get_class_property(string &); - Tango::DbDatum get_default_device_property(string &); - Tango::DbDatum get_default_class_property(string &); - -protected: - RetrigAOClass(string &); - static RetrigAOClass *_instance; - void command_factory(); - void get_class_property(); - void attribute_factory(vector<Tango::Attr *> &); - void write_class_property(); - void set_default_property(); - -private: - void device_factory(const Tango::DevVarStringArray *); -}; - - -} // namespace RetrigAO_ns - -#endif // _RETRIGAOCLASS_H +//============================================================================= +// +// file : RetrigAOClass.h +// +// description : Include for the RetrigAOClass root class. +// This class is represents the singleton class for +// the RetrigAO device class. +// It contains all properties and methods which the +// RetrigAO requires only once e.g. the commands. +// +// project : TANGO Device Server +// +// $Author: anoureddine $ +// +// $Revision: 1.2 $ +// +// $Log: not supported by cvs2svn $ +// Revision 1.1.1.1 2004/12/06 10:23:38 syldup +// initial import +// +// +// copyleft : Synchrotron SOLEIL +// L'Orme des Merisiers +// Saint-Aubin - BP 48 +//============================================================================= +// +// This file is generated by POGO +// (Program Obviously used to Generate tango Object) +// +// (c) - Software Engineering Group - ESRF +//============================================================================= + +#ifndef _RETRIGAOCLASS_H +#define _RETRIGAOCLASS_H + +#include <tango.h> +#include <RetrigAO.h> + +namespace RetrigAO_ns +{ +//===================================== +// Define classes for attributes +//===================================== +class channel7Attrib: public Tango::SpectrumAttr +{ +public: + channel7Attrib():SpectrumAttr("channel7", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; + ~channel7Attrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel7(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel7_allowed(ty);} +}; + +class channel6Attrib: public Tango::SpectrumAttr +{ +public: + channel6Attrib():SpectrumAttr("channel6", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; + ~channel6Attrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel6(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel6_allowed(ty);} +}; + +class channel5Attrib: public Tango::SpectrumAttr +{ +public: + channel5Attrib():SpectrumAttr("channel5", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; + ~channel5Attrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel5(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel5_allowed(ty);} +}; + +class channel4Attrib: public Tango::SpectrumAttr +{ +public: + channel4Attrib():SpectrumAttr("channel4", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; + ~channel4Attrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel4(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel4_allowed(ty);} +}; + +class channel3Attrib: public Tango::SpectrumAttr +{ +public: + channel3Attrib():SpectrumAttr("channel3", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; + ~channel3Attrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel3(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel3_allowed(ty);} +}; + +class channel2Attrib: public Tango::SpectrumAttr +{ +public: + channel2Attrib():SpectrumAttr("channel2", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; + ~channel2Attrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel2(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel2_allowed(ty);} +}; + +class channel1Attrib: public Tango::SpectrumAttr +{ +public: + channel1Attrib():SpectrumAttr("channel1", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; + ~channel1Attrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel1(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel1_allowed(ty);} +}; + +class channel0Attrib: public Tango::SpectrumAttr +{ +public: + channel0Attrib():SpectrumAttr("channel0", Tango::DEV_DOUBLE, Tango::READ, 1000000) {}; + ~channel0Attrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel0(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel0_allowed(ty);} +}; + +class frequencyAttrib: public Tango::Attr +{ +public: + frequencyAttrib():Attr("frequency", Tango::DEV_DOUBLE, Tango::READ_WRITE) {}; + ~frequencyAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_frequency(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<RetrigAO *>(dev))->write_frequency(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_frequency_allowed(ty);} +}; + +class channel7EnableAttrib: public Tango::Attr +{ +public: + channel7EnableAttrib():Attr("channel7Enable", Tango::DEV_SHORT, Tango::READ) {}; + ~channel7EnableAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel7Enable(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel7Enable_allowed(ty);} +}; + +class channel6EnableAttrib: public Tango::Attr +{ +public: + channel6EnableAttrib():Attr("channel6Enable", Tango::DEV_SHORT, Tango::READ) {}; + ~channel6EnableAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel6Enable(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel6Enable_allowed(ty);} +}; + +class channel5EnableAttrib: public Tango::Attr +{ +public: + channel5EnableAttrib():Attr("channel5Enable", Tango::DEV_SHORT, Tango::READ) {}; + ~channel5EnableAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel5Enable(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel5Enable_allowed(ty);} +}; + +class channel4EnableAttrib: public Tango::Attr +{ +public: + channel4EnableAttrib():Attr("channel4Enable", Tango::DEV_SHORT, Tango::READ) {}; + ~channel4EnableAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel4Enable(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel4Enable_allowed(ty);} +}; + +class channel3EnableAttrib: public Tango::Attr +{ +public: + channel3EnableAttrib():Attr("channel3Enable", Tango::DEV_SHORT, Tango::READ) {}; + ~channel3EnableAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel3Enable(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel3Enable_allowed(ty);} +}; + +class channel2EnableAttrib: public Tango::Attr +{ +public: + channel2EnableAttrib():Attr("channel2Enable", Tango::DEV_SHORT, Tango::READ) {}; + ~channel2EnableAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel2Enable(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel2Enable_allowed(ty);} +}; + +class channel1EnableAttrib: public Tango::Attr +{ +public: + channel1EnableAttrib():Attr("channel1Enable", Tango::DEV_SHORT, Tango::READ) {}; + ~channel1EnableAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel1Enable(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel1Enable_allowed(ty);} +}; + +class channel0EnableAttrib: public Tango::Attr +{ +public: + channel0EnableAttrib():Attr("channel0Enable", Tango::DEV_SHORT, Tango::READ) {}; + ~channel0EnableAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_channel0Enable(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_channel0Enable_allowed(ty);} +}; + +class useBoardFifoAttrib: public Tango::Attr +{ +public: + useBoardFifoAttrib():Attr("useBoardFifo", Tango::DEV_SHORT, Tango::READ) {}; + ~useBoardFifoAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_useBoardFifo(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_useBoardFifo_allowed(ty);} +}; + +class errorCounterAttrib: public Tango::Attr +{ +public: + errorCounterAttrib():Attr("errorCounter", Tango::DEV_DOUBLE, Tango::READ) {}; + ~errorCounterAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_errorCounter(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_errorCounter_allowed(ty);} +}; + +class bufferDepthAttrib: public Tango::Attr +{ +public: + bufferDepthAttrib():Attr("bufferDepth", Tango::DEV_USHORT, Tango::READ_WRITE) {}; + ~bufferDepthAttrib() {}; + + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<RetrigAO *>(dev))->read_bufferDepth(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<RetrigAO *>(dev))->write_bufferDepth(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<RetrigAO *>(dev))->is_bufferDepth_allowed(ty);} +}; + +//========================================= +// Define classes for commands +//========================================= +class SetAOScaledDataCmd : public Tango::Command +{ +public: + SetAOScaledDataCmd(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out, + const char *in_desc, + const char *out_desc, + Tango::DispLevel level) + :Command(name,in,out,in_desc,out_desc, level) {}; + + SetAOScaledDataCmd(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out) + :Command(name,in,out) {}; + ~SetAOScaledDataCmd() {}; + + virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); + virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) + {return (static_cast<RetrigAO *>(dev))->is_SetAOScaledData_allowed(any);} +}; + + + +class StopCmd : public Tango::Command +{ +public: + StopCmd(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out, + const char *in_desc, + const char *out_desc, + Tango::DispLevel level) + :Command(name,in,out,in_desc,out_desc, level) {}; + + StopCmd(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out) + :Command(name,in,out) {}; + ~StopCmd() {}; + + virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); + virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) + {return (static_cast<RetrigAO *>(dev))->is_Stop_allowed(any);} +}; + + + +class StartCmd : public Tango::Command +{ +public: + StartCmd(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out, + const char *in_desc, + const char *out_desc, + Tango::DispLevel level) + :Command(name,in,out,in_desc,out_desc, level) {}; + + StartCmd(const char *name, + Tango::CmdArgType in, + Tango::CmdArgType out) + :Command(name,in,out) {}; + ~StartCmd() {}; + + virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); + virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) + {return (static_cast<RetrigAO *>(dev))->is_Start_allowed(any);} +}; + + + +// +// The RetrigAOClass singleton definition +// + +class +#ifdef _TG_WINDOWS_ + __declspec(dllexport) +#endif + RetrigAOClass : public Tango::DeviceClass +{ +public: +// properties member data + +// add your own data members here +//------------------------------------ + +public: + Tango::DbData cl_prop; + Tango::DbData cl_def_prop; + Tango::DbData dev_def_prop; + +// Method prototypes + static RetrigAOClass *init(const char *); + static RetrigAOClass *instance(); + ~RetrigAOClass(); + Tango::DbDatum get_class_property(string &); + Tango::DbDatum get_default_device_property(string &); + Tango::DbDatum get_default_class_property(string &); + +protected: + RetrigAOClass(string &); + static RetrigAOClass *_instance; + void command_factory(); + void get_class_property(); + void attribute_factory(vector<Tango::Attr *> &); + void write_class_property(); + void set_default_property(); + string get_cvstag(); + string get_cvsroot(); + +private: + void device_factory(const Tango::DevVarStringArray *); +}; + + +} // namespace RetrigAO_ns + +#endif // _RETRIGAOCLASS_H diff --git a/src/RetrigAOStateMachine.cpp b/src/RetrigAOStateMachine.cpp index 708a4ac..1254502 100644 --- a/src/RetrigAOStateMachine.cpp +++ b/src/RetrigAOStateMachine.cpp @@ -1,365 +1,379 @@ -static const char *RcsId = "$Header: $"; -//+============================================================================= -// -// file : RetrigAOStateMachine.cpp -// -// description : C++ source for the RetrigAO and its alowed. -// method for commands and attributes -// -// 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 <RetrigAO.h> -#include <RetrigAOClass.h> - -/*==================================================================== - * This file contains the methods to allow commands and attributes - * read or write execution. - * - * If you wand to add your own code, add it between - * the "End/Re-Start of Generated Code" comments. - * - * If you want, you can also add your own methods. - *==================================================================== - */ - -namespace RetrigAO_ns -{ - -//================================================= -// Attributes Allowed Methods -//================================================= - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_useBoardFifo_allowed -// -// description : Read/Write allowed for useBoardFifo attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_useBoardFifo_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel1Enable_allowed -// -// description : Read/Write allowed for channel1Enable attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel1Enable_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel3Enable_allowed -// -// description : Read/Write allowed for channel3Enable attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel3Enable_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel5Enable_allowed -// -// description : Read/Write allowed for channel5Enable attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel5Enable_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel7Enable_allowed -// -// description : Read/Write allowed for channel7Enable attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel7Enable_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel1_allowed -// -// description : Read/Write allowed for channel1 attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel1_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel3_allowed -// -// description : Read/Write allowed for channel3 attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel3_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel5_allowed -// -// description : Read/Write allowed for channel5 attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel5_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel7_allowed -// -// description : Read/Write allowed for channel7 attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel7_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_errorCounter_allowed -// -// description : Read/Write allowed for errorCounter attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_errorCounter_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel0Enable_allowed -// -// description : Read/Write allowed for channel0Enable attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel0Enable_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel2Enable_allowed -// -// description : Read/Write allowed for channel2Enable attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel2Enable_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel4Enable_allowed -// -// description : Read/Write allowed for channel4Enable attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel4Enable_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel6Enable_allowed -// -// description : Read/Write allowed for channel6Enable attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel6Enable_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel0_allowed -// -// description : Read/Write allowed for channel0 attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel0_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel2_allowed -// -// description : Read/Write allowed for channel2 attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel2_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel4_allowed -// -// description : Read/Write allowed for channel4 attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel4_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_channel6_allowed -// -// description : Read/Write allowed for channel6 attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_channel6_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_bufferDepth_allowed -// -// description : Read/Write allowed for bufferDepth attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_bufferDepth_allowed(Tango::AttReqType type) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} - -//================================================= -// Commands Allowed Methods -//================================================= - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_Start_allowed -// -// description : Execution allowed for Start command. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_Start_allowed(const CORBA::Any &any) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_Stop_allowed -// -// description : Execution allowed for Stop command. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_Stop_allowed(const CORBA::Any &any) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_SetAOScaledData_allowed -// -// description : Execution allowed for SetAOScaledData command. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_SetAOScaledData_allowed(const CORBA::Any &any) -{ - // End of Generated Code - - // Re-Start of Generated Code - return true; -} - -} // namespace RetrigAO_ns +static const char *RcsId = "$Header: $"; +//+============================================================================= +// +// file : RetrigAOStateMachine.cpp +// +// description : C++ source for the RetrigAO and its alowed. +// method for commands and attributes +// +// 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 <RetrigAO.h> +#include <RetrigAOClass.h> + +/*==================================================================== + * This file contains the methods to allow commands and attributes + * read or write execution. + * + * If you wand to add your own code, add it between + * the "End/Re-Start of Generated Code" comments. + * + * If you want, you can also add your own methods. + *==================================================================== + */ + +namespace RetrigAO_ns +{ + +//================================================= +// Attributes Allowed Methods +//================================================= + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_useBoardFifo_allowed +// +// description : Read/Write allowed for useBoardFifo attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_useBoardFifo_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel1Enable_allowed +// +// description : Read/Write allowed for channel1Enable attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel1Enable_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel3Enable_allowed +// +// description : Read/Write allowed for channel3Enable attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel3Enable_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel5Enable_allowed +// +// description : Read/Write allowed for channel5Enable attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel5Enable_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel7Enable_allowed +// +// description : Read/Write allowed for channel7Enable attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel7Enable_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel1_allowed +// +// description : Read/Write allowed for channel1 attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel1_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel3_allowed +// +// description : Read/Write allowed for channel3 attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel3_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel5_allowed +// +// description : Read/Write allowed for channel5 attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel5_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel7_allowed +// +// description : Read/Write allowed for channel7 attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel7_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_errorCounter_allowed +// +// description : Read/Write allowed for errorCounter attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_errorCounter_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel0Enable_allowed +// +// description : Read/Write allowed for channel0Enable attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel0Enable_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel2Enable_allowed +// +// description : Read/Write allowed for channel2Enable attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel2Enable_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel4Enable_allowed +// +// description : Read/Write allowed for channel4Enable attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel4Enable_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel6Enable_allowed +// +// description : Read/Write allowed for channel6Enable attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel6Enable_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel0_allowed +// +// description : Read/Write allowed for channel0 attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel0_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel2_allowed +// +// description : Read/Write allowed for channel2 attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel2_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel4_allowed +// +// description : Read/Write allowed for channel4 attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel4_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_channel6_allowed +// +// description : Read/Write allowed for channel6 attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_channel6_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_bufferDepth_allowed +// +// description : Read/Write allowed for bufferDepth attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_bufferDepth_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_frequency_allowed +// +// description : Read/Write allowed for frequency attribute. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_frequency_allowed(Tango::AttReqType type) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} + +//================================================= +// Commands Allowed Methods +//================================================= + +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_Start_allowed +// +// description : Execution allowed for Start command. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_Start_allowed(const CORBA::Any &any) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_Stop_allowed +// +// description : Execution allowed for Stop command. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_Stop_allowed(const CORBA::Any &any) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} +//+---------------------------------------------------------------------------- +// +// method : RetrigAO::is_SetAOScaledData_allowed +// +// description : Execution allowed for SetAOScaledData command. +// +//----------------------------------------------------------------------------- +bool RetrigAO::is_SetAOScaledData_allowed(const CORBA::Any &any) +{ + // End of Generated Code + + // Re-Start of Generated Code + return true; +} + +} // namespace RetrigAO_ns diff --git a/src/TangoClassID.txt b/src/TangoClassID.txt new file mode 100644 index 0000000..ed2f3dc --- /dev/null +++ b/src/TangoClassID.txt @@ -0,0 +1,11 @@ +/** + * Device Class Identification: + * + * Class Name : RetrigAO + * Contact : sebastien.gara@nexeya.com + * Class Family : Miscellaneous + * Platform : All Platforms + * Bus : Not Applicable + * Manufacturer : none + * Reference : + */ -- GitLab