cobs_codec 1.1.0
cobs_codec: ^1.1.0 copied to clipboard
Consistent Overhead Byte Stuffing (COBS) and COBS/R codecs for zero-free, low-overhead framing of serial, UART and packet byte streams.
Changelog #
All notable changes to this package are documented here. This project adheres to Semantic Versioning.
1.1.0 #
Added #
- Configurable sentinel byte for both COBS and COBS/R:
cobsEncodeWithSentinel/cobsDecodeWithSentinelandcobsrEncodeWithSentinel/cobsrDecodeWithSentinelencode to avoid an arbitrary delimiter byte instead of0x00(by XORing the finished encoding with the sentinel).sentinel == 0is byte-for-byte identical to the plain codecs. - In-place basic-COBS decoding:
cobsDecodeInPlaceandcobsDecodeInPlaceWithSentineldecode within the caller'sUint8Listand return the decoded length, needing no output buffer and with no "output too small" case (COBS decoding never expands). - Sentinel framing:
cobsFrame,cobsUnframe,CobsFrameEncoderandCobsFrameDecodergain an optionalsentinelparameter (defaulting to the0x00cobsDelimiter) so a non-zero byte can delimit frames on the wire, for both the basic and reduced codecs.
1.0.0 #
Initial release.
Added #
- Basic COBS encoding and decoding: the cobs codec plus the
cobsEncodeandcobsDecodefunctions. - COBS/R (Reduced) encoding and decoding: the
cobsrcodec plus thecobsrEncodeandcobsrDecodefunctions. COBS/R often removes the trailing overhead byte for smaller messages. dart:convertintegration:CobsCodec/CobsrCodecextendCodec, and the encoders/decoders extendConverterwith chunked-conversion support, so they compose withfuse,Stream.transform, and other codecs.- Stream framing for
0x00-delimited links (serial, UART, USB-CDC):cobsFrame,cobsUnframe, and theCobsFrameEncoder/CobsFrameDecoderstream transformers.CobsFrameDecoderreassembles packets across arbitrary chunk boundaries, propagates pause/resume/cancel to the source (even during a delimiter-less run), supports amaxFrameLengthbound against unbounded buffering on a noisy or malicious link, and offers configurable handling of empty and malformed frames. - Size helpers:
encodingOverheadandmaxEncodedLengthfor buffer pre-allocation. - Extensive test suite, including the golden vectors from the reference COBS and COBS/R implementations.