aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-10-13 14:12:07 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-10-13 14:12:07 +1300
commitfc0933a50d0ee2081e98e652ebfa0fc04d2e7069 (patch)
tree88b2cd6db01ffb0bc427461115f0d2187c71f6fd
parent63d6a96b7953b09c013657fa912f4bcf21308477 (diff)
downloadtraccar-server-fc0933a50d0ee2081e98e652ebfa0fc04d2e7069.tar.gz
traccar-server-fc0933a50d0ee2081e98e652ebfa0fc04d2e7069.tar.bz2
traccar-server-fc0933a50d0ee2081e98e652ebfa0fc04d2e7069.zip
Decode X1 GPS RFID data
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 9570eac96..71df47f0a 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -495,6 +495,14 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(), buf.readUnsignedByte(),
buf.readUnsignedShort(), buf.readUnsignedInt())));
+ long driverId = buf.readUnsignedInt();
+ if (driverId > 0) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, String.valueOf(driverId));
+ }
+
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+
return position;
} else if (type == MSG_X1_PHOTO_INFO) {
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index bb7e2bdba..e7635d63f 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -16,6 +16,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"78780D01086471700328358100093F040D0A"));
+ verifyPosition(decoder, binary(
+ "78783c3439000000120a0902093a07031f9e690529be2e00155500000016214901a30308b70000b3fb004aa82b059401a3422100000001000000007d9370b90d0a"));
+
verifyAttributes(decoder, binary(
"7878079404eb001c705d0d0a"));