コード例 #1
0
 public void AddSensorTest()
 {
     lock (_target)
     {
         try
         {
             _target.COMPort = _port;
             _target.Initialise();
             ConsultSensor sens = new ConsultData(new DataEngine()).GetSensor("Injection Time (LH)");
             sens.NewDataByte += new ConsultSensor.SensorNewDataByteEvent(PrintByte);
             _target.MonitoringSensors.SensorAdd(sens);
             _target.MonitoringSensors.SensorStartLive();
             Thread.Sleep(10000);
             _target.MonitoringSensors.SensorStopLive();
         }
         catch (Exception ex)
         {
             Assert.Fail(ex.Message + ex.StackTrace);
         }
     }
 }
コード例 #2
0
ファイル: ConsultTest.cs プロジェクト: vc/from-editor
 public void AddSensorTest()
 {
     lock (_target)
     {
         try
         {
             _target.COMPort = _port;
             _target.Initialise();
             ConsultSensor sens = new ConsultData(new DataEngine()).GetSensor("Injection Time (LH)");
             sens.NewDataByte += new ConsultSensor.SensorNewDataByteEvent(PrintByte);
             _target.MonitoringSensors.SensorAdd(sens);
             _target.MonitoringSensors.SensorStartLive();
             Thread.Sleep(10000);
             _target.MonitoringSensors.SensorStopLive();
         }
         catch (Exception ex)
         {
             Assert.Fail(ex.Message + ex.StackTrace);
         }
     }
 }
コード例 #3
0
        private void InitializeConsult()
        {
            ConsultData data = new ConsultData(new DataEngine());

            if (_consult.DataSource.ToString() != data.ToString())
            {
                _consult.DataSource = data;
                _sensSpeed          = data.ValidSensors["Vehicle speed"];
            }
            else
            {
                try
                {
                    _sensSpeed = _consult.DataSource.ValidSensors["Vehicle speed"];
                }
                catch (KeyNotFoundException)
                {
                    throw new ConsultException("No information about sensor 'Vehicle speed'");
                }
            }
            _consult.MonitoringSensors.Add(_sensSpeed);
        }