From cbd55752405d65132a47205748435d937610ee7a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 30 Aug 2016 05:31:21 +1200 Subject: Improve TK103 protocol decoder (fix #2270) --- src/org/traccar/protocol/Tk103ProtocolDecoder.java | 5 ++--- test/org/traccar/protocol/Tk103ProtocolDecoderTest.java | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java index ac99a1440..90c80be71 100644 --- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java @@ -41,9 +41,9 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { .number("d*") // imei? .number("(dd)(dd)(dd),?") // date .expression("([AV]),?") // validity - .number("(dd)(dd.d+)") // latitude + .number("(d+)(dd.d+)") // latitude .expression("([NS]),?") - .number("(ddd)(dd.d+)") // longitude + .number("(d+)(dd.d+)") // longitude .expression("([EW]),?") .number("(d+.d)(?:d*,)?") // speed .number("(dd)(dd)(dd),?") // time @@ -211,7 +211,6 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder { position.setCourse(parser.nextDouble()); - // Status String status = parser.next(); if (status != null) { position.set(Position.KEY_STATUS, status); // binary status diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java index c1bf148bc..ba820f2f6 100644 --- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest { Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new Tk103Protocol()); + verifyPosition(decoder, text( + "(01602009983BR00160830V1855.7022S4817.8731W000.0002729000.0010000000L00000000)")); + verifyPosition(decoder, text( "(088046338039BR00160727A3354.7768N03540.7258E000.0140832068.4700000000L00BEB0D4+017.7)")); -- cgit v1.2.3