diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-18 22:40:44 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-18 22:40:44 -0700 |
commit | bfe6c5736899e82ba5f9754d4acc5493c34faff4 (patch) | |
tree | ce4b75a7272497c717fa48d9d6e5d9535f61d872 | |
parent | f458cbe473bdc49157415a8bfc6441afd86b670e (diff) | |
download | trackermap-server-bfe6c5736899e82ba5f9754d4acc5493c34faff4.tar.gz trackermap-server-bfe6c5736899e82ba5f9754d4acc5493c34faff4.tar.bz2 trackermap-server-bfe6c5736899e82ba5f9754d4acc5493c34faff4.zip |
Decode hex values correctly
-rw-r--r-- | src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java | 8 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java index aeb57a116..46ef4fff8 100644 --- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -648,16 +648,16 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_AXLE_WEIGHT, Integer.parseInt(values[index - 1])); } if (BitUtil.check(reportMask, 16) && !values[index++].isEmpty()) { - position.set("tachographInfo", Integer.parseInt(values[index - 1])); + position.set("tachographInfo", Integer.parseInt(values[index - 1], 16)); } if (BitUtil.check(reportMask, 17) && !values[index++].isEmpty()) { - position.set("indicators", Integer.parseInt(values[index - 1])); + position.set("indicators", Integer.parseInt(values[index - 1], 16)); } if (BitUtil.check(reportMask, 18) && !values[index++].isEmpty()) { - position.set("lights", Integer.parseInt(values[index - 1])); + position.set("lights", Integer.parseInt(values[index - 1], 16)); } if (BitUtil.check(reportMask, 19) && !values[index++].isEmpty()) { - position.set("doors", Integer.parseInt(values[index - 1])); + position.set("doors", Integer.parseInt(values[index - 1], 16)); } if (BitUtil.check(reportMask, 20) && !values[index++].isEmpty()) { position.set("vehicleOverspeed", Double.parseDouble(values[index - 1])); diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java index 2fe860573..df7e5d53c 100644 --- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java @@ -26,6 +26,9 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest { "+RESP:GTFRI,1A0900,860599000306845,G3-313,0,0,4,1,2.1,0,426.7,8.611466,47.681639,20181214134603,0228,0001,077F,4812,25.2,1,5.7,34,437.3,8.611600,47.681846,20181214134619,0228,0001,077F,4812,25.2,1,4.4,62,438.2,8.611893,47.681983,20181214134633,0228,0001,077F,4812,25.2,1,4.8,78,436.6,8.612236,47.682040,20181214134648,0228,0001,077F,4812,25.2,83,20181214134702,0654$")); verifyPosition(decoder, buffer( + "+RESP:GTCAN,4B0201,867995030004314,,00,1,C07FFFFF,,2,H982769,30263.00,1266,69,82,H0,P69.20,,0,2037.40,243.93,45.56,74.33,13115,,C00,,0,,,0,68.3,99,42.5,-69.099503,18.445614,20190417233605,0370,0002,5A3D,EB42,00,20190417183607,BD76$")); + + 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( |