mod device; mod ble; mod device_repo; use crate::{ble::scan_devices, device_repo::{repo_from_devices, try_from_file, Repo}}; // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ #[tauri::command] async fn read_repo() -> Repo { match try_from_file() { Ok(repo) => repo, Err(_) => Repo::new() } } #[tauri::command] async fn scan() -> Repo { repo_from_devices((scan_devices(5).await).unwrap_or_default()) } #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() .plugin(tauri_plugin_opener::init()) .invoke_handler(tauri::generate_handler![read_repo, scan]) .run(tauri::generate_context!()) .expect("error while running tauri application"); }