[feat](trx-protocol): add SubscribeMeter command and MeterUpdate DTO
Adds a dedicated one-way JSON-line stream for high-rate signal-strength samples so meter updates bypass full-RigState diffing in the control path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -18,4 +18,4 @@ pub use auth::{NoAuthValidator, SimpleTokenValidator, TokenValidator};
|
||||
pub use codec::{mode_to_string, parse_envelope, parse_mode};
|
||||
pub use decoders::{DecoderActivation, DecoderDescriptor, DECODER_REGISTRY};
|
||||
pub use mapping::{client_command_to_rig, rig_command_to_client};
|
||||
pub use types::{ClientCommand, ClientEnvelope, ClientResponse, RigEntry};
|
||||
pub use types::{ClientCommand, ClientEnvelope, ClientResponse, MeterUpdate, RigEntry};
|
||||
|
||||
@@ -102,7 +102,7 @@ macro_rules! define_command_mapping {
|
||||
|
||||
define_command_mapping! {
|
||||
// ── Client-only variants (no RigCommand counterpart) ─────────────
|
||||
client_only: GetRigs, GetSatPasses;
|
||||
client_only: GetRigs, GetSatPasses, SubscribeMeter;
|
||||
|
||||
// ── Unit variants (no payload) ───────────────────────────────────
|
||||
unit:
|
||||
|
||||
@@ -61,6 +61,24 @@ pub enum ClientCommand {
|
||||
SetSamCarrierSync { enabled: bool },
|
||||
SetRecorderEnabled { enabled: bool },
|
||||
GetSpectrum,
|
||||
/// Subscribe to a per-rig meter stream on this connection. After the
|
||||
/// server receives this command, the connection becomes a one-way flow of
|
||||
/// newline-delimited `MeterUpdate` JSON frames and no further commands or
|
||||
/// regular responses are sent. Intended for a dedicated TCP connection.
|
||||
SubscribeMeter,
|
||||
}
|
||||
|
||||
/// Fast meter sample pushed by the server on a dedicated meter stream.
|
||||
///
|
||||
/// Emitted at ~30 Hz for SDR backends and ~6–7 Hz for CAT backends.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct MeterUpdate {
|
||||
/// Rig identifier this sample belongs to.
|
||||
pub rig_id: String,
|
||||
/// Receive signal strength in dBm (rig/DSP-reported).
|
||||
pub sig_dbm: f64,
|
||||
/// Monotonic millisecond timestamp from the server's steady clock.
|
||||
pub ts_ms: u64,
|
||||
}
|
||||
|
||||
/// Envelope for client commands with optional authentication token and rig routing.
|
||||
|
||||
Reference in New Issue
Block a user