[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:
@@ -1,49 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2025 Stanislaw Grams <stanislawgrams@gmail.com>
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::rig::state::RigSnapshot;
|
||||
|
||||
/// Command received from network clients (JSON).
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(tag = "cmd", rename_all = "snake_case")]
|
||||
pub enum ClientCommand {
|
||||
GetState,
|
||||
SetFreq { freq_hz: u64 },
|
||||
SetMode { mode: String },
|
||||
SetPtt { ptt: bool },
|
||||
PowerOn,
|
||||
PowerOff,
|
||||
ToggleVfo,
|
||||
Lock,
|
||||
Unlock,
|
||||
GetTxLimit,
|
||||
SetTxLimit { limit: u8 },
|
||||
SetAprsDecodeEnabled { enabled: bool },
|
||||
SetCwDecodeEnabled { enabled: bool },
|
||||
SetCwAuto { enabled: bool },
|
||||
SetCwWpm { wpm: u32 },
|
||||
SetCwToneHz { tone_hz: u32 },
|
||||
SetFt8DecodeEnabled { enabled: bool },
|
||||
ResetAprsDecoder,
|
||||
ResetCwDecoder,
|
||||
ResetFt8Decoder,
|
||||
}
|
||||
|
||||
/// Envelope for client commands with optional authentication token.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ClientEnvelope {
|
||||
pub token: Option<String>,
|
||||
#[serde(flatten)]
|
||||
pub cmd: ClientCommand,
|
||||
}
|
||||
|
||||
/// Response sent to network clients over TCP.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ClientResponse {
|
||||
pub success: bool,
|
||||
pub state: Option<RigSnapshot>,
|
||||
pub error: Option<String>,
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
// SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
pub mod audio;
|
||||
pub mod client;
|
||||
pub mod decode;
|
||||
pub mod math;
|
||||
pub mod radio;
|
||||
@@ -11,7 +10,6 @@ pub mod rig;
|
||||
|
||||
pub type DynResult<T> = Result<T, Box<dyn std::error::Error + Send + Sync>>;
|
||||
|
||||
pub use client::{ClientCommand, ClientResponse};
|
||||
pub use rig::command::RigCommand;
|
||||
pub use rig::request::RigRequest;
|
||||
pub use rig::response::{RigError, RigResult};
|
||||
|
||||
Reference in New Issue
Block a user