Inheritance: TransportAddress
コード例 #1
0
ファイル: Coder.cs プロジェクト: AlexAlbala/MaCRo
 public void Start()
 {
     t         = new SerialTransportAddress("COM1", false);
     transport = new SerialTransport(t, 9600);
     transport.Start(this);
     monitor = new object();
 }
コード例 #2
0
        public SerialTransport(SerialTransportAddress sta, int baudRate)
        {
            this.sta  = sta;
            this.port = CreateSerialPort(sta, baudRate);

            SendBuffer = new Dictionary();
            headerACK  = new SafeSerialHeader();
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #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);
        }
コード例 #6
0
ファイル: SerialTransport.cs プロジェクト: AlexAlbala/MaCRo
 /// <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;
 }
コード例 #7
0
ファイル: SerialTransport.cs プロジェクト: AlexAlbala/MaCRo
        public SerialTransport(SerialTransportAddress sta, int baudRate)
        {
            this.sta = sta;
            this.port = CreateSerialPort(sta, baudRate);

            SendBuffer = new Dictionary();
            headerACK = new SafeSerialHeader();
        }
コード例 #8
0
ファイル: Coder.cs プロジェクト: AlexAlbala/MaCRo
 public void Start()
 {
     t = new SerialTransportAddress("COM1", false);
     transport = new SerialTransport(t, 9600);
     transport.Start(this);
     monitor = new object();
 }