Go to the documentation of this file.
107 int baudRate,
int parity = 0,
int bits = 8,
int nStopBits = 1,
108 bool enableFlowControl =
false );
114 int ReadIntervalTimeout,
int ReadTotalTimeoutMultiplier,
115 int ReadTotalTimeoutConstant,
int WriteTotalTimeoutMultiplier,
116 int WriteTotalTimeoutConstant);
124 size_t Read (
void * Buffer,
size_t Count);
139 const int total_timeout_ms = -1,
bool * out_timeout =
nullptr ,
140 const char * eol_chars =
"\r\n" );
143 size_t Write (
const void * Buffer,
size_t Count)
override ;
bool isOpen() const
Returns if port has been correctly open.
void close()
Close the port.
uint64_t getPosition() const override
not applicable in a serial port
A high-performance stopwatch, with typical resolution of nanoseconds.
size_t Read(void *Buffer, size_t Count)
Implements the virtual method responsible for reading from the stream - Unlike CStream::ReadBuffer,...
A communications serial port built as an implementation of a utils::CStream.
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CSerialPort()
Default constructor: it does not open any port - later you must call "setSerialPortName" and then "op...
uint64_t Seek(int64_t off, CStream::TSeekOrigin o=sFromBeginning) override
not applicable in a serial port
void purgeBuffers()
Purge tx and rx buffers.
uint64_t getTotalBytesCount() const override
not applicable in a serial port
void setConfig(int baudRate, int parity=0, int bits=8, int nStopBits=1, bool enableFlowControl=false)
Changes the configuration of the port.
unsigned __int64 uint64_t
int m_interBytesTimeout_ms
void open()
Open the port.
mrpt::system::CTicTac m_timer
std::string ReadString(const int total_timeout_ms=-1, bool *out_timeout=nullptr, const char *eol_chars="\r\n")
Reads one text line from the serial port in POSIX "canonical mode".
void setTimeouts(int ReadIntervalTimeout, int ReadTotalTimeoutMultiplier, int ReadTotalTimeoutConstant, int WriteTotalTimeoutMultiplier, int WriteTotalTimeoutConstant)
Changes the timeouts of the port, in milliseconds.
GLsizei const GLchar ** string
void setSerialPortName(const std::string &COM_name)
Sets the serial port to open (it is an error to try to change this while open yet).
friend class PosixSignalDispatcherImpl
std::string m_serialName
The complete name of the serial port device (i.e.
virtual ~CSerialPort()
Destructor.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST