Incrementally COBS-encodes a frame of arbitrary length through a small output buffer (StreamerBuffer<> or a caller-provided ByteSpan).
Feed payload chunks into Write(). Whenever Write() returns a non-empty unconsumed remainder, transmit Flush() before calling Write() again. Once all payload chunks have been written, transmit Finish() to complete the frame:
while (!seg.empty()) {
seg = streamer.
Write(seg);
if (!seg.empty()) {
WriteToUart(streamer.
Flush());
}
}
}
WriteToUart(streamer.
Finish());
ConstByteSpan Write(ConstByteSpan data)