Exemple #1
0
        public override eSuccessState ParseData(GSMParameters param, bool[] decodedBurst, int sequence)
        {
            if (IsDummy(decodedBurst))
            {
                /* this may happen with dumps that do not contain SCH/BCCH anymore. simply accept it. */
                return(eSuccessState.Unknown);
            }

            Array.Copy(decodedBurst, 3, SCHData, 0, 39);
            Array.Copy(decodedBurst, 106, SCHData, 39, 39);

            if (Deconvolution() == eCorrectionResult.Failed)
            {
                ErrorMessage = "(Error in ConvolutionalCoder)";
                return(eSuccessState.Failed);
            }

            bool[] crc = CRC.Calc(SCHDataDecoded, 0, 35, CRC.PolynomialSCH);
            if (!CRC.Matches(crc))
            {
                ErrorMessage = "(Error in CRC)";
                return(eSuccessState.Failed);
            }

            byte BSIC = (byte)ByteUtil.BitsToLongRev(SCHDataDecoded, 2, 6);
            long T1   = ByteUtil.BitsToLongRev(SCHDataDecoded, new[] { new[] { 0, 2 }, new[] { 8, 8 }, new[] { 23, 1 } });
            long T2   = ByteUtil.BitsToLongRev(SCHDataDecoded, 18, 5);
            long T3M  = ByteUtil.BitsToLongRev(SCHDataDecoded, new[] { new[] { 16, 2 }, new[] { 24, 1 } });
            long T3   = (10 * T3M) + 1;

            long FN;

            if (T2 <= T3)
            {
                FN = 51 * ((T3 - T2) % 26) + T3 + 51 * 26 * T1;
            }
            else
            {
                FN = 51 * (26 - ((T2 - T3) % 26)) + T3 + 51 * 26 * T1;
            }

            if (param.FN != FN)
            {
                param.FN = FN;
            }

            param.TN   = 0;
            param.BSIC = BSIC;

            if (DumpData)
            {
                StatusMessage =
                    "BSIC: " + String.Format("{0,3}", BSIC) +
                    "  T1: " + String.Format("{0,5}", T1) +
                    "  T2: " + String.Format("{0,3}", T2) +
                    "  T3: " + String.Format("{0,3}", T3) +
                    "  FN: " + String.Format("{0,8}", FN) +
                    "  TrainOffs: " + String.Format("{0,3}", param.SampleOffset);
            }

            return(eSuccessState.Succeeded);
        }