Commit 43f52849 authored by kirov's avatar kirov
Browse files

+ added check for isMeta() in EspiaSerialLine constructor (commented out for now)

+ cosmetic codding style changes



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@65 45c4679d-1946-429d-baad-37912b19538b
parent 88ea3764
......@@ -22,11 +22,11 @@ class EspiaSerialLine : public HwSerialLine
virtual void write( const std::string& buffer, bool no_wait=false );
virtual void read( std::string& buffer, int max_len,
double timeout=TMOUT_DEFAULT );
double timeout=TimeoutDefault );
virtual void readStr( std::string& buffer, int max_len,
const std::string& term,
double timeout=TMOUT_DEFAULT );
double timeout=TimeoutDefault );
void flush();
......
......@@ -13,6 +13,9 @@ EspiaSerialLine::EspiaSerialLine( EspiaDev& edev, const string& line_term,
m_dev(edev),
HwSerialLine(line_term, timeout, block_size, block_delay)
{
if( 0/*edev.isMeta()*/ )
throw LIMA_HW_EXC(NotSupported, "Can't create an "
"EspiaSerialLine for a meta-device");
}
......
......@@ -13,9 +13,9 @@ class HwSerialLine
public :
enum TimeoutConst {
TMOUT_DEFAULT = -2,
TMOUT_BLOCK_FOREVER = -1,
TMOUT_NO_BLOCK = 0
TimeoutDefault = -2,
TimeoutBlockForever = -1,
TimeoutNoBlock = 0
};
HwSerialLine( const std::string& line_term="\r", double timeout=1.0,
......@@ -26,27 +26,27 @@ class HwSerialLine
virtual void flush();
virtual void read( std::string& buffer, int max_len,
double timeout=TMOUT_DEFAULT ) = 0;
double timeout=TimeoutDefault ) = 0;
virtual void write( const std::string& buffer, bool no_wait=false ) = 0;
virtual void readStr( std::string& buffer, int max_len,
const std::string& term,
double timeout=TMOUT_DEFAULT );
double timeout=TimeoutDefault );
virtual void readLine( std::string& buffer, int max_len,
double timeout=TMOUT_DEFAULT );
double timeout=TimeoutDefault );
virtual void writeRead( const std::string& writebuffer,
std::string& readbuffer, int max_len,
bool wr_no_wait=false,
double rd_timeout=TMOUT_DEFAULT );
double rd_timeout=TimeoutDefault );
virtual void writeReadStr( const std::string& writebuffer,
std::string& readbuffer,
int max_len, const std::string& term,
bool wr_no_wait=false,
double rd_timeout=TMOUT_DEFAULT );
double rd_timeout=TimeoutDefault );
virtual void readAvailable( std::string& buffer, int max_len );
......@@ -76,7 +76,7 @@ class HwSerialLine
inline double HwSerialLine::checkDefTimeout( double timeout )
{
return (TMOUT_DEFAULT == (int)timeout)? m_timeout : timeout; // XXX
return (TimeoutDefault == (int)timeout)? m_timeout : timeout; // XXX
}
......
......@@ -96,7 +96,7 @@ void HwSerialLine::writeReadStr( const string& writebuffer,
*/
void HwSerialLine::readAvailable( string& buffer, int max_len )
{
read( buffer, max_len, TMOUT_NO_BLOCK );
read( buffer, max_len, TimeoutNoBlock );
}
......@@ -109,7 +109,7 @@ void HwSerialLine::flush()
int len;
getNumAvailBytes(len);
read( buf, len, TMOUT_NO_BLOCK );
read( buf, len, TimeoutNoBlock );
}
......
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