Goby v2
Public Member Functions | List of all members
goby::util::SerialClient Class Reference

provides a basic client for line by line text based communications over a 8N1 tty (such as an RS-232 serial link) without flow control More...

#include <goby/util/linebasedcomms/serial_client.h>

Inheritance diagram for goby::util::SerialClient:
Inheritance graph
[legend]

Public Member Functions

 SerialClient (const std::string &name="", unsigned baud=9600, const std::string &delimiter="\r\n")
 create a serial client More...
 
void set_name (const std::string &name)
 set serial port name, e.g. "/dev/ttyS0"
 
void set_baud (unsigned baud)
 baud rate, e.g. 4800
 
std::string name () const
 serial port name, e.g. "/dev/ttyS0"
 
unsigned baud () const
 baud rate, e.g. 4800
 
boost::asio::serial_port & socket ()
 
std::string local_endpoint ()
 our serial port, e.g. "/dev/ttyUSB1"
 
std::string remote_endpoint ()
 who knows where the serial port goes?! (empty string)
 
- Public Member Functions inherited from goby::util::LineBasedInterface
 LineBasedInterface (const std::string &delimiter)
 
void start ()
 
void close ()
 
bool active ()
 
void sleep (int sec)
 
bool readline (std::string *s, AccessOrder order=OLDEST_FIRST)
 returns string line (including delimiter) More...
 
bool readline (protobuf::Datagram *msg, AccessOrder order=OLDEST_FIRST)
 
void write (const std::string &s)
 
void write (const protobuf::Datagram &msg)
 
void clear ()
 
void set_delimiter (const std::string &s)
 
std::string delimiter () const
 
boost::asio::io_service & io_service ()
 
- Public Member Functions inherited from goby::util::LineBasedConnection< boost::asio::serial_port >
 LineBasedConnection (LineBasedInterface *interface)
 
void read_start ()
 
void write_start ()
 
void read_complete (const boost::system::error_code &error)
 
void write_complete (const boost::system::error_code &error)
 
std::deque< protobuf::Datagram > & out ()
 

Additional Inherited Members

- Public Types inherited from goby::util::LineBasedInterface
enum  AccessOrder { NEWEST_FIRST, OLDEST_FIRST }
 
- Protected Member Functions inherited from goby::util::LineBasedClient< boost::asio::serial_port >
 LineBasedClient (const std::string &delimiter, int retry_interval=10)
 
void do_start ()
 
void do_write (const protobuf::Datagram &line)
 
void do_close (const boost::system::error_code &error)
 
void socket_close (const boost::system::error_code &error)
 
- Protected Member Functions inherited from goby::util::LineBasedInterface
void set_active (bool active)
 
std::string & delimiter ()
 
std::deque< goby::util::protobuf::Datagram > & in ()
 
boost::mutex & in_mutex ()
 
- Protected Attributes inherited from goby::util::LineBasedInterface
std::string delimiter_
 
boost::asio::io_service io_service_
 
std::deque< protobuf::Datagramin_
 
boost::mutex in_mutex_
 

Detailed Description

provides a basic client for line by line text based communications over a 8N1 tty (such as an RS-232 serial link) without flow control

Definition at line 35 of file serial_client.h.

Constructor & Destructor Documentation

goby::util::SerialClient::SerialClient ( const std::string &  name = "",
unsigned  baud = 9600,
const std::string &  delimiter = "\r\n" 
)

create a serial client

Parameters
namename of the serial connection (e.g. "/dev/ttyS0")
baudbaud rate of the serial connection (e.g. 9600)
delimiterstring used to split lines

Definition at line 29 of file serial_client.cpp.


The documentation for this class was generated from the following files: