diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-11-26 10:14:25 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-11-26 10:14:25 +1300 |
commit | 3099d53fae70aa2f7aba0c123b1feecd8f072ef1 (patch) | |
tree | 82de04c415507358906fe6bac4c09a9e8c3d1d2a | |
parent | 4c6089f544c429dad9cf36cdafe3054cba164033 (diff) | |
download | traccar-server-3099d53fae70aa2f7aba0c123b1feecd8f072ef1.tar.gz traccar-server-3099d53fae70aa2f7aba0c123b1feecd8f072ef1.tar.bz2 traccar-server-3099d53fae70aa2f7aba0c123b1feecd8f072ef1.zip |
Fix GV300W CAN decoding
-rw-r--r-- | src/org/traccar/protocol/Gl200TextProtocolDecoder.java | 3 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java index e004ce994..97cc8f987 100644 --- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -729,6 +729,9 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); if (BitUtil.check(reportMask, 30)) { + while (values[index].isEmpty()) { + index += 1; + } position.setValid(Integer.parseInt(values[index++]) > 0); if (!values[index].isEmpty()) { position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(values[index++]))); diff --git a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java index abca940b5..f6264b7e3 100644 --- a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest { Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null); + verifyPosition(decoder, buffer( + "+RESP:GTCAN,270703,867162025056839,gv300w,0,1,E07FFFFF,,2,H9307659,368713.50,1291,90,91,,P82.40,,61,10.10,6.76,3.34,524.08,,,0000,,00,,,007FFFFF,,,,,,,,,,,,,,,,,,,,,0000,2,0,,,0,88.6,104,117.6,-116.886007,32.543697,20181031202959,0334,0020,5234,7FCC3D0,00,20181031203002,9F50$")); + verifyPositions(decoder, buffer( "+RESP:GTERI,310701,863286023712855,,00000004,28378,10,1,1,0.0,294,358.4,14.271475,50.110771,20181111185001,0230,0003,94D4,3B30,00,14.5,,,,110000,2,0,C03FFFFF,,0,H46400,12310.70,0,0,83,,,,0,,0.53,3.43,,,,40,,0,,,20181111185252,2DFF")); |