gardesk/gartop / 78c91f8

Browse files

Add temperature IPC types (TempStats, TempSensor, GetTemperature)

Authored by espadonne
SHA
78c91f8f2b417ebe02fdf2687486a1635f91b714
Parents
bc81b54
Tree
cc17e98

1 changed file

StatusFile+-
M gartop-ipc/src/lib.rs 28 0
gartop-ipc/src/lib.rsmodified
@@ -40,6 +40,8 @@ pub enum Command {
4040
         #[serde(default)]
4141
         count: Option<usize>,
4242
     },
43
+    /// Get current temperature stats.
44
+    GetTemperature,
4345
     /// Get running processes.
4446
     GetProcesses {
4547
         #[serde(default)]
@@ -240,6 +242,30 @@ pub struct DiskStats {
240242
     pub timestamp: u64,
241243
 }
242244
 
245
+/// Individual temperature sensor reading.
246
+#[derive(Debug, Clone, Serialize, Deserialize)]
247
+pub struct TempSensor {
248
+    /// Sensor label (e.g., "Core 0", "Package id 0", "GPU").
249
+    pub label: String,
250
+    /// Hardware device name (e.g., "coretemp", "k10temp", "amdgpu").
251
+    pub device: String,
252
+    /// Temperature in degrees Celsius.
253
+    pub temp_celsius: f64,
254
+    /// Critical temperature threshold (if available).
255
+    pub critical: Option<f64>,
256
+    /// High temperature threshold (if available).
257
+    pub high: Option<f64>,
258
+}
259
+
260
+/// Temperature statistics from all sensors.
261
+#[derive(Debug, Clone, Serialize, Deserialize)]
262
+pub struct TempStats {
263
+    /// All temperature sensor readings.
264
+    pub sensors: Vec<TempSensor>,
265
+    /// Timestamp (milliseconds since epoch).
266
+    pub timestamp: u64,
267
+}
268
+
243269
 /// Events broadcast to subscribers.
244270
 #[derive(Debug, Clone, Serialize, Deserialize)]
245271
 #[serde(tag = "event", rename_all = "snake_case")]
@@ -254,6 +280,8 @@ pub enum Event {
254280
     NetworkUpdate { interfaces: Vec<NetworkStats> },
255281
     /// Disk stats updated.
256282
     DiskUpdate { disks: Vec<DiskStats> },
283
+    /// Temperature stats updated.
284
+    TempUpdate(TempStats),
257285
 }
258286
 
259287
 /// Daemon status information.