[refactor](trx-protocol): move transport dto out of core
Phase 5: relocate ClientCommand/Envelope/Response into trx-protocol and update call sites so trx-core remains domain-focused. Co-authored-by: Codex <codex@openai.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
trx-core = { path = "../../../trx-core" }
|
||||
trx-frontend = { path = ".." }
|
||||
trx-protocol = { path = "../../../../src/trx-protocol" }
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -12,3 +12,4 @@ tokio = { workspace = true, features = ["full"] }
|
||||
tracing = { workspace = true }
|
||||
trx-core = { path = "../../../trx-core" }
|
||||
trx-frontend = { path = ".." }
|
||||
trx-protocol = { path = "../../../../src/trx-protocol" }
|
||||
|
||||
@@ -11,6 +11,7 @@ use tokio::sync::{mpsc, oneshot, watch};
|
||||
use tokio::task::JoinHandle;
|
||||
use tokio::time::timeout;
|
||||
use tracing::{debug, error, info, warn};
|
||||
use trx_protocol::{mode_to_string, parse_mode};
|
||||
|
||||
use trx_core::radio::freq::Freq;
|
||||
use trx_core::rig::state::RigSnapshot;
|
||||
@@ -252,26 +253,8 @@ fn current_snapshot(state_rx: &watch::Receiver<RigState>) -> Option<RigSnapshot>
|
||||
state_rx.borrow().snapshot()
|
||||
}
|
||||
|
||||
fn parse_mode(s: &str) -> RigMode {
|
||||
match s.to_ascii_uppercase().as_str() {
|
||||
"LSB" => RigMode::LSB,
|
||||
"USB" => RigMode::USB,
|
||||
"CW" => RigMode::CW,
|
||||
"CWR" => RigMode::CWR,
|
||||
"AM" => RigMode::AM,
|
||||
"FM" => RigMode::FM,
|
||||
"WFM" => RigMode::WFM,
|
||||
"DIG" | "DIGI" => RigMode::DIG,
|
||||
"PKT" | "PACKET" => RigMode::PKT,
|
||||
other => RigMode::Other(other.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
fn rig_mode_to_str(mode: &RigMode) -> String {
|
||||
match mode {
|
||||
RigMode::Other(other) => other.clone(),
|
||||
other => format!("{:?}", other),
|
||||
}
|
||||
mode_to_string(mode)
|
||||
}
|
||||
|
||||
fn dump_state_lines(_snapshot: &RigSnapshot) -> Vec<String> {
|
||||
|
||||
Reference in New Issue
Block a user