public Pv2RttFixedPointDesc(byte id, string name, string description, string units, string formatString, Pv2RttFieldFlags flags, BitSizeEnum bitSize, double offset, double fraction, double defaultValue, Pv2RttRecordDesc group) : base(id, name, description, units, formatString, flags, defaultValue, group) { BitSize = bitSize; Offset = offset; Fraction = fraction; try { FormatString.FormatWith(defaultValue); } catch (Exception e) { throw new Exception($"RTT field {name}[{id}] has wrong format string '{formatString}':{e.Message}"); } if (Enum.GetValues(typeof(BitSizeEnum)).Cast <BitSizeEnum>().Contains(bitSize) == false) { throw new ArgumentOutOfRangeException(nameof(bitSize), bitSize, $"Unknwon value of enum {nameof(BitSizeEnum)}"); } }
public override string ConvertToString(Pv2ParamValue value) { return(FormatString.FormatWith(GetValue(value))); }