添加获取所有串口名函数
This commit is contained in:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user