
use super::serport::serport::*;


#[tauri::command]
pub fn greet(name: &str) -> String {
    format!("Hello, {}! You've been greeted from Rust!", name)
}
 #[tauri::command]
 pub fn getportnames() -> Vec<String> {
    get_port_name()

}
// #[tauri::command]
// pub fn opencom(portname: serde_json::Value, baudrate: serde_json::Value) -> String {
//     //tauri
//     let portname = portname.as_str().unwrap();
//     let baudrate = baudrate.as_u64().unwrap() as u32;
//     set_port_info(&portname.to_string(), baudrate);

//     println!("opencom portname:{} baudrate:{}", portname, baudrate);
//     logtorust(format!(
//         "opencom portname:{} baudrate:{}",
//         portname, baudrate
//     ));
//     tryuseport()
// }
#[tauri::command]
pub fn clearportbuff() -> String {
    clearserilport()
}


#[tauri::command]
pub fn closecome() -> String {
    closeport()
}