aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java14
-rw-r--r--test/org/traccar/protocol/Jt600ProtocolDecoderTest.java3
2 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index f76fd8069..58835c7d6 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -21,6 +21,7 @@ import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.helper.BcdUtil;
+import org.traccar.helper.BitBuffer;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
@@ -152,6 +153,19 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
fuel += buf.readUnsignedByte();
position.set(Position.KEY_FUEL_LEVEL, fuel);
+ } else if (version == 3) {
+
+ BitBuffer bitBuffer = new BitBuffer(buf);
+
+ position.set("fuel1", bitBuffer.readUnsigned(12));
+ position.set("fuel2", bitBuffer.readUnsigned(12));
+ position.set("fuel3", bitBuffer.readUnsigned(12));
+ position.set(Position.KEY_ODOMETER, bitBuffer.readUnsigned(20) * 1000);
+
+ int status = bitBuffer.readUnsigned(24);
+ position.set(Position.KEY_IGNITION, BitUtil.check(status, 0));
+ position.set(Position.KEY_STATUS, status);
+
}
positions.add(position);
diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
index eb82d8c23..33959bc29 100644
--- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
@@ -12,6 +12,9 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest {
Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new Jt600Protocol());
verifyPositions(decoder, binary(
+ "24657060730131001b13111710361906538525079524797f000000000000000003f300036c"));
+
+ verifyPositions(decoder, binary(
"24624090196121001b19071703493631277203074235752f295800005308010000768b0822"));
verifyPositions(decoder, binary(