30#ifndef PT_SYSTEM_SERIALDEVICE_H
31#define PT_SYSTEM_SERIALDEVICE_H
33#include <Pt/System/Api.h>
34#include <Pt/System/IODevice.h>
71 class SerialDeviceImpl* _impl;
93 BaudRate19200 = 19200,
94 BaudRate38400 = 38400,
95 BaudRate57600 = 57600,
96 BaudRate115200 = 115200
98 , BaudRate230400 = 230400
146 void open(
const std::string& file, std::ios::openmode mode);
150 void open(
const char* file, std::ios::openmode mode);
215 void onSetTimeout(std::size_t timeout);
218 std::size_t onBeginRead(
EventLoop&
loop,
char* buffer, std::size_t n,
bool& eof);
221 std::size_t onEndRead(
EventLoop&
loop,
char* buffer, std::size_t n,
bool& eof);
224 std::size_t onBeginWrite(
EventLoop&
loop,
const char* buffer, std::size_t n);
227 std::size_t onEndWrite(
EventLoop&
loop,
const char* buffer, std::size_t n);
230 std::size_t onRead(
char* buffer, std::size_t count,
bool& eof);
233 std::size_t onWrite(
const char* buffer, std::size_t count);
Event loop of a thread or process.
Definition EventLoop.h:83
IODevice()
Default Constructor.
EventLoop * loop() const
Returns the used event loop.
Definition IODevice.h:240
void open(const char *file, std::ios::openmode mode)
Open the specified device file.
SerialDevice()
Default constructor.
void sendBreak(int duration=0)
Sends a break condition.
SerialDevice(const std::string &file, std::ios::openmode mode)
Constructs a serial device and open the specified device file.
StopBits
Stop bits values.
Definition SerialDevice.h:123
int charSize() const
Gets the current char size.
void setCharSize(int size)
Sets the char size.
StopBits stopBits() const
Gets the current number of stop bits.
void setFlowControl(FlowControl flowControl)
Sets the flow control kind.
void onCancel()
Blocks until operation has cancelled.
bool onRun()
Check if ready and run.
void setBreak(bool on)
Sets or clears a break condition.
BaudRate
Baud rates.
Definition SerialDevice.h:78
FlowControl flowControl() const
Gets the current flow control kind.
void setParity(Parity parity)
Sets the parity.
void open(const std::string &file, std::ios::openmode mode)
Open the specified device file.
void setBaudRate(unsigned rate)
Sets the baud rate.
Parity
Parity values.
Definition SerialDevice.h:105
unsigned baudRate() const
Gets the baud rate.
void clear()
Clears pending error flags.
bool isCts() const
Returns true if CTS is asserted.
Parity parity() const
Gets the current parity.
void setDtr(bool on)
Sets the DTR control line.
bool isDsr() const
Returns true if DSR is asserted.
void setStopBits(StopBits bits)
Sets the number of stop bits.
virtual ~SerialDevice()
Destructor.
FlowControl
Flow control values.
Definition SerialDevice.h:114
SerialDevice(const char *file, std::ios::openmode mode)
Constructs a serial device and open the specified device file.
void setRts(bool on)
Sets the RTS control line.
uint_type uint32_t
Unsigned 32-bit integer type.
Definition Api-Types.h:52
System programming
Definition Connection.h:26
Core module.
Definition Allocator.h:33