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 NavSol : Packet
\r
16 #region constructors
\r
18 public NavSol(byte[] sentence, int length)
\r
19 : base(sentence, length)
\r
21 ID = MessageID.NavSol;
\r
23 uint tow = BitConverter.ToUInt32(sentence, 6 + 0);
\r
24 int ftow = BitConverter.ToInt32(sentence, 6 + 4);
\r
25 TimeOfWeek = tow * 1e-3m + ftow * 1e-9m;
\r
26 Week = BitConverter.ToInt16(sentence, 6 + 8);
\r
27 PositionFixType = (GpsFixType)sentence[6 + 10];
\r
28 FixFlags = (FixStatusFlag)sentence[6 + 11];
\r
29 int x = BitConverter.ToInt32(sentence, 6 + 12);
\r
30 int y = BitConverter.ToInt32(sentence, 6 + 16);
\r
31 int z = BitConverter.ToInt32(sentence, 6 + 20);
\r
32 uint acc = BitConverter.ToUInt32(sentence, 6 + 24);
\r
33 Position = new EcefCoordinate(x, y, z, acc);
\r
34 int vx = BitConverter.ToInt32(sentence, 6 + 28);
\r
35 int vy = BitConverter.ToInt32(sentence, 6 + 32);
\r
36 int vz = BitConverter.ToInt32(sentence, 6 + 36);
\r
37 uint vAcc = BitConverter.ToUInt32(sentence, 6 + 40);
\r
38 Velocity = new EcefVelocity(vx, vy, vz, vAcc);
\r
45 public decimal TimeOfWeek
\r
57 public GpsFixType PositionFixType
\r
63 public FixStatusFlag FixFlags
\r
69 public EcefCoordinate Position
\r
75 public EcefVelocity Velocity
\r
88 #region public methods
\r
90 public static bool TryParse(byte[] sentence, out UnknownPacket packet)
\r
92 return TryParse(sentence, out packet, MessageID.NavSol, 52, Build);
\r
97 #region private methods
\r
99 private static Packet Build(byte[] sentence, int length)
\r
101 return new NavSol(sentence, length);
\r