From 3ebd185a7e6e86278181eb64137e1f89fe2a0e6e Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Mon, 23 Feb 2026 18:30:04 +0100 Subject: [PATCH] [refactor](decoders): consolidate decoder crates under src/decoders/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move trx-ft8 and trx-wspr into src/decoders/ alongside a new trx-aprs crate that extracts the Bell 202/AX.25 decoder from trx-server, giving all three modems a consistent crate-per-decoder layout. - src/decoders/trx-ft8/ (moved from src/trx-ft8/) - src/decoders/trx-wspr/ (moved from src/trx-wspr/) - src/decoders/trx-aprs/ (new — Bell 202 AFSK + AX.25/APRS decoder) - trx-ft8/build.rs: fix external/ft8_lib relative path after move - trx-server: drop decode::aprs module, use trx_aprs::AprsDecoder - AprsPacket stays in trx-core (mirrors Ft8Message / WsprMessage) - Workspace Cargo.toml updated with new member paths Co-Authored-By: Claude Sonnet 4.6 --- Cargo.lock | 8 ++++++++ Cargo.toml | 5 +++-- src/decoders/trx-aprs/Cargo.toml | 11 +++++++++++ .../decode/aprs.rs => decoders/trx-aprs/src/lib.rs} | 2 +- src/{ => decoders}/trx-ft8/Cargo.toml | 0 src/{ => decoders}/trx-ft8/build.rs | 2 +- src/{ => decoders}/trx-ft8/src/ft8_wrapper.c | 0 src/{ => decoders}/trx-ft8/src/lib.rs | 0 src/{ => decoders}/trx-wspr/Cargo.toml | 0 src/{ => decoders}/trx-wspr/src/decoder.rs | 0 src/{ => decoders}/trx-wspr/src/lib.rs | 0 src/{ => decoders}/trx-wspr/src/protocol.rs | 0 src/trx-server/Cargo.toml | 5 +++-- src/trx-server/src/audio.rs | 3 ++- src/trx-server/src/decode/mod.rs | 1 - 15 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 src/decoders/trx-aprs/Cargo.toml rename src/{trx-server/src/decode/aprs.rs => decoders/trx-aprs/src/lib.rs} (99%) rename src/{ => decoders}/trx-ft8/Cargo.toml (100%) rename src/{ => decoders}/trx-ft8/build.rs (97%) rename src/{ => decoders}/trx-ft8/src/ft8_wrapper.c (100%) rename src/{ => decoders}/trx-ft8/src/lib.rs (100%) rename src/{ => decoders}/trx-wspr/Cargo.toml (100%) rename src/{ => decoders}/trx-wspr/src/decoder.rs (100%) rename src/{ => decoders}/trx-wspr/src/lib.rs (100%) rename src/{ => decoders}/trx-wspr/src/protocol.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 5b2e19a..9dc6526 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2261,6 +2261,13 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "trx-aprs" +version = "0.1.0" +dependencies = [ + "trx-core", +] + [[package]] name = "trx-backend" version = "0.1.0" @@ -2415,6 +2422,7 @@ dependencies = [ "toml", "tracing", "trx-app", + "trx-aprs", "trx-backend", "trx-core", "trx-ft8", diff --git a/Cargo.toml b/Cargo.toml index edc42cd..b10d95b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,8 +4,9 @@ [workspace] members = [ - "src/trx-ft8", - "src/trx-wspr", + "src/decoders/trx-aprs", + "src/decoders/trx-ft8", + "src/decoders/trx-wspr", "src/trx-core", "src/trx-protocol", "src/trx-app", diff --git a/src/decoders/trx-aprs/Cargo.toml b/src/decoders/trx-aprs/Cargo.toml new file mode 100644 index 0000000..0188d53 --- /dev/null +++ b/src/decoders/trx-aprs/Cargo.toml @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2026 Stanislaw Grams +# +# SPDX-License-Identifier: BSD-2-Clause + +[package] +name = "trx-aprs" +version = "0.1.0" +edition = "2021" + +[dependencies] +trx-core = { path = "../../trx-core" } diff --git a/src/trx-server/src/decode/aprs.rs b/src/decoders/trx-aprs/src/lib.rs similarity index 99% rename from src/trx-server/src/decode/aprs.rs rename to src/decoders/trx-aprs/src/lib.rs index bed29ca..7cad161 100644 --- a/src/trx-server/src/decode/aprs.rs +++ b/src/decoders/trx-aprs/src/lib.rs @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2025 Stanislaw Grams +// SPDX-FileCopyrightText: 2026 Stanislaw Grams // // SPDX-License-Identifier: BSD-2-Clause diff --git a/src/trx-ft8/Cargo.toml b/src/decoders/trx-ft8/Cargo.toml similarity index 100% rename from src/trx-ft8/Cargo.toml rename to src/decoders/trx-ft8/Cargo.toml diff --git a/src/trx-ft8/build.rs b/src/decoders/trx-ft8/build.rs similarity index 97% rename from src/trx-ft8/build.rs rename to src/decoders/trx-ft8/build.rs index 1ea8294..fb6ffd6 100644 --- a/src/trx-ft8/build.rs +++ b/src/decoders/trx-ft8/build.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: BSD-2-Clause fn main() { - let base = "../../external/ft8_lib"; + let base = "../../../external/ft8_lib"; let mut build = cc::Build::new(); build .include(base) diff --git a/src/trx-ft8/src/ft8_wrapper.c b/src/decoders/trx-ft8/src/ft8_wrapper.c similarity index 100% rename from src/trx-ft8/src/ft8_wrapper.c rename to src/decoders/trx-ft8/src/ft8_wrapper.c diff --git a/src/trx-ft8/src/lib.rs b/src/decoders/trx-ft8/src/lib.rs similarity index 100% rename from src/trx-ft8/src/lib.rs rename to src/decoders/trx-ft8/src/lib.rs diff --git a/src/trx-wspr/Cargo.toml b/src/decoders/trx-wspr/Cargo.toml similarity index 100% rename from src/trx-wspr/Cargo.toml rename to src/decoders/trx-wspr/Cargo.toml diff --git a/src/trx-wspr/src/decoder.rs b/src/decoders/trx-wspr/src/decoder.rs similarity index 100% rename from src/trx-wspr/src/decoder.rs rename to src/decoders/trx-wspr/src/decoder.rs diff --git a/src/trx-wspr/src/lib.rs b/src/decoders/trx-wspr/src/lib.rs similarity index 100% rename from src/trx-wspr/src/lib.rs rename to src/decoders/trx-wspr/src/lib.rs diff --git a/src/trx-wspr/src/protocol.rs b/src/decoders/trx-wspr/src/protocol.rs similarity index 100% rename from src/trx-wspr/src/protocol.rs rename to src/decoders/trx-wspr/src/protocol.rs diff --git a/src/trx-server/Cargo.toml b/src/trx-server/Cargo.toml index 82878e3..4ea6e35 100644 --- a/src/trx-server/Cargo.toml +++ b/src/trx-server/Cargo.toml @@ -24,6 +24,7 @@ opus = "0.3" trx-app = { path = "../trx-app" } trx-backend = { path = "trx-backend" } trx-core = { path = "../trx-core" } -trx-ft8 = { path = "../trx-ft8" } -trx-wspr = { path = "../trx-wspr" } +trx-aprs = { path = "../decoders/trx-aprs" } +trx-ft8 = { path = "../decoders/trx-ft8" } +trx-wspr = { path = "../decoders/trx-wspr" } trx-protocol = { path = "../trx-protocol" } diff --git a/src/trx-server/src/audio.rs b/src/trx-server/src/audio.rs index 371ca79..2c2344e 100644 --- a/src/trx-server/src/audio.rs +++ b/src/trx-server/src/audio.rs @@ -22,6 +22,7 @@ use trx_core::audio::{ }; use trx_core::decode::{AprsPacket, DecodedMessage, Ft8Message, WsprMessage}; use trx_core::rig::state::{RigMode, RigState}; +use trx_aprs::AprsDecoder; use trx_ft8::Ft8Decoder; use trx_wspr::WsprDecoder; @@ -666,7 +667,7 @@ pub async fn run_aprs_decoder( decode_logs: Option>, ) { info!("APRS decoder started ({}Hz, {} ch)", sample_rate, channels); - let mut decoder = decode::aprs::AprsDecoder::new(sample_rate); + let mut decoder = AprsDecoder::new(sample_rate); let mut was_active = false; let mut last_reset_seq: u64 = 0; let mut active = matches!(state_rx.borrow().status.mode, RigMode::PKT); diff --git a/src/trx-server/src/decode/mod.rs b/src/trx-server/src/decode/mod.rs index 447e4eb..b969820 100644 --- a/src/trx-server/src/decode/mod.rs +++ b/src/trx-server/src/decode/mod.rs @@ -2,5 +2,4 @@ // // SPDX-License-Identifier: BSD-2-Clause -pub mod aprs; pub mod cw;