aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java16
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java7
2 files changed, 18 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 020feb6f6..4c8c4255c 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -47,13 +47,14 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder {
"(\\d{2})(\\d{2})(\\d{2})\\d+," + // Date
"[^,]*," +
"[FL]," + // F - full / L - low
- "(\\d{2})(\\d{2})(\\d{2}).(\\d{3})," + // Time (HHMMSS.SSS)
+ "(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
- "(\\d{2})(\\d{2}.\\d{4})," + // Latitude (DDMM.MMMM)
+ "(\\d{2})(\\d{2}\\.\\d{4})," + // Latitude (DDMM.MMMM)
"([NS])," +
- "(\\d{3})(\\d{2}.\\d{4})," + // Longitude (DDDMM.MMMM)
+ "(\\d{3})(\\d{2}\\.\\d{4})," + // Longitude (DDDMM.MMMM)
"([EW])?," +
"(\\d+\\.?\\d*)," + // Speed
+ "(\\d+\\.\\d+)?" + // Course
".*");
/**
@@ -135,7 +136,14 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder {
// Speed
position.setSpeed(Double.valueOf(parser.group(index++)));
- position.setCourse(0.0);
+
+ // Course
+ String course = parser.group(index++);
+ if (course != null) {
+ position.setCourse(Double.valueOf(course));
+ } else {
+ position.setCourse(0.0);
+ }
// Extended info
position.setExtendedInfo(extendedInfo.toString());
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index 0c2b33536..61585d3c1 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -60,7 +60,12 @@ public class Gps103ProtocolDecoderTest {
assertNotNull(decoder.decode(null, null,
"imei:863070010423167,tracker,1211051840,,F,104000.000,A,2220.6483,N,11407.6377,,0,0,"));
-
+
+ assertNotNull(decoder.decode(null, null,
+ "imei:863070010423167,tracker,1211051951,63360926,F,115123.000,A,2220.6322,N,11407.5313,E,0.00,,"));
+
+ assertNotNull(decoder.decode(null, null,
+ "imei:863070010423167,tracker,1211060621,,F,062152.000,A,2220.6914,N,11407.5506,E,15.85,347.84,"));
}
}