public MFTestResults GetSetReadTimeout() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.ReadTimeout, Timeout.Infinite); serialPort.ReadTimeout = 100; serialPort.Eval(serialPort.ReadTimeout, 100); serialPort.ReadTimeout = int.MinValue; serialPort.Eval(serialPort.ReadTimeout, int.MinValue); serialPort.ReadTimeout = int.MaxValue; serialPort.EvalOpenClose(serialPort.ReadTimeout, int.MaxValue); serialPort.ReadTimeout = 1000; serialPort.EvalOpenClose(serialPort.ReadTimeout, 1000); } } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return(result); }
public MFTestResults GetSetHandShake() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.Handshake, Handshake.None); serialPort.Handshake = Handshake.RequestToSend; serialPort.EvalOpenClose(serialPort.Handshake, Handshake.RequestToSend); serialPort.Handshake = Handshake.XOnXOff; serialPort.EvalOpenClose(serialPort.Handshake, Handshake.XOnXOff); } if (portCount > 0) { // Validate we can re-reserve all pins using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Handshake = Handshake.RequestToSend; serialPort.EvalOpenClose(serialPort.Handshake, Handshake.RequestToSend); serialPort.Open(); } } // TODO: Write Desktop tests to validate proper function of RTS/XonXoff } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return(result); }
public MFTestResults GetSetStopBits() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.StopBits, StopBits.One); serialPort.StopBits = StopBits.Two; serialPort.EvalOpenClose(serialPort.StopBits, StopBits.Two); } } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return(result); }
public MFTestResults GetSetBaudRate() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.BaudRate, (int)BaudRate.Baudrate9600); serialPort.BaudRate = (int)BaudRate.Baudrate230400; serialPort.Eval(serialPort.BaudRate, (int)BaudRate.Baudrate230400); serialPort.BaudRate = (int)BaudRate.Baudrate19200; serialPort.EvalOpenClose(serialPort.BaudRate, (int)BaudRate.Baudrate19200); } } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return(result); }
public MFTestResults GetSetParity() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.Parity, Parity.None); serialPort.Parity = Parity.Even; serialPort.Eval(serialPort.Parity, Parity.Even); serialPort.Parity = Parity.Odd; serialPort.EvalOpenClose(serialPort.Parity, Parity.Odd); } } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return(result); }
public MFTestResults GetSetWriteTimeout() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.WriteTimeout, Timeout.Infinite); serialPort.WriteTimeout = 100; serialPort.Eval(serialPort.WriteTimeout, 100); serialPort.WriteTimeout = int.MinValue; serialPort.Eval(serialPort.WriteTimeout, int.MinValue); serialPort.WriteTimeout = int.MaxValue; serialPort.EvalOpenClose(serialPort.WriteTimeout, int.MaxValue); } } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return result; }
public MFTestResults GetSetHandShake() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.Handshake, Handshake.None); serialPort.Handshake = Handshake.RequestToSend; serialPort.EvalOpenClose(serialPort.Handshake, Handshake.RequestToSend); serialPort.Handshake = Handshake.XOnXOff; serialPort.EvalOpenClose(serialPort.Handshake, Handshake.XOnXOff); } if (portCount > 0) { // Validate we can re-reserve all pins using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Handshake = Handshake.RequestToSend; serialPort.EvalOpenClose(serialPort.Handshake, Handshake.RequestToSend); serialPort.Open(); } } // TODO: Write Desktop tests to validate proper function of RTS/XonXoff } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return result; }
public MFTestResults GetSetStopBits() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.StopBits, StopBits.One); serialPort.StopBits = StopBits.Two; serialPort.EvalOpenClose(serialPort.StopBits, StopBits.Two); } } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return result; }
public MFTestResults GetSetParity() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.Parity, Parity.None); serialPort.Parity = Parity.Even; serialPort.Eval(serialPort.Parity, Parity.Even); serialPort.Parity = Parity.Odd; serialPort.EvalOpenClose(serialPort.Parity, Parity.Odd); } } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return result; }
public MFTestResults GetSetBaudRate() { result = MFTestResults.Pass; try { using (TestSerialPort serialPort = new TestSerialPort(Serial.COM1)) { serialPort.Eval(serialPort.BaudRate, (int)BaudRate.Baudrate9600); serialPort.BaudRate = (int)BaudRate.Baudrate230400; serialPort.Eval(serialPort.BaudRate, (int)BaudRate.Baudrate230400); serialPort.BaudRate = (int)BaudRate.Baudrate19200; serialPort.EvalOpenClose(serialPort.BaudRate, (int)BaudRate.Baudrate19200); } } catch (Exception ex) { result = MFTestResults.Fail; Log.Exception(ex.Message); } return result; }