private void ReceiveData(object sender, SerialDataReceivedEventArgs e) { var length = serialPort.BytesToRead; var buffer = new byte[length]; serialPort.Read(buffer, 0, length); logger.Debug("Receiving data: [" + ByteUtils.ToBase16(buffer) + "]"); reader.ReceiveData(buffer); }