private void CreateDestinationIdSensor(bool endOperation) { if (IsDeviceSensor) { return; } SensorParametersInternal parameters; switch (dynamicParams.ActiveSensorType.Type) { case SensorType.Factory: var channelDefinition = dynamicParams.IsInvokableParameterSet ? dynamicParams.ActiveSensorType.GetInvoker(this).Output.Select(o => o.ToString()): new string[] {}; parameters = new FactorySensorParameters(channelDefinition); break; default: throw new NotImplementedException($"Don't know what needs to be done to process DestinationId sensor type '{dynamicParams.ActiveSensorType.Type}'."); } BindParametersAndAddSensor(parameters, endOperation); }
public void SensorParameters_FactorySensor_CanBeGetAndSet() { var parameters = new FactorySensorParameters(Enumerable.Empty <string>()); SetAndGetArray(parameters, nameof(FactorySensorParameters.ChannelDefinition), "first", "second"); SetAndGet(parameters, nameof(FactorySensorParameters.FactoryErrorMode), FactoryErrorMode.WarnOnError); SetAndGet(parameters, nameof(FactorySensorParameters.FactoryErrorFormula), "test"); SetAndGet(parameters, nameof(FactorySensorParameters.FactoryMissingDataMode), FactoryMissingDataMode.CalculateWithZero); }
private NewSensorParameters CreateTypedParameters() { NewSensorParameters parameters; switch (Type) { case SensorType.ExeXml: parameters = new ExeXmlSensorParameters("FAKE_VALUE") { ExeFile = GetImplicit <ExeFileTarget>(Second) }; break; case SensorType.Http: var httpParameters = new HttpSensorParameters(); MaybeSet(Second, v => httpParameters.Url = v?.ToString()); parameters = httpParameters; break; case SensorType.WmiService: parameters = new WmiServiceSensorParameters(new List <WmiServiceTarget>()) { Services = GetList <WmiServiceTarget>(First) }; break; case SensorType.Factory: parameters = new FactorySensorParameters(Enumerable.Empty <string>()) { ChannelDefinition = GetList <string>(Second)?.ToArray() }; break; default: throw new NotImplementedException($"Sensor type '{Type}' is currently not supported."); } return(parameters); }