Inheritance: TransportAddress
Esempio n. 1
0
 public void Start(MainWindow display)
 {
     this.display = display;
     t            = new SerialTransportAddress("COM3", false);
     transport    = new SerialTransport(t, 9600);
     transport.Start(this);
 }
Esempio n. 2
0
        /// <summary>
        /// Check if a Tranport Address belongs to the same network as this one.
        /// </summary>
        public override bool IsSameNetwork(TransportAddress ta)
        {
            if (ta == null || GetType() != ta.GetType())
            {
                return(false);
            }
            SerialTransportAddress t = (SerialTransportAddress)ta;

            return(serialport == t.serialport);
        }
Esempio n. 3
0
        /// <summary>
        /// Override this method in order to perform a custom Serial Port initialization.
        /// </summary>
        /// <param name="baudRate">Serial port baud rate.</param>
        /// <returns>Ready-to-use serial port.</returns>
        internal virtual SerialPort CreateSerialPort(SerialTransportAddress sta, int baudRate)
        {
            SerialPort port;

            port = new SerialPort(sta.serialport, baudRate, Parity.None, 8, StopBits.One);
#if !MicroFramework
            port.ReadBufferSize = 65536;
            port.Encoding       = Encoding.GetEncoding("iso-8859-1");
#endif
            return(port);
        }
Esempio n. 4
0
        public SerialTransport(SerialTransportAddress sta, int baudRate)
        {
            this.sta  = sta;
            this.port = CreateSerialPort(sta, baudRate);
#if MicroFramework
            SendBuffer = new Dictionary();
#else
            SendBuffer = new Dictionary <byte, SafeData>();
#endif
            headerACK = new SafeSerialHeader();
        }
Esempio n. 5
0
        /// <summary>
        /// Indicates if this object equals to an other object
        /// </summary>
        /// <param name="obj">Object used to compare</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            //Check for null and compare run-time types.
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            SerialTransportAddress tm = (SerialTransportAddress)obj;

            return(transportMode.Equals(tm.transportMode) && serialport.Equals(tm.serialport));
        }
Esempio n. 6
0
 public void Start(MainWindow display)
 {
     this.display = display;
     t = new SerialTransportAddress("COM3", false);
     transport = new SerialTransport(t, 9600);
     transport.Start(this);
 }
Esempio n. 7
0
 /// <summary>
 /// Override this method in order to perform a custom Serial Port initialization.
 /// </summary>
 /// <param name="baudRate">Serial port baud rate.</param>
 /// <returns>Ready-to-use serial port.</returns>
 internal virtual SerialPort CreateSerialPort(SerialTransportAddress sta, int baudRate)
 {
     SerialPort port;
     port = new SerialPort(sta.serialport, baudRate, Parity.None, 8, StopBits.One);
     #if !MicroFramework
     port.ReadBufferSize = 65536;
     port.Encoding = Encoding.GetEncoding("iso-8859-1");
     #endif
     return port;
 }
Esempio n. 8
0
 public SerialTransport(SerialTransportAddress sta, int baudRate)
 {
     this.sta = sta;
     this.port = CreateSerialPort(sta, baudRate);
     #if MicroFramework
     SendBuffer = new Dictionary();
     #else
     SendBuffer = new Dictionary<byte, SafeData>();
     #endif
     headerACK = new SafeSerialHeader();
 }