swaits 4cccb65124 feat!: protocol v2 wire format and module restructure
The wire protocol is re-specified as DongLoRa Protocol v2 (see PROTOCOL.md). Every type_id, tag-correlation rule, and field layout is incompatible with 0.1.0.

* Add PROTOCOL.md as the normative spec for the v2 wire format.

* Replace framing.rs with a streaming FrameDecoder that emits (type_id, tag, payload) triples on each COBS-delimited, CRC-checked frame.

* Split the single-file lib.rs into dedicated modules: frame, commands, events, errors, modulation, info, crc, chip_id. Re-exports preserve convenience imports at the crate root.

* Replace RadioConfig / Bandwidth with a Modulation enum covering LoRa, FSK/GFSK, LR-FHSS, and FLRC, each with its own typed parameter struct.

* Add TxFlags, RxOrigin, SetConfigResult, OkPayload to model v2 response shapes, and RadioChipId for GET_INFO.

* Rewrite fuzz corpus: replace the 4 cobs_* / command_roundtrip targets with decoder_feed, frame_roundtrip, lora_config_roundtrip, and parse_device_message; drop parse_radio_config.

* Expand proptest and mutation-killer coverage for the new wire shape.

* Rewrite canonical-byte test vectors against the v2 spec.
2026-04-22 09:21:11 -06:00

donglora-protocol

CI Crates.io Docs.rs

Wire protocol types and COBS framing for DongLoRa, shared between the firmware and host crates (client-rs, mux-rs, bridge). no_std, zero-alloc, fixed-width little-endian — see the firmware repo's PROTOCOL.md for the full spec.

Install

# Embedded / firmware (defmt::Format derives on by default):
donglora-protocol = "0.1"

# Host (no defmt):
donglora-protocol = { version = "0.1", default-features = false }

Layout

  • src/lib.rs — Command, Response, RadioConfig, Bandwidth, ErrorCode plus constants and validation/resolve helpers.
  • src/framing.rs — CobsDecoder (streaming) and cobs_encode_response.

Features

Feature Default What it does
defmt yes Derive defmt::Format on public enums.
std no Enable Debug-based niceties for host-side fuzz / proptest.

Testing

The crate ships its own quality gate via just test:

Gate What runs
test-unit nextest across all feature permutations + doc tests
test-clippy -D warnings across all feature permutations
test-fmt cargo fmt -- --check
test-doc cargo doc --no-deps --all-features
test-deny cargo deny check
test-fuzz 60 s on each of 7 cargo-fuzz targets (nightly)
test-miri miri on lib + vector tests, both feature shapes (nightly)
test-mutants cargo-mutants under both feature configurations

The proptest suite alone exercises ~1.13M test cases per run.

License

MIT — see LICENSE.

S
Description
No description provided
Readme MIT
176 KiB
0 Stars 1 Watchers 0 Forks
Languages
Rust 98.6%
Just 1.4%