From ee2fbc5cb8bb5dc017eed3db3785fb8c2166df67 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 28 Dec 2017 16:59:44 +1300 Subject: Handle missing T333 taxi info --- src/org/traccar/protocol/MeitrackProtocolDecoder.java | 2 +- test/org/traccar/protocol/MeitrackProtocolDecoderTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 1fd1bb3ac..259283c19 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -259,7 +259,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { boolean started = data[0].charAt(0) == '0'; position.set("taximeterOn", started); position.set("taximeterStart", data[1]); - if (!started) { + if (data.length > 2) { position.set("taximeterEnd", data[2]); position.set("taximeterDistance", Integer.parseInt(data[3])); position.set("taximeterFare", Integer.parseInt(data[4])); diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java index 35529f721..9021da8f9 100644 --- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class MeitrackProtocolDecoderTest extends ProtocolTest { MeitrackProtocolDecoder decoder = new MeitrackProtocolDecoder(new MeitrackProtocol()); + verifyPosition(decoder, buffer( + "$$^182,864507031245110,AAA,109,13.844553,100.644360,171227173141,A,11,19,0,359,0.8,8,15075,934591,520|4|0643|07D20555,8400,0000|0000|0000|018D|04CB,,,108,0000,,6,0,,,,,10|171227173100*7C")); + verifyPosition(decoder, buffer( "$$S214,864507031219974,AAA,109,13.844643,100.644395,171207021520,A,10,28,0,31,0.8,6,390,421327,520|0|0016|000F2DB0,8400,0000|0000|0000|018D|04C6,,,108,0000,,6,0,,,,,11|171207091500|171207091500|78|3500|000000|000003*12")); -- cgit v1.2.3