35#ifndef SERIAL_INCLUDED
36#define SERIAL_INCLUDED
45#include <sigc++/sigc++.h>
181 explicit Serial(
const std::string& serial_port);
244 int write(
const char *buf,
size_t count)
246 return ::write(fd, buf, count);
321 const std::string serial_port;
325 struct termios port_settings;
A class for using asyncronous serial communications.
bool open(bool flush=false)
Open the serial port.
Flow
A type that defines the possible choices for flow control.
@ FLOW_NONE
No flow control in use.
@ FLOW_HW
Use hardware flow control.
@ FLOW_XONOFF
Use software (XON/XOFF) flow control.
Serial(const std::string &serial_port)
Constuctor.
bool setParams(int speed, Parity parity, int bits, int stop_bits, Flow flow)
Setup the serial port communications parameters.
bool close(void)
Close a previously opened serial port.
sigc::signal< void, char *, int > charactersReceived
A signal that is emitted when there is data to read.
Pin
A type that defines the read/write pins in the serial port.
@ PIN_DTR
Output: Data Terminal Ready.
@ PIN_CTS
Input: Clear To Send.
@ PIN_DCD
Input: Data Carrier Detect.
@ PIN_RI
Input: Ring Indicate.
@ PIN_RTS
Output: Request To Send.
@ PIN_DSR
Input: Data Set Ready.
int write(const char *buf, size_t count)
Write data to the serial port.
Parity
A type that defines the possible choices for parity.
@ PARITY_ODD
Use odd parity.
@ PARITY_NONE
Parity not used.
@ PARITY_EVEN
Use even parity.
bool setPin(Pin pin, bool set)
Set the state of one of the output pins in the serial port.
static const int READ_BUFSIZE
The maximum number of characters that can be read at once.
bool stopInput(bool stop)
Stop/start input of data.
bool setCanonical(bool canonical)
Set or clear canonical mode.
bool getPin(Pin pin, bool &is_set)
Get the state of one of the input pins in the serial port.
Namespace for the asynchronous programming classes.