105 int baudRate,
int parity = 0,
int bits = 8,
int nStopBits = 1,
106 bool enableFlowControl =
false);
112 int ReadIntervalTimeout,
int ReadTotalTimeoutMultiplier,
113 int ReadTotalTimeoutConstant,
int WriteTotalTimeoutMultiplier,
114 int WriteTotalTimeoutConstant);
122 size_t Read(
void* Buffer,
size_t Count);
137 const int total_timeout_ms = -1,
bool* out_timeout =
nullptr,
138 const char* eol_chars =
"\r\n");
141 size_t Write(
const void* Buffer,
size_t Count)
override;
A communications serial port built as an implementation of a utils::CStream.
bool isOpen() const
Returns if port has been correctly open.
void open()
Open the port.
void setConfig(int baudRate, int parity=0, int bits=8, int nStopBits=1, bool enableFlowControl=false)
Changes the configuration of the port.
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".
mrpt::system::CTicTac m_timer
CSerialPort()
Default constructor: it does not open any port - later you must call "setSerialPortName" and then "op...
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
uint64_t Seek(int64_t off, CStream::TSeekOrigin o=sFromBeginning) override
not applicable in a serial port
size_t Read(void *Buffer, size_t Count)
Implements the virtual method responsible for reading from the stream - Unlike CStream::ReadBuffer,...
uint64_t getTotalBytesCount() const override
not applicable in a serial port
void purgeBuffers()
Purge tx and rx buffers.
void close()
Close the port.
std::string m_serialName
The complete name of the serial port device (i.e.
void setTimeouts(int ReadIntervalTimeout, int ReadTotalTimeoutMultiplier, int ReadTotalTimeoutConstant, int WriteTotalTimeoutMultiplier, int WriteTotalTimeoutConstant)
Changes the timeouts of the port, in milliseconds.
int m_interBytesTimeout_ms
virtual ~CSerialPort()
Destructor.
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
uint64_t getPosition() const override
not applicable in a serial port
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A high-performance stopwatch, with typical resolution of nanoseconds.
GLsizei const GLchar ** string
Serial and networking devices and utilities.
unsigned __int64 uint64_t