[feat](trx-client): preserve server callsign/version and default to N0CALL
Carry server_callsign and server_version through from received snapshots into the local RigState. Default client callsign is N0CALL when not configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -28,7 +28,7 @@ pub struct ClientConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// General application settings.
|
/// General application settings.
|
||||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct GeneralConfig {
|
pub struct GeneralConfig {
|
||||||
/// Callsign or owner label to display in frontends
|
/// Callsign or owner label to display in frontends
|
||||||
@@ -37,6 +37,15 @@ pub struct GeneralConfig {
|
|||||||
pub log_level: Option<String>,
|
pub log_level: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for GeneralConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
callsign: Some("N0CALL".to_string()),
|
||||||
|
log_level: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Remote connection configuration.
|
/// Remote connection configuration.
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|||||||
@@ -267,6 +267,8 @@ async fn async_init() -> DynResult<AppState> {
|
|||||||
clar_on: None,
|
clar_on: None,
|
||||||
enabled: Some(false),
|
enabled: Some(false),
|
||||||
},
|
},
|
||||||
|
server_callsign: None,
|
||||||
|
server_version: None,
|
||||||
};
|
};
|
||||||
let (state_tx, state_rx) = watch::channel(initial_state);
|
let (state_tx, state_rx) = watch::channel(initial_state);
|
||||||
|
|
||||||
|
|||||||
@@ -180,6 +180,8 @@ pub fn state_from_snapshot(snapshot: trx_core::RigSnapshot) -> RigState {
|
|||||||
clar_on: None,
|
clar_on: None,
|
||||||
enabled: snapshot.enabled,
|
enabled: snapshot.enabled,
|
||||||
},
|
},
|
||||||
|
server_callsign: snapshot.server_callsign,
|
||||||
|
server_version: snapshot.server_version,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user