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
- Module:
<name>.rsplusmod <name>;inlib.rs. It holds the settings struct (sdrmm_wire::DecoderSettingswith itsTYPE_ID), event payloads (EventPayload), theChannelDescriptor, the channel (NativeChannelandChannel), and a constructor<name>_decoder()that buildsNative::new::<Channel>(..)with.filter,.form,.kinds, and.signatures. - Shared code: what a second decoder could use goes to
sdrmm-dsp(primitives) orsdrmm-modem(sync, FEC, framing). - Register: add
<name>::<name>_decodertobuilt_in!inbuiltin.rs. Its order is the palette order. - Positive fixture:
<name>/fixture.rs, declared#[cfg(test)] pub(crate) mod fixture;, with a function named like the constructor that returns aPositive:reads(&[..])lists text the rendered events must carry, and.hearing(..)makes the signal, usually with the module’ssynthandFixture::new(params, iq).heard().built_in!turns it into the testbuiltin::positive::<name>_decoder; tests do not compile without it. - Codegen:
cargo xtask codegenrefreshesopenapi.json,web/src/generated/,docs/operate/decoders.md, andsite/src/data/modes.json. Forms and event views come from the registry, so there is no frontend code to write. - Test:
cargo nextest run -p sdrmm-channels <name>.