yanjinhui
2025-02-28 880766ff5ccc98f1def11cd3c6e15e860f143ada
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/SerialPortService/SerialPortService.cs
@@ -8,22 +8,21 @@
using RJCP.IO.Ports;
using WIDESEA_ISerialPortRepository;
using WIDESEA_ISerialPortService;
using WIDESEA_SerialPortTestService;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Model.Models.SerialPort;
namespace WIDESEA_SerialPortService
{
    public class SerialPortService : ServiceBase<Dt_TorqueOp, ISerialPortRepository>, ISerialPortService
    {
        private SerialPortTestService _serialPortTestService;  // ä¸²å£æœåŠ¡
        //private SerialPortTestJob _SerialPortTestJob;  // ä¸²å£æœåŠ¡
        public SerialPortService(ISerialPortRepository BaseDal) : base(BaseDal)
        {
            //_SerialPortTestJob = new SerialPortTestJob("COM3", this);
            //_serialPortTestService = new SerialPortTestService("COM3");
            // ä¼ é€’ SerialPortService åˆ° SerialPortTestService
            _serialPortTestService = new SerialPortTestService("COM3", this);
        }
        public WebResponseContent AddSerialPort(Dt_TorqueOp TorqueOp)
@@ -32,6 +31,7 @@
            //BaseDal.Db.Insertable(TorqueOp).ExecuteCommand();
            BaseDal.AddData(TorqueOp);
            content = WebResponseContent.Instance.OK("成功");
            return content;
@@ -44,7 +44,7 @@
            //WebResponseContent content = new WebResponseContent();
            // æ‰“开串口并开始发送数据
            _serialPortTestService.OpenSerialPort();
            //_SerialPortTestJob.OpenSerialPort();
            //return content;
        }
@@ -55,15 +55,16 @@
        public void StopSerialPortCom()
        {
            //WebResponseContent content = new WebResponseContent();
            _serialPortTestService.CloseSerialPort();  // å…³é—­ä¸²å£
            //return content;
            //_SerialPortTestJob.CloseSerialPort();  // å…³é—­ä¸²å£
           // return content;
        }
        public List<string> GetSerialPortCom()
        {
          return  _serialPortTestService.GetReceivedData();
            //return  _serialPortTestService.GetReceivedData();
            return null;
         
        }