示例#1
0
        /// <inheritdoc />
        public void Initialize(PluginConfiguration configuration, Action <Action <ISystemController, IRaceController> > queueCommand)
        {
            _components  = new List <IPluginComponent>();
            _initialized = false;

            //TODO: maybe use the container or child container for this?
            ISensor sensor;

            if (_simulated)
            {
                sensor = new SimulatedWindSensor(_logger, this);
            }
            else
            {
                if (string.IsNullOrWhiteSpace(_deviceAddress))
                {
                    throw new ArgumentNullException("deviceAddress");
                }

                var bmas = new BlendMicroAnemometerSensor(_logger, _clock, _maximumDataAge, this, _btAdapterName, _deviceAddress, _connection, _windAngleOffset);
                bmas.Start();
                sensor = bmas;
            }

            _components.Add(sensor);
            configuration.Sensors.Add(sensor);

            var trueCalculator = new TrueWindCalculator(_logger, this);

            _components.Add(trueCalculator);
            configuration.Calculators.Add(trueCalculator);

            var mastBendCalculator = new MastBendCalculator(_logger, this);

            _components.Add(mastBendCalculator);
            configuration.Calculators.Add(mastBendCalculator);

            _initialized = true;
        }
        /// <inheritdoc />
        public void Initialize(PluginConfiguration configuration, Action<Action<ISystemController, IRaceController>> queueCommand)
        {
			_components = new List<IPluginComponent>();
            _initialized = false;

			//TODO: maybe use the container or child container for this?
			ISensor sensor;
			if (_simulated) 
			{
				sensor = new SimulatedWindSensor (_logger,this);
			} 
			else 
			{
				if (string.IsNullOrWhiteSpace (_deviceAddress)) 
				{
					throw new ArgumentNullException ("deviceAddress");
				}

				var bmas = new BlendMicroAnemometerSensor (_logger, _clock, _maximumDataAge, this,_btAdapterName,_deviceAddress, _connection,_windAngleOffset);
				bmas.Start ();
				sensor = bmas;
			}

			_components.Add (sensor);
			configuration.Sensors.Add (sensor);

			var trueCalculator = new TrueWindCalculator (_logger, this);
			_components.Add (trueCalculator);
			configuration.Calculators.Add (trueCalculator);

			var mastBendCalculator = new MastBendCalculator (_logger, this);
			_components.Add (mastBendCalculator);
			configuration.Calculators.Add (mastBendCalculator);

            _initialized = true;
        }