[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:
@@ -21,6 +21,10 @@ pub enum ClientCommand {
|
||||
Unlock,
|
||||
GetTxLimit,
|
||||
SetTxLimit { limit: u8 },
|
||||
SetAprsDecodeEnabled { enabled: bool },
|
||||
SetCwDecodeEnabled { enabled: bool },
|
||||
ResetAprsDecoder,
|
||||
ResetCwDecoder,
|
||||
}
|
||||
|
||||
/// Envelope for client commands with optional authentication token.
|
||||
|
||||
@@ -19,4 +19,8 @@ pub enum RigCommand {
|
||||
SetTxLimit(u8),
|
||||
Lock,
|
||||
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::Lock => Box::new(LockCommand),
|
||||
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),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,14 @@ pub struct RigState {
|
||||
pub server_latitude: Option<f64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
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.
|
||||
@@ -68,6 +76,8 @@ impl RigState {
|
||||
server_version: self.server_version.clone(),
|
||||
server_latitude: self.server_latitude,
|
||||
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>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub server_longitude: Option<f64>,
|
||||
#[serde(default)]
|
||||
pub aprs_decode_enabled: bool,
|
||||
#[serde(default)]
|
||||
pub cw_decode_enabled: bool,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user