Mountain/IPC/StatusReporter/
mountain_start_ipc_status_reporting.rs1use tauri::Manager;
6
7use crate::{IPC::StatusReporter::Reporter::Struct as Reporter, dev_log};
8
9#[tauri::command]
10pub async fn mountain_start_ipc_status_reporting(
11 app_handle:tauri::AppHandle,
12
13 interval_seconds:u64,
14) -> Result<serde_json::Value, String> {
15 dev_log!("lifecycle", "Tauri command: start_ipc_status_reporting");
16
17 if let Some(reporter) = app_handle.try_state::<Reporter>() {
18 reporter
19 .start_periodic_reporting(interval_seconds)
20 .await
21 .map(|_| serde_json::json!({ "status": "started", "interval_seconds": interval_seconds }))
22 } else {
23 Err("StatusReporter not found in application state".to_string())
24 }
25}