• R/O
  • HTTP
  • SSH
  • HTTPS

yubeshi: Commit

source codes and tests


Commit MetaInfo

Revisionacb26e7ccb9db7224dd0f123ba80620a49622a69 (tree)
Time2011-02-23 23:07:47
Authorkimikage <kimikage_ceo@hotm...>
Commiterkimikage

Log Message

WeekとTimeOfWeekプロパティを持つパケットにGpsTimeプロパティ追加

Change Summary

Incremental Difference

--- a/Yubeshi/Ubx/NavSol.cs
+++ b/Yubeshi/Ubx/NavSol.cs
@@ -24,6 +24,14 @@ namespace Yubeshi.Ubx
2424
2525 #region properties
2626
27+ public GpsTime GpsTime
28+ {
29+ get
30+ {
31+ return new GpsTime(Week, TimeOfWeek);
32+ }
33+ }
34+
2735 public decimal TimeOfWeek
2836 {
2937 get
--- a/Yubeshi/Ubx/NavTimeGps.cs
+++ b/Yubeshi/Ubx/NavTimeGps.cs
@@ -24,6 +24,14 @@ namespace Yubeshi.Ubx
2424
2525 #region properties
2626
27+ public GpsTime GpsTime
28+ {
29+ get
30+ {
31+ return new GpsTime(Week, TimeOfWeek);
32+ }
33+ }
34+
2735 public decimal TimeOfWeek
2836 {
2937 get
--- a/Yubeshi/Ubx/NavTimeUtc.cs
+++ b/Yubeshi/Ubx/NavTimeUtc.cs
@@ -29,36 +29,35 @@ namespace Yubeshi.Ubx
2929 get
3030 {
3131 uint tow = BitConverter.ToUInt32(Raw, 6 + 0);
32- int ftow = BitConverter.ToInt32(Raw, 6 + 4);
32+ int ftow = BitConverter.ToInt32(Raw, 6 + 8);
3333 return tow * 1e-3m + ftow * 1e-9m;
3434 }
35-
3635 }
3736
38- public int Week
37+ public decimal Accuracy
3938 {
40- get
39+ get
4140 {
42- return BitConverter.ToInt16(Raw, 6 + 8);
41+ return BitConverter.ToUInt32(Raw, 6 + 4) * 1e-9m;
4342 }
4443 }
4544
46- public int LeapSecond
45+ public DateTime Utc
4746 {
4847 get
49- {
50- return (sbyte)(Raw[6 + 10]);
48+ {
49+ int y = BitConverter.ToUInt16(Raw, 6 + 12);
50+ int m = Raw[6 + 14];
51+ int d = Raw[6 + 14];
52+ int h = Raw[6 + 14];
53+ int min = Raw[6 + 14];
54+ int s = Raw[6 + 14];
55+ int ftow = BitConverter.ToInt32(Raw, 6 + 8);
56+ DateTime utc = new DateTime(y, m, d, h, min, s,
57+ DateTimeKind.Utc);
58+ return utc.AddTicks(ftow / 100);
5159 }
5260 }
53-
54- public decimal Accuracy
55- {
56- get
57- {
58- return BitConverter.ToUInt32(Raw, 6 + 12) * 1e-9m;
59- }
60- }
61-
6261 #endregion
6362
6463 #region public methods
@@ -66,7 +65,7 @@ namespace Yubeshi.Ubx
6665 public static bool TryParse(byte[] sentence, out UnknownPacket packet)
6766 {
6867 return TryParse(sentence, out packet,
69- MessageID.NavTimeGps, 16, Build);
68+ MessageID.NavTimeUtc, 20, Build);
7069 }
7170
7271 #endregion
--- a/Yubeshi/Ubx/RxmRaw.cs
+++ b/Yubeshi/Ubx/RxmRaw.cs
@@ -21,10 +21,7 @@ namespace Yubeshi.Ubx
2121 get;
2222 private set;
2323 }
24- public void Set(byte[] raw)
25- {
26- Raw = raw;
27- }
24+
2825 public double CarrierPhase
2926 {
3027 get
@@ -61,7 +58,7 @@ namespace Yubeshi.Ubx
6158 {
6259 get
6360 {
64- return (Raw[21] << 24) >> 24; // SByte
61+ return ((int)(Raw[21] << 24)) >> 24; // SByte
6562 }
6663 }
6764
@@ -69,7 +66,7 @@ namespace Yubeshi.Ubx
6966 {
7067 get
7168 {
72- return (Raw[22] << 24) >> 24; // SByte
69+ return ((int)(Raw[22] << 24)) >> 24; // SByte
7370 }
7471 }
7572
@@ -80,7 +77,12 @@ namespace Yubeshi.Ubx
8077 return Raw[23];
8178 }
8279 }
83-
80+
81+
82+ public void Set(byte[] raw)
83+ {
84+ Raw = raw;
85+ }
8486 }
8587 #endregion
8688
@@ -100,6 +102,14 @@ namespace Yubeshi.Ubx
100102
101103 #region properties
102104
105+ public GpsTime GpsTime
106+ {
107+ get
108+ {
109+ return new GpsTime(Week, TimeOfWeek);
110+ }
111+ }
112+
103113 public decimal TimeOfWeek
104114 {
105115 get
Show on old repository browser