initial commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
use crate::hardware::sysfs;
|
||||
use crate::ipc::protocol::{DaemonRequest, DaemonResponse};
|
||||
use crate::models::DuoStatus;
|
||||
use crate::runtime::client;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_status() -> Result<DuoStatus, String> {
|
||||
match client::request(DaemonRequest::GetStatus) {
|
||||
Ok(DaemonResponse::Status { status }) => Ok(status),
|
||||
Ok(DaemonResponse::Error { message }) => Err(message),
|
||||
Ok(_) => Err("Unexpected daemon response while reading status".into()),
|
||||
Err(_) => Ok(sysfs::get_full_status()),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user