public UARTDriver(string portName, int baudRate = 115200, Parity parity = Parity.None, int databits = 8, StopBits stopBits = StopBits.One) { InitPort(portName, baudRate, parity.GetHashCode(), databits, stopBits.GetHashCode()); Timer.AutoReset = true; Timer.Elapsed += ReadBytes; Timer.Start(); }
public override int GetHashCode() { return (PortName.GetHashCode() ^ BaudRate.GetHashCode() ^ DataBits.GetHashCode() ^ Parity.GetHashCode() ^ StopBits.GetHashCode()); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures /// like a hash table. /// </returns> public override int GetHashCode() { int hash = 13; hash = (hash * 7) + Baudrate.GetHashCode(); hash = (hash * 7) + Databits.GetHashCode(); hash = (hash * 7) + Stopbits.GetHashCode(); hash = (hash * 7) + Parity.GetHashCode(); hash = (hash * 7) + Handshake.GetHashCode(); hash = (hash * 7) + TxTimeoutMSec.GetHashCode(); hash = (hash * 7) + RxTimeoutMSec.GetHashCode(); return(hash); }