aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Jt600ProtocolDecoder.java10
-rw-r--r--test/org/traccar/protocol/Jt600ProtocolDecoderTest.java3
2 files changed, 12 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
index 87996a0c3..109f8a68a 100644
--- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -145,7 +145,15 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedInt(); // vehicle id combined
- position.set(Position.KEY_STATUS, buf.readUnsignedShort());
+ int status = buf.readUnsignedShort();
+ position.set(Position.KEY_ALARM, BitUtil.check(status, 1) ? Position.ALARM_GEOFENCE_ENTER : null);
+ position.set(Position.KEY_ALARM, BitUtil.check(status, 2) ? Position.ALARM_GEOFENCE_EXIT : null);
+ position.set(Position.KEY_ALARM, BitUtil.check(status, 3) ? Position.ALARM_POWER_CUT : null);
+ position.set(Position.KEY_ALARM, BitUtil.check(status, 4) ? Position.ALARM_VIBRATION : null);
+ position.set(Position.KEY_BLOCKED, BitUtil.check(status, 7));
+ position.set(Position.KEY_ALARM, BitUtil.check(status, 8 + 3) ? Position.ALARM_LOW_BATTERY : null);
+ position.set(Position.KEY_ALARM, BitUtil.check(status, 8 + 6) ? Position.ALARM_FAULT : null);
+ position.set(Position.KEY_STATUS, status);
int battery = buf.readUnsignedByte();
if (battery == 0xff) {
diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
index ed583e012..3baa17667 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(
+ "2475801263981711002713061813333723501622090221558f012f0000002a070000000020c055b88552191f000f0f0f07"));
+
+ verifyPositions(decoder, binary(
"24408111888821001B09060908045322564025113242329F0598000001003F0000002D00AB"));
verifyPositions(decoder, binary(