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

No more retry done if no response received from the hardware, instead an exception is thrown

parent 693cfa5a
No related branches found
No related tags found
No related merge requests found
......@@ -268,17 +268,25 @@ std::string TangoSerialLink::write_read (std::string command_to_send, size_t nbC
//- sleep a little bit to let the adapter(RS232/485) to switch mode
omni_thread::sleep(0, 100000000); //100 milliseconds
//- wait till characters are available in the input buffer (max 30 retries !)
size_t nbRetries = 0;
//- No more retry! (for test purpose) //- wait till characters are available in the input buffer (max 3 retries !)
//size_t nbRetries = 0;
Tango::DevLong nbCharReceived = 0;
dd_out = this->_serial_proxy->command_inout("DevSerGetNChar");
dd_out >> nbCharReceived;
while ( !nbCharReceived && nbRetries < 50 )
//- if no response throw !
if ( !nbCharReceived )
{
dd_out = this->_serial_proxy->command_inout("DevSerGetNChar");
dd_out >> nbCharReceived;
nbRetries++;
// dd_out = this->_serial_proxy->command_inout("DevSerGetNChar");
// dd_out >> nbCharReceived;
// nbRetries++;
//std::cout << "TangoSerialLink::write_read -> nbRetries = " << nbRetries << " & nbCharReceived = " << nbCharReceived << std::endl;
std::string desc("");
desc = "No response received from the hardware for command : " + command_to_send;
Tango::Except::throw_exception (
"COMMUNICATION_ERROR",
desc,
"TangoSerialLink::write_read");
}
//std::cout << "END WHILE -> nbRetries = " << nbRetries << " & nbCharReceived = " << nbCharReceived << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment