Skip to main content

Mountain/IPC/StatusReporter/
mountain_discover_services.rs

1
2//! `mountain_discover_services` Tauri command - run a
3//! one-shot discovery pass and return the populated
4//! `ServiceInfo::Struct` list.
5
6use tauri::Manager;
7
8use crate::{
9	IPC::StatusReporter::{Reporter::Struct as Reporter, ServiceInfo::Struct as ServiceInfo},
10	dev_log,
11};
12
13#[tauri::command]
14pub async fn mountain_discover_services(app_handle:tauri::AppHandle) -> Result<Vec<ServiceInfo>, String> {
15	dev_log!("lifecycle", "Tauri command: discover_services");
16
17	if let Some(reporter) = app_handle.try_state::<Reporter>() {
18		reporter.discover_services().await
19	} else {
20		Err("StatusReporter not found in application state".to_string())
21	}
22}