|
|
|
@ -2,6 +2,8 @@ mod device;
|
|
|
|
mod ble;
|
|
|
|
mod ble;
|
|
|
|
mod device_repo;
|
|
|
|
mod device_repo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use tauri::{AppHandle, Manager};
|
|
|
|
|
|
|
|
|
|
|
|
use crate::{ble::scan_devices, device_repo::{repo_from_devices, try_from_file, 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/
|
|
|
|
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
|
|
|
@ -15,14 +17,28 @@ async fn read_repo() -> Repo {
|
|
|
|
|
|
|
|
|
|
|
|
#[tauri::command]
|
|
|
|
#[tauri::command]
|
|
|
|
async fn scan() -> Repo {
|
|
|
|
async fn scan() -> Repo {
|
|
|
|
|
|
|
|
println!("kek");
|
|
|
|
repo_from_devices((scan_devices(5).await).unwrap_or_default())
|
|
|
|
repo_from_devices((scan_devices(5).await).unwrap_or_default())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[tauri::command]
|
|
|
|
|
|
|
|
async fn init(app: AppHandle) -> Result<(),()> {
|
|
|
|
|
|
|
|
println!("init rideinn app");
|
|
|
|
|
|
|
|
let splash = app.get_webview_window("splashscreen").unwrap();
|
|
|
|
|
|
|
|
let connect = app.get_webview_window("connect").unwrap();
|
|
|
|
|
|
|
|
let repo = repo_from_devices((scan_devices(5).await).unwrap_or_default());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
splash.close().unwrap();
|
|
|
|
|
|
|
|
connect.show().unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
|
pub fn run() {
|
|
|
|
pub fn run() {
|
|
|
|
tauri::Builder::default()
|
|
|
|
tauri::Builder::default()
|
|
|
|
.plugin(tauri_plugin_opener::init())
|
|
|
|
|
|
|
|
.invoke_handler(tauri::generate_handler![read_repo, scan])
|
|
|
|
.invoke_handler(tauri::generate_handler![init, read_repo, scan])
|
|
|
|
.run(tauri::generate_context!())
|
|
|
|
.run(tauri::generate_context!())
|
|
|
|
.expect("error while running tauri application");
|
|
|
|
.expect("error while running tauri application");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|