• R/O
  • HTTP
  • SSH
  • HTTPS

yubeshi: Commit

source codes and tests


Commit MetaInfo

Revision2ee551c5288abc974a0ab498fcfa20e6e7db9a5c (tree)
Time2011-02-23 23:08:39
Authorkimikage <kimikage_ceo@hotm...>
Commiterkimikage

Log Message

NavSvInfo,RxmSfrB実装

Change Summary

Incremental Difference

--- a/Yubeshi/Ubx/NavSvInfo.cs
+++ b/Yubeshi/Ubx/NavSvInfo.cs
@@ -14,9 +14,99 @@ namespace Yubeshi.Ubx
1414 public class NavSvInfo : Packet
1515 {
1616 #region type definitions
17+
18+ public enum ChipGeneration : byte
19+ {
20+ Antaris = 0,
21+ Ublox5 = 1,
22+ Ublox6 = 2,
23+ }
24+
1725 public struct SvInfo
1826 {
27+
28+ [Flags]
29+ public enum Status : byte
30+ {
31+ SvUsed = 0x01,
32+ DifferentialCorrection = 0x02,
33+ OrbitInformation = 0x04,
34+ Ephemeris = 0x08,
35+ Unhealthy = 0x10,
36+ AlmanacPlus = 0x20,
37+ AutonomousOrbitPrediction = 0x40,
38+ }
39+
1940 private byte[] Raw;
41+
42+ public int Channel
43+ {
44+ get
45+ {
46+ return Raw[0];
47+ }
48+ }
49+
50+ public int SatelliteId
51+ {
52+ get
53+ {
54+ return Raw[1];
55+ }
56+ }
57+
58+ public Status StatusFlags
59+ {
60+ get
61+ {
62+ return (Status)Raw[2];
63+ }
64+ }
65+
66+ public int Quality
67+ {
68+ get
69+ {
70+ return Raw[3] & 0x0F;
71+ }
72+ }
73+
74+ public int SignalStrength
75+ {
76+ get
77+ {
78+ return Raw[4];
79+ }
80+ }
81+
82+ public Degree Elevation
83+ {
84+ get
85+ {
86+ return ((int)(Raw[4] << 24)) >> 24;
87+ }
88+ }
89+
90+ public Degree Azimuth
91+ {
92+ get
93+ {
94+ return BitConverter.ToInt16(Raw, 6);
95+ }
96+ }
97+
98+ public double PseudoRangeResidual
99+ {
100+ get
101+ {
102+ return BitConverter.ToInt32(Raw, 8) * 0.01;
103+ }
104+ }
105+
106+ public void Set(byte[] raw)
107+ {
108+ Raw = raw;
109+ }
20110 }
21111 #endregion
22112
@@ -25,6 +115,12 @@ namespace Yubeshi.Ubx
25115 public NavSvInfo(byte[] sentence, int length)
26116 : base(sentence, length)
27117 {
118+ SvInformation = new SvInfo[NumberOfChannels];
119+ for (int i = 0; i < NumberOfChannels; ++i)
120+ {
121+ SvInformation[i].Set(
122+ OctetString.Substring(Raw, 14 + 12 * i, 12));
123+ }
28124 }
29125
30126 #endregion
@@ -39,6 +135,28 @@ namespace Yubeshi.Ubx
39135 }
40136 }
41137
138+ public int NumberOfChannels
139+ {
140+ get
141+ {
142+ return Raw[6 + 4];
143+ }
144+ }
145+
146+ public ChipGeneration Chip
147+ {
148+ get
149+ {
150+ return (ChipGeneration)(Raw[6 + 5] & 0x7);
151+ }
152+ }
153+
154+ public SvInfo[] SvInformation
155+ {
156+ get;
157+ private set;
158+ }
159+
42160 #endregion
43161
44162 #region public methods
--- a/Yubeshi/Ubx/Packet.cs
+++ b/Yubeshi/Ubx/Packet.cs
@@ -51,7 +51,7 @@ namespace Yubeshi.Ubx
5151 NavSvInfo = 0x0130,
5252 NavSbas = 0x0132,
5353 RxmRaw = 0x0210,
54- RxmSfrb = 0x0211,
54+ RxmSfrB = 0x0211,
5555 RxmSvSI = 0x0220,
5656 RxmAlm = 0x0230,
5757 RxmEph = 0x0231,
--- a/Yubeshi/Ubx/Parser.cs
+++ b/Yubeshi/Ubx/Parser.cs
@@ -48,12 +48,15 @@ namespace Yubeshi.Ubx
4848 parsers[Packet.MessageID.NavPosLlh] = NavPosLlh.TryParse;
4949 parsers[Packet.MessageID.NavSol] = NavSol.TryParse;
5050 parsers[Packet.MessageID.NavStatus] = NavStatus.TryParse;
51+ parsers[Packet.MessageID.NavSvInfo] = NavSvInfo.TryParse;
5152 parsers[Packet.MessageID.NavTimeGps] = NavTimeGps.TryParse;
53+ parsers[Packet.MessageID.NavTimeUtc] = NavTimeUtc.TryParse;
5254 parsers[Packet.MessageID.NavVelEcef] = NavVelEcef.TryParse;
5355 parsers[Packet.MessageID.NavVelNed] = NavVelNed.TryParse;
5456
5557 parsers[Packet.MessageID.RxmAlm] = RxmAlm.TryParse;
5658 parsers[Packet.MessageID.RxmRaw] = RxmRaw.TryParse;
59+ parsers[Packet.MessageID.RxmSfrB] = RxmSfrB.TryParse;
5760 }
5861 #endregion
5962
--- /dev/null
+++ b/Yubeshi/Ubx/RxmSfrB.cs
@@ -0,0 +1,75 @@
1+/*
2+ * Yubeshi GPS Parser
3+ *
4+ * This software is distributed under a zlib-style license.
5+ * See license.txt for more information.
6+ */
7+
8+using System;
9+using System.Collections.Generic;
10+using System.Text;
11+
12+namespace Yubeshi.Ubx
13+{
14+ public class RxmSfrB : Packet
15+ {
16+ #region constructors
17+
18+ public RxmSfrB(byte[] sentence, int length)
19+ : base(sentence, length)
20+ {
21+ Subframe = new uint[10];
22+ for(int i = 0; i < Subframe.Length; ++i)
23+ {
24+ Subframe[i] = BitConverter.ToUInt32(Raw, 8 + 4 * i);
25+ }
26+ }
27+
28+ #endregion
29+
30+ #region properties
31+
32+ public int Channel
33+ {
34+ get
35+ {
36+ return Raw[6 + 0];
37+ }
38+ }
39+
40+ public int SatelliteId
41+ {
42+ get
43+ {
44+ return Raw[6 + 1];
45+ }
46+ }
47+
48+ public uint[] Subframe
49+ {
50+ get;
51+ private set;
52+ }
53+
54+ #endregion
55+
56+ #region public methods
57+
58+ public static bool TryParse(byte[] sentence, out UnknownPacket packet)
59+ {
60+ return TryParse(sentence, out packet,
61+ MessageID.RxmSfrB, 42, Build);
62+ }
63+
64+ #endregion
65+
66+ #region private methods
67+
68+ private static Packet Build(byte[] sentence, int length)
69+ {
70+ return new RxmSfrB(sentence, length);
71+ }
72+
73+ #endregion
74+ }
75+}
--- a/Yubeshi/Yubeshi.csproj
+++ b/Yubeshi/Yubeshi.csproj
@@ -88,6 +88,8 @@
8888 <Compile Include="Ubx\InfWarning.cs" />
8989 <Compile Include="Ubx\InfNotice.cs" />
9090 <Compile Include="Ubx\InfTest.cs" />
91+ <Compile Include="Ubx\Inf.cs" />
92+ <Compile Include="Ubx\RxmSfrB.cs" />
9193 <Compile Include="UnknownPacket.cs" />
9294 <Compile Include="EnuVelocity.cs" />
9395 <Compile Include="YumaAlmanacReader.cs" />
Show on old repository browser