Mountain/IPC/StatusReporter/
mountain_get_ipc_status.rs1
2use tauri::Manager;
6
7use crate::{IPC::StatusReporter::Reporter::Struct as Reporter, dev_log};
8
9#[tauri::command]
10pub async fn mountain_get_ipc_status(app_handle:tauri::AppHandle) -> Result<serde_json::Value, String> {
11 dev_log!("lifecycle", "Tauri command: get_ipc_status");
12
13 if let Some(reporter) = app_handle.try_state::<Reporter>() {
14 reporter
15 .generate_status_report()
16 .await
17 .map(|report| serde_json::to_value(report).unwrap_or(serde_json::Value::Null))
18 } else {
19 Err("StatusReporter not found in application state".to_string())
20 }
21}