diff --git a/src/SingleShotAO.cpp b/src/SingleShotAO.cpp index cc7f5b65743017ccf12f78c38f7ebaa29c3e1548..699767f450ef72a93a22bc09255b2ef0e5f2a0f9 100755 --- a/src/SingleShotAO.cpp +++ b/src/SingleShotAO.cpp @@ -129,7 +129,32 @@ SingleShotAO::SingleShotAO(Tango::DeviceClass *cl,const char *s,const char *d) //----------------------------------------------------------------------------- void SingleShotAO::delete_device() { - // Delete device allocated objects + DEBUG_STREAM << "SingleShotAO::delete_device(): entering... !" << endl; + + // Make sure running processes are aborted properly if channels are running + //-------------------------------------------- + try + { + _abort(); + } + catch (Tango::DevFailed &df) + { + ERROR_STREAM << df << endl; + RETHROW_DEVFAILED(df, + "DRIVER_FAILURE", + "could not abort [caught Tango::DevFailed]", + "SingleShotAO::delete_device"); + } + catch (...) + { + ERROR_STREAM << "SingleShotAO::init::unknown exception caught" << std::endl; + THROW_DEVFAILED("DRIVER_FAILURE", + "could not abort [unknown error]", + "SingleShotAO::delete_device"); + } + + // Delete device allocated objects + //-------------------------------------------- yat4tango::TraceHelper t("SingleShotAO::delete_device", this); if (m_manager) @@ -138,14 +163,16 @@ void SingleShotAO::delete_device() m_manager = NULL; } - //- release the asl::SingleShotAO object + // Release the asl::SingleShotAO object + //-------------------------------------------- if (m_ssao) { delete m_ssao; m_ssao = NULL; } - // remove dynamic attributes + // Remove dynamic attributes + //-------------------------------------------- if (m_dyn_attr_manager) { try @@ -165,7 +192,8 @@ void SingleShotAO::delete_device() m_dyn_attr_manager = NULL; } - //- remove the inner appender + // Remove the inner appender + //-------------------------------------------- yat4tango::Logging::release(this); yat4tango::DeviceInfo::release(this); } @@ -315,17 +343,20 @@ void SingleShotAO::init_device() return; } + // get frequency value in database + //-------------------------------------------- try { - m_frequency = yat4tango::PropertyHelper::get_memorized_attribute<double>(this,"frequency"); + m_frequency = yat4tango::PropertyHelper::get_memorized_attribute<double>(this, "frequency"); DEBUG_STREAM << "Frequency : " << m_frequency << endl; } catch (...) { DEBUG_STREAM << "Failed to get frequency value. Maybe there is no value yet." << std::endl; } - + + // initialize the AO manager //-------------------------------------------- try @@ -348,28 +379,6 @@ void SingleShotAO::init_device() } - // Make sure running processes are aborted properly - //-------------------------------------------- - try - { - _abort(); - } - catch (Tango::DevFailed &df) - { - ERROR_STREAM << df << endl; - RETHROW_DEVFAILED(df, - "DRIVER_FAILURE", - "could not abort [caught Tango::DevFailed]", - "SingleShotAO::init"); - } - catch (...) - { - ERROR_STREAM << "SingleShotAO::init::unknown exception caught" << std::endl; - THROW_DEVFAILED("DRIVER_FAILURE", - "could not abort [unknown error]", - "SingleShotAO::init"); - } - // Create dynamic attributes //-------------------------------------------- @@ -1047,9 +1056,8 @@ void SingleShotAO::_abort() yat4tango::PropertyHelper::set_memorized_attribute(this, kCHANNEL + std::to_string(l_cpt), l_val_channel); DEBUG_STREAM << "Memorizing channel " << l_cpt << " to " << l_val_channel << std::endl; - double l_val_initial = m_manager->get_initial(l_cpt); - yat4tango::PropertyHelper::set_memorized_attribute(this, kINITIAL + std::to_string(l_cpt), l_val_initial); - DEBUG_STREAM << "Memorizing initial " << l_cpt << " to " << l_val_initial << std::endl; + yat4tango::PropertyHelper::set_memorized_attribute(this, kINITIAL + std::to_string(l_cpt), l_val_channel); + DEBUG_STREAM << "Memorizing initial " << l_cpt << " to " << l_val_channel << std::endl; } } m_manager->abort();