Пример #1
0
        public static Message1020 Parse(string binStr)
        {
            StringSequence sequence = new StringSequence();

            sequence.EnQuence(binStr);

            Message1020 msg = new Message1020();

            msg.MessageNumber = BitConvertUtil.GetUInt(sequence.DeQueue(12));
            msg.SatelliteID   = BitConvertUtil.GetUInt(sequence.DeQueue(6));
            msg.SatelliteFrequencyChannelNumber = BitConvertUtil.GetUInt(sequence.DeQueue(5)) - 7;
            msg.AlmanacHealth = BitConvertUtil.GetInt(sequence.DeQueue(1)) == 1;
            msg.AlmanacHealthAvailabilityIndicator = BitConvertUtil.GetInt(sequence.DeQueue(1));
            msg.P1 = BitConvertUtil.GetUInt(sequence.DeQueue(2));
            //Tk 分为时、分、秒,各自所占字符数不等
            msg.Tkh                = BitConvertUtil.GetUInt(sequence.DeQueue(6));
            msg.Tkm                = BitConvertUtil.GetUInt(sequence.DeQueue(5));
            msg.Tks                = BitConvertUtil.GetInt(sequence.DeQueue(1)) * 30;
            msg.MsbOfBnWord        = BitConvertUtil.GetInt(sequence.DeQueue(1));
            msg.P2                 = BitConvertUtil.GetInt(sequence.DeQueue(1)) == 1;
            msg.Tb                 = BitConvertUtil.GetUInt(sequence.DeQueue(7)) * 900;
            msg.XnfFirstDerivative = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(24)) * GnssConst.P2_20 * 1E3;
            msg.Xn                 = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(27)) * GnssConst.P2_11 * 1E3;
            msg.XnSecondDerivative = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(5)) * GnssConst.P2_30 * 1E3;
            msg.YnfFirstDerivative = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(24)) * GnssConst.P2_20 * 1E3;
            msg.Yn                 = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(27)) * GnssConst.P2_11 * 1E3;
            msg.YnSecondDerivative = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(5)) * GnssConst.P2_30 * 1E3;
            msg.ZnfFirstDerivative = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(24)) * GnssConst.P2_20 * 1E3;
            msg.Zn                 = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(27)) * GnssConst.P2_11 * 1E3;
            msg.ZnSecondDerivative = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(5)) * GnssConst.P2_30 * 1E3;
            msg.P3                 = BitConvertUtil.GetInt(sequence.DeQueue(1)) == 1;
            msg.GamaN              = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(11)) * GnssConst.P2_40;
            msg.Mp                 = BitConvertUtil.GetUInt(sequence.DeQueue(2));
            msg.Mln                = BitConvertUtil.GetInt(sequence.DeQueue(1)) == 1;
            msg.TaoN               = BitConvertUtil.GetInt(sequence.DeQueue(22)) * GnssConst.P2_30;
            msg.MDeltaTaoN         = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(5));
            msg.En                 = BitConvertUtil.GetUInt(sequence.DeQueue(5));
            msg.Mp4                = BitConvertUtil.GetInt(sequence.DeQueue(1)) == 1;
            msg.Mft                = BitConvertUtil.GetUInt(sequence.DeQueue(4));
            msg.Mnt                = BitConvertUtil.GetUInt(sequence.DeQueue(11));
            msg.Mm                 = BitConvertUtil.GetUInt(sequence.DeQueue(2));
            msg.TheAvailabilityOfAdditionalData = BitConvertUtil.GetInt(sequence.DeQueue(1)) == 1;
            msg.Na             = BitConvertUtil.GetUInt(sequence.DeQueue(11));
            msg.TaoC           = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(32));
            msg.Mn4            = BitConvertUtil.GetUInt(sequence.DeQueue(5));
            msg.MtaoGps        = BitConvertUtil.ConvertToInt64WithInverseCode(sequence.DeQueue(22));
            msg.MlnFifthString = BitConvertUtil.GetInt(sequence.DeQueue(1)) == 1;
            msg.Reserved       = BitConvertUtil.GetUInt(sequence.DeQueue(7));

            return(msg);
        }