Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public JT808_0x0200_0x07 Deserialize(ref JT808MessagePackReader reader, IJT808Config config)
        {
            JT808_0x0200_0x07 value = new JT808_0x0200_0x07();

            value.AttachInfoId     = reader.ReadByte();
            value.AttachInfoLength = reader.ReadByte();
            //BeiDou
            byte beidouCount = reader.ReadByte();

            for (int i = 0; i < beidouCount; i++)
            {
                SatelliteStatusInformation ssi = new SatelliteStatusInformation();
                ssi.No           = reader.ReadByte();
                ssi.Elevation    = reader.ReadByte();
                ssi.AzimuthAngle = reader.ReadUInt16();
                value.BeiDou.Add(ssi);
            }
            //GPS
            byte gpsCount = reader.ReadByte();

            for (int i = 0; i < gpsCount; i++)
            {
                SatelliteStatusInformation ssi = new SatelliteStatusInformation();
                ssi.No           = reader.ReadByte();
                ssi.Elevation    = reader.ReadByte();
                ssi.AzimuthAngle = reader.ReadUInt16();
                value.GPS.Add(ssi);
            }
            //GLONASS
            byte glonassCount = reader.ReadByte();

            for (int i = 0; i < glonassCount; i++)
            {
                SatelliteStatusInformation ssi = new SatelliteStatusInformation();
                ssi.No           = reader.ReadByte();
                ssi.Elevation    = reader.ReadByte();
                ssi.AzimuthAngle = reader.ReadUInt16();
                value.GLONASS.Add(ssi);
            }
            //Galileo
            byte galileoCount = reader.ReadByte();

            for (int i = 0; i < galileoCount; i++)
            {
                SatelliteStatusInformation ssi = new SatelliteStatusInformation();
                ssi.No           = reader.ReadByte();
                ssi.Elevation    = reader.ReadByte();
                ssi.AzimuthAngle = reader.ReadUInt16();
                value.Galileo.Add(ssi);
            }
            return(value);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="writer"></param>
        /// <param name="config"></param>
        public void Analyze(ref JT808MessagePackReader reader, Utf8JsonWriter writer, IJT808Config config)
        {
            JT808_0x0200_0x07 value = new JT808_0x0200_0x07();

            value.AttachInfoId = reader.ReadByte();
            writer.WriteNumber($"[{value.AttachInfoId.ReadNumber()}]附加信息Id", value.AttachInfoId);
            value.AttachInfoLength = reader.ReadByte();
            writer.WriteNumber($"[{value.AttachInfoLength.ReadNumber()}]附加信息长度", value.AttachInfoLength);
            //BeiDou
            byte beidouCount = reader.ReadByte();

            writer.WriteNumber($"[{beidouCount.ReadNumber()}]北斗卫星数量", beidouCount);
            writer.WriteStartArray();
            for (int i = 0; i < beidouCount; i++)
            {
                SatelliteStatusInformation ssi = new SatelliteStatusInformation();
                ssi.No           = reader.ReadByte();
                ssi.Elevation    = reader.ReadByte();
                ssi.AzimuthAngle = reader.ReadUInt16();
                ssi.Analyze("BeiDou", writer);
            }
            writer.WriteEndArray();
            //GPS
            byte gpsCount = reader.ReadByte();

            writer.WriteNumber($"[{gpsCount.ReadNumber()}]GPS卫星数量", gpsCount);
            writer.WriteStartArray();
            for (int i = 0; i < gpsCount; i++)
            {
                SatelliteStatusInformation ssi = new SatelliteStatusInformation();
                ssi.No           = reader.ReadByte();
                ssi.Elevation    = reader.ReadByte();
                ssi.AzimuthAngle = reader.ReadUInt16();
                ssi.Analyze("GPS", writer);
            }
            writer.WriteEndArray();
            //GLONASS
            byte glonassCount = reader.ReadByte();

            writer.WriteNumber($"[{glonassCount.ReadNumber()}]GLONASS卫星数量", glonassCount);
            writer.WriteStartArray();
            for (int i = 0; i < glonassCount; i++)
            {
                SatelliteStatusInformation ssi = new SatelliteStatusInformation();
                ssi.No           = reader.ReadByte();
                ssi.Elevation    = reader.ReadByte();
                ssi.AzimuthAngle = reader.ReadUInt16();
                ssi.Analyze("GLONASS", writer);
            }
            writer.WriteEndArray();
            //Galileo
            byte galileoCount = reader.ReadByte();

            writer.WriteNumber($"[{galileoCount.ReadNumber()}]Galileo卫星数量", galileoCount);
            writer.WriteStartArray();
            for (int i = 0; i < galileoCount; i++)
            {
                SatelliteStatusInformation ssi = new SatelliteStatusInformation();
                ssi.No           = reader.ReadByte();
                ssi.Elevation    = reader.ReadByte();
                ssi.AzimuthAngle = reader.ReadUInt16();
                ssi.Analyze("Galileo", writer);
            }
            writer.WriteEndArray();
        }