コード例 #1
0
 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();
 }
コード例 #2
0
 public override int GetHashCode()
 {
     return
         (PortName.GetHashCode()
          ^
          BaudRate.GetHashCode()
          ^
          DataBits.GetHashCode()
          ^
          Parity.GetHashCode()
          ^
          StopBits.GetHashCode());
 }
コード例 #3
0
        /// <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);
        }