12 #ifndef ECL_DEVICES_SERIAL_POS_HPP_ 
   13 #define ECL_DEVICES_SERIAL_POS_HPP_ 
   20 #if defined(ECL_IS_POSIX) 
  144     Serial() : is_open(false), error_handler(
NoError)
 
  244     template <
typename Byte>
 
  245     long write(
const Byte &
byte);
 
  257     template <
typename Byte>
 
  258     long write(
const Byte *bytes, 
const unsigned long &n);
 
  290     void block(
const unsigned long &timeout = 500);
 
  323     template <
typename Byte>
 
  324     long read(Byte &
byte);
 
  339     template <
typename Byte>
 
  340     long read(Byte *bytes, 
const unsigned long &n);
 
  352     { tcflush(file_descriptor,TCIOFLUSH);}
 
  358     void clearInputBuffer()
 
  359     { tcflush(file_descriptor,TCIFLUSH);}
 
  365     void clearOutputBuffer()
 
  366     { tcflush(file_descriptor,TCOFLUSH);}
 
  374     const Error& error()
 const 
  375     { 
return error_handler;}
 
  389     unsigned long read_timeout_ms;
 
  390     ecl::Snooze fake_snooze;
 
  391     unsigned int fake_loop_count;
 
  400   template <
typename Byte>
 
  401   long Serial::write(
const Byte &
byte)
 
  410     ssize_t no_written = ::write(file_descriptor, &
byte, 1);
 
  411     if ( no_written < 0 )
 
  421   template <
typename Byte>
 
  422   long Serial::write(
const Byte *bytes, 
const unsigned long &n)
 
  431     ssize_t no_written = ::write(file_descriptor, bytes, n);
 
  432     if ( no_written < 0 )
 
  442   template <
typename Byte>
 
  443   long Serial::read(Byte &
byte)
 
  453     if ( ( read_timeout_ms != NonBlocking ) && ( read_timeout_ms < 100 ) )
 
  455       fake_snooze.initialise();
 
  456       for ( 
unsigned int i = 0; i < fake_loop_count; ++i )
 
  458         no_read = ::read(file_descriptor, &
byte, 1);
 
  468       no_read = ::read(file_descriptor, &
byte, 1);
 
  481   template <
typename Byte>
 
  482   long Serial::read(Byte *bytes, 
const unsigned long &n)
 
  492     if ( ( read_timeout_ms != NonBlocking ) && ( read_timeout_ms < 100 ) )
 
  494       fake_snooze.initialise();
 
  495       for ( 
unsigned int i = 0; i < fake_loop_count; ++i )
 
  497         no_read = ::read(file_descriptor, bytes, n);
 
  507       no_read = ::read(file_descriptor, bytes, n);
 
  528   class is_sink<Serial> : 
public True 
  537   class is_source<Serial> : 
public True 
  546   class is_sourcesink<Serial> : 
public True