public SerialController(string portName, byte address)
        {
            this.address = address;
            this.serialPort = new SerialPort(portName, 38400);

            this.lineManager = new LineManager();
            this.lineManager.LineReceived += lineManager_LineReceived;

            this.serialPort.DataReceived += serialPort_DataReceived;
        }
Beispiel #2
0
        public SerialController(string portName, byte address)
        {
            this.log        = Log.Logger;
            this.address    = address;
            this.serialPort = new SerialPort(portName, 38400);

            this.lineManager = new LineManager();
            this.lineManager.LineReceived += lineManager_LineReceived;

            this.serialPort.DataReceived += serialPort_DataReceived;
        }
 private void lineManager_LineReceived(object sender, LineManager.LineReceivedEventArgs e)
 {
     if (e.LineData.StartsWith(string.Format("!IOX:{0}", address)))
     {
         // Matches
         var data = e.LineData.Substring(7);
         if (data.Length > 0)
         {
             CommandReceived(data);
         }
     }
     else
         log.Warn("Received unknown data: {0}", e.LineData);
 }