aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-08-30 21:51:57 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-08-30 21:51:57 -0700
commitc08d8c971390446ad20f04e67c7e63c7fe1d767d (patch)
tree951056b76d9ca2f666b03ebc023b31a176aeb8c1 /src
parent18a4c32e2c99b5b43e9c8daefd44e50bbd620faa (diff)
downloadtraccar-server-c08d8c971390446ad20f04e67c7e63c7fe1d767d.tar.gz
traccar-server-c08d8c971390446ad20f04e67c7e63c7fe1d767d.tar.bz2
traccar-server-c08d8c971390446ad20f04e67c7e63c7fe1d767d.zip
Decode engine hours
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java3
-rw-r--r--src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java
index 8d39abead..f1d146bda 100644
--- a/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java
@@ -190,6 +190,9 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder {
position.set(
Position.KEY_VIN, buf.readCharSequence(length, StandardCharsets.US_ASCII).toString());
break;
+ case 0x0011:
+ position.set(Position.KEY_HOURS, buf.readUnsignedInt() * 0.05);
+ break;
case 0x0020:
String[] cells = buf.readCharSequence(
length, StandardCharsets.US_ASCII).toString().split("\\+");
diff --git a/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
index b624f69ab..9ba31e08a 100644
--- a/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class HuaShengProtocolDecoderTest extends ProtocolTest {
@@ -16,6 +17,10 @@ public class HuaShengProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"c000000077aa0200000000000e000100143347315f48312e315f56312e30372e54000300133335353835353035303434303635380004000b3531323030303000050005010006000400070004000800050000090018383936313032353431343533333239313833360d000a000f796573696e7465726e6574c0"));
+ verifyAttribute(decoder, binary(
+ "c000000049aa0000000000028e8800000032303038323630373534323800e1d47fffcd163d0000000000f30000000100157703f8000046000000000aade0ffffffff0011000800000496c0"),
+ Position.KEY_HOURS, 58.7);
+
verifyNotNull(decoder, binary(
"c000000077aa00000000000070020000003230303132373035313635330000000000000000000000000000000000010015ffffffff000000000000019dffffffffff0005000a1f00000e455a00200019313238354031406666666540386233663930634030000f0013333536373236313038313335343530c0"));