public ConnectionSettings(uint baudRate, WORD_LENGTH wordLength, STOP_BITS stopBits, PARITY parity, FLOW_CONTROL flowControl, byte xOn = 0x00, byte xOff = 0x00) { BaudRate = baudRate; WordLength = wordLength; StopBits = stopBits; Parity = parity; FlowControl = flowControl; XOn = xOn; XOff = xOff; }
public static void PrintNumbers(int lower, int upper, PARITY parity) { if (parity == PARITY.EVEN) { PrintEvenNumbers(lower, upper); } else { PrintOddNumbers(lower, upper); } }
/// <summary> /// Sets basic parameters of the Serial-Connection. /// </summary> /// <param name="c">Number of the COM-Port on which this connection will be opened.</param> /// <param name="b">The Baudrate for the speed of this connection.</param> /// <param name="d">The number of databits transfered within block.</param> /// <param name="p">Defines the type of parity to use with this connection</param> /// <param name="s">Defines the number of stopbits to use with this connection</param> /// <see cref="ISerialInterface"/> public void configure(string c = "COM1", BAUDRATE b = BAUDRATE.B9600, DATABITS d = DATABITS.DATABITS_8, PARITY p = PARITY.NONE, STOPBIT s = STOPBIT.ONE) { sio.PortName = c; sio.BaudRate = (int)b; sio.DataBits = (int)d; //sio.Handshake = Handshake.XOnXOff; // do not use this, because we don't have a real rs232 interface. its emulated over rs485 sio.Parity = (Parity)p; switch (s) { default: case STOPBIT.ONE: sio.StopBits = StopBits.One; break; case STOPBIT.TWO: sio.StopBits = StopBits.Two; break; } switch (p) { default: case PARITY.NONE: sio.Parity = Parity.None; break; case PARITY.EVEN: sio.Parity = Parity.Even; break; case PARITY.ODD: sio.Parity = Parity.Odd; break; } }