qiuyao
2025-02-28 976fca8449b9fee3092903472c89a41b84eaa312
ÏîÄ¿´úÂë/WIDESEAWCS_Server Õýʽ/WIDESEAWCS_Tasks/SerialPort/SerialPortTestJob.cs
@@ -9,7 +9,6 @@
{
    public class SerialPortTestJob:IJob
    {
        // åœ¨ SerialPortTestService ç±»ä¸­æ·»åР坹 ISerialPortService çš„引用
        private readonly ISerialPortService _serialPortService;
        public readonly string _port;
@@ -23,17 +22,13 @@
            SerialPort = new SerialPort(_port);
            //串口接收到数据时,SerialPort ä¼šè‡ªåŠ¨è§¦å‘ DataReceived äº‹ä»¶
            //SerialPort.DataReceived += OnDataReceived; //接收串口发出的数据
        }
        private CancellationTokenSource _cancellationTokenSource;
        private Task _sendTask;
        private int commandType = 2;
        private int commandType = 2;
        // å‘½ä»¤å­—符串
        private string command0 = "";  // ä¸å‘送命令
@@ -43,7 +38,7 @@
        public Task Execute(IJobExecutionContext context)
        {
            OpenSerialPort();
            //OpenSerialPort();
            SerialPort.DataReceived += OnDataReceived;
            return Task.CompletedTask;