[feat](trx-core): add WSPR decode plumbing across stack

Introduce WSPR command/state/protocol/transport wiring and integrate lifecycle, history, and frontend API paths mirroring the FT8 architecture.

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-02-12 22:38:05 +01:00
parent 8e59e205a8
commit 63ba6882cd
16 changed files with 310 additions and 5 deletions
+48
View File
@@ -35,9 +35,13 @@ pub fn client_command_to_rig(cmd: ClientCommand) -> RigCommand {
ClientCommand::SetCwWpm { wpm } => RigCommand::SetCwWpm(wpm),
ClientCommand::SetCwToneHz { tone_hz } => RigCommand::SetCwToneHz(tone_hz),
ClientCommand::SetFt8DecodeEnabled { enabled } => RigCommand::SetFt8DecodeEnabled(enabled),
ClientCommand::SetWsprDecodeEnabled { enabled } => {
RigCommand::SetWsprDecodeEnabled(enabled)
}
ClientCommand::ResetAprsDecoder => RigCommand::ResetAprsDecoder,
ClientCommand::ResetCwDecoder => RigCommand::ResetCwDecoder,
ClientCommand::ResetFt8Decoder => RigCommand::ResetFt8Decoder,
ClientCommand::ResetWsprDecoder => RigCommand::ResetWsprDecoder,
}
}
@@ -68,9 +72,13 @@ pub fn rig_command_to_client(cmd: RigCommand) -> ClientCommand {
RigCommand::SetCwWpm(wpm) => ClientCommand::SetCwWpm { wpm },
RigCommand::SetCwToneHz(tone_hz) => ClientCommand::SetCwToneHz { tone_hz },
RigCommand::SetFt8DecodeEnabled(enabled) => ClientCommand::SetFt8DecodeEnabled { enabled },
RigCommand::SetWsprDecodeEnabled(enabled) => {
ClientCommand::SetWsprDecodeEnabled { enabled }
}
RigCommand::ResetAprsDecoder => ClientCommand::ResetAprsDecoder,
RigCommand::ResetCwDecoder => ClientCommand::ResetCwDecoder,
RigCommand::ResetFt8Decoder => ClientCommand::ResetFt8Decoder,
RigCommand::ResetWsprDecoder => ClientCommand::ResetWsprDecoder,
}
}
@@ -263,6 +271,16 @@ mod tests {
}
}
#[test]
fn test_client_command_to_rig_set_wspr_decode_enabled() {
let cmd = ClientCommand::SetWsprDecodeEnabled { enabled: true };
if let RigCommand::SetWsprDecodeEnabled(enabled) = client_command_to_rig(cmd) {
assert!(enabled);
} else {
panic!("Expected SetWsprDecodeEnabled");
}
}
#[test]
fn test_client_command_to_rig_reset_aprs_decoder() {
let cmd = ClientCommand::ResetAprsDecoder;
@@ -293,6 +311,16 @@ mod tests {
}
}
#[test]
fn test_client_command_to_rig_reset_wspr_decoder() {
let cmd = ClientCommand::ResetWsprDecoder;
if let RigCommand::ResetWsprDecoder = client_command_to_rig(cmd) {
// Success
} else {
panic!("Expected ResetWsprDecoder");
}
}
#[test]
fn test_rig_command_to_client_get_snapshot() {
let cmd = RigCommand::GetSnapshot;
@@ -473,6 +501,16 @@ mod tests {
}
}
#[test]
fn test_rig_command_to_client_set_wspr_decode_enabled() {
let cmd = RigCommand::SetWsprDecodeEnabled(true);
if let ClientCommand::SetWsprDecodeEnabled { enabled } = rig_command_to_client(cmd) {
assert!(enabled);
} else {
panic!("Expected SetWsprDecodeEnabled");
}
}
#[test]
fn test_rig_command_to_client_reset_aprs_decoder() {
let cmd = RigCommand::ResetAprsDecoder;
@@ -503,6 +541,16 @@ mod tests {
}
}
#[test]
fn test_rig_command_to_client_reset_wspr_decoder() {
let cmd = RigCommand::ResetWsprDecoder;
if let ClientCommand::ResetWsprDecoder = rig_command_to_client(cmd) {
// Success
} else {
panic!("Expected ResetWsprDecoder");
}
}
#[test]
fn test_round_trip_set_freq() {
let original = ClientCommand::SetFreq { freq_hz: 7050000 };
+2
View File
@@ -29,9 +29,11 @@ pub enum ClientCommand {
SetCwWpm { wpm: u32 },
SetCwToneHz { tone_hz: u32 },
SetFt8DecodeEnabled { enabled: bool },
SetWsprDecodeEnabled { enabled: bool },
ResetAprsDecoder,
ResetCwDecoder,
ResetFt8Decoder,
ResetWsprDecoder,
}
/// Envelope for client commands with optional authentication token.