aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-04-07 22:10:25 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-04-07 22:10:25 -0700
commit2aaadf1b8c793548558f87465cff50b991181ee1 (patch)
tree47d6da9d7a74d82dc1676dac5adb888ab4cff95d /src
parent719608b5553aceb4734b2d376382670049f87951 (diff)
downloadtraccar-server-2aaadf1b8c793548558f87465cff50b991181ee1.tar.gz
traccar-server-2aaadf1b8c793548558f87465cff50b991181ee1.tar.bz2
traccar-server-2aaadf1b8c793548558f87465cff50b991181ee1.zip
Fix second fuel decoding
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java5
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java4
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index bf5b6d89a..5ebc721dd 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -261,9 +261,8 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // unused
break;
case 0x0023:
- buf.skipBytes(4); // unused
position.set("fuel2", Double.parseDouble(
- buf.readCharSequence(2, StandardCharsets.US_ASCII).toString()));
+ buf.readCharSequence(6, StandardCharsets.US_ASCII).toString()));
break;
default:
buf.skipBytes(tenetLength - 2);
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index c5e8d5b2a..233603179 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -15,6 +15,10 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
"7E01000021013345678906000F002C012F373031313142534A2D4D3742203030303030303001D4C1423838383838B47E"));
verifyAttribute(decoder, binary(
+ "7E0200005C03204187290418C70000000000040003015AFC8D06D134D600000000000020040110063457080000000000000000010400000002530901000000000000000030010F310106EB1D000800233030312E3437000A000300000000000000000005000101A500357E"),
+ "fuel2", 1.47);
+
+ verifyAttribute(decoder, binary(
"7E0200005C087034547007000B0000000000040003015A7CEF06CF8A84000000000000200108064451570800000000000000000104000000005309010000000000000000300113310109EB1D000800233030302E3838000A0003001A00000000000000050001037700B27E"),
"fuel1", 88.7);