aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-08-18 11:51:03 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-08-18 11:51:03 -0700
commitdd848b71892c7f5f2554cf793dc123f8f456ddb5 (patch)
tree5f7221575dd4b21a18fa8801e45a667f4378969b /src
parent3ecbff1ae54759fdf212030d7721b7c66b0ea41b (diff)
downloadtrackermap-server-dd848b71892c7f5f2554cf793dc123f8f456ddb5.tar.gz
trackermap-server-dd848b71892c7f5f2554cf793dc123f8f456ddb5.tar.bz2
trackermap-server-dd848b71892c7f5f2554cf793dc123f8f456ddb5.zip
Implement RFID support
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java13
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java4
2 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index ee28a5062..eeb0ae9f2 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -86,6 +86,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_COMMAND_2 = 0x82;
public static final int MSG_TIME_REQUEST = 0x8A;
public static final int MSG_INFO = 0x94;
+ public static final int MSG_RFID = 0x9B;
public static final int MSG_STRING_INFO = 0x21;
public static final int MSG_GPS_2 = 0xA0;
public static final int MSG_LBS_2 = 0xA1;
@@ -942,6 +943,18 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
return position;
+ } else if (type == MSG_RFID) {
+
+ getLastLocation(position, null);
+
+ buf.readUnsignedByte(); // external device type code
+ buf.readUnsignedByte(); // card type
+ position.set(
+ Position.KEY_DRIVER_UNIQUE_ID,
+ buf.readCharSequence(buf.readableBytes() - 9, StandardCharsets.US_ASCII).toString());
+
+ return position;
+
} else {
return decodeExtendedOther(channel, buf, deviceSession, type);
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index a6008e682..09270faff 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -17,6 +17,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"78780D01086471700328358100093F040D0A"));
+ verifyAttribute(decoder, binary(
+ "797900149b03023539303042343843454238410300139ba40d0a"),
+ Position.KEY_DRIVER_UNIQUE_ID, "5900B48CEB");
+
verifyPosition(decoder, binary(
"787821121303120b2524c70138e363085b549003d43301940057d200cd52c000006aa1ca0d0a"));