Commit 722eed44 authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Remove retry logic

parent 6a724cdf
......@@ -1511,7 +1511,6 @@ void Agilent4uhv::send_message(const int win, const windowType type,
const vector<unsigned char> &payload)
{
vector<unsigned char> header, footer;
int attempts = 2;
init_header(win, type, header);
int crc = calc_crc(header, payload);
......@@ -1522,20 +1521,7 @@ void Agilent4uhv::send_message(const int win, const windowType type,
message.insert(message.end(), payload.begin(), payload.end());
message.insert(message.end(), footer.begin(), footer.end());
retry:
try {
Serial2Client::write(message);
} catch (Tango::DevFailed &e) {
if (--attempts) {
// Waiting the device
int retries = 0;
while(get_state2() != Tango::ON && retries++ < 5) {
sleep(1);
}
goto retry;
}
throw;
}
Serial2Client::write(message);
assert(Serial2Client::output_length() == 0);
}
......@@ -1543,18 +1529,9 @@ retry:
void Agilent4uhv::receive_message(vector<unsigned char> &payload)
{
vector<unsigned char> message, crc;
int attempts = 5;
retry:
try {
Serial2Client::read_until(ETX, message);
Serial2Client::read(CRC_LENGTH, crc);
} catch (Tango::DevFailed &e) {
if (--attempts) {
goto retry;
}
throw;
}
Serial2Client::read_until(ETX, message);
Serial2Client::read(CRC_LENGTH, crc);
assert(Serial2Client::input_length() == 0);
message.insert(message.end(), crc.begin(), crc.end());
......@@ -1645,7 +1622,7 @@ void Agilent4uhv::encode(const int &data, vector<unsigned char> &payload)
void Agilent4uhv::decode(const vector<unsigned char> &payload, double &data)
{
// Left trim of spaces
size_t start;
size_t start = 0;
for (size_t i=0; i<payload.size(); ++i) {
if (payload[i] != ' ') {
start = i;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment