diff --git a/src/ADLinkContinuousAO.cpp b/src/ADLinkContinuousAO.cpp index 278c0af748d90309cb27db61cf65d7631b6e3f66..6970a5f25c1e29bc8327c4ec36a1577995c2ff93 100755 --- a/src/ADLinkContinuousAO.cpp +++ b/src/ADLinkContinuousAO.cpp @@ -7,12 +7,12 @@ //============================================================ //ADLinkContinuousAO::ADLinkContinuousAO //============================================================ -ADLinkContinuousAO::ADLinkContinuousAO (Tango::DeviceImpl* dev) - : Tango::LogAdapter(dev), - asl::ContinuousAO (), - err_ctr(0) + ADLinkContinuousAO::ADLinkContinuousAO (Tango::DeviceImpl* dev) +: Tango::LogAdapter(dev), + asl::ContinuousAO (), + err_ctr(0) { - + } //============================================================ //ADLinkContinuousAO::~ADLinkContinuousAO @@ -25,11 +25,11 @@ ADLinkContinuousAO::~ADLinkContinuousAO (void) //============================================================ void ADLinkContinuousAO::handle_error (const asl::DAQException& de) { - cout<<"error occured during acquisition"<<endl; - lock_data(); - err_ctr++; - unlock_data(); - _ASL_TO_TANGO_EXCEPTION(de, df); - ERROR_STREAM<<"error occured during acquisition"<<endl; - ERROR_STREAM<<df<<endl; + cout<<"error occured during acquisition"<<endl; + lock_data(); + err_ctr++; + unlock_data(); + _ASL_TO_TANGO_EXCEPTION(de, df); + ERROR_STREAM<<"error occured during acquisition"<<endl; + ERROR_STREAM<<df<<endl; } diff --git a/src/ADLinkContinuousAO.h b/src/ADLinkContinuousAO.h index 59eeff3d0f8c2cca46146d2278cf3f2ca9d2a8bd..488f985921dad1531c54b29388eadbb82d6c5ef4 100755 --- a/src/ADLinkContinuousAO.h +++ b/src/ADLinkContinuousAO.h @@ -9,32 +9,32 @@ class ADLinkContinuousAO: public asl::ContinuousAO, public Tango::LogAdapter { - -public: - - ADLinkContinuousAO (Tango::DeviceImpl* dev); - virtual ~ADLinkContinuousAO (void) ; - /** - * Receive errors ocurring during the waveform generation. - * @param de The error - */ - virtual void handle_error (const asl::DAQException& de); - /** - * Get the mutex - */ - inline void lock_data(void) - { - data_lock_.acquire(); - }; - /** - * Release the mutex - */ - inline void unlock_data(void) - { - data_lock_.release(); - }; - unsigned long err_ctr; -private: - ACE_Thread_Mutex data_lock_; + + public: + + ADLinkContinuousAO (Tango::DeviceImpl* dev); + virtual ~ADLinkContinuousAO (void) ; + /** + * Receive errors ocurring during the waveform generation. + * @param de The error + */ + virtual void handle_error (const asl::DAQException& de); + /** + * Get the mutex + */ + inline void lock_data(void) + { + data_lock_.acquire(); + }; + /** + * Release the mutex + */ + inline void unlock_data(void) + { + data_lock_.release(); + }; + unsigned long err_ctr; + private: + ACE_Thread_Mutex data_lock_; }; #endif // _ADLinkContinuousAO_H diff --git a/src/RetrigAO.cpp b/src/RetrigAO.cpp index e4e4b63523e17d2f988d3b607569ceae325a937b..819d6c7dbb606df058ec97a8f6c0d2904f88f14d 100755 --- a/src/RetrigAO.cpp +++ b/src/RetrigAO.cpp @@ -98,1992 +98,1992 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/InputOutput/AD 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()), + //+---------------------------------------------------------------------------- + // + // 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()), m_default_waveform(2, asl::AOScaledData(0)) -{ - init_device(); -} + { + init_device(); + } -RetrigAO::RetrigAO(Tango::DeviceClass *cl,const char *s) : Tango::Device_4Impl(cl,s), + RetrigAO::RetrigAO(Tango::DeviceClass *cl,const char *s) : Tango::Device_4Impl(cl,s), m_default_waveform(2, asl::AOScaledData(0)) -{ - init_device(); -} + { + init_device(); + } -RetrigAO::RetrigAO(Tango::DeviceClass *cl,const char *s,const char *d) : Tango::Device_4Impl(cl,s,d), + RetrigAO::RetrigAO(Tango::DeviceClass *cl,const char *s,const char *d) : Tango::Device_4Impl(cl,s,d), m_default_waveform(2, asl::AOScaledData(0)) -{ - 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(m_ao != nullptr) - { - delete m_ao; - m_ao = nullptr; - } - for (int i = 0; i < 8; i++) - { - if (m_channel[i] != nullptr) - { - delete [] m_channel[i]; - m_channel[i] = nullptr; - } - } -} - -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::init_device() -// -// description : will be called at device initialization. -// -//----------------------------------------------------------------------------- -void RetrigAO::init_device() -{ - INFO_STREAM << "RetrigAO::RetrigAO() create device " << device_name << endl; - - m_ao = nullptr; - for (int i = 0; i < 8; i++) - { - m_channel[i] = nullptr; - } - - m_error_message = "An error has occured"; - - // 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); - - 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 = true; - channel1Enable = false; - channel2Enable = false; - channel3Enable = false; - channel4Enable = false; - channel5Enable = false; - channel6Enable = false; - channel7Enable = false; - - 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; + { + init_device(); } - // 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; + //+---------------------------------------------------------------------------- + // + // 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(m_ao != nullptr) + { + delete m_ao; + m_ao = nullptr; + } + for (int i = 0; i < 8; i++) + { + if (m_channel[i] != nullptr) + { + delete [] m_channel[i]; + m_channel[i] = nullptr; + } + } } - // 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; + + //+---------------------------------------------------------------------------- + // + // method : RetrigAO::init_device() + // + // description : will be called at device initialization. + // + //----------------------------------------------------------------------------- + void RetrigAO::init_device() + { + INFO_STREAM << "RetrigAO::RetrigAO() create device " << device_name << endl; + + m_ao = nullptr; + for (int i = 0; i < 8; i++) + { + m_channel[i] = nullptr; + } + + m_error_message = "An error has occured"; + + // 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); + + init_board(); + } - // 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; + + + //+---------------------------------------------------------------------------- + // + // 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 = true; + channel1Enable = false; + channel2Enable = false; + channel3Enable = false; + channel4Enable = false; + channel5Enable = false; + channel6Enable = false; + channel7Enable = false; + + 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); } - // 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; + //+---------------------------------------------------------------------------- + // + // method : RetrigAO::always_executed_hook() + // + // description : method always executed before any command is executed + // + //----------------------------------------------------------------------------- + void RetrigAO::always_executed_hook() + { + set_internal_state(); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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 + //--------------------------------- + m_ao->lock_data(); + + m_err_ctr = m_ao->err_ctr; + + m_ao->unlock_data(); + } - // 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; + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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"); + init_board(); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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"); + init_board(); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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(&m_err_ctr); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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(get_state() == Tango::RUNNING) + attr.set_value(&m_use_fifo); + else + attr.set_quality(Tango::ATTR_INVALID); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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(m_channel[0], bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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(m_channel[1], bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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(m_channel[2], bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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(m_channel[3], bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); } - // 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; + + //+---------------------------------------------------------------------------- + // + // 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(m_channel[4], bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); } - // 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() -{ - 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 - //--------------------------------- - m_ao->lock_data(); - - m_err_ctr = m_ao->err_ctr; - - m_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::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(m_channel[5], bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); + } -//+---------------------------------------------------------------------------- -// -// 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"); - init_board(); -} + //+---------------------------------------------------------------------------- + // + // 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(m_channel[6], bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); + } -//+---------------------------------------------------------------------------- -// -// 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::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; -//+---------------------------------------------------------------------------- -// -// 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"); - init_board(); -} + if(channel7Enable) + attr.set_value(m_channel[7], bufferDepth); + else + attr.set_quality(Tango::ATTR_INVALID); + } -//+---------------------------------------------------------------------------- -// -// 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(&m_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(get_state() == Tango::RUNNING) - attr.set_value(&m_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::start + * + * description: method to execute "Start" + * start the generation. + * + * + */ + //+------------------------------------------------------------------ + void RetrigAO::start() + { + DEBUG_STREAM << "RetrigAO::start(): entering... !" << endl; -//+---------------------------------------------------------------------------- -// -// 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); -} + // give the configuration + _ASL_TRY_ACTION + ( + m_ao->configure(m_config), + "configure", + "RetrigAO::start", + set_internal_state() + ); -//+---------------------------------------------------------------------------- -// -// 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); -} + _ASL_TRY_ACTION + ( + m_ao->start(), + "start", + "RetrigAO::start", + set_internal_state() + ); -//+---------------------------------------------------------------------------- -// -// 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); -} + // get if the output data have been loaded in the onboard FIFO. + // depends on the size of the buffer. + m_use_fifo = m_ao->use_board_fifo(); -//+---------------------------------------------------------------------------- -// -// 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::stop + * + * description: method to execute "Stop" + * stop the generation. + * + * + */ + //+------------------------------------------------------------------ + void RetrigAO::stop() + { + DEBUG_STREAM << "RetrigAO::stop(): entering... !" << endl; + + /*_ASL_TRY_ACTION + ( + m_ao->stop(), + "stop", + "RetrigAO::stop", + set_internal_state() + );*/ + if(get_state() == Tango::RUNNING) + stop_with_zero_forcing(); -//+---------------------------------------------------------------------------- -// -// 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::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; -//+---------------------------------------------------------------------------- -// -// 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); -} + // save the configuration + //m_config = m_ao->configuration(); -//+---------------------------------------------------------------------------- -// -// 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(m_channel[0], 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(m_channel[1], 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(m_channel[2], 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(m_channel[3], 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(m_channel[4], 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(m_channel[5], 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(m_channel[6], 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(m_channel[7], 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 - ( - m_ao->configure(m_config), - "configure", - "RetrigAO::start", - set_internal_state() - ); - - _ASL_TRY_ACTION - ( - m_ao->start(), - "start", - "RetrigAO::start", - set_internal_state() - ); - - // get if the output data have been loaded in the onboard FIFO. - // depends on the size of the buffer. - m_use_fifo = m_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 - ( - m_ao->stop(), - "stop", - "RetrigAO::stop", - set_internal_state() - );*/ - if(get_state() == Tango::RUNNING) - 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 - //m_config = m_ao->configuration(); - - _ASL_TRY_ACTION - ( - m_ao->stop(), - "stop", - "RetrigAO::stop_with_zero_forcing", - set_internal_state() - ); - - // get the current configuration - m_stop_config = m_ao->configuration(); - - // set buffer with 0 volts - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - (data)[i] = 0; - - if(channel0Enable) - m_stop_config.set_channel_periodic_data(0, data); - if(channel1Enable) - m_stop_config.set_channel_periodic_data(1, data); - if(channel2Enable) - m_stop_config.set_channel_periodic_data(2, data); - if(channel3Enable) - m_stop_config.set_channel_periodic_data(3, data); - if(channel4Enable) - m_stop_config.set_channel_periodic_data(4, data); - if(channel5Enable) - m_stop_config.set_channel_periodic_data(5, data); - if(channel6Enable) - m_stop_config.set_channel_periodic_data(6, data); - if(channel7Enable) - m_stop_config.set_channel_periodic_data(7, data); - - // configure trigger mode (no trigger to generate immediatly) - m_stop_config.disable_retrigger(); - m_stop_config.set_trigger_source(adl::internal_software); - - // give the configuration the new channel - _ASL_TRY_ACTION - ( - m_ao->configure(m_stop_config), - "configure", - "RetrigAO::stop_with_zero_forcing", - set_internal_state() - ); - - _ASL_TRY_ACTION - ( - m_ao->start(), - "start", - "RetrigAO::stop_with_zero_forcing", - set_internal_state() - ); - - _ASL_TRY_ACTION - ( - m_ao->stop(), - "stop", - "RetrigAO::stop_with_zero_forcing", - set_internal_state() - ); - - //correction bug: aftera stop, start doesn't work !! - init_board(); -} - -void RetrigAO::raise_error(std::string p_error_message) -{ - m_error_message = p_error_message; - set_state(Tango::FAULT); -} + _ASL_TRY_ACTION + ( + m_ao->stop(), + "stop", + "RetrigAO::stop_with_zero_forcing", + set_internal_state() + ); + + // get the current configuration + m_stop_config = m_ao->configuration(); + + // set buffer with 0 volts + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + (data)[i] = 0; + + if(channel0Enable) + m_stop_config.set_channel_periodic_data(0, data); + if(channel1Enable) + m_stop_config.set_channel_periodic_data(1, data); + if(channel2Enable) + m_stop_config.set_channel_periodic_data(2, data); + if(channel3Enable) + m_stop_config.set_channel_periodic_data(3, data); + if(channel4Enable) + m_stop_config.set_channel_periodic_data(4, data); + if(channel5Enable) + m_stop_config.set_channel_periodic_data(5, data); + if(channel6Enable) + m_stop_config.set_channel_periodic_data(6, data); + if(channel7Enable) + m_stop_config.set_channel_periodic_data(7, data); + + // configure trigger mode (no trigger to generate immediatly) + m_stop_config.disable_retrigger(); + m_stop_config.set_trigger_source(adl::internal_software); + + // give the configuration the new channel + _ASL_TRY_ACTION + ( + m_ao->configure(m_stop_config), + "configure", + "RetrigAO::stop_with_zero_forcing", + set_internal_state() + ); + _ASL_TRY_ACTION + ( + m_ao->start(), + "start", + "RetrigAO::stop_with_zero_forcing", + set_internal_state() + ); -asl::AOScaledData RetrigAO::assign_default_waveform(Tango::DevDouble p_ref, std::function <double(int, int)> p_lambda, int p_first_channel, int p_last_channel) -{ - // default waveform for group defined - asl::AOScaledData result = asl::AOScaledData(bufferDepth); - - double max_val; - - if(aORefSource == adl::external_reference) - max_val = p_ref; - else - max_val = 10.0; - - // fill buffer with a sin signal - for (unsigned long i = 0; i < bufferDepth; i++) - { - (result)[i] = p_lambda(i, max_val); - } - - //Assignation of waveform for group - for (int i = p_first_channel; i <= p_last_channel; i++) - { - ACE_OS::memcpy(m_channel[i], result.base(), result.size()); + _ASL_TRY_ACTION + ( + m_ao->stop(), + "stop", + "RetrigAO::stop_with_zero_forcing", + set_internal_state() + ); + + //correction bug: aftera stop, start doesn't work !! + init_board(); } - - return (result); -} -void RetrigAO::activate_channel(int p_channel_index, vector<double>& p_channel_wave_form, asl::AOScaledData& p_default_waveform) -{ - m_ac.id = p_channel_index; - if(aORefSource == adl::external_reference) - m_ac.volt_ref = aORefA; - m_config.add_active_channel(m_ac); - - for (int i = 0; i < bufferDepth; i++) - m_channel[p_channel_index][i] = 0; - load_waveform(m_channel[p_channel_index],"Channel" + to_string(p_channel_index) + "Waveform"); - asl::AOScaledData data(bufferDepth); - for(i=0; i<bufferDepth; i++) - data[i] = m_channel[p_channel_index][i]; - // put the waveform in the configuration - m_config.set_channel_periodic_data(p_channel_index, data); - - /* - if(p_channel_wave_form.empty()) + void RetrigAO::raise_error(std::string p_error_message) { - WARN_STREAM<<"No waveform is saved in database for channel " << p_channel_index << ", using a default one"<<endl; - m_config.set_channel_periodic_data(0, p_default_waveform); + m_error_message = p_error_message; + set_state(Tango::FAULT); } - else if(p_channel_wave_form.size() != bufferDepth) + + + asl::AOScaledData RetrigAO::assign_default_waveform(Tango::DevDouble p_ref, std::function <double(int, int)> p_lambda, int p_first_channel, int p_last_channel) { - WARN_STREAM<<"The waveform saved in database for channel " << p_channel_index << " has a different size from property BufferDepth, using default waveform"<<endl; - m_config.set_channel_periodic_data(p_channel_index, p_default_waveform); + // default waveform for group defined + asl::AOScaledData result = asl::AOScaledData(bufferDepth); + + double max_val; + + if(aORefSource == adl::external_reference) + max_val = p_ref; + else + max_val = 10.0; + + // fill buffer with a sin signal + for (unsigned long i = 0; i < bufferDepth; i++) + { + (result)[i] = p_lambda(i, max_val); + } + + //Assignation of waveform for group + for (int i = p_first_channel; i <= p_last_channel; i++) + { + ACE_OS::memcpy(m_channel[i], result.base(), result.size()); + } + + return (result); } - else - { - asl::AOScaledData data(bufferDepth); - for(int i=0; i<bufferDepth; i++) - data[i] = p_channel_wave_form[i]; - // put the waveform in the configuration - m_config.set_channel_periodic_data(p_channel_index, data); - //cpy data in the attribute of the device - ::memcpy(m_channel[p_channel_index], data.base(), data.size()); - }*/ -} -//+------------------------------------------------------------------ -/** - * method: RetrigAI::init_board - */ -//+------------------------------------------------------------------ -void RetrigAO::init_board(void) -{ - delete_device(); - - //- create a continuous analog output daq - m_ao = new ADLinkContinuousAO(this); - - //- check memory allocation - if (m_ao == 0) + + void RetrigAO::activate_channel(int p_channel_index, vector<double>& p_channel_wave_form, asl::AOScaledData& p_default_waveform) { - raise_error("RetrigAO::init_board\nout of memory error while initializing ADLinkContinuousAO"); - return; + m_ac.id = p_channel_index; + if(aORefSource == adl::external_reference) + m_ac.volt_ref = aORefA; + m_config.add_active_channel(m_ac); + + for (int i = 0; i < bufferDepth; i++) + m_channel[p_channel_index][i] = 0; + load_waveform(m_channel[p_channel_index],"Channel" + to_string(p_channel_index) + "Waveform"); + asl::AOScaledData data(bufferDepth); + for(i=0; i<bufferDepth; i++) + data[i] = m_channel[p_channel_index][i]; + // put the waveform in the configuration + m_config.set_channel_periodic_data(p_channel_index, data); + + /* + if(p_channel_wave_form.empty()) + { + WARN_STREAM<<"No waveform is saved in database for channel " << p_channel_index << ", using a default one"<<endl; + m_config.set_channel_periodic_data(p_channel_index, p_default_waveform); + } + else if(p_channel_wave_form.size() != bufferDepth) + { + WARN_STREAM<<"The waveform saved in database for channel " << p_channel_index << " has a different size from property BufferDepth, using default waveform"<<endl; + m_config.set_channel_periodic_data(p_channel_index, p_default_waveform); + } + else + { + asl::AOScaledData data(bufferDepth); + for(int i=0; i<bufferDepth; i++) + data[i] = p_channel_wave_form[i]; + // put the waveform in the configuration + m_config.set_channel_periodic_data(p_channel_index, data); + //cpy data in the attribute of the device + ::memcpy(m_channel[p_channel_index], data.base(), data.size()); + }*/ } - - for (int i = 0; i < 8; i++) - { - m_channel[i] = new double[bufferDepth]; - - if (m_channel[i] == nullptr) + //+------------------------------------------------------------------ + /** + * method: RetrigAI::init_board + */ + //+------------------------------------------------------------------ + void RetrigAO::init_board(void) + { + delete_device(); + + //- create a continuous analog output daq + m_ao = new ADLinkContinuousAO(this); + + //- check memory allocation + if (m_ao == 0) { - raise_error("RetrigAO::init_device\nout of memory error while initializing channel's datas"); + raise_error("RetrigAO::init_board\nout of memory error while initializing ADLinkContinuousAO"); return; } - } - // default waveform for group A (channel 0 to 3) - m_default_waveform[0] = assign_default_waveform(aORefA, [&](int p_value, int p_max_value){ - return (::sin((double)p_value * 2. * 3.14159 / (double) bufferDepth) * p_max_value); - }, 0, 3); - - // default waveform for group A (channel 0 to 3) - m_default_waveform[1] = assign_default_waveform(aORefB, [&](int p_value, int p_max_value){ - if (p_value < bufferDepth/2) + + for (int i = 0; i < 8; i++) + { + m_channel[i] = new double[bufferDepth]; + + if (m_channel[i] == nullptr) + { + raise_error("RetrigAO::init_device\nout of memory error while initializing channel's datas"); + return; + } + } + // default waveform for group A (channel 0 to 3) + m_default_waveform[0] = assign_default_waveform(aORefA, [&](int p_value, int p_max_value){ + return (::sin((double)p_value * 2. * 3.14159 / (double) bufferDepth) * p_max_value); + }, 0, 3); + + // default waveform for group A (channel 0 to 3) + m_default_waveform[1] = assign_default_waveform(aORefB, [&](int p_value, int p_max_value){ + if (p_value < bufferDepth/2) return (p_max_value - 0.01); - else + else return (-p_max_value + 0.01); - }, 4, 7); - - //--------------------------channels m_config------------------------------------ - m_ac = asl::ActiveAOChannel(); - // configure all channels - m_ac.polarity = (adl::OutputPolarity)polarity; - m_ac.volt_ref_src = (adl::VoltageReferenceSource)aORefSource; - m_ac.volt_ref = 10.0; - - - //------active/m_config. channel 0--------- - if(channel0Enable) - activate_channel(0, channel0Waveform, m_default_waveform[0]); - - //------active/m_config. channel 1--------- - if(channel1Enable) - activate_channel(1, channel1Waveform, m_default_waveform[0]); - - //------active/m_config. channel 2--------- - if(channel2Enable) - activate_channel(2, channel2Waveform, m_default_waveform[0]); - - //------active/m_config. channel 3--------- - if(channel3Enable) - activate_channel(3, channel3Waveform, m_default_waveform[0]); - - //------active/m_config. channel 4--------- - if(channel4Enable) - activate_channel(4, channel4Waveform, m_default_waveform[1]); - - //------active/m_config. channel 5--------- - if(channel5Enable) - activate_channel(5, channel5Waveform, m_default_waveform[1]); - - //------active/m_config. channel 6--------- - if(channel6Enable) - activate_channel(6, channel6Waveform, m_default_waveform[1]); - - //------active/m_config. channel 7--------- - if(channel7Enable) - activate_channel(7, channel7Waveform, m_default_waveform[1]); - - //--------------------------------trigger m_config--------------------------------- - m_config.enable_retrigger(); - - m_config.set_trigger_source((adl::AIOTriggerSource)triggerSource); - m_config.set_trigger_mode((adl::AOTriggerMode)triggerMode); - m_config.set_nb_waveforms(1); - - if(triggerMode == adl::ao_delay) + }, 4, 7); + + //--------------------------channels m_config------------------------------------ + m_ac = asl::ActiveAOChannel(); + // configure all channels + m_ac.polarity = (adl::OutputPolarity)polarity; + m_ac.volt_ref_src = (adl::VoltageReferenceSource)aORefSource; + m_ac.volt_ref = 10.0; + + + //------active/m_config. channel 0--------- + if(channel0Enable) + activate_channel(0, channel0Waveform, m_default_waveform[0]); + + //------active/m_config. channel 1--------- + if(channel1Enable) + activate_channel(1, channel1Waveform, m_default_waveform[0]); + + //------active/m_config. channel 2--------- + if(channel2Enable) + activate_channel(2, channel2Waveform, m_default_waveform[0]); + + //------active/m_config. channel 3--------- + if(channel3Enable) + activate_channel(3, channel3Waveform, m_default_waveform[0]); + + //------active/m_config. channel 4--------- + if(channel4Enable) + activate_channel(4, channel4Waveform, m_default_waveform[1]); + + //------active/m_config. channel 5--------- + if(channel5Enable) + activate_channel(5, channel5Waveform, m_default_waveform[1]); + + //------active/m_config. channel 6--------- + if(channel6Enable) + activate_channel(6, channel6Waveform, m_default_waveform[1]); + + //------active/m_config. channel 7--------- + if(channel7Enable) + activate_channel(7, channel7Waveform, m_default_waveform[1]); + + //--------------------------------trigger m_config--------------------------------- + m_config.enable_retrigger(); + + m_config.set_trigger_source((adl::AIOTriggerSource)triggerSource); + m_config.set_trigger_mode((adl::AOTriggerMode)triggerMode); + m_config.set_nb_waveforms(1); + + if(triggerMode == adl::ao_delay) + { + //cout<<"delay: "<<delay<<endl; + m_config.set_delay_counter(delay); + } + if(triggerSource == adl::external_digital) + { + m_config.set_trigger_polarity((adl::AOTriggerPolarity)dTRIGPolarity); + } + else if(triggerSource == adl::external_analog) + { + m_config.set_analog_trigger_source(adl::analog_trigger_ext); + m_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); + m_config.set_analog_low_level_condition(level); + m_config.set_analog_high_level_condition(level); + } + + m_config.set_output_rate(frequency); + + // configure the conversion source (sampling timer) + m_config.set_conversion_source((adl::AOConversionSource)conversionSource); + + //when stop command will be call, the waveform will be generated until its end before stopping + //m_config.set_stop_mode (adl::wait_end_waveform); + + DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl; + try{ + _ASL_TRY_ACTION + ( + m_ao->init(adl::DAQ2502, boardNum), + "init", + "RetrigAO::init_device", + set_internal_state() + ); + + /*DEBUG_STREAM<<"RetrigAO::init_device : m_config acq"<<std::endl; + try + { + _ASL_TRY_ACTION + ( + m_ao->configure(m_config), + "configure", + "RetrigAO::init_device", + set_internal_state() + ); + } + catch (...) + { + raise_error("RetrigAO::init_device\nError while configurating drivers"); + return; + } + */ + } + catch (...) + { + raise_error("RetrigAO::init_device\nError while initializing drivers"); + return; + } + } + //+------------------------------------------------------------------ + /** + * 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 + ( + m_ao->stop(), + "stop", + "RetrigAO::set_aoscaled_data", + set_internal_state() + ); + + // get the configuration + //asl::ContinuousAOConfig m_config = m_ao->configuration(); + + //--------------------------------trigger m_config--------------------------------- + /* m_config.enable_retrigger(); + + m_config.set_trigger_source((adl::AIOTriggerSource)triggerSource); + m_config.set_trigger_mode((adl::AOTriggerMode)triggerMode); + m_config.set_nb_waveforms(1); + + if(triggerMode == adl::ao_delay) + { //cout<<"delay: "<<delay<<endl; m_config.set_delay_counter(delay); - } - if(triggerSource == adl::external_digital) - { + } + if(triggerSource == adl::external_digital) + { m_config.set_trigger_polarity((adl::AOTriggerPolarity)dTRIGPolarity); - } - else if(triggerSource == adl::external_analog) - { + } + else if(triggerSource == adl::external_analog) + { m_config.set_analog_trigger_source(adl::analog_trigger_ext); m_config.set_analog_trigger_condition((adl::AnalogTriggerCondition)aTRIGSelection); unsigned short level; if(aTRIGLevel>=0) - level = (aTRIGLevel / 0.078125) + 127; + level = (aTRIGLevel / 0.078125) + 127; else // v < 0 - level = (-aTRIGLevel / 0.078125); + level = (-aTRIGLevel / 0.078125); m_config.set_analog_low_level_condition(level); m_config.set_analog_high_level_condition(level); - } - - m_config.set_output_rate(frequency); - - // configure the conversion source (sampling timer) - m_config.set_conversion_source((adl::AOConversionSource)conversionSource); - - //when stop command will be call, the waveform will be generated until its end before stopping - //m_config.set_stop_mode (adl::wait_end_waveform); - - DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl; - try{ + } + + m_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)); + + int chan_index = chan - '0'; + + //NB: if a chan hasn't been enable with properties, 'm_ao' will do nothing + // cout << "RetrigAO::set_aoscaled_data - set periodic channel : " <<chan - '0'<< endl; + m_config.set_channel_periodic_data(chan_index, data); + + ::memcpy(m_channel[chan_index], data.base(), data.size()); + //save the waveform in the database + save_waveform(m_channel[chan_index], "Channel" + std::to_string(chan_index) + "Waveform"); + + /* DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl; + _ASL_TRY_ACTION + ( + m_ao->init(adl::DAQ2502, boardNum), + "init", + "RetrigAO::init_device", + set_internal_state() + ); + + // give the configuration the new channel _ASL_TRY_ACTION ( - m_ao->init(adl::DAQ2502, boardNum), - "init", - "RetrigAO::init_device", - set_internal_state() - ); - - /*DEBUG_STREAM<<"RetrigAO::init_device : m_config acq"<<std::endl; - try + m_ao->configure(m_config), + "configure", + "RetrigAO::set_aoscaled_data", + set_internal_state() + );*/ + + } + //+------------------------------------------------------------------ + /** + * method: RetrigAO::set_internal_state + */ + //+------------------------------------------------------------------ + void RetrigAO::set_internal_state(void) + { + if(m_ao == 0) { - _ASL_TRY_ACTION - ( - m_ao->configure(m_config), - "configure", - "RetrigAO::init_device", - set_internal_state() - ); + set_state(Tango::UNKNOWN); + set_status("The acquisition was not initialized properly"); } - catch (...) + else { - raise_error("RetrigAO::init_device\nError while configurating drivers"); - return; + switch(m_ao->state()) + { + case asl::ContinuousAO::STANDBY: + set_state(Tango::STANDBY); + set_status("The generation is stopped"); + break; + case asl::ContinuousAO::RUNNING: + case asl::ContinuousAO::ABORTING: + set_state(Tango::RUNNING); + set_status("The generation is running"); + break; + case asl::ContinuousAO::FAULT: + set_state(Tango::FAULT); + set_status(m_error_message); + break; + case asl::ContinuousAO::UNKNOWN: + default: + set_state(Tango::UNKNOWN); + set_status("The generation is in an unknown state"); + break; + } } - */ - } - catch (...) - { - raise_error("RetrigAO::init_device\nError while initializing drivers"); - return; - } -} -//+------------------------------------------------------------------ -/** - * 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 - ( - m_ao->stop(), - "stop", - "RetrigAO::set_aoscaled_data", - set_internal_state() - ); - - // get the configuration - //asl::ContinuousAOConfig m_config = m_ao->configuration(); - - //--------------------------------trigger m_config--------------------------------- - /* m_config.enable_retrigger(); - - m_config.set_trigger_source((adl::AIOTriggerSource)triggerSource); - m_config.set_trigger_mode((adl::AOTriggerMode)triggerMode); - m_config.set_nb_waveforms(1); - - if(triggerMode == adl::ao_delay) - { - //cout<<"delay: "<<delay<<endl; - m_config.set_delay_counter(delay); - } - if(triggerSource == adl::external_digital) - { - m_config.set_trigger_polarity((adl::AOTriggerPolarity)dTRIGPolarity); - } - else if(triggerSource == adl::external_analog) - { - m_config.set_analog_trigger_source(adl::analog_trigger_ext); - m_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); - m_config.set_analog_low_level_condition(level); - m_config.set_analog_high_level_condition(level); - } - - m_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)); - - int chan_index = chan - '0'; - - //NB: if a chan hasn't been enable with properties, 'm_ao' will do nothing - // cout << "RetrigAO::set_aoscaled_data - set periodic channel : " <<chan - '0'<< endl; - m_config.set_channel_periodic_data(chan_index, data); - - ::memcpy(m_channel[chan_index], data.base(), data.size()); - //save the waveform in the database - save_waveform(m_channel[chan_index], "Channel" + std::to_string(chan_index) + "Waveform"); - - /* DEBUG_STREAM<<"RetrigAO::init_device : init acq"<<std::endl; - _ASL_TRY_ACTION - ( - m_ao->init(adl::DAQ2502, boardNum), - "init", - "RetrigAO::init_device", - set_internal_state() - ); - - // give the configuration the new channel - _ASL_TRY_ACTION - ( - m_ao->configure(m_config), - "configure", - "RetrigAO::set_aoscaled_data", - set_internal_state() - );*/ - -} -//+------------------------------------------------------------------ -/** -* method: RetrigAO::set_internal_state -*/ -//+------------------------------------------------------------------ -void RetrigAO::set_internal_state(void) -{ - if(m_ao == 0) - { - set_state(Tango::UNKNOWN); - set_status("The acquisition was not initialized properly"); - } - else - { - switch(m_ao->state()) - { - case asl::ContinuousAO::STANDBY: - set_state(Tango::STANDBY); - set_status("The generation is stopped"); - break; - case asl::ContinuousAO::RUNNING: - case asl::ContinuousAO::ABORTING: - set_state(Tango::RUNNING); - set_status("The generation is running"); - break; - case asl::ContinuousAO::FAULT: - set_state(Tango::FAULT); - set_status(m_error_message); - break; - case asl::ContinuousAO::UNKNOWN: - default: - set_state(Tango::UNKNOWN); - 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 = 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<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 = 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<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) + //+------------------------------------------------------------------ + /** + * method: RetrigAO::save_waveform + * Save a waveform in tango database + */ + //+------------------------------------------------------------------ + void RetrigAO::save_waveform(double* waveform, string wfm_channel) { - string message= "Error in storing " + property_name + " in Configuration DataBase "; - LOG_ERROR((message)); - Tango::Except::print_exception(e); - } -} + // cpy the waveform in a double vector + /* vector<double> vec; + for(int i=0; i<bufferDepth; i++) + vec.push_back(waveform[i]); -//////////////////////////////////////////////////////////////////////////// -/// 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; + //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(current_value); - + 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 = 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 { - get_db_device()->put_property(db_data); + //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<bufferDepth; i++) + file<<waveform[i] << endl; + + file.close(); + } - catch(Tango::DevFailed &e) + catch(...) { - string message= "Error in storing " + property_name + " in Configuration DataBase "; - LOG_ERROR((message)); - Tango::Except::print_exception(e); + 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 = 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; -//////////////////////////////////////////////////////////////////////////// -/// 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++) + ifstream file (file_name.c_str()); + string fileline; + if(! file.fail() ) // file has been found + { + for(int i=0; i<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) { - std::string sPropertyName(dev_prop[i].name); - if (sPropertyName == property_name) return i; + 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; } - if (i == iNbProperties) return -1; - return i; -} } // namespace diff --git a/src/RetrigAO.h b/src/RetrigAO.h index a7d0526f418e7eda432745042faf892857ae7680..fb3d56574057405d8c138edef7eadef3e7862135 100755 --- a/src/RetrigAO.h +++ b/src/RetrigAO.h @@ -70,504 +70,504 @@ * @version $Revision: 1.11 $ $ */ - // Add your own constants definitions here. - //----------------------------------------------- +// Add your own constants definitions here. +//----------------------------------------------- namespace RetrigAO_ns { -/** - * Class Description: - * Perform continuous anolog ouput (waveform generation) on the selected outputs. - */ + /** + * Class Description: + * Perform continuous anolog ouput (waveform generation) on the selected outputs. + */ -/* - * Device States Description: -* Tango::UNKNOWN : -* Tango::STANDBY : -* Tango::RUNNING : -* Tango::FAULT : - */ + /* + * Device States Description: + * Tango::UNKNOWN : + * Tango::STANDBY : + * Tango::RUNNING : + * Tango::FAULT : + */ -class RetrigAO: public Tango::Device_4Impl -{ -public : - // Add your own data members here - //----------------------------------------- + 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; -//@} + // 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 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 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 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 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 *); + /** + * @name RetrigAO methods prototypes + */ -/** - * 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* m_ao = nullptr; - unsigned long m_err_ctr; - short m_use_fifo; - - asl::ActiveAOChannel m_ac; - - asl::ContinuousAOConfig m_config; - asl::ContinuousAOConfig m_stop_config; - - double* m_channel[8]; - std::vector<asl::AOScaledData> m_default_waveform; - std::string m_error_message; - //- 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); - - void set_internal_state(void); - void stop_with_zero_forcing(); - void raise_error(std::string p_error_message); - - asl::AOScaledData assign_default_waveform(Tango::DevDouble p_ref, std::function <double(int, int)> p_lambda, int p_first_channel, int p_last_channel); - void activate_channel(int p_channel_index, vector<double>& p_channel_wave_form, asl::AOScaledData& p_default_waveform); -}; + //@{ + /** + * 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* m_ao = nullptr; + unsigned long m_err_ctr; + short m_use_fifo; + + asl::ActiveAOChannel m_ac; + + asl::ContinuousAOConfig m_config; + asl::ContinuousAOConfig m_stop_config; + + double* m_channel[8]; + std::vector<asl::AOScaledData> m_default_waveform; + std::string m_error_message; + //- 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); + + void set_internal_state(void); + void stop_with_zero_forcing(); + void raise_error(std::string p_error_message); + + asl::AOScaledData assign_default_waveform(Tango::DevDouble p_ref, std::function <double(int, int)> p_lambda, int p_first_channel, int p_last_channel); + void activate_channel(int p_channel_index, vector<double>& p_channel_wave_form, asl::AOScaledData& p_default_waveform); + }; } // namespace diff --git a/src/RetrigAOClass.cpp b/src/RetrigAOClass.cpp index 28b24a6bba8d8573a310a12a3127f0dbe4d9b4bf..9d02d38034479ec2f7e8984c22f2be211f82dbcc 100644 --- a/src/RetrigAOClass.cpp +++ b/src/RetrigAOClass.cpp @@ -59,1002 +59,1002 @@ 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) -{ + // + // 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; + cout2 << "StartCmd::execute(): arrived" << endl; - ((static_cast<RetrigAO *>(device))->start()); - return new CORBA::Any(); -} + ((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) -{ + // + // 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; + cout2 << "StopCmd::execute(): arrived" << endl; - ((static_cast<RetrigAO *>(device))->stop()); - return new CORBA::Any(); -} + ((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) -{ + //+---------------------------------------------------------------------------- + // + // 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; + cout2 << "SetAOScaledDataCmd::execute(): arrived" << endl; - const Tango::DevVarDoubleStringArray *argin; - extract(in_any, argin); + const Tango::DevVarDoubleStringArray *argin; + extract(in_any, argin); - ((static_cast<RetrigAO *>(device))->set_aoscaled_data(argin)); - return new CORBA::Any(); -} + ((static_cast<RetrigAO *>(device))->set_aoscaled_data(argin)); + return new CORBA::Any(); + } -// -//---------------------------------------------------------------- -// Initialize pointer for singleton pattern -//---------------------------------------------------------------- -// -RetrigAOClass *RetrigAOClass::_instance = NULL; + // + //---------------------------------------------------------------- + // 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) + { -//+---------------------------------------------------------------------------- -// -// 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 << "Entering RetrigAOClass constructor" << endl; - set_default_property(); - get_class_property(); - write_class_property(); - - cout2 << "Leaving RetrigAOClass constructor" << endl; + cout2 << "Leaving RetrigAOClass constructor" << endl; -} -//+---------------------------------------------------------------------------- -// -// method : RetrigAOClass::~RetrigAOClass() -// -// description : destructor for the RetrigAOClass -// -//----------------------------------------------------------------------------- -RetrigAOClass::~RetrigAOClass() -{ - _instance = NULL; -} + } + //+---------------------------------------------------------------------------- + // + // 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) + //+---------------------------------------------------------------------------- + // + // 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() { - try + if (_instance == NULL) { - string s(name); - _instance = new RetrigAOClass(s); + cerr << "Class is not initialised !!" << endl; + exit(-1); } - catch (bad_alloc) + 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++) { - throw; - } - } - return _instance; -} + } + } -RetrigAOClass *RetrigAOClass::instance() -{ - if (_instance == NULL) + //+---------------------------------------------------------------------------- + // + // 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) { - cerr << "Class is not initialised !!" << endl; - exit(-1); + 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); } - 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_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) + { -//+---------------------------------------------------------------------------- -// -// 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 + //------------------------------------------------------------- - // Create all devices.(Automatic code generation) - //------------------------------------------------------------- - for (unsigned long i=0 ; i < devlist_ptr->length() ; i++) + } + //+---------------------------------------------------------------------------- + // Method: RetrigAOClass::attribute_factory(vector<Tango::Attr *> &att_list) + //----------------------------------------------------------------------------- + void RetrigAOClass::attribute_factory(vector<Tango::Attr *> &att_list) { - 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]); + // 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 + //------------------------------------------------------------- } - // 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); + //+---------------------------------------------------------------------------- + // + // 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). + //------------------------------------------------------------------ - // 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); + // Read class properties from database.(Automatic code generation) + //------------------------------------------------------------------ - // Attribute : channel0 - channel0Attrib *channel0 = new channel0Attrib(); - att_list.push_back(channel0); + // 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; - // Attribute : channel1 - channel1Attrib *channel1 = new channel1Attrib(); - att_list.push_back(channel1); - // Attribute : channel2 - channel2Attrib *channel2 = new channel2Attrib(); - att_list.push_back(channel2); + // End of Automatic code generation + //------------------------------------------------------------------ - // Attribute : channel3 - channel3Attrib *channel3 = new channel3Attrib(); - att_list.push_back(channel3); + } - // Attribute : channel4 - channel4Attrib *channel4 = new channel4Attrib(); - att_list.push_back(channel4); + //+---------------------------------------------------------------------------- + // + // 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); - // Attribute : channel5 - channel5Attrib *channel5 = new channel5Attrib(); - att_list.push_back(channel5); + 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); - // Attribute : channel6 - channel6Attrib *channel6 = new channel6Attrib(); - att_list.push_back(channel6); + 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); - // Attribute : channel7 - channel7Attrib *channel7 = new channel7Attrib(); - att_list.push_back(channel7); + 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); - // End of Automatic code generation - //------------------------------------------------------------- -} + 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); -//+---------------------------------------------------------------------------- -// -// 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). - //------------------------------------------------------------------ + 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); - // Read class properties from database.(Automatic code generation) - //------------------------------------------------------------------ + 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); - // 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; + 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); - // End of Automatic code generation - //------------------------------------------------------------------ + 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); -//+---------------------------------------------------------------------------- -// -// 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); + 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); -} -//+---------------------------------------------------------------------------- -// -// 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) + prop_name = "Channel3Waveform"; + prop_desc = "The waveform for channel 3 (attribute persistency)."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) { - 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); + 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); + } - // check for svn information - else + //+---------------------------------------------------------------------------- + // + // method : RetrigAOClass::write_class_property + // + // description : Set class description as property in database + // + //----------------------------------------------------------------------------- + void RetrigAOClass::write_class_property() { - string src_path(SvnPath); - start = src_path.find("://"); + // 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); + 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); + 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 ) + // 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) { - 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); + 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); - } + // 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); - // 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); -} + 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 0800e41711d8f08e5f676fa38c8e0b2299712f13..272e92e64004982bad4ec45ac83bade557c3d64b 100644 --- a/src/RetrigAOClass.h +++ b/src/RetrigAOClass.h @@ -38,371 +38,371 @@ 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 + //===================================== + // 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) + __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 *); -}; + 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 diff --git a/src/RetrigAOStateMachine.cpp b/src/RetrigAOStateMachine.cpp index 1254502678801138b2f48434ecc039a7c82bd73c..85317087af725d25866fe575041c8f1d11dc1d5f 100644 --- a/src/RetrigAOStateMachine.cpp +++ b/src/RetrigAOStateMachine.cpp @@ -44,336 +44,336 @@ static const char *RcsId = "$Header: $"; namespace RetrigAO_ns { -//================================================= -// Attributes Allowed Methods -//================================================= + //================================================= + // Attributes Allowed Methods + //================================================= -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_useBoardFifo_allowed -// -// description : Read/Write allowed for useBoardFifo attribute. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_useBoardFifo_allowed(Tango::AttReqType type) -{ + //+---------------------------------------------------------------------------- + // + // 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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) -{ + 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; -} + return true; + } -//================================================= -// Commands Allowed Methods -//================================================= + //================================================= + // Commands Allowed Methods + //================================================= -//+---------------------------------------------------------------------------- -// -// method : RetrigAO::is_Start_allowed -// -// description : Execution allowed for Start command. -// -//----------------------------------------------------------------------------- -bool RetrigAO::is_Start_allowed(const CORBA::Any &any) -{ + //+---------------------------------------------------------------------------- + // + // 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) -{ + 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) -{ + 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; -} + return true; + } } // namespace RetrigAO_ns diff --git a/src/main.cpp b/src/main.cpp index c9e0a34c1a22989d8dc93cf69a1856431f5a9495..bbd5cd76e67f3f7d4c70d30037b7be8e0c302e2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,7 +47,7 @@ DECLARE_CRASH_HANDLER; int main(int argc, char *argv[]) { - INSTALL_CRASH_HANDLER; + INSTALL_CRASH_HANDLER; Tango::Util *tg = 0; @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) catch (CORBA::Exception &e) { Tango::Except::print_exception(e); - + cout << "Received a CORBA_Exception" << endl; cout << "Exiting" << endl; } @@ -83,6 +83,6 @@ int main(int argc, char *argv[]) // clean ORB, threads..... //-------------------------- tg->server_cleanup(); - + return(0); }