// Static Methods // Delegate handler to create a new IEEE 1344 frequency definition internal static IFrequencyDefinition CreateNewDefinition(IConfigurationCell parent, byte[] buffer, int startIndex, out int parsedLength) { IFrequencyDefinition frequencyDefinition = new FrequencyDefinition(parent); parsedLength = frequencyDefinition.ParseBinaryImage(buffer, startIndex, 0); return(frequencyDefinition); }
/// <summary> /// Parses the binary body image. /// </summary> /// <param name="buffer">Binary image to parse.</param> /// <param name="startIndex">Start index into <paramref name="buffer"/> to begin parsing.</param> /// <param name="length">Length of valid data within <paramref name="buffer"/>.</param> /// <returns>The length of the data that was parsed.</returns> /// <remarks> /// The IEEE 1344 protocol provides frequency and df/dt as optional data measurements, so we override /// the default behavior to account for this change in operation. /// </remarks> protected override int ParseBodyImage(byte[] buffer, int startIndex, int length) { FrequencyDefinition definition = Definition; int parsedLength = 0; if (definition != null) { // Note that IEEE 1344 only supports scaled integers (no need to worry about floating points) if (definition.FrequencyIsAvailable) { UnscaledFrequency = BigEndian.ToInt16(buffer, startIndex); startIndex += 2; parsedLength += 2; } if (definition.DfDtIsAvailable) { UnscaledDfDt = BigEndian.ToInt16(buffer, startIndex); parsedLength += 2; } } return(parsedLength); }
/// <summary> /// Creates a new <see cref="FrequencyValue"/> from specified parameters. /// </summary> /// <param name="parent">The <see cref="DataCell"/> parent of this <see cref="FrequencyValue"/>.</param> /// <param name="frequencyDefinition">The <see cref="FrequencyDefinition"/> associated with this <see cref="FrequencyValue"/>.</param> /// <param name="frequency">The floating point value that represents this <see cref="FrequencyValue"/>.</param> /// <param name="dfdt">The floating point value that represents the change in this <see cref="FrequencyValue"/> over time.</param> public FrequencyValue(DataCell parent, FrequencyDefinition frequencyDefinition, double frequency, double dfdt) : base(parent, frequencyDefinition, frequency, dfdt) { }
// Static Methods // Delegate handler to create a new IEEE 1344 frequency definition internal static IFrequencyDefinition CreateNewDefinition(IConfigurationCell parent, byte[] buffer, int startIndex, out int parsedLength) { IFrequencyDefinition frequencyDefinition = new FrequencyDefinition(parent); parsedLength = frequencyDefinition.ParseBinaryImage(buffer, startIndex, 0); return frequencyDefinition; }