SDRmm

Develop

Built-in decoders

Add a decoder to sdrmm-channels, from module to registration, fixture, and codegen.

On this page

A built-in decoder is one module in crates/channels/src. Nothing outside it names the decoder. dtmf.rs is a small one to copy.

Steps

  1. Module: <name>.rs plus mod <name>; in lib.rs. It holds the settings struct (sdrmm_wire::DecoderSettings with its TYPE_ID), event payloads (EventPayload), the ChannelDescriptor, the channel (NativeChannel and Channel), and a constructor <name>_decoder() that builds Native::new::<Channel>(..) with .filter, .form, .kinds, and .signatures.
  2. Shared code: what a second decoder could use goes to sdrmm-dsp (primitives) or sdrmm-modem (sync, FEC, framing).
  3. Register: add <name>::<name>_decoder to built_in! in builtin.rs. Its order is the palette order.
  4. Positive fixture: <name>/fixture.rs, declared #[cfg(test)] pub(crate) mod fixture;, with a function named like the constructor that returns a Positive: reads(&[..]) lists text the rendered events must carry, and .hearing(..) makes the signal, usually with the module’s synth and Fixture::new(params, iq).heard(). built_in! turns it into the test builtin::positive::<name>_decoder; tests do not compile without it.
  5. Codegen: cargo xtask codegen refreshes openapi.json, web/src/generated/, docs/operate/decoders.md, and site/src/data/modes.json. Forms and event views come from the registry, so there is no frontend code to write.
  6. Test: cargo nextest run -p sdrmm-channels <name>.

Edit this page on GitHub

Esc