/*using Autofac.Core; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WIDESEA_ISerialPortService; using WIDESEA_SerialPortService; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseController; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob.Service; //using WIDESEA_ISerialPortService.ISerialPortService; namespace WIDESEAWCS_Server.Controllers.SerialPort { [Route("api/[controller]")] [ApiController] public class SerialPortController : ApiBaseController { private readonly ISerialPortService _serialPortService; // 构造函数注入服务 public SerialPortController(ISerialPortService serialPortService):base(serialPortService) { _serialPortService = serialPortService; } [HttpPost, Route("AddStudent"), AllowAnonymous] public WebResponseContent AddStudent([FromBody] Dt_TorqueOp TorqueOp) { return Service.AddSerialPort(TorqueOp); } /// /// 开启 /// /// [HttpPost, Route("StartSerialPortCom"), AllowAnonymous] public IActionResult StartSerialPortCom() { Service.StartSerialPortCom(); return Ok(new { messga = "开启成功" }); } /// /// 关 /// /// [HttpPost,Route("StopSerialPortCom"),AllowAnonymous] public IActionResult StopSerialPortCom() { _serialPortService.StopSerialPortCom(); return Ok(new { messga = "关闭成功" }); } /// /// 查 /// /// [HttpGet, Route("GetSerialPortCom"), AllowAnonymous] public IActionResult GetSerialPortCom() { var receivedData = _serialPortService.GetSerialPortCom(); // 调用 SerialPortService 的 GetReceivedData 方法 return Ok(receivedData); // 返回接收到的数据 } } }*/