public void Write(byte[] send, int offSet, int count) { if (this.IsOpen) { _serialPort.Write(send, offSet, count); } } public void Dispose() { if (this._serialPort == null) return; if (this._serialPort.IsOpen) this.Close(); this._serialPort.Dispose(); this._serialPort = null; } #endregion void _serialPort_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { // 等待100ms,防止读取不全的情况 Thread.Sleep(100); byte[] m_recvBytes = new byte[_serialPort.BytesToRead];//定义缓冲区大小 int result = _serialPort.Read(m_recvBytes, 0, m_recvBytes.Length);//从串口读取数据 if (result