Inheritance: TransportAddress
Example #1
0
 public void Start()
 {
     t         = new SerialTransportAddress("COM1", false);
     transport = new SerialTransport(t, 9600);
     transport.Start(this);
     monitor = new object();
 }
Example #2
0
        public SerialTransport(SerialTransportAddress sta, int baudRate)
        {
            this.sta  = sta;
            this.port = CreateSerialPort(sta, baudRate);

            SendBuffer = new Dictionary();
            headerACK  = new SafeSerialHeader();
        }
Example #3
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);
        }
Example #4
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));
        }
Example #5
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);
        }
Example #6
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;
 }
Example #7
0
        public SerialTransport(SerialTransportAddress sta, int baudRate)
        {
            this.sta = sta;
            this.port = CreateSerialPort(sta, baudRate);

            SendBuffer = new Dictionary();
            headerACK = new SafeSerialHeader();
        }
Example #8
0
 public void Start()
 {
     t = new SerialTransportAddress("COM1", false);
     transport = new SerialTransport(t, 9600);
     transport.Start(this);
     monitor = new object();
 }