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

selectedName attribute update in always_exe_hook method.

parent f55d6351
No related branches found
No related tags found
No related merge requests found
......@@ -447,6 +447,34 @@ 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";
}
// Now updata PosData structure
// parcourir toutes les lignes de la property TCConfiguration
for (size_t i = 0; i < fixed_pos_data_vect.size (); i++)
{
fixed_pos_data_vect[i]->is_on_fixed_pos = compare (&current_pos);
//- update selectedAttributeName attribute
std::string selectedPositionName(*attr_selectedAttributeName_read);
if ( fixed_pos_data_vect[i]-> is_on_fixed_pos &&
selectedPositionName.find(UNKNOWN_POSITION) != std::string::npos )
{
if (*attr_selectedAttributeName_read)
{
delete[] *attr_selectedAttributeName_read;
std::string pos_name = fixed_pos_data_vect[i]->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;
}
}
}
} //- end for
}
//+----------------------------------------------------------------------------
......@@ -917,23 +945,7 @@ void FixedPositions::read_callback (yat4tango::DynamicAttributeReadCallbackData&
fixed_pos_data->is_on_fixed_pos = compare (fixed_pos_data);
cbd.tga->set_value (&fixed_pos_data->is_on_fixed_pos);
//- update selectedAttributeName attribute
std::string selectedPositionName(*attr_selectedAttributeName_read);
if ( fixed_pos_data->is_on_fixed_pos &&
selectedPositionName.find(UNKNOWN_POSITION) != std::string::npos )
{
if (*attr_selectedAttributeName_read)
{
delete[] *attr_selectedAttributeName_read;
std::string pos_name = fixed_pos_data->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());
}
}
}
}
//------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment