SerialPortHelper.cs 901 Bytes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO.Ports;
using System.Windows;

namespace HH_WCS_Standard
{
    /// <summary>
    /// 串口助手
    /// </summary>
    public class SerialPortHelper
    {
        public SerialPort serialPort { get; set; }
        //获取计算机com口
        public string[] PortNames { get { return System.IO.Ports.SerialPort.GetPortNames(); } }
        public AlgorithmHelper algorithmHelper { get; set; }

        public SerialPortHelper()
        {
            this.serialPort = new SerialPort() ;
            this.algorithmHelper = new AlgorithmHelper();
            this.serialPort.BaudRate = 9600;
            this.serialPort.StopBits = StopBits.One;
            this.serialPort.Parity = Parity.None;
            this.serialPort.DataBits = 8;   
        }       
    }
}