• R/O
  • HTTP
  • SSH
  • HTTPS

yubeshi: Commit

source codes and tests


Commit MetaInfo

Revisiona5d10497f96a553c3013b97d9c2f874bb3d57dd8 (tree)
Time2011-02-23 22:47:42
Authorkimikage <kimikage_ceo@hotm...>
Commiterkimikage

Log Message

Infパケットに共通の抽象クラスを設定

Change Summary

Incremental Difference

--- /dev/null
+++ b/Yubeshi/Ubx/Inf.cs
@@ -0,0 +1,36 @@
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 abstract class Inf : Packet
15+ {
16+ #region constructors
17+
18+ public Inf(byte[] sentence, int length)
19+ : base(sentence, length)
20+ {
21+ }
22+
23+ #endregion
24+
25+ #region properties
26+
27+ public string Message
28+ {
29+ get
30+ {
31+ return Encoding.ASCII.GetString(Raw, 6, Raw.Length - 8);
32+ }
33+ }
34+ #endregion
35+ }
36+}
--- a/Yubeshi/Ubx/InfDebug.cs
+++ b/Yubeshi/Ubx/InfDebug.cs
@@ -11,7 +11,7 @@ using System.Text;
1111
1212 namespace Yubeshi.Ubx
1313 {
14- public class InfDebug : Packet
14+ public class InfDebug : Inf
1515 {
1616 #region constructors
1717
@@ -22,24 +22,11 @@ namespace Yubeshi.Ubx
2222
2323 #endregion
2424
25- #region properties
26-
27- public string Message
28- {
29- get
30- {
31- return Encoding.ASCII.GetString(Raw, 6, Raw.Length - 8);
32- }
33- }
34-
35- #endregion
36-
3725 #region public methods
3826
3927 public static bool TryParse(byte[] sentence, out UnknownPacket packet)
4028 {
41- return TryParse(sentence, out packet,
42- MessageID.InfDebug, -1, Build);
29+ return TryParse(sentence, out packet, MessageID.InfDebug, Build);
4330 }
4431
4532 #endregion
--- a/Yubeshi/Ubx/InfError.cs
+++ b/Yubeshi/Ubx/InfError.cs
@@ -11,7 +11,7 @@ using System.Text;
1111
1212 namespace Yubeshi.Ubx
1313 {
14- public class InfError : Packet
14+ public class InfError : Inf
1515 {
1616 #region constructors
1717
@@ -22,18 +22,6 @@ namespace Yubeshi.Ubx
2222
2323 #endregion
2424
25- #region properties
26-
27- public string Message
28- {
29- get
30- {
31- return Encoding.ASCII.GetString(Raw, 6, Raw.Length - 8);
32- }
33- }
34-
35- #endregion
36-
3725 #region public methods
3826
3927 public static bool TryParse(byte[] sentence, out UnknownPacket packet)
--- a/Yubeshi/Ubx/InfNotice.cs
+++ b/Yubeshi/Ubx/InfNotice.cs
@@ -11,7 +11,7 @@ using System.Text;
1111
1212 namespace Yubeshi.Ubx
1313 {
14- public class InfNotice : Packet
14+ public class InfNotice : Inf
1515 {
1616 #region constructors
1717
@@ -22,18 +22,6 @@ namespace Yubeshi.Ubx
2222
2323 #endregion
2424
25- #region properties
26-
27- public string Message
28- {
29- get
30- {
31- return Encoding.ASCII.GetString(Raw, 6, Raw.Length - 8);
32- }
33- }
34-
35- #endregion
36-
3725 #region public methods
3826
3927 public static bool TryParse(byte[] sentence, out UnknownPacket packet)
--- a/Yubeshi/Ubx/InfTest.cs
+++ b/Yubeshi/Ubx/InfTest.cs
@@ -11,7 +11,7 @@ using System.Text;
1111
1212 namespace Yubeshi.Ubx
1313 {
14- public class InfTest : Packet
14+ public class InfTest : Inf
1515 {
1616 #region fields
1717 private static readonly Encoding ascii = Encoding.ASCII;
@@ -26,18 +26,6 @@ namespace Yubeshi.Ubx
2626
2727 #endregion
2828
29- #region properties
30-
31- public string Message
32- {
33- get
34- {
35- return ascii.GetString(Raw, 6, Raw.Length - 8);
36- }
37- }
38-
39- #endregion
40-
4129 #region public methods
4230
4331 public static bool TryParse(byte[] sentence, out UnknownPacket packet)
--- a/Yubeshi/Ubx/InfWarning.cs
+++ b/Yubeshi/Ubx/InfWarning.cs
@@ -11,7 +11,7 @@ using System.Text;
1111
1212 namespace Yubeshi.Ubx
1313 {
14- public class InfWarning : Packet
14+ public class InfWarning : Inf
1515 {
1616 #region constructors
1717
@@ -22,18 +22,6 @@ namespace Yubeshi.Ubx
2222
2323 #endregion
2424
25- #region properties
26-
27- public string Message
28- {
29- get
30- {
31- return Encoding.ASCII.GetString(Raw, 6, Raw.Length - 8);
32- }
33- }
34-
35- #endregion
36-
3725 #region public methods
3826
3927 public static bool TryParse(byte[] sentence, out UnknownPacket packet)
Show on old repository browser