Commit 0d342fc9 authored by kirov's avatar kirov
Browse files

+ Added default timeout.



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@60 45c4679d-1946-429d-baad-37912b19538b
parent 005c66a6
...@@ -27,23 +27,25 @@ class HwSerialLine ...@@ -27,23 +27,25 @@ class HwSerialLine
double block_delay=0, bool no_wait=false ) = 0; double block_delay=0, bool no_wait=false ) = 0;
virtual void readStr( std::string& buffer, int max_len, virtual void readStr( std::string& buffer, int max_len,
const std::string& term, double timeout ); const std::string& term,
double timeout=TMOUT_DEFAULT );
virtual void readLine( std::string& buffer, int max_len, double timeout ); virtual void readLine( std::string& buffer, int max_len,
double timeout=TMOUT_DEFAULT );
virtual void writeRead( const std::string& writebuffer, int block_size, virtual void writeRead( const std::string& writebuffer, int block_size,
double block_delay, bool no_wait, double block_delay, bool no_wait,
std::string& readbuffer, /*int max_len, ???*/ std::string& readbuffer, /*int max_len, ???*/
double timeout ); double timeout=TMOUT_DEFAULT );
virtual void writeReadStr( const std::string& writebuffer, virtual void writeReadStr( const std::string& writebuffer,
int block_size, double block_delay, int block_size, double block_delay,
bool no_wait, std::string& readbuffer, bool no_wait, std::string& readbuffer,
int max_len, const std::string& term, int max_len, const std::string& term,
double timeout ); double timeout=TMOUT_DEFAULT );
virtual void readAvailable( std::string& buffer, /*int max_len, ???*/ virtual void readAvailable( std::string& buffer, /*int max_len, ???*/
double timeout ); double timeout=TMOUT_DEFAULT );
virtual void flush(); virtual void flush();
......
...@@ -26,7 +26,7 @@ void HwSerialLine::readStr( string& buffer, int max_len, ...@@ -26,7 +26,7 @@ void HwSerialLine::readStr( string& buffer, int max_len,
Timestamp start=Timestamp::now(); Timestamp start=Timestamp::now();
int match=0, n, term_len=term.length(), len=0; int match=0, n, term_len=term.length(), len=0;
bool have_timeout=(timeout > 0), have_maxlen=(max_len > 0); bool have_timeout=(timeout > 0), have_maxlen=(max_len > 0);
double tout=timeout; double tout=((TMOUT_DEFAULT==timeout)? m_timeout: timeout);
string buf; string buf;
buffer = ""; buffer = "";
...@@ -99,7 +99,7 @@ void HwSerialLine::readAvailable( std::string& buffer, /*int max_len, ???*/ ...@@ -99,7 +99,7 @@ void HwSerialLine::readAvailable( std::string& buffer, /*int max_len, ???*/
{ {
int max_len; int max_len;
getAvail( max_len ); getAvail( max_len );
read( buffer, max_len, timeout ); read( buffer, max_len, ((TMOUT_DEFAULT==timeout)? m_timeout: timeout) );
} }
......
Supports Markdown
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