starla_common/status.rs
1//! Probe status for tray app communication
2//!
3//! Serialized as JSON over a Unix domain socket (or named pipe on Windows).
4
5use crate::pause::PauseState;
6use serde::{Deserialize, Serialize};
7use std::collections::HashMap;
8
9/// Current probe status, sent to the tray app on socket connection.
10#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ProbeStatus {
12 /// Probe ID (0 if not yet registered)
13 pub probe_id: u32,
14 /// Whether connected to the controller
15 pub connected: bool,
16 /// Controller hostname (if connected)
17 #[serde(skip_serializing_if = "Option::is_none")]
18 pub controller: Option<String>,
19 /// Seconds since probe started
20 pub uptime_secs: u64,
21 /// Scheduled measurement counts by type
22 pub measurements: HashMap<String, u64>,
23 /// Results waiting in the upload queue
24 pub queue_depth: usize,
25 /// SSH public key (for registration)
26 #[serde(skip_serializing_if = "Option::is_none")]
27 pub public_key: Option<String>,
28 /// Most recent controller/registration error. Lets the tray show
29 /// *why* the probe is disconnected instead of just a red dot.
30 #[serde(skip_serializing_if = "Option::is_none")]
31 pub last_connection_error: Option<String>,
32 /// Active pause (suppresses measurement dispatch). Tray writes the
33 /// underlying file; probe reads it back on every scheduler tick.
34 #[serde(skip_serializing_if = "Option::is_none")]
35 pub pause: Option<PauseState>,
36}