# serial: serial::Timeout Struct Reference

serial 1.0.1 Cross-platform serial port library written in C++

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Data Fields

All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Defines
Public Member Functions | Static Public Member Functions | Data Fields
serial::Timeout Struct Reference

`#include <serial.h>`

## Public Member Functions

| Timeout (uint32_t inter_byte_timeout_=0, uint32_t read_timeout_constant_=0, uint32_t read_timeout_multiplier_=0, uint32_t write_timeout_constant_=0, uint32_t write_timeout_multiplier_=0)

## Static Public Member Functions

static uint32_t | max ()
static Timeout | simpleTimeout (uint32_t timeout)

## Data Fields

uint32_t | inter_byte_timeout
uint32_t | read_timeout_constant
uint32_t | read_timeout_multiplier
uint32_t | write_timeout_constant
uint32_t | write_timeout_multiplier

## Detailed Description

Structure for setting the timeout of the serial port, times are in milliseconds.

In order to disable the interbyte timeout, set it to Timeout::max().

## Constructor & Destructor Documentation

serial::Timeout::Timeout | ( | uint32_t | inter_byte_timeout_ = `0`,
|  | uint32_t | read_timeout_constant_ = `0`,
|  | uint32_t | read_timeout_multiplier_ = `0`,
|  | uint32_t | write_timeout_constant_ = `0`,
|  | uint32_t | write_timeout_multiplier_ = `0`
| ) |  | `[inline, explicit]`

      : inter_byte_timeout(inter_byte_timeout_),
        read_timeout_constant(read_timeout_constant_),
        read_timeout_multiplier(read_timeout_multiplier_),
        write_timeout_constant(write_timeout_constant_),
        write_timeout_multiplier(write_timeout_multiplier_)
      {}

## Member Function Documentation

static uint32_t serial::Timeout::max | ( |  | ) | `[inline, static]`

    {return std::numeric_limits<uint32_t>::max();}

static Timeout serial::Timeout::simpleTimeout | ( | uint32_t | timeout | ) | `[inline, static]`

Convenience function to generate Timeout structs using a single absolute timeout.

Parameters:

  timeout | A long that defines the time in milliseconds until a timeout occurs after a call to read or write is made.

Returns:
  Timeout struct that represents this simple timeout provided.

                                                     {
        return Timeout(max(), timeout, 0, timeout, 0);
      }

## Field Documentation

uint32_t serial::Timeout::inter_byte_timeout

Number of milliseconds between bytes received to timeout on.

uint32_t serial::Timeout::read_timeout_constant

A constant number of milliseconds to wait after calling read.

uint32_t serial::Timeout::read_timeout_multiplier

A multiplier against the number of requested bytes to wait after calling read.

uint32_t serial::Timeout::write_timeout_constant

A constant number of milliseconds to wait after calling write.

uint32_t serial::Timeout::write_timeout_multiplier

A multiplier against the number of requested bytes to wait after calling write.

The documentation for this struct was generated from the following file:

- include/serial/serial.h