4 * This software is distributed under a zlib-style license.
\r
5 * See license.txt for more information.
\r
9 using System.Collections.Generic;
\r
12 namespace Yubeshi.Ubx
\r
14 public class NavSvInfo : Packet
\r
16 #region type definitions
\r
18 public enum ChipGeneration : byte
\r
25 public struct SvInfo
\r
29 public enum Status : byte
\r
32 DifferentialCorrection = 0x02,
\r
33 OrbitInformation = 0x04,
\r
37 AutonomousOrbitPrediction = 0x40,
\r
50 public int SatelliteID
\r
58 public Status StatusFlags
\r
62 return (Status)Raw[2];
\r
70 return Raw[3] & 0x0F;
\r
74 public int SignalStrength
\r
82 public Degree Elevation
\r
86 return (sbyte)(Raw[5]);
\r
90 public Degree Azimuth
\r
94 return BitConverter.ToInt16(Raw, 6);
\r
98 public double PseudoRangeResidual
\r
102 return BitConverter.ToInt32(Raw, 8) * 0.01;
\r
106 public void Set(byte[] raw)
\r
113 #region constructors
\r
115 public NavSvInfo(byte[] sentence, int length)
\r
116 : base(sentence, length)
\r
118 SvInformation = new SvInfo[NumberOfChannels];
\r
119 for (int i = 0; i < NumberOfChannels; ++i)
\r
121 SvInformation[i].Set(
\r
122 OctetString.Substring(Raw, 14 + 12 * i, 12));
\r
130 public decimal TimeOfWeek
\r
134 return BitConverter.ToUInt32(Raw, 6 + 0) * 1e-3m;
\r
138 public int NumberOfChannels
\r
146 public ChipGeneration Chip
\r
150 return (ChipGeneration)(Raw[6 + 5] & 0x7);
\r
154 public SvInfo[] SvInformation
\r
162 #region public methods
\r
164 public static bool TryParse(byte[] sentence, out UnknownPacket packet)
\r
167 if (sentence.Length < 16)
\r
171 int length = 8 + 12 * sentence[6 + 4];
\r
172 return TryParse(sentence, out packet,
\r
173 MessageID.NavSvInfo, length, Build);
\r
178 #region private methods
\r
180 private static Packet Build(byte[] sentence, int length)
\r
182 return new NavSvInfo(sentence, length);
\r