diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-03-06 16:31:49 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-03-06 16:31:49 -0800 |
commit | 312cd7bd408c978392cacb6ef580288158361ce5 (patch) | |
tree | 49b65f998eba6ad6ef5d8cde2e9ecf79da592579 | |
parent | 7f28cbe9a997fb5271ece16f30383d7cc4241575 (diff) | |
download | traccar-server-312cd7bd408c978392cacb6ef580288158361ce5.tar.gz traccar-server-312cd7bd408c978392cacb6ef580288158361ce5.tar.bz2 traccar-server-312cd7bd408c978392cacb6ef580288158361ce5.zip |
Decode heartbeat battery level
-rw-r--r-- | src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index c5e8809e3..b7d6d2595 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -838,7 +838,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(); // satellites buf.readUnsignedByte(); // alarm buf.readUnsignedByte(); // language - buf.readUnsignedByte(); // battery + + position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); + buf.readUnsignedByte(); // working mode buf.readUnsignedShort(); // working voltage buf.readUnsignedByte(); // reserved diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index eeafbbdc4..1f92f5a26 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -18,6 +18,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { "78780D01086471700328358100093F040D0A")); verifyAttribute(decoder, binary( + "7878151330802b00000642014f0008720000802b5ee4d4c90d0a"), + Position.KEY_BATTERY_LEVEL, 6); + + verifyAttribute(decoder, binary( "7878281520000000003c49434349443a38393838323339303030303039373330323635303e00020d446f260d0a"), Position.KEY_ICCID, "89882390000097302650"); |