diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/Tr20ProtocolDecoder.java | 11 |
1 files changed, 9 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; } |