[feat](trx-core): add decoder toggle and reset commands

Add aprs_decode_enabled, cw_decode_enabled, aprs_decode_reset_seq, and
cw_decode_reset_seq fields to RigState and RigSnapshot. Add corresponding
RigCommand and ClientCommand variants for toggling and resetting decoders.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-02-08 23:09:32 +01:00
parent 2feecbfe4f
commit b257f69389
4 changed files with 28 additions and 0 deletions
+4
View File
@@ -21,6 +21,10 @@ pub enum ClientCommand {
Unlock, Unlock,
GetTxLimit, GetTxLimit,
SetTxLimit { limit: u8 }, SetTxLimit { limit: u8 },
SetAprsDecodeEnabled { enabled: bool },
SetCwDecodeEnabled { enabled: bool },
ResetAprsDecoder,
ResetCwDecoder,
} }
/// Envelope for client commands with optional authentication token. /// Envelope for client commands with optional authentication token.
+4
View File
@@ -19,4 +19,8 @@ pub enum RigCommand {
SetTxLimit(u8), SetTxLimit(u8),
Lock, Lock,
Unlock, Unlock,
SetAprsDecodeEnabled(bool),
SetCwDecodeEnabled(bool),
ResetAprsDecoder,
ResetCwDecoder,
} }
@@ -500,6 +500,12 @@ pub fn command_from_rig_command(cmd: RigCommand) -> Box<dyn RigCommandHandler> {
RigCommand::SetTxLimit(limit) => Box::new(SetTxLimitCommand::new(limit)), RigCommand::SetTxLimit(limit) => Box::new(SetTxLimitCommand::new(limit)),
RigCommand::Lock => Box::new(LockCommand), RigCommand::Lock => Box::new(LockCommand),
RigCommand::Unlock => Box::new(UnlockCommand), RigCommand::Unlock => Box::new(UnlockCommand),
// Decoder commands are handled before reaching this function;
// map to GetSnapshot as a safe fallback.
RigCommand::SetAprsDecodeEnabled(_)
| RigCommand::SetCwDecodeEnabled(_)
| RigCommand::ResetAprsDecoder
| RigCommand::ResetCwDecoder => Box::new(GetSnapshotCommand),
} }
} }
+14
View File
@@ -23,6 +23,14 @@ pub struct RigState {
pub server_latitude: Option<f64>, pub server_latitude: Option<f64>,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
pub server_longitude: Option<f64>, pub server_longitude: Option<f64>,
#[serde(default)]
pub aprs_decode_enabled: bool,
#[serde(default)]
pub cw_decode_enabled: bool,
#[serde(default, skip_serializing)]
pub aprs_decode_reset_seq: u64,
#[serde(default, skip_serializing)]
pub cw_decode_reset_seq: u64,
} }
/// Mode supported by the rig. /// Mode supported by the rig.
@@ -68,6 +76,8 @@ impl RigState {
server_version: self.server_version.clone(), server_version: self.server_version.clone(),
server_latitude: self.server_latitude, server_latitude: self.server_latitude,
server_longitude: self.server_longitude, server_longitude: self.server_longitude,
aprs_decode_enabled: self.aprs_decode_enabled,
cw_decode_enabled: self.cw_decode_enabled,
}) })
} }
@@ -110,4 +120,8 @@ pub struct RigSnapshot {
pub server_latitude: Option<f64>, pub server_latitude: Option<f64>,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
pub server_longitude: Option<f64>, pub server_longitude: Option<f64>,
#[serde(default)]
pub aprs_decode_enabled: bool,
#[serde(default)]
pub cw_decode_enabled: bool,
} }