aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java9
-rw-r--r--test/org/traccar/protocol/V680ProtocolDecoderTest.java3
2 files changed, 10 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index e3388576e..53843c23d 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -49,7 +49,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
"(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
"(\\d+\\.\\d+)," + // Speed
- "(\\d+\\.?\\d*)#" + // Course
+ "(\\d+\\.?\\d*)?#" + // Course
"(\\d{2})(\\d{2})(\\d{2})#" + // Date (DDMMYY)
"(\\d{2})(\\d{2})(\\d{2})" + // Time (HHMMSS)
".*");
@@ -129,7 +129,12 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
// Speed and Course
position.setSpeed(Double.valueOf(parser.group(index++)));
- position.setCourse(Double.valueOf(parser.group(index++)));
+ String course = parser.group(index++);
+ if (course != null) {
+ position.setCourse(Double.valueOf(course));
+ } else {
+ position.setCourse(0.0);
+ }
// Date
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
index 1d1a74878..815a828a7 100644
--- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
@@ -35,6 +35,9 @@ public class V680ProtocolDecoderTest {
assertNotNull(decoder.decode(null, null,
"#356823031236214##0#0000#AUT#1#V#01904.5491,E,6941.0085,N,000.09,248#170513#160140"));
+
+ assertNotNull(decoder.decode(null, null,
+ "#353588550032869##1#0000#AUT#01#72400401cd01a5#00000.0000,E,0000.0000,N,0.00,#000000#000000.000"));
}