예제 #1
0
 public SerialParser(byte portNumber, int baudRate, IValueParserAdd valueParserAdd)
     : this(new SerialPort(), valueParserAdd)
 {
     this.serialPort.BaudRate = baudRate;
     this.serialPort.PortName = "COM" + portNumber;
     this.serialPort.Open();
 }
예제 #2
0
        public SerialParser(SerialPort serial, IValueParserAdd valueParserAdd)
        {
            this.valueParserAdd            = valueParserAdd;
            this.serialPort                = serial;
            this.serialPort.DataReceived  += Serial_DataReceived;
            this.serialPort.ErrorReceived += SerialPort_ErrorReceived;
            this.serialPort.Disposed      += SerialPort_Disposed;

            valueBuilder = new StringBuilder();
        }