Ejemplo n.º 1
0
        public void Connect(string portName)
        {
            serialPort = new System.IO.Ports.SerialPort(portName, _baudrate, _parity, _dataBits, _stopBits);

            try
            {
                serialPort.Open();
                _dataDisplayer.Show("Connected");
                serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedCallback);
            }
            catch (Exception ex)
            {
                _dataDisplayer.ShowError(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private bool logger(string s)
        {
            if (s != null) // A null is sent when the stream is closed
            {
                dataDisplayer.Show(s.Replace("\0", String.Empty) + Environment.NewLine);
                return(true);
            }

            return(false);
        }