48 #ifndef _MIRA_SERIALPORT_H_ 49 #define _MIRA_SERIALPORT_H_ 52 #include <boost/asio/serial_port.hpp> 58 # define MIRA_ASIO_OPTION_STORAGE DCB 60 # define MIRA_ASIO_OPTION_STORAGE termios 119 typedef boost::asio::serial_port::parity
Parity;
120 typedef boost::asio::serial_port::stop_bits
StopBits;
131 #if BOOST_VERSION < 106600 132 SerialPort(boost::asio::io_service& service,
const std::string& device,
134 SerialPort(boost::asio::io_context& service,
const std::string& device,
137 mSerialPort(service, device)
139 setBaudrate(baudrate);
149 operator boost::asio::serial_port&()
155 operator const boost::asio::serial_port&()
const 161 boost::asio::serial_port&
port()
167 const boost::asio::serial_port&
port()
const 175 #if BOOST_VERSION < 104700 176 Baudrate baudrate(mSerialPort.native(), rate);
178 Baudrate baudrate(mSerialPort.native_handle(), rate);
180 mSerialPort.set_option(baudrate);
187 mSerialPort.set_option(
Parity(parity));
194 mSerialPort.set_option(
StopBits(stopbits));
221 #if BOOST_VERSION < 104700 222 explicit Baudrate(boost::asio::serial_port::native_type handle,
224 explicit Baudrate(boost::asio::serial_port::native_handle_type handle,
227 mHandle(handle), mRate(rate)
235 boost::system::error_code& ec)
const;
237 boost::system::error_code& ec)
239 ec = boost::system::error_code();
243 #if BOOST_VERSION < 104700 244 boost::asio::serial_port::native_type mHandle;
246 boost::asio::serial_port::native_handle_type mHandle;
virtual ~SerialPort()
The destructor.
Definition: SerialPort.h:143
This class acts as a wrapper to boost::asio::serial_port.
Definition: SerialPort.h:116
Typedefs for OS independent basic data types.
#define MIRA_ASIO_OPTION_STORAGE
Definition: SerialPort.h:60
boost::asio::serial_port::parity Parity
Definition: SerialPort.h:119
const boost::asio::serial_port & port() const
Access to the underlying boost::asio::serial_port object.
Definition: SerialPort.h:167
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
SerialPort & setParity(Parity::type parity)
Set a new parity.
Definition: SerialPort.h:185
SerialPort(boost::asio::io_service &service, const std::string &device, uint32 baudrate)
Construct a new serial port with the given I/O service.
Definition: SerialPort.h:132
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
SerialPort & setStopBits(StopBits::type stopbits)
Set a new stop bits configuration.
Definition: SerialPort.h:192
uint32 rate() const
Definition: SerialPort.h:229
boost::asio::serial_port mSerialPort
The underlying boost::asio::serial_port object.
Definition: SerialPort.h:214
Baudrate(boost::asio::serial_port::native_type handle, uint32 rate=0)
Definition: SerialPort.h:222
boost::asio::serial_port::character_size CharacterSize
Definition: SerialPort.h:122
boost::system::error_code load(const MIRA_ASIO_OPTION_STORAGE &storage, boost::system::error_code &ec)
Definition: SerialPort.h:236
SerialPort & setDataBits(uint32 databits)
Set a new data bits configuration.
Definition: SerialPort.h:199
An internal class for handling the baudrate.
Definition: SerialPort.h:218
boost::asio::serial_port::stop_bits StopBits
Definition: SerialPort.h:120
SerialPort & setFlowControl(FlowControl::type flowcontrol)
Set a new flow control (handshake) configuration.
Definition: SerialPort.h:206
SerialPort & setBaudrate(uint32 rate)
Set a new baudrate.
Definition: SerialPort.h:173
boost::asio::serial_port::flow_control FlowControl
Definition: SerialPort.h:121
boost::asio::serial_port & port()
Access to the underlying boost::asio::serial_port object.
Definition: SerialPort.h:161