27 #ifndef NIDAS_UTIL_SERIALPORT_H
28 #define NIDAS_UTIL_SERIALPORT_H
31 #include <sys/types.h>
41 namespace nidas {
namespace util {
163 void drain() throw(IOException);
197 virtual
int write(const
void *buf,
int len) throw(IOException);
216 static
int createPtyLink(const std::
string& linkname) throw(IOException);
char * _savebuf
Definition: SerialPort.h:235
void flushInput()
Do a tcflush() system call on the device.
Definition: SerialPort.cc:215
int _fd
Definition: SerialPort.h:227
Definition: SerialPort.h:231
bool _blocking
Definition: SerialPort.h:241
virtual int write(const void *buf, int len)
Definition: SerialPort.cc:302
void applyTermios()
Apply the Termios settings to an opened serial port.
Definition: SerialPort.cc:100
std::string _name
Definition: SerialPort.h:229
bool getBlocking()
Definition: SerialPort.cc:125
const std::string & getName() const
Get device name of the SerialPort.
Definition: SerialPort.h:94
void setName(const std::string &val)
Set device name of the SerialPort.
Definition: SerialPort.h:99
int getModemStatus()
Get the current state of the modem bits.
Definition: SerialPort.cc:137
SerialPort()
Definition: SerialPort.cc:48
virtual int readUntil(char *buf, int len, char term)
Read bytes until either the term character is read, or len-1 number of characters have been read...
Definition: SerialPort.cc:229
int timeoutOrEOF() const
Definition: SerialPort.h:179
int _savelen
Definition: SerialPort.h:237
Termios _termios
Definition: SerialPort.h:225
void clearModemBits(int val)
Clear the indicated modem bits.
Definition: SerialPort.cc:153
void drain()
Do a tcdrain() system call on the device.
Definition: SerialPort.cc:201
virtual ~SerialPort()
close the file descriptor if is is open.
Definition: SerialPort.cc:72
bool getCarrierDetect()
Definition: SerialPort.cc:167
void setModemStatus(int val)
Set the current state of the modem bits.
Definition: SerialPort.cc:146
Definition: SerialPort.h:43
enum nidas::util::SerialPort::state _state
int _savealloc
Definition: SerialPort.h:239
int len
Definition: sing.cc:934
virtual char readchar()
Do a buffered read and return character read.
Definition: SerialPort.cc:330
int fd
Definition: twod.c:56
virtual int read(char *buf, int len)
Definition: SerialPort.cc:312
Definition: IOException.h:37
state
Definition: SerialPort.h:231
void close()
close the file descriptor.
Definition: SerialPort.cc:79
int getFd() const
Definition: SerialPort.h:114
const Termios & getTermios() const
Readonly reference to Termios.
Definition: SerialPort.h:84
void flushBoth()
Definition: SerialPort.cc:222
virtual int readLine(char *buf, int len)
Do a readUntil with a newline terminator.
Definition: SerialPort.cc:296
static std::string modemFlagsToString(int modem)
Definition: SerialPort.cc:173
void setBlocking(bool val)
Definition: SerialPort.cc:106
A class providing get/set methods into a termios structure.
Definition: Termios.h:48
void setModemBits(int val)
Set the indicated modem bits.
Definition: SerialPort.cc:160
virtual int open(int mode=O_RDONLY)
open the serial port.
Definition: SerialPort.cc:89
Termios & termios()
Writable reference to the SerialPort's Termios.
Definition: SerialPort.h:79
Definition: SerialPort.h:231
char * _savep
Definition: SerialPort.h:233
static int createPtyLink(const std::string &linkname)
Static utility that creates a pseudo-terminal, returning the file descriptor of the master side and c...
Definition: SerialPort.cc:351
void flushOutput()
Do a tcflush() system call on the device.
Definition: SerialPort.cc:208