aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Tr20ProtocolDecoder.java11
-rw-r--r--test/org/traccar/protocol/Tr20ProtocolDecoderTest.java3
2 files changed, 12 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
index e7ae0185f..6c7b689a6 100644
--- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java
@@ -52,6 +52,9 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
.number("(ddd)(dd.d+),") // longitude
.number("(d+),") // speed
.number("(d+),") // course
+ .number("(?:NA|[FC](-?d+)),") // temperature
+ .number("(x{8}),") // status
+ .number("(d+)") // event
.any()
.compile();
@@ -87,8 +90,12 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN));
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN));
- position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
- position.setCourse(parser.nextDouble(0));
+ position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
+ position.setCourse(parser.nextDouble());
+
+ position.set(Position.PREFIX_TEMP + 1, parser.nextInt());
+ position.set(Position.KEY_STATUS, parser.nextHexLong());
+ position.set(Position.KEY_EVENT, parser.nextInt());
return position;
}
diff --git a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java
index c00c5f069..d43031e06 100644
--- a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class Tr20ProtocolDecoderTest extends ProtocolTest {
"%%TRACKPRO01,1"));
verifyPosition(decoder, text(
+ "%%868873457748532,A,181109121248,N2237.4181E11403.2857,000,282,NA,47010000,108"));
+
+ verifyPosition(decoder, text(
"%%TR-10,A,050916070549,N2240.8887E11359.2994,0,000,NA,D3800000,150,CFG:resend|"),
position("2005-09-16 07:05:49.000", true, 22.68148, 113.98832));