Skip to main content

Mountain/IPC/StatusReporter/
mountain_start_ipc_status_reporting.rs

1
2//! `mountain_start_ipc_status_reporting` Tauri command - kick
3//! off the periodic Sky-emit loop with `interval_seconds`
4//! between snapshots.
5
6use tauri::Manager;
7
8use crate::{IPC::StatusReporter::Reporter::Struct as Reporter, dev_log};
9
10#[tauri::command]
11pub async fn mountain_start_ipc_status_reporting(
12	app_handle:tauri::AppHandle,
13
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}