예제 #1
0
        /// <summary>
        /// Generates the BIP checksum from content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="blockCount">The block count.</param>
        /// <param name="level">The level.</param>
        /// <returns></returns>
        public static string GenerateBIP(List <IContent> content, int blockCount, StmLevel level)
        {
            Frame bipFrame = new Frame(level);

            bipFrame.Content = new List <IContent>(content);
            return(BinaryInterleavedParity.GenerateBIP(bipFrame, blockCount));
        }
예제 #2
0
        /// <summary>
        /// Evaluates the header.
        /// </summary>
        /// <param name="sdhFrame">The SDH frame.</param>
        /// <returns></returns>
        public bool evaluateHeader(IFrame sdhFrame)
        {
            Frame tempFrame = new Frame((Frame)sdhFrame);

            tempFrame.Msoh = null;
            if (sdhFrame.Msoh != null && (sdhFrame.Msoh.Checksum == BinaryInterleavedParity.GenerateBIP(((Frame)sdhFrame).Content, 21, ((Frame)sdhFrame).Level)))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// Evaluates the header.
        /// </summary>
        /// <param name="sdhFrame">The SDH frame.</param>
        /// <returns></returns>
        public bool evaluateHeader(IFrame sdhFrame)
        {
            //Remove RSOH header from tempFrame
            Frame tempFrame = new Frame((Frame)sdhFrame);

            tempFrame.Rsoh = null;
            //Check BIP
            if (sdhFrame.Rsoh != null && sdhFrame.Rsoh.Checksum == BinaryInterleavedParity.GenerateBIP(((Frame)tempFrame), 8))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// Generates the MSOH header.
        /// </summary>
        /// <param name="sdhFrame">The SDH frame.</param>
        public void generateHeader(IFrame sdhFrame)
        {
            Frame tempFrame = (Frame)sdhFrame;

            if (sdhFrame.Msoh != null)
            {
                sdhFrame.Msoh.Checksum = BinaryInterleavedParity.GenerateBIP(((Frame)sdhFrame).Content, 21, ((Frame)sdhFrame).Level);
            }
            else
            {
                sdhFrame.Msoh = new Header(BinaryInterleavedParity.GenerateBIP(((Frame)sdhFrame).Content, 21, ((Frame)sdhFrame).Level), null, null);
            }

            if (nextData.Count > 0)
            {
                ((SDHFrame.Frame)sdhFrame).Rsoh.DCC = nextData[0];
                nextData.RemoveAt(0);
            }
        }