Skip to content

Commit

Permalink
Handle missing T333 taxi info
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Dec 28, 2017
1 parent 6e0be98 commit ee2fbc5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/org/traccar/protocol/MeitrackProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private void decodeDataFields(Position position, int count, String[] values) {
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]));
Expand Down
3 changes: 3 additions & 0 deletions test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public void testDecode() throws Exception {

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"));

Expand Down

0 comments on commit ee2fbc5

Please sign in to comment.