Go to the documentation of this file.
31 #include <sys/ioctl.h>
36 #if defined(__linux__)
37 #include <linux/serial.h>
38 #elif defined(__MACH__)
39 #include <AvailabilityMacros.h>
40 #include <mach/clock.h>
41 #include <mach/mach.h>
42 #if defined(MAC_OS_X_VERSION_10_3) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3)
43 #include <IOKit/serial/ioss.h>
48 #define TIOCINQ FIONREAD
50 #define TIOCINQ 0x541B
59 inline std::string escape(
const std::string &str) {
61 std::regex_search(str, match, std::regex(R
"(^\\\\.\\)"));
63 return R
"(\\.\)" + str;
84 bool waitReadable(std::chrono::milliseconds timeout_ms)
const;
86 bool waitWritable(std::chrono::milliseconds timeout_ms)
const;
90 size_t read(uint8_t *buf,
size_t size = 1);
92 size_t write(
const uint8_t *data,
size_t size);
104 void setModemStatus(uint32_t request, uint32_t command = 0)
const;
106 void setRTS(
bool level)
const;
108 void setDTR(
bool level)
const;
122 void setPort(
const std::string &port);
170 #endif // SERIAL_IMPL_H
void setPort(const std::string &port)
void waitByteTimes(size_t count) const
void sendBreak(int duration_ms) const
stopbits_t getStopbits() const
std::string getPort() const
void setBaudrate(unsigned long baudrate)
void setDTR(bool level) const
bool waitReadable(std::chrono::milliseconds timeout_ms) const
void setBytesize(bytesize_t bytesize)
void setModemStatus(uint32_t request, uint32_t command=0) const
unsigned long getBaudrate() const
flowcontrol_t flowcontrol_
size_t read(uint8_t *buf, size_t size=1)
Timeout getTimeout() const
void setRTS(bool level) const
void setFlowcontrol(flowcontrol_t flowcontrol)
bool waitWritable(std::chrono::milliseconds timeout_ms) const
uint32_t getModemStatus() const
void setParity(parity_t parity)
void setBreak(bool level) const
void setStopbits(stopbits_t stopbits)
size_t write(const uint8_t *data, size_t size)
bytesize_t getBytesize() const
SerialImpl(std::string port, unsigned long baudrate, Timeout timeout, bytesize_t bytesize, parity_t parity, stopbits_t stopbits, flowcontrol_t flowcontrol)
parity_t getParity() const
void waitForModemChanges() const
flowcontrol_t getFlowcontrol() const
void setTimeout(const Timeout &timeout)
qb_device_driver
Author(s): qbroboticsĀ®
autogenerated on Thu Apr 27 2023 02:36:32