dle-encoder 0.1.4

DLE ASCII encoder and transport layer for Rust
Documentation
  • Coverage
  • 55.56%
    10 out of 18 items documented4 out of 8 items with examples
  • Size
  • Source code size: 43.93 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.07 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • robamu-org/rs-dle-encoder
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • robamu

Crates.io Package docs.rs

DLE Encoder for Rust

This encoder provides a simple ASCII transport layer for serial data. It uses the C0 and C1 ASCII control characters for this. You can find a C++ implementation here and a Python implementation here.

Encoder Modes

Escaped mode

The encoded stream starts with a STX marker and ends with an ETX marker. STX and ETX occurrences in the stream are escaped and internally encoded as well so the receiver side can simply check for STX and ETX markers as frame delimiters. When using a strictly char based reception of packets encoded with DLE, STX can be used to notify a reader that actual data will start to arrive while ETX can be used to notify the reader that the data has ended.

Example:

[0, STX, DLE] -> [STX, 0, 0, DLE, STX + 0x40, DLE, DLE, ETX]

Non-escaped mode

The encoded stream starts with DLE STX and ends with DLE ETX. All DLE occurrences in the stream are escaped with DLE. If the receiver detects a DLE char, it needs to read the next char to determine whether a start (STX) or end (ETX) of a frame has been detected.

Example:

[0, STX, DLE] -> [DLE, STX, 0, DLE, STX, DLE, DLE, DLE, ETX]