11 #ifndef _UGCS_VSM_SERIAL_PROCESSOR_H_
12 #define _UGCS_VSM_SERIAL_PROCESSOR_H_
80 parity_check = enable;
106 if (timeout.count() < 0) {
107 VSM_EXCEPTION(Invalid_param_exception,
"Negative timeout specified.");
109 read_timeout = timeout;
120 Get_char_size()
const
132 Get_parity_check()
const
148 bool stop_bit =
false;
149 bool parity_check =
false;
151 std::chrono::milliseconds read_timeout = std::chrono::milliseconds(100);
162 const std::string& port_name,
164 Native_handle::Unique_ptr&& native_handle);
174 template <
typename... Args>
178 return singleton.Get_instance(std::forward<Args>(args)...);
201 Open(
const std::string &port_name,
const Stream::Mode &mode = Stream::Mode());
209 static std::list<std::string>
213 static const uint8_t MAX_VMIN;
221 Open_native_handle(
const std::string &port_name,
const Stream::Mode &mode);
Mode & Stop_bit(bool enable)
Set number of stop bits.
Definition: serial_processor.h:66
Mode & Baud(int baud)
Set baud rate.
Definition: serial_processor.h:44
Mode & Parity(bool is_odd)
Set parity mode.
Definition: serial_processor.h:90
Reference_guard< Ptr > Ref
Reference type.
Definition: serial_processor.h:31
Stream::Ref Open(const std::string &port_name, const Stream::Mode &mode=Stream::Mode())
Open serial port for communication.
Mode & Parity_check(bool enable)
Set parity check/generation mode.
Definition: serial_processor.h:78
Mode & Char_size(int size)
Set character size.
Definition: serial_processor.h:55
Communication mode parameters for a serial port.
Definition: serial_processor.h:34
Abstract I/O stream interface.
Definition: io_stream.h:66
static std::list< std::string > Enumerate_port_names()
Platform-specific enumeration of available serial ports.
std::unique_ptr< Native_handle > Unique_ptr
Unique pointer type.
Definition: file_processor.h:112
Generic container for queued requests.
Definition: request_container.h:30
std::shared_ptr< Serial_processor > Ptr
Pointer type.
Definition: serial_processor.h:22
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25
static Ptr Get_instance(Args &&...args)
Get global or create new processor instance.
Definition: serial_processor.h:176
Reference guard objects keep references for managed objects.
Definition: reference_guard.h:31
Stream which represents opened serial port.
Definition: serial_processor.h:26
std::shared_ptr< File_processor > Ptr
Pointer type.
Definition: file_processor.h:32
Logging functionality for VSM.
Helper class for implementing singletons.
Definition: singleton.h:69
std::shared_ptr< Stream > Ptr
Pointer type.
Definition: file_processor.h:52
#define VSM_EXCEPTION(__exc_class, __msg,...)
Throw VSM exception instance.
Definition: exception.h:168
Mode & Read_timeout(std::chrono::milliseconds timeout)
Set read timeout.
Definition: serial_processor.h:104
Processor for working with filesystem I/O.
Definition: file_processor.h:31
Processor for handling file I/O.
Serial ports I/O processor.
Definition: serial_processor.h:21