添加获取所有串口名函数

This commit is contained in:
jie 2024-07-08 00:49:51 +08:00
parent 15529bf2a3
commit c66195054a

View File

@ -1,3 +1,4 @@
use std::ptr::null;
use crate::models::work_model::WorkModel;
use crate::services::{serial_service::SerialService, sqlite_service::SqliteService, excel_service::ExcelService};
@ -7,14 +8,13 @@ pub struct WorkService {
excel_service: ExcelService,
}
impl Default for WorkService {
fn default() -> Self {
todo!()
}
}
impl WorkService {
pub fn get_port_names() -> Vec<String> {
//maybe should not use unwrap
return SerialService::get_ports().unwrap()
}
fn init_excel_service(&mut self, path: String)->Result<bool, String>{
return if let Ok(excel_service) = ExcelService::new(&path) {
self.excel_service = excel_service;