[feat](trx-rs): display APRS-IS connection status on About page
Thread aprs_is_status through RigState, RigSnapshot, and the protocol layer following the same pattern as pskreporter_status. Show the connection target and callsign when enabled, or "Disabled" otherwise. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -402,6 +402,25 @@ fn build_rig_task_config(
|
||||
Some("Disabled".to_string())
|
||||
};
|
||||
|
||||
let aprs_is_status = if rig_cfg.aprsfi.enabled {
|
||||
let cs = rig_cfg
|
||||
.aprsfi
|
||||
.callsign
|
||||
.as_deref()
|
||||
.or(callsign.as_deref())
|
||||
.unwrap_or("");
|
||||
if cs.trim().is_empty() {
|
||||
Some("Enabled but inactive (missing callsign)".to_string())
|
||||
} else {
|
||||
Some(format!(
|
||||
"Enabled ({}:{}, {})",
|
||||
rig_cfg.aprsfi.host, rig_cfg.aprsfi.port, cs
|
||||
))
|
||||
}
|
||||
} else {
|
||||
Some("Disabled".to_string())
|
||||
};
|
||||
|
||||
rig_task::RigTaskConfig {
|
||||
registry,
|
||||
rig_id: rig_cfg.id.clone(),
|
||||
@@ -424,6 +443,7 @@ fn build_rig_task_config(
|
||||
server_latitude: latitude,
|
||||
server_longitude: longitude,
|
||||
pskreporter_status,
|
||||
aprs_is_status,
|
||||
histories,
|
||||
prebuilt_rig: None,
|
||||
}
|
||||
@@ -1007,6 +1027,14 @@ async fn main() -> DynResult<()> {
|
||||
} else {
|
||||
Some("Disabled".to_string())
|
||||
};
|
||||
initial_state.aprs_is_status = if rig_cfg.aprsfi.enabled {
|
||||
Some(format!(
|
||||
"Enabled ({}:{})",
|
||||
rig_cfg.aprsfi.host, rig_cfg.aprsfi.port
|
||||
))
|
||||
} else {
|
||||
Some("Disabled".to_string())
|
||||
};
|
||||
let (state_tx, state_rx) = watch::channel(initial_state);
|
||||
|
||||
let mut task_config = build_rig_task_config(
|
||||
|
||||
@@ -46,6 +46,7 @@ pub struct RigTaskConfig {
|
||||
pub server_latitude: Option<f64>,
|
||||
pub server_longitude: Option<f64>,
|
||||
pub pskreporter_status: Option<String>,
|
||||
pub aprs_is_status: Option<String>,
|
||||
/// Per-rig decoder history store. Used by Reset* commands to clear the
|
||||
/// history and by the audio listener to serve history on connection.
|
||||
pub histories: Arc<DecoderHistories>,
|
||||
@@ -78,6 +79,7 @@ impl Default for RigTaskConfig {
|
||||
server_latitude: None,
|
||||
server_longitude: None,
|
||||
pskreporter_status: None,
|
||||
aprs_is_status: None,
|
||||
histories: DecoderHistories::new(),
|
||||
prebuilt_rig: None,
|
||||
}
|
||||
@@ -136,6 +138,7 @@ pub async fn run_rig_task(
|
||||
config.initial_mode.clone(),
|
||||
);
|
||||
state.pskreporter_status = config.pskreporter_status.clone();
|
||||
state.aprs_is_status = config.aprs_is_status.clone();
|
||||
|
||||
// Polling configuration
|
||||
let polling = &config.polling;
|
||||
|
||||
Reference in New Issue
Block a user