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