MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Core::SerialSpec Struct Reference

What a serial device is: its line setup, framing and parsing, as a plain value. More...

#include <SerialSpec.hpp>

Collaboration diagram for MayaFlux::Core::SerialSpec:

Public Member Functions

SerialSpec baud (uint32_t rate) const
SerialSpec bytes () const
SerialSpec data_bits (uint8_t bits) const
std::vector< uint8_t > delimiter () const
 The terminator of DELIMITED framing, LF when none was given.
SerialSpec dtr_on_open (bool level) const
SerialSpec flow_control (SerialFlowControl value) const
SerialSpec max_message (size_t bytes) const
 The longest message in bytes.
SerialSpec numbers () const
SerialSpec parity (SerialParity value) const
SerialSpec parse_with (SerialParser parser_function) const
SerialSpec rts_on_open (bool level) const
SerialSpec settle_ms (uint32_t milliseconds) const
 How long the port stays unread after it opens, for boards that restart on open.
SerialSpec stop_bits (SerialStopBits value) const

Static Public Member Functions

static SerialSpec cobs ()
static SerialSpec delimited (std::string_view terminator)
 Messages ended by terminator, of one or more bytes.
static SerialSpec from (const SerialLineSettings &line, const SerialProtocolSettings &protocol)
 The spec a configured port describes.
static SerialSpec idle_gap (std::chrono::milliseconds gap)
 Messages ended by gap of silence.
static SerialSpec lines ()
static SerialSpec midi ()
 A MIDI byte stream at 31250 baud: channel voice messages and real-time bytes.
static SerialSpec raw ()
static SerialSpec slip ()

Public Attributes

SerialFraming framing { SerialFraming::LINES }
std::chrono::milliseconds gap { 2 }
SerialLineSettings line
size_t message_limit { 4096 }
SerialParse parse { SerialParse::NUMBERS }
SerialParser parser
std::vector< uint8_t > terminator

Detailed Description

What a serial device is: its line setup, framing and parsing, as a plain value.

Start from a framing factory and refine with the chained setters, each of which returns a changed copy.

const auto board = SerialSpec::lines().baud(115200).dtr_on_open(false).settle_ms(1500);
const auto din = SerialSpec::midi();
const auto frames = SerialSpec::cobs().baud(921600).parse_with(
[](Transitive::Protocol::Message m) -> std::optional<InputValue> { return {}; });
std::span< const uint8_t > Message
One complete message.
Definition Framing.hpp:8
static SerialSpec cobs()
SerialSpec parse_with(SerialParser parser_function) const
static SerialSpec midi()
A MIDI byte stream at 31250 baud: channel voice messages and real-time bytes.
SerialSpec settle_ms(uint32_t milliseconds) const
How long the port stays unread after it opens, for boards that restart on open.
SerialSpec baud(uint32_t rate) const
static SerialSpec lines()
SerialSpec dtr_on_open(bool level) const

Definition at line 30 of file SerialSpec.hpp.


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