Skip to content
Snippets Groups Projects
Commit a9fd5241 authored by Alexandre MALFREYT's avatar Alexandre MALFREYT
Browse files

fix: abort in delete_device (and inherently in init and exit)

parent 4a82daf2
No related branches found
No related tags found
2 merge requests!4develop -> main,!2[CTRLRFC-1594] Apply memorized dynamic attributes at init
......@@ -129,7 +129,32 @@ SingleShotAO::SingleShotAO(Tango::DeviceClass *cl,const char *s,const char *d)
//-----------------------------------------------------------------------------
void SingleShotAO::delete_device()
{
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,7 +343,9 @@ void SingleShotAO::init_device()
return;
}
// get frequency value in database
//--------------------------------------------
try
{
m_frequency = yat4tango::PropertyHelper::get_memorized_attribute<double>(this, "frequency");
......@@ -326,6 +356,7 @@ void SingleShotAO::init_device()
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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment