feat: new demo api

This commit is contained in:
2026-10-24 11:37:27 +02:00
parent ef338cc088
commit 8f1f221605
12 changed files with 124 additions and 30 deletions
+4 -7
View File
@@ -1,5 +1,5 @@
use crate::state::{AppState, DSPDevice};
use dsp_thomann::dsp408::types::DelayUnit;
use dsp_thomann::dsp408::types::{DSPMode, DelayUnit};
use dsp_thomann::dsp408::{types, DSP408};
use std::sync::{Arc, Mutex};
use std::{net::IpAddr, str::FromStr};
@@ -54,11 +54,11 @@ pub fn create_dsp408(
ip: String,
port: u16,
device_id: u8,
demo: bool,
demo: DSPMode,
) -> Result<u64, String> {
let ip = IpAddr::from_str(&ip).map_err(|e| e.to_string())?;
let dsp = if demo {
let dsp = if matches!(demo, DSPMode::Demo) {
DSP408::new_demo()
} else {
DSP408::new(ip, port, device_id).map_err(|e| e.to_string())?
@@ -244,10 +244,7 @@ pub async fn lock_device(
password: String,
) -> Result<bool, String> {
state.with_device_mut(id, |device| {
device
.dsp
.lock_device(&password)
.map_err(|e| e.to_string())
device.dsp.lock_device(&password).map_err(|e| e.to_string())
})
}
+2 -1
View File
@@ -7,6 +7,7 @@ use tauri::Manager;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_store::Builder::new().build())
.plugin(tauri_plugin_opener::init())
.manage(AppState::new())
.invoke_handler(tauri::generate_handler![
@@ -52,4 +53,4 @@ pub fn run() {
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
}