private FH4TelemetryValue SurgeLowPass() { LowpassFilter lp = (LowpassFilter)session.Get("SurgeLowPass", new LowpassFilter()); float data = (float)lp.firstOrder_lowpassFilter(telemetryData.AccelerationZ, 0.1); FH4TelemetryValue tv = new FH4TelemetryValue("Surge", data); return(tv); }
public TelemetryValue TelemetryValueByName(string name) { FH4TelemetryValue tv; switch (name) { case "Surge": tv = SurgeLowPass(); break; default: object data; Type eleDataType = typeof(FH4Data); PropertyInfo propertyInfo; FieldInfo fieldInfo = eleDataType.GetField(name); if (fieldInfo != null) { data = fieldInfo.GetValue(telemetryData); } else if ((propertyInfo = eleDataType.GetProperty(name)) != null) { data = propertyInfo.GetValue(telemetryData, null); } else { throw new UnknownTelemetryValueException(name); } tv = new FH4TelemetryValue(name, data); object value = tv.Value; if (value == null) { throw new UnknownTelemetryValueException(name); } break; } return(tv); }