Skip to content
Snippets Groups Projects
Commit e2e5253c authored by Alain BUTEAU's avatar Alain BUTEAU
Browse files

- tests DIFFABS 17/11

supression caract�res dans trame de reponse
parent ff28a1e0
No related branches found
No related tags found
No related merge requests found
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/CYBERSTAR/src/CYBERSTARx1000.cpp,v 1.22 2008-07-29 17:13:39 buteau Exp $";
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/CYBERSTAR/src/CYBERSTARx1000.cpp,v 1.23 2008-11-17 15:27:13 buteau Exp $";
//+=============================================================================
//
// file : CYBERSTARx1000.cpp
......@@ -13,9 +13,12 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
//
// $Author: buteau $
//
// $Revision: 1.22 $
// $Revision: 1.23 $
//
// $Log: not supported by cvs2svn $
// Revision 1.22 2008/07/29 17:13:39 buteau
// Pb MANTIS 9936
//
// Revision 1.21 2008/03/03 16:50:37 sebleport
// - read part of windowWidth and windowCenterPosition attributes added
//
......@@ -395,7 +398,7 @@ namespace CYBERSTARx1000_ns
"CYBERSTARx1000::read_voltage()");
*attr_voltage_read = XString<double>::convertFromString(response);
cout << "voltage == " << *attr_voltage_read <<endl;
attr.set_value(attr_voltage_read);
}
//+----------------------------------------------------------------------------
......@@ -688,7 +691,7 @@ namespace CYBERSTARx1000_ns
long nb_char_written,mode=2;
//cout << "**** cmd_to_send=" << cmd_to_send <<endl;
cout << "**** cmd_to_send=" << cmd_to_send <<endl;
// Construct a dedicated DevVarCharArray with validation char <LF>
Tango::DevVarCharArray *LF = new Tango::DevVarCharArray();
LF->length(1);
......@@ -733,7 +736,10 @@ namespace CYBERSTARx1000_ns
"CYBERSTARx1000::write_read()");
// get rid of ACK characters in the response
cout << "responsede l'appareil||" << response <<"||" <<endl;
response = process_string(response);
cout << "response apres process_string||" << response <<"||" << endl;
}
......@@ -812,10 +818,27 @@ namespace CYBERSTARx1000_ns
try
{
// the "ack" character(s) at the begining of the string is removed
char ack=0x06;
size_t idx= origin_string.find_last_of(string(&ack));
processed_string=origin_string.substr(idx+1);
// get rid of first characters which are useless
std::string::size_type beg, end;
beg = origin_string.find_first_of("0123456789");
end = origin_string.find_last_of("0123456789");
std::stringstream s;
processed_string = origin_string.substr(beg, (end - beg + 1));
for(unsigned int i = 0; i < origin_string.size(); i++)
s << std::hex << (unsigned int)(origin_string[i]) << " ";
s << std::ends;
INFO_STREAM << "CYBERSTARx1000::process_string() string received : "
<< origin_string
<< "substring retained : "
<< processed_string
<< " hex values : "
<< s.str()
<< std::endl;
return processed_string;
}
......@@ -849,6 +872,8 @@ namespace CYBERSTARx1000_ns
"CYBERSTARx1000::read_lower()");
*attr_scaLowerThreshold_read = XString<double>::convertFromString(response);
// cout << " read_lower() = " << *attr_scaLowerThreshold_read << endl;
}
//+------------------------------------------------------------------
/**
......@@ -915,6 +940,7 @@ namespace CYBERSTARx1000_ns
"CYBERSTARx1000::read_upper()");
*attr_scaUpperThreshold_read = XString<double>::convertFromString(response);
// cout << " read_upper() = " << *attr_scaUpperThreshold_read << endl;
}
//+------------------------------------------------------------------
......@@ -1046,14 +1072,14 @@ namespace CYBERSTARx1000_ns
{
argout=Tango::RUNNING;
set_status("SCA threshold voltages are changing");
cout << "SCA threshold voltages are changing" <<endl;
DEBUG_STREAM << "SCA threshold voltages are changing" <<endl;
}
else
{
argout=Tango::STANDBY;
set_status("CYBERSTAR is waiting for request");
cout << "CYBERSTAR is waiting for request" <<endl;
DEBUG_STREAM << "CYBERSTAR is waiting for request" <<endl;
}
return argout;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment