private bool SetType(byte vif) { Type = (PrimaryValueInformation)vif; var success = Enum.IsDefined(typeof(PrimaryValueInformation), Type); return(success); }
private void Parse() { var baseMultiplier = DetermineTypeAndMultiplier(); switch (Type) { case PrimaryValueInformation.Date: ParseDate(_dataField); break; case PrimaryValueInformation.DateTimeGeneral: ParseDate(_dataField); break; case PrimaryValueInformation.EnergyWh: Multiplier = baseMultiplier - 3; Unit = Unit.Wh; break; case PrimaryValueInformation.EnergyJoule: Multiplier = baseMultiplier; Unit = Unit.J; break; case PrimaryValueInformation.Volume: Multiplier = baseMultiplier - 6; Unit = Unit.M3; break; case PrimaryValueInformation.Mass: Multiplier = baseMultiplier - 3; Unit = Unit.Kg; break; case PrimaryValueInformation.PowerW: Multiplier = baseMultiplier - 3; Unit = Unit.W; break; case PrimaryValueInformation.PowerJh: Multiplier = baseMultiplier; Unit = Unit.Jh; break; case PrimaryValueInformation.VolumeFlow: Multiplier = baseMultiplier - 6; Unit = Unit.M3h; break; case PrimaryValueInformation.VolumeFlowExt: Multiplier = baseMultiplier - 7; Unit = Unit.M3min; break; case PrimaryValueInformation.VolumeFlowExtS: Multiplier = baseMultiplier - 9; Unit = Unit.M3s; break; case PrimaryValueInformation.MassFlow: Multiplier = baseMultiplier - 3; Unit = Unit.Kgh; break; case PrimaryValueInformation.OnTime: Type = PrimaryValueInformation.OnTime; ParseTime(baseMultiplier); break; case PrimaryValueInformation.InletFlowTemperature: case PrimaryValueInformation.ReturnFlowTemperature: case PrimaryValueInformation.ExternalTemperature: Multiplier = baseMultiplier - 3; Unit = Unit.C; break; case PrimaryValueInformation.TemperatureDifference: Multiplier = baseMultiplier - 3; Unit = Unit.K; break; case PrimaryValueInformation.Pressure: Type = PrimaryValueInformation.Pressure; Multiplier = baseMultiplier - 3; Unit = Unit.Bar; break; } }