Skip to content
Snippets Groups Projects
Commit 0ad1cf65 authored by Xavier ELATTAOUI's avatar Xavier ELATTAOUI
Browse files

Release preparation : TANGODEVIC-1532 -> yat exceptions to Tango::DevFailed exceptions.

parent c2d4e3d1
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@
<groupId>fr.soleil.device</groupId>
<artifactId>HexapodFMBO-${aol}-${mode}</artifactId>
<version>1.2.16-SNAPSHOT</version>
<version>1.2.16</version>
<packaging>nar</packaging>
......
......@@ -108,6 +108,7 @@ FixedPositions::FixedPositions(Tango::DeviceClass *cl,const char *s,const char *
{
init_device();
}
//+----------------------------------------------------------------------------
//
// method : FixedPositions::delete_device()
......@@ -152,8 +153,6 @@ void FixedPositions::delete_device()
}
// JIRA TANGODEVIC-919
fixed_pos_data_vect.clear();
}
//+----------------------------------------------------------------------------
......@@ -192,7 +191,6 @@ void FixedPositions::init_device()
if (properties_missing)
return;
//- Parse fixedPositionsProp
if (! this->parse ())
{
......@@ -254,7 +252,6 @@ void FixedPositions::init_device()
this->init_device_done = true;
}
//+----------------------------------------------------------------------------
//
// method : FixedPositions::get_device_property()
......@@ -359,8 +356,6 @@ void FixedPositions::get_device_property()
// And try to extract Deadband value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> deadband;
// End of Automatic code generation
//------------------------------------------------------------------
Tango::DbData data_put;
......@@ -405,8 +400,8 @@ void FixedPositions::get_device_property()
if (! data_put.empty ())
get_db_device()->put_property(data_put);
}
//+----------------------------------------------------------------------------
//
// method : FixedPositions::always_executed_hook()
......@@ -419,6 +414,7 @@ void FixedPositions::always_executed_hook()
//- read the 6 positions at same time
if (!init_device_done || properties_missing)
return;
this->current_pos.tcp = hex->get_tcp ();
if (this->current_pos.tcp.size () < 6)
{
......@@ -440,6 +436,7 @@ void FixedPositions::always_executed_hook()
ERROR_STREAM << "}" << std::endl;
this->last_error = "FixedPositions::always_executed_hook did not receive the full 6 lcs positions \n";
}
this->current_pos.uc = hex->get_axes_positions ();
if (this->current_pos.uc.size () < 6)
{
......@@ -450,8 +447,8 @@ void FixedPositions::always_executed_hook()
ERROR_STREAM << "}" << std::endl;
this->last_error = "FixedPositions::always_executed_hook did not receive the full 6 uc positions \n";
}
}
//+----------------------------------------------------------------------------
//
// method : FixedPositions::read_attr_hardware
......@@ -464,6 +461,7 @@ void FixedPositions::read_attr_hardware(vector<long> &attr_list)
DEBUG_STREAM << "FixedPositions::read_attr_hardware(vector<long> &attr_list) entering... "<< endl;
// Add your own code here
}
//+----------------------------------------------------------------------------
//
// method : FixedPositions::read_selectedAttributeName
......@@ -478,7 +476,6 @@ void FixedPositions::read_selectedAttributeName(Tango::Attribute &attr)
attr.set_value(attr_selectedAttributeName_read);
}
//+----------------------------------------------------------------------------
//
// method : FixedPositions::read_labelList
......@@ -495,7 +492,6 @@ void FixedPositions::read_labelList(Tango::Attribute &attr)
attr.set_value(attr_labelList_read, _labelList_size);
}
//+------------------------------------------------------------------
/**
* method: FixedPositions::initialize_reference_position
......@@ -517,8 +513,15 @@ void FixedPositions::initialize_reference_position()
" device not configured or in error [check properties, restart device]",
"FixedPositions::initialize_reference_position");
}
hex->home ();
try
{
hex->home ();
}
catch (yat::Exception& ex)
{
THROW_YAT_TO_TANGO_EXCEPTION (ex);
}
}
//+------------------------------------------------------------------
......@@ -542,9 +545,16 @@ void FixedPositions::stop()
" device not configured or in error [check properties, restart device]",
"FixedPositions::stop");
}
try
{
hex->stop ();
}
catch (yat::Exception& ex)
{
THROW_YAT_TO_TANGO_EXCEPTION (ex);
}
}
//+------------------------------------------------------------------
/**
......@@ -664,6 +674,14 @@ bool FixedPositions::parse_coord_line (std::string expected, std::string line, s
for (size_t i = 0; i < 6; i++)
values[i] = tok.get_token <double> (i);
}
catch (yat::Exception& ex)
{
std::stringstream s;
s << "FixedPositions::parse () line <" << line_number << "> "
<< line << " apparently, some value is not a number [fix property and restart device]" << std::endl;
status_str = s.str ();
THROW_YAT_TO_TANGO_EXCEPTION (ex);
}
catch (...)
{
std::stringstream s;
......@@ -676,8 +694,6 @@ bool FixedPositions::parse_coord_line (std::string expected, std::string line, s
return true;
}
//+------------------------------------------------------------------
/**
* internal method: FixedPositions::goto_fixed
......@@ -687,6 +703,9 @@ bool FixedPositions::parse_coord_line (std::string expected, std::string line, s
void FixedPositions::goto_fixed (PositionsData & fixed_pos)
{
DEBUG_STREAM << "FixedPositions::goto_fixed (): entering... !" << endl;
try
{
//- write TCP
hex->set_tcp (fixed_pos.tcp);
omni_thread::sleep (0, 250000000);
......@@ -704,7 +723,11 @@ void FixedPositions::goto_fixed (PositionsData & fixed_pos)
//- issue Start
hex->start ();
omni_thread::sleep (0, 250000000);
return;
}
catch (yat::Exception& ex)
{
THROW_YAT_TO_TANGO_EXCEPTION (ex);
}
}
//+------------------------------------------------------------------
......@@ -821,9 +844,9 @@ Tango::ConstDevString FixedPositions::dev_status()
status_str = "device not connected to HW (could not communicate with HW)";
return status_str.c_str ();
}
status_str = hex->get_status_as_string (state);
return status_str.c_str ();
}
//------------------------------------------------------------------
......@@ -866,7 +889,6 @@ throw (Tango::DevFailed)
//- now insert the attribute data in the dynamic attribute (see Nicolas Leclercq's mail 12/05/2011)
yat4tango::DynamicAttribute & dyn_attr = this->m_dam->get_attribute (dai.tai.name);
dyn_attr.set_user_data (fixed_pos_data);
}
//------------------------------------------------------------------
......@@ -882,6 +904,10 @@ void FixedPositions::read_callback (yat4tango::DynamicAttributeReadCallbackData&
if (fixed_pos_data == 0)
throw bad_alloc ();
}
catch (yat::Exception& ex)
{
THROW_YAT_TO_TANGO_EXCEPTION (ex);
}
catch (...)
{
FATAL_STREAM << "FixedPositions::read_callback read ERROR trying to retreive attribute data associated with <"
......@@ -910,32 +936,6 @@ void FixedPositions::read_callback (yat4tango::DynamicAttributeReadCallbackData&
}
}
/* size_t nb_pos = fixed_pos_data_vect.size();
size_t idx = 0;
for (; idx < nb_pos; idx++)
{
//- update selectedAttributeName attribute
bool is_on_fixed_pos = fixed_pos_data_vect.at(idx)->is_on_fixed_pos;
if (is_on_fixed_pos)
{
if (*attr_selectedAttributeName_read)
{
delete[] *attr_selectedAttributeName_read;
std::string pos_name = fixed_pos_data_vect.at(idx)->dyn_attr_name;
size_t len = pos_name.size() + 1;
*attr_selectedAttributeName_read = new char[len];
if (*attr_selectedAttributeName_read)
{
::memset(*attr_selectedAttributeName_read, 0, len * sizeof(char));
::strcpy(*attr_selectedAttributeName_read, pos_name.c_str());
}
break;
}
}
}
*/
//------------------------------------------------------------------
//- void FixedPositions::write_callback ()
//------------------------------------------------------------------
......@@ -943,6 +943,9 @@ void FixedPositions::write_callback (yat4tango::DynamicAttributeWriteCallbackDat
{
DEBUG_STREAM << "FixedPositions::write_callback (): for attribute <" << cbd.dya->get_name() << ">" << endl;
Tango::DevBoolean b;
try
{
cbd.tga->get_write_value (b);
if (!b)
return;
......@@ -951,6 +954,11 @@ void FixedPositions::write_callback (yat4tango::DynamicAttributeWriteCallbackDat
fixed_pos_data_vect = cbd.dya->get_user_data <PositionsData> ();
this->goto_fixed (*fixed_pos_data_vect);
omni_thread::sleep (0, 250000000);
}
catch (yat::Exception& ex)
{
THROW_YAT_TO_TANGO_EXCEPTION (ex);
}
//- new position requested : set UNKOWN till the (fixed) position is not reached!
if (*attr_selectedAttributeName_read)
......@@ -965,10 +973,8 @@ void FixedPositions::write_callback (yat4tango::DynamicAttributeWriteCallbackDat
::strcpy(*attr_selectedAttributeName_read, default_pos.c_str());
}
}
}
//+------------------------------------------------------------------
/**
* internal method: FixedPositions::compare
......@@ -1053,9 +1059,4 @@ bool FixedPositions::compare_line (std::vector <double> & current, std::vector <
return true;
}
} // namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment