diff options
author | Anton Tananaev <anton@traccar.org> | 2024-06-15 06:53:13 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-06-15 06:53:13 -0700 |
commit | bc65eb120807b7c899d3fd95fbb6684934bfa3ef (patch) | |
tree | b48cbd60b050423ef70edbee835eef5cc7194ede /src | |
parent | 0c6880698769d87a866ebbb60c84dbe13ee42ce7 (diff) | |
download | trackermap-server-bc65eb120807b7c899d3fd95fbb6684934bfa3ef.tar.gz trackermap-server-bc65eb120807b7c899d3fd95fbb6684934bfa3ef.tar.bz2 trackermap-server-bc65eb120807b7c899d3fd95fbb6684934bfa3ef.zip |
Support GT06 RFID card
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 13 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index a1a9c3773..0c23f42d3 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -65,6 +65,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { public static final int MSG_STRING = 0x15; public static final int MSG_GPS_LBS_STATUS_1 = 0x16; public static final int MSG_WIFI = 0x17; + public static final int MSG_GPS_LBS_RFID = 0x17; public static final int MSG_GPS_LBS_STATUS_2 = 0x26; public static final int MSG_GPS_LBS_STATUS_3 = 0x27; public static final int MSG_LBS_MULTIPLE_1 = 0x28; @@ -125,6 +126,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { JC400, SL4X, SEEWORLD, + RFID, } private Variant variant; @@ -175,6 +177,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { case MSG_GPS_PHONE: case MSG_GPS_LBS_EXTEND: case MSG_GPS_LBS_7: + case MSG_GPS_LBS_RFID: case MSG_FENCE_SINGLE: case MSG_FENCE_MULTI: return true; @@ -197,6 +200,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { case MSG_GPS_LBS_STATUS_3: case MSG_GPS_LBS_STATUS_4: case MSG_GPS_LBS_7: + case MSG_GPS_LBS_RFID: case MSG_FENCE_SINGLE: case MSG_FENCE_MULTI: case MSG_LBS_ALARM: @@ -602,7 +606,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { return null; - } else if (type == MSG_WIFI || type == MSG_WIFI_2 || type == MSG_WIFI_4) { + } else if ((type == MSG_WIFI && variant != Variant.RFID) || type == MSG_WIFI_2 || type == MSG_WIFI_4) { ByteBuf time = buf.readSlice(6); DateBuilder dateBuilder = new DateBuilder() @@ -945,6 +949,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } } + if (type == MSG_GPS_LBS_RFID) { + buf.readUnsignedByte(); // validity + position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(8))); + } + if (buf.readableBytes() == 3 + 6 || buf.readableBytes() == 3 + 4 + 6) { position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0); buf.readUnsignedByte(); // upload mode @@ -1492,6 +1501,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { variant = Variant.SEEWORLD; } else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_1 && length == 0x26) { variant = Variant.SEEWORLD; + } else if (header == 0x7878 && type == MSG_GPS_LBS_RFID && length == 0x28) { + variant = Variant.RFID; } else { variant = Variant.STANDARD; } diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 05a33cc72..962bcb5c8 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( + "7878281718060e021831c6026e8acc0c361b1000140001cc00286d000f4dbf0000012ca7e001000004b2630d0a"), + Position.KEY_DRIVER_UNIQUE_ID, "0000012ca7e00100"); + + verifyAttribute(decoder, binary( "78782732180214123324ca0162bdf0041f45d900190b0a02d4000bc5270000ec025206040202005e07e10d0a"), Position.KEY_ALARM, Position.ALARM_POWER_CUT); |