59 using ecl::MilliSleep;
    69         Writer(Serial *serial_device, 
bool timestamps = 
false) :
    96                         if ( fgets(buffer,80,stdin) == NULL ) {
   106                         std::cout << std::endl;
   107                         serial->write(&hex_values[0],hex_values.size());
   108                         if ( display_timestamps ) {
   110                                 std::cout << 
"[" << timestamp << 
"]"  << std::endl;
   120         Reader(Serial *serial_device, 
bool timestamps = 
false) :
   133                 unsigned long ch_read;
   136                         ch_read = 
serial->read(s,1);
   141                                         std::cout << 
"[" << time << 
"] ";
   143                                 for (
unsigned int i = 0; i < ch_read; ++i) {
   146                                 std::cout << std::endl;
   174 int main(
int argc, 
char** argv) {
   181     bool timestamps(
false);
   184         CmdLine cmd(
"This is a simple interface for reading/echoing from a serial port [115.2k,8N1].",
' ',
"0.1");
   185         ValueArg<string> arg_port(
"p",
"port",
"Port to connect to",
false,
"/dev/ttyS0",
"string");
   186         ValueArg<string> arg_baud(
"b",
"baud",
"Baud rate (9600,38400,115200) [115200]",
false,
"115200",
"string");
   187         SwitchArg switch_timestamps(
"t",
"timestamps",
"Print timestamps.",
false);
   191         cmd.
add(switch_timestamps);
   192         cmd.
parse(argc,argv);
   196         timestamps = switch_timestamps.
getValue();
   198         if ( baud == 
"9600" ) {
   200         } 
else if ( baud == 
"38400" ) {
   207         std::cerr << 
"error: " << e.
error() << 
" for arg " << e.
argId() << std::endl;
   215         Reader reader(&serial,timestamps);
   216         Writer writer(&serial,timestamps);
   221         std::cout << e.
what() << std::endl;
 
Writer(Serial *serial_device, bool timestamps=false)
int main(int argc, char **argv)
const char * what() const 
Format< char > hex_format
Format< unsigned char > hex_format
Reader(Serial *serial_device, bool timestamps=false)
std::string argId() const 
Converter< vector< char > > toByteArray
std::string error() const 
void parse(int argc, char **argv)