MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ send_framed()

bool MayaFlux::Core::SerialDevice::send_framed ( std::span< const uint8_t > message)

Send one message framed the way the spec reads them.

Returns
false when the port is not open or the message cannot be framed, such as an LF inside a line.

Definition at line 89 of file SerialDevice.cpp.

90{
91 std::vector<uint8_t> out;
92 out.reserve(message.size() + 4);
93
94 switch (m_spec.framing) {
96 if (!P::encode_line(message, out)) {
97 return false;
98 }
99 break;
101 if (!P::encode_delimited(message, m_spec.delimiter(), out)) {
102 return false;
103 }
104 break;
106 P::encode_cobs(message, out);
107 break;
109 P::encode_slip(message, out);
110 break;
113 out.assign(message.begin(), message.end());
114 break;
115 }
116
117 return m_link->write(out);
118}
std::unique_ptr< ISerialLink > m_link

References MayaFlux::Core::COBS, MayaFlux::Core::DELIMITED, MayaFlux::Core::IDLE_GAP, MayaFlux::Core::LINES, m_link, m_spec, MayaFlux::Core::RAW, and MayaFlux::Core::SLIP.

Referenced by operator=().

Here is the caller graph for this function: