/// <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> protected override int ParseBodyImage(byte[] buffer, int startIndex, int length) { ConfigurationCell configCell = ConfigurationCell; IPhasorValue phasorValue; int x, parsedLength, index = startIndex; // Parse out frequency value FrequencyValue = SelFastMessage.FrequencyValue.CreateNewValue(this, configCell.FrequencyDefinition, buffer, index, out parsedLength); index += parsedLength; // Parse out phasor values for (x = 0; x < configCell.PhasorDefinitions.Count; x++) { phasorValue = PhasorValue.CreateNewValue(this, configCell.PhasorDefinitions[x], buffer, index, out parsedLength); PhasorValues.Add(phasorValue); index += parsedLength; } // Parse out status flags StatusFlags = (StatusFlags)BigEndian.ToUInt16(buffer, index); index += 2; // Return total parsed length return(index - startIndex); }
// Static Methods // Delegate handler to create a new SEL Fast Message phasor value internal static IPhasorValue CreateNewValue(IDataCell parent, IPhasorDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IPhasorValue phasor = new PhasorValue(parent, definition); parsedLength = phasor.ParseBinaryImage(buffer, startIndex, 0); return(phasor); }
// Static Methods // Delegate handler to create a new SEL Fast Message phasor value internal static IPhasorValue CreateNewValue(IDataCell parent, IPhasorDefinition definition, byte[] buffer, int startIndex, out int parsedLength) { IPhasorValue phasor = new PhasorValue(parent, definition); parsedLength = phasor.ParseBinaryImage(buffer, startIndex, 0); return phasor; }