pub struct NodeStatus {Show 23 fields
pub v: u8,
pub id: String,
pub sq: u32,
pub up: Option<u32>,
pub ver: Option<String>,
pub bn: Option<String>,
pub bs: Option<String>,
pub bt: Option<u8>,
pub fc: Option<bool>,
pub fa: Option<bool>,
pub fv: Option<String>,
pub ff: Option<String>,
pub sr: Option<u16>,
pub sf: Option<u16>,
pub so: Option<u16>,
pub sn: Option<Vec<String>>,
pub cp: Option<f32>,
pub mp: Option<f32>,
pub dp: Option<f32>,
pub tc: Option<f32>,
pub cs: Option<String>,
pub vs: Option<String>,
pub vn: Option<u8>,
}Expand description
A compact projection of a node’s status, sized for one aux frame.
Field names are short because msgpack writes map keys verbatim; each is
documented, and the with_* builders are the only way to put external data
into one, so the bounds cannot be bypassed.
Fields§
§v: u8Schema version (NODE_STATUS_VERSION).
id: StringThe device id this snapshot describes, so a receiver can key it without depending on an identity frame having arrived first.
sq: u32Monotonic sequence number. Lets a receiver spot loss and ignore a datagram that arrives out of order, which UDP permits even over loopback.
up: Option<u32>Agent uptime in seconds.
ver: Option<String>Agent version string.
bn: Option<String>Board name (rock-5c-lite, rpi4b, …).
bs: Option<String>Board SoC.
bt: Option<u8>Board capability tier.
fc: Option<bool>The honest connected-or-reachable verdict: true for a live MAVLink heartbeat, and also true for a healthy MSP flight controller (Betaflight/iNav), which never emits a MAVLink heartbeat but is reachable and drivable over the byte-transparent proxy. False only when no flight controller is evidenced at all.
fa: Option<bool>Whether MAVLink heartbeats are actually arriving. Distinct from Self::fc
on purpose: an MSP flight controller is reachable but never sends a MAVLink
heartbeat, and a serial port can be open with nothing behind it. Collapsing
the two would report a silent link as a live one.
fv: Option<String>Firmware family from the USB descriptor (betaflight, inav).
ff: Option<String>Canonical firmware family (ardupilot, px4, betaflight, inav).
sr: Option<u16>Units in running.
sf: Option<u16>Units failed. This is the TRUE total even when Self::sn is clipped.
so: Option<u16>Units in any other state (dead, exited, inactive).
sn: Option<Vec<String>>Names of failed units, capped at MAX_FAILED_NAMES. Which service
failed is the single most actionable fact a ground operator can have, so
it is worth the bytes; the cap is what keeps it safe.
cp: Option<f32>CPU percent.
mp: Option<f32>Memory used percent.
dp: Option<f32>Root filesystem used percent.
tc: Option<f32>SoC temperature in Celsius.
cs: Option<String>Camera state (ready, recovering, …).
vs: Option<String>Video pipeline state.
vn: Option<u8>How many video legs the node is serving.
A ground station relays a drone it cannot otherwise interrogate — the
radio carries no IP — so without this it cannot tell a single-camera
drone from a pod shipping two concurrent legs, and any surface that
needs to know has to assume. Absent means the drone did not say, which
is deliberately distinct from a reported 1.
Implementations§
Source§impl NodeStatus
impl NodeStatus
Sourcepub fn new(device_id: &str, seq: u32) -> Self
pub fn new(device_id: &str, seq: u32) -> Self
Start a snapshot with the always-present core. Optional fields are set by
the caller through the with_* helpers, each of which clips its input.
Sourcepub fn with_services(
self,
running: u16,
failed: u16,
other: u16,
failed_names: &[String],
) -> Self
pub fn with_services( self, running: u16, failed: u16, other: u16, failed_names: &[String], ) -> Self
Set the service summary. failed_names is clipped to
MAX_FAILED_NAMES entries of MAX_UNIT_NAME characters; failed
stays the true total so a clipped list never understates the fault.
Sourcepub fn with_board(
self,
name: Option<&str>,
soc: Option<&str>,
tier: Option<u8>,
) -> Self
pub fn with_board( self, name: Option<&str>, soc: Option<&str>, tier: Option<u8>, ) -> Self
Set the board descriptors, clipping each string.
Sourcepub fn with_fc(
self,
connected: Option<bool>,
alive: Option<bool>,
variant: Option<&str>,
firmware: Option<&str>,
) -> Self
pub fn with_fc( self, connected: Option<bool>, alive: Option<bool>, variant: Option<&str>, firmware: Option<&str>, ) -> Self
Set the flight controller block, clipping each string.
Sourcepub fn with_resources(
self,
cpu: Option<f32>,
mem: Option<f32>,
disk: Option<f32>,
temp_c: Option<f32>,
) -> Self
pub fn with_resources( self, cpu: Option<f32>, mem: Option<f32>, disk: Option<f32>, temp_c: Option<f32>, ) -> Self
Set the resource gauges.
Sourcepub fn with_payload(
self,
camera: Option<&str>,
video: Option<&str>,
video_legs: Option<u8>,
) -> Self
pub fn with_payload( self, camera: Option<&str>, video: Option<&str>, video_legs: Option<u8>, ) -> Self
Set the payload states, clipping each string.
video_legs is how many video legs the node serves. None when the node
could not read its own stream list: a ground station reading this must
show “unknown”, never assume one camera.
Sourcepub fn with_agent(self, uptime_s: Option<u32>, version: Option<&str>) -> Self
pub fn with_agent(self, uptime_s: Option<u32>, version: Option<&str>) -> Self
Set uptime and agent version.
Sourcepub fn encode(&self) -> Option<(Vec<u8>, usize)>
pub fn encode(&self) -> Option<(Vec<u8>, usize)>
Encode to msgpack, shedding fields down TRIM_LADDER until the frame
fits one aux payload.
Returns the bytes and how many ladder steps were applied, so a producer
can log that it degraded rather than trimming invisibly. None only when
even the fully-trimmed core does not fit, which the caps make
unreachable; a producer that somehow hits it must send nothing rather
than a truncated frame, because a truncated msgpack body decodes as
garbage instead of failing cleanly.