aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/OpenGtsProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/OpenGtsProtocolDecoderTest.java3
2 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/OpenGtsProtocolDecoder.java b/src/org/traccar/protocol/OpenGtsProtocolDecoder.java
index c1967917f..c854ad491 100644
--- a/src/org/traccar/protocol/OpenGtsProtocolDecoder.java
+++ b/src/org/traccar/protocol/OpenGtsProtocolDecoder.java
@@ -42,7 +42,7 @@ public class OpenGtsProtocolDecoder extends BaseHttpProtocolDecoder {
.number("(d+)(dd.d+),") // longitude
.expression("([EW]),")
.number("(d+.d+),") // speed
- .number("(d+.d+),") // course
+ .number("(d+.d+)?,") // course
.number("(dd)(dd)(dd),") // date (ddmmyy)
.any()
.compile();
@@ -80,15 +80,15 @@ public class OpenGtsProtocolDecoder extends BaseHttpProtocolDecoder {
}
DateBuilder dateBuilder = new DateBuilder()
- .setTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
+ .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setValid(parser.next().equals("A"));
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
- position.setSpeed(parser.nextDouble(0));
+ position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble(0));
- dateBuilder.setDateReverse(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
+ dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
break;
case "alt":
diff --git a/test/org/traccar/protocol/OpenGtsProtocolDecoderTest.java b/test/org/traccar/protocol/OpenGtsProtocolDecoderTest.java
index 5942f38d0..cc7d5b684 100644
--- a/test/org/traccar/protocol/OpenGtsProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/OpenGtsProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class OpenGtsProtocolDecoderTest extends ProtocolTest {
OpenGtsProtocolDecoder decoder = new OpenGtsProtocolDecoder(new OpenGtsProtocol());
verifyPosition(decoder, request(
+ "/?id=999000000000003&gprmc=$GPRMC,082202.0,A,5006.747329,N,01416.512315,E,0.0,,131018,1.2,E,A*2E"));
+
+ verifyPosition(decoder, request(
"/?id=gprmc_999000000000003&gprmc=$GPRMC,143013.0,A,5006.728217,N,01416.437869,E,0.0,329.6,281017,1.2,E,A*0E"));
verifyPosition(decoder, request(