diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-28 16:59:44 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-28 17:00:41 +1300 |
commit | ee2fbc5cb8bb5dc017eed3db3785fb8c2166df67 (patch) | |
tree | d93e8b1a1ae813501652284d335690584729e18f | |
parent | 6e0be9857bc26c59936d4446ef15488bd90f5150 (diff) | |
download | traccar-server-ee2fbc5cb8bb5dc017eed3db3785fb8c2166df67.tar.gz traccar-server-ee2fbc5cb8bb5dc017eed3db3785fb8c2166df67.tar.bz2 traccar-server-ee2fbc5cb8bb5dc017eed3db3785fb8c2166df67.zip |
Handle missing T333 taxi info
-rw-r--r-- | src/org/traccar/protocol/MeitrackProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/MeitrackProtocolDecoderTest.java | 3 |
2 files changed, 4 insertions, 1 deletions
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 @@ -12,6 +12,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")); verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN, |