class ugcs::vsm::Serial_processor::Stream::Mode

Overview

Communication mode parameters for a serial port. More…

#include <serial_processor.h>

class Mode
{
public:
    // methods

    Mode& Baud(int baud);
    Mode& Char_size(int size);
    Mode& Stop_bit(bool enable);
    Mode& Parity_check(bool enable);
    Mode& Parity(bool is_odd);
    Mode& Read_timeout(std::chrono::milliseconds timeout);
    int Get_baud() const;
    int Get_char_size() const;
    bool Get_stop_bit() const;
    bool Get_parity_check() const;
    bool Get_parity() const;
};

Detailed Documentation

Communication mode parameters for a serial port.

Methods

Mode& Baud(int baud)

Set baud rate.

Parameters:

baud

Baud rate. The value is rounded to the closest allowed one.

Mode& Char_size(int size)

Set character size.

Parameters:

size

Character size in bits.

Mode& Stop_bit(bool enable)

Set number of stop bits.

Parameters:

enable

Two stop bits if “true”, one stop bit otherwise.

Mode& Parity_check(bool enable)

Set parity check/generation mode.

Parameters:

enable

Enable parity check on input and generation on output when “true”.

Mode& Parity(bool is_odd)

Set parity mode.

Parameters:

is_odd

If “true”, then parity for input and output is odd; otherwise even parity is used.

Mode& Read_timeout(std::chrono::milliseconds timeout)

Set read timeout.

It specifies the minimum amount of time to wait for data, if maximum number of requested bytes is not received. Note that maximum supported value is platform specific.

Parameters:

timeout

Read timeout.

Invalid_param_exception

if negative timeout is specified.