[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:
2026-04-19 19:49:57 +02:00
parent 20b3f505e3
commit 894b7c57be
3 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -18,4 +18,4 @@ pub use auth::{NoAuthValidator, SimpleTokenValidator, TokenValidator};
pub use codec::{mode_to_string, parse_envelope, parse_mode}; pub use codec::{mode_to_string, parse_envelope, parse_mode};
pub use decoders::{DecoderActivation, DecoderDescriptor, DECODER_REGISTRY}; pub use decoders::{DecoderActivation, DecoderDescriptor, DECODER_REGISTRY};
pub use mapping::{client_command_to_rig, rig_command_to_client}; 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};
+1 -1
View File
@@ -102,7 +102,7 @@ macro_rules! define_command_mapping {
define_command_mapping! { define_command_mapping! {
// ── Client-only variants (no RigCommand counterpart) ───────────── // ── Client-only variants (no RigCommand counterpart) ─────────────
client_only: GetRigs, GetSatPasses; client_only: GetRigs, GetSatPasses, SubscribeMeter;
// ── Unit variants (no payload) ─────────────────────────────────── // ── Unit variants (no payload) ───────────────────────────────────
unit: unit:
+18
View File
@@ -61,6 +61,24 @@ pub enum ClientCommand {
SetSamCarrierSync { enabled: bool }, SetSamCarrierSync { enabled: bool },
SetRecorderEnabled { enabled: bool }, SetRecorderEnabled { enabled: bool },
GetSpectrum, 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 ~67 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. /// Envelope for client commands with optional authentication token and rig routing.