Пример #1
0
        // Static Methods

        // Delegate handler to create a new BPA PDCstream data cell
        internal static IDataCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState <IDataCell> state, int index, byte[] buffer, int startIndex, out int parsedLength)
        {
            DataCell dataCell = new DataCell(parent as IDataFrame, (state as IDataFrameParsingState).ConfigurationFrame.Cells[index]);

            parsedLength = dataCell.ParseBinaryImage(buffer, startIndex, 0);

            return(dataCell);
        }
Пример #2
0
        // Static Methods

        // Create new header cell delegate handler
        internal static IHeaderCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState <IHeaderCell> state, int index, byte[] buffer, int startIndex, out int parsedLength)
        {
            parsedLength = 1;
            return(new HeaderCell(parent as IHeaderFrame, buffer[startIndex])
            {
                IDCode = (ushort)index
            });
        }
Пример #3
0
        // Static Methods

        // Delegate handler to create a new IEEE C37.118 configuration cell
        internal static IConfigurationCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState <IConfigurationCell> state, int index, byte[] buffer, int startIndex, out int parsedLength)
        {
            ConfigurationCell configCell = new ConfigurationCell(parent as IConfigurationFrame);

            parsedLength = configCell.ParseBinaryImage(buffer, startIndex, 0);

            return(configCell);
        }
Пример #4
0
        /// <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 body image of the <see cref="ChannelFrameBase{T}"/> is parsed to create a collection of <see cref="Cells"/>.
        /// </remarks>
        protected override int ParseBodyImage(byte[] buffer, int startIndex, int length)
        {
            IChannelFrameParsingState <T> state = State;
            T   cell;
            int parsedLength, index = startIndex;

            // Parse all frame cells
            for (int x = 0; x < state.CellCount; x++)
            {
                cell = state.CreateNewCell(this, state, x, buffer, index, out parsedLength);
                m_cells.Add(cell);
                index += parsedLength;
            }

            return(index - startIndex);
        }
Пример #5
0
        // Static Methods

        // Delegate handler to create a new IEC 61850-90-5 data cell
        internal static IDataCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState <IDataCell> state, int index, byte[] buffer, int startIndex, out int parsedLength)
        {
            IDataFrameParsingState parsingState      = state as IDataFrameParsingState;
            IConfigurationCell     configurationCell = null;

            // With or without an associated configuration, we'll parse the data cell
            if (parsingState != null && parsingState.ConfigurationFrame != null)
            {
                configurationCell = parsingState.ConfigurationFrame.Cells[index];
            }

            DataCell dataCell = new DataCell(parent as IDataFrame, configurationCell);

            parsedLength = dataCell.ParseBinaryImage(buffer, startIndex, 0);

            return(dataCell);
        }
Пример #6
0
        // Static Methods

        // Delegate handler to create a new IEEE 1344 data cell
        internal static IDataCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState<IDataCell> state, int index, byte[] binaryImage, int startIndex, out int parsedLength)
        {
            DataCell dataCell = new DataCell(parent as IDataFrame, (state as IDataFrameParsingState).ConfigurationFrame.Cells[index]);

            parsedLength = dataCell.Initialize(binaryImage, startIndex, 0);

            return dataCell;
        }
Пример #7
0
        // Static Methods

        // Delegate handler to create a new BPA PDCstream configuration cell
        internal static IConfigurationCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState<IConfigurationCell> state, int index, byte[] binaryImage, int startIndex, out int parsedLength)
        {
            ConfigurationCell configCell = new ConfigurationCell(parent as IConfigurationFrame);

            parsedLength = configCell.Initialize(binaryImage, startIndex, 0);

            return configCell;
        }
Пример #8
0
        // Static Methods

        // Create new header cell delegate handler
        internal static IHeaderCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState<IHeaderCell> state, int index, byte[] binaryImage, int startIndex, out int parsedLength)
        {
            parsedLength = 1;
            return new HeaderCell(parent as IHeaderFrame, binaryImage[startIndex]) { IDCode = (ushort)index };
        }
Пример #9
0
        // Static Methods

        // Delegate handler to create a new Macrodyne configuration cell
        internal static IConfigurationCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState <IConfigurationCell> state, int index, byte[] buffer, int startIndex, out int parsedLength)
        {
            parsedLength = 0;
            return(new ConfigurationCell(parent as ConfigurationFrame, null));
        }
Пример #10
0
        // Static Methods

        // Create new command cell delegate handler
        internal static ICommandCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState<ICommandCell> state, int index, byte[] buffer, int startIndex, out int parsedLength)
        {
            parsedLength = 1;
            return new CommandCell(parent as ICommandFrame, buffer[startIndex])
            {
                IDCode = (ushort)index
            };
        }
Пример #11
0
        // Static Methods

        // Delegate handler to create a new IEC 61850-90-5 data cell
        internal static IDataCell CreateNewCell(IChannelFrame parent, IChannelFrameParsingState<IDataCell> state, int index, byte[] buffer, int startIndex, out int parsedLength)
        {
            IDataFrameParsingState parsingState = state as IDataFrameParsingState;
            IConfigurationCell configurationCell = null;

            // With or without an associated configuration, we'll parse the data cell
            if (parsingState != null && parsingState.ConfigurationFrame != null)
                configurationCell = parsingState.ConfigurationFrame.Cells[index];

            DataCell dataCell = new DataCell(parent as IDataFrame, configurationCell);

            parsedLength = dataCell.ParseBinaryImage(buffer, startIndex, 0);

            return dataCell;
        }