diff options
author | Anton Tananaev <anton@traccar.org> | 2023-09-22 18:43:00 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-09-22 18:43:00 -0700 |
commit | 6f59f756a7d3e86924e762919dbbe13940a6511f (patch) | |
tree | 180c7b1f5297a8ae58f0c01753a558bcac3416e3 | |
parent | d5bc3cc9d97be0df8e0ce46b000556efb08a9451 (diff) | |
download | trackermap-server-6f59f756a7d3e86924e762919dbbe13940a6511f.tar.gz trackermap-server-6f59f756a7d3e86924e762919dbbe13940a6511f.tar.bz2 trackermap-server-6f59f756a7d3e86924e762919dbbe13940a6511f.zip |
Fix TLW2-12BL ADC decoding
-rw-r--r-- | src/main/java/org/traccar/protocol/T800xProtocolDecoder.java | 2 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java index 4ddea730c..a1093fc32 100644 --- a/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/T800xProtocolDecoder.java @@ -391,7 +391,7 @@ public class T800xProtocolDecoder extends BaseProtocolDecoder { for (int i = 1; i <= adcCount; i++) { String value = ByteBufUtil.hexDump(buf.readSlice(2)); if (!value.equals("ffff")) { - position.set(Position.PREFIX_ADC + i, Integer.parseInt(value) * 0.01); + position.set(Position.PREFIX_ADC + i, Integer.parseInt(value, 16) * 0.01); } } } diff --git a/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java index 3f62a834c..468751e1b 100644 --- a/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class T800xProtocolDecoderTest extends ProtocolTest { var decoder = inject(new T800xProtocolDecoder(null)); verifyAttributes(decoder, binary( + "25251300594a1b0869738060144917003c0e101e03e85a2dc8c00005070000410000000000000000000000005b000003a5b45e00230919102252e3a5094288fabfc0e98b15420000010403921352ffff0000001cffffffffff25251300594a1c0869738060144917003c0e101e03e85a2ac7c00005070000410000000000000000000000002d000003a5b48b002309191023522d320642abfebfc0e98b15420000010c03921345ffff0000001bffffffffff25251300594a1d0869738060144917003c0e101e03e85a1ac9c000050700004100000000000000000000000024000003a5b4af00230919102452b81ef9410002c0c0ec8b15420108011403911345ffff0000001dffffffffff25251300594a1e0869738060144917003c0e101e03e85a3ec7c00005070000410000000000000000000000000e000003a5b4bd002309191025060ad7ec41da02c0c0058c15420084016303921345ffff0000001cffffffffff25251300594a1f0869738060144917003c0e101e03e85a3ec7c020050700004100000000000000000000000005000003a5b4c2002309191025090e2deb410203c0c0108c15420089014303921338ffff0000001dffffffffff25251300594a200869738060144917003c0e101e03e85a1ec5c000050700004100000000000000000000000020000003a5b4e20023091910260948e1bc412205c0c0458c15420040013603921355ffff0000001bffffffffff25251300594a210869738060144917003c0e101e03e85a00c5c020050700004100000000000000000000000000000003a5b4e20023091910270948e1bc412205c0c0458c15420040013603911332ffff0000001dffffffffff")); + + verifyAttributes(decoder, binary( "272704004901380864112055585747c612230321220006000036435fc8acc2ee600f420000000000000000909019003900001356a18000012c0000a8c00000001e20d4800000c00000")); verifyAttributes(decoder, binary( |