Mountain/IPC/StatusReporter/mountain_start_service_discovery.rs
1
2//! `mountain_start_service_discovery` Tauri command - kicks
3//! off the periodic service-discovery background task driven
4//! by `ServiceRegistry::Struct::discovery_interval`.
5
6use tauri::Manager;
7
8use crate::{IPC::StatusReporter::Reporter::Struct as Reporter, dev_log};
9
10#[tauri::command]
11pub async fn mountain_start_service_discovery(app_handle:tauri::AppHandle) -> Result<(), String> {
12 dev_log!("lifecycle", "Tauri command: start_service_discovery");
13
14 if let Some(reporter) = app_handle.try_state::<Reporter>() {
15 reporter.start_periodic_discovery().await
16 } else {
17 Err("StatusReporter not found in application state".to_string())
18 }
19}