55 using ecl::MilliSleep;
    64         Writer(Serial *serial_device, 
bool timestamps = 
false) :
    89                         if ( fgets(buffer,80,stdin) == NULL ) {
    95                         while ( *s_ptr != 
'\0') { ++s_ptr; }
    96                         serial->write(buffer,s_ptr - buffer);
    97                         if ( display_timestamps ) {
    99                                 std::cout << 
"[" << timestamp << 
"]"  << std::endl;
   109         Reader(Serial *serial_device, 
bool hexFormat = 
false, 
bool timestamps = 
false) :
   123                 unsigned long ch_read;
   125                 if ( hex ) { std::cout << 
"Hex format" << std::endl; } 
else { std::cout << 
"Ascii format" << std::endl; }
   128                         ch_read = 
serial->read(s,1);
   133                                         std::cout << 
"[" << time << 
"] ";
   135                                 for (
unsigned int i = 0; i < ch_read; ++i) {
   143                                         std::cout << std::endl;
   175 int main(
int argc, 
char** argv) {
   183     bool timestamps(
false);
   186         CmdLine cmd(
"This is a simple interface for reading/echoing from a serial port [115.2k,8N1].",
' ',
"0.1");
   187         ValueArg<string> arg_port(
"p",
"port",
"Port to connect to",
false,
"/dev/ttyS0",
"string");
   188         ValueArg<string> arg_baud(
"b",
"baud",
"Baud rate (9600,38400,115200) [115200]",
false,
"115200",
"string");
   189         SwitchArg switch_hex(
"x",
"hex",
"Enable hex output.",
false);
   190         SwitchArg switch_timestamps(
"t",
"timestamps",
"Print timestamps.",
false);
   195         cmd.
add(switch_timestamps);
   196         cmd.
parse(argc,argv);
   201         timestamps = switch_timestamps.
getValue();
   203         if ( baud == 
"9600" ) {
   205         } 
else if ( baud == 
"38400" ) {
   212         std::cerr << 
"error: " << e.
error() << 
" for arg " << e.
argId() << std::endl;
   220         Reader reader(&serial,hex,timestamps);
   221         Writer writer(&serial,timestamps);
   226         std::cout << e.
what() << std::endl;
 
Writer(Serial *serial_device, bool timestamps=false)
const char * what() const 
Format< char > hex_format
int main(int argc, char **argv)
Reader(Serial *serial_device, bool hexFormat=false, bool timestamps=false)
std::string argId() const 
std::string error() const 
void parse(int argc, char **argv)