//Constructor for all numbers not zero or double zero public TableValues(int row, int colummn, int tableNumber, string name, Colors color, Parities parity) { Row = row; Column = colummn; TableNumber = tableNumber; Name = name; Color = color; Parity = parity; }
/// <summary> /// Constructor for initialisation of this class /// </summary> /// <param name="portName">Name of the networkPort, where connected the device</param> /// <param name="baudRate">baudrate for the device-communicaton</param> /// <param name="databits">count of the databits for the device communication</param> /// <param name="parity">kind of parity for the device communication</param> /// <param name="stopBit">kind of stopbits for the device communication</param> public SerialCom(string portName, BaudRate baudRate, int databits, Parities parity, StopBit stopBit) { initSerial(); setPortName(portName); setBaudRate(baudRate); setDatabits(databits); setParity(parity); setStopbit(stopBit); }
/// <summary> /// set the kind of parity for the communication /// </summary> /// <param name="parity">parity</param> private void setParity(Parities parity) { try { if (_sPort.IsOpen) { _sPort.Close(); } switch (parity) { case Parities.Even: _sPort.Parity = System.IO.Ports.Parity.Even; break; case Parities.Mark: _sPort.Parity = System.IO.Ports.Parity.Mark; break; case Parities.None: _sPort.Parity = System.IO.Ports.Parity.None; break; case Parities.Odd: _sPort.Parity = System.IO.Ports.Parity.Odd; break; case Parities.Space: _sPort.Parity = System.IO.Ports.Parity.Space; break; } } catch (ArgumentOutOfRangeException e) { throw new ArgumentOutOfRangeException(e.Message); } catch (Exception e) { if (e.InnerException != null) { throw new Exception(e.InnerException.Message); } else { throw new Exception(e.Message); } } }
public SerialPort(string port, BaudRates baudRate, Parities parity, DataSizes dataBits, StopSizes stopBits) { this.ComPort = port; this.BaudRate = baudRate; this.Parity = parity; this.DataBits = dataBits; this.StopBits = stopBits; }