30 #ifndef PT_SYSTEM_SERIALDEVICE_H
31 #define PT_SYSTEM_SERIALDEVICE_H
33 #include <Pt/System/Api.h>
34 #include <Pt/System/IODevice.h>
75 class SerialDeviceImpl* _impl;
97 BaudRate19200 = 19200,
98 BaudRate38400 = 38400,
99 BaudRate57600 = 57600,
100 BaudRate115200 = 115200
102 , BaudRate230400 = 230400
139 SerialDevice(
const std::string& file, std::ios::openmode mode);
143 SerialDevice(
const char* file, std::ios::openmode mode);
150 void open(
const std::string& file, std::ios::openmode mode);
154 void open(
const char* file, std::ios::openmode mode);
157 void setBaudRate(
unsigned rate );
160 unsigned baudRate()
const;
163 void setCharSize(
int size );
166 int charSize()
const;
169 void setStopBits( StopBits bits );
172 StopBits stopBits()
const;
175 void setParity( Parity parity );
178 Parity parity()
const;
181 void setFlowControl( FlowControl flowControl );
184 FlowControl flowControl()
const;
187 void setRts(
bool on);
189 void setDtr(
bool on);
191 void setBreak(
bool on);
193 void sendBreak(
int duration = 0);
204 void onSetTimeout(std::size_t timeout);
207 std::size_t onBeginRead(
EventLoop& loop,
char* buffer, std::size_t n,
bool& eof);
210 std::size_t onEndRead(
EventLoop& loop,
char* buffer, std::size_t n,
bool& eof);
213 std::size_t onBeginWrite(
EventLoop& loop,
const char* buffer, std::size_t n);
216 std::size_t onEndWrite(
EventLoop& loop,
const char* buffer, std::size_t n);
219 std::size_t onRead(
char* buffer, std::size_t count,
bool& eof);
222 std::size_t onWrite(
const char* buffer, std::size_t count);
238 #endif // PT_SYSTEM_SERIALDEVICE_H
Parity
Parity values.
Definition: SerialDevice.h:108
BaudRate
Baud rates.
Definition: SerialDevice.h:81
Endpoint for I/O operations.
Definition: IODevice.h:55
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:72
StopBits
Stop bits values.
Definition: SerialDevice.h:126
Serial device.
Definition: SerialDevice.h:72
uint_type uint32_t
Unsigned 32-bit integer type.
Definition: Types.h:42
FlowControl
Flow control values.
Definition: SerialDevice.h:117