From c0b737b3a8b3a5bb2a383e14d3ae5c14a5260781 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 2 Feb 2019 00:35:53 -0800 Subject: Fix TR20 decoder --- src/org/traccar/protocol/Tr20ProtocolDecoder.java | 2 +- test/org/traccar/protocol/Tr20ProtocolDecoderTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/Tr20ProtocolDecoder.java b/src/org/traccar/protocol/Tr20ProtocolDecoder.java index 6c7b689a6..c2e6c381f 100644 --- a/src/org/traccar/protocol/Tr20ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tr20ProtocolDecoder.java @@ -52,7 +52,7 @@ public class Tr20ProtocolDecoder extends BaseProtocolDecoder { .number("(ddd)(dd.d+),") // longitude .number("(d+),") // speed .number("(d+),") // course - .number("(?:NA|[FC](-?d+)),") // temperature + .number("(?:NA|[FC]?(-?d+)),") // temperature .number("(x{8}),") // status .number("(d+)") // event .any() diff --git a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java index d43031e06..76355066b 100644 --- a/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tr20ProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Tr20ProtocolDecoderTest extends ProtocolTest { Tr20ProtocolDecoder decoder = new Tr20ProtocolDecoder(null); + verifyPosition(decoder, text( + "%%123456789012345,A,120101121800,N6000.0000E13000.0000,0,000,0,01034802,150,[Message]")); + verifyNull(decoder, text( "%%TRACKPRO01,1")); -- cgit v1.2.3