diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-01-25 09:47:45 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-01-25 09:47:45 -0800 |
commit | c8198d40db6e623ee45eff121cdf8cfaa2d58281 (patch) | |
tree | 650d1f1eae8d409538462660b50063936904874d | |
parent | a9855cd2df5e364c66bb419eb0ab7fb4d66f2643 (diff) | |
download | trackermap-server-c8198d40db6e623ee45eff121cdf8cfaa2d58281.tar.gz trackermap-server-c8198d40db6e623ee45eff121cdf8cfaa2d58281.tar.bz2 trackermap-server-c8198d40db6e623ee45eff121cdf8cfaa2d58281.zip |
Support driver license
-rw-r--r-- | src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 8 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index c435b6cec..946652b03 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -730,6 +730,14 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { decodeStatus(position, buf); } + if (type == MSG_GPS_LBS_1 && buf.readableBytes() > 75 + 6) { + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + String data = buf.readCharSequence(buf.readUnsignedByte(), StandardCharsets.US_ASCII).toString(); + buf.readUnsignedByte(); // alarm + buf.readUnsignedByte(); // swiped + position.set("driverLicense", data.trim()); + } + if (type == MSG_GPS_LBS_1 && buf.readableBytes() == 2 + 6) { int mask = buf.readUnsignedShort(); position.set(Position.KEY_IGNITION, BitUtil.check(mask, 8 + 7)); diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index fd5d55a50..672711f22 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -18,6 +18,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { "78780D01086471700328358100093F040D0A")); verifyAttributes(decoder, binary( + "7878711213081f081d0fc6017ba3fa0ac62a923e550e02080503f300b26d000000004b20202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202030300017c7470d0a")); + + verifyAttributes(decoder, binary( "797900B2700000000102003500010400330012000000000000000000000000000000000000003400061354A48DFF00003400061154A48E56000011000A000000000000000000000001000803537601000282180002000802140743044211890003000A89340752000038689636001800020182002B000116002C000454A4FF350009000100000A0001010028000100002E000400000000002A00010000290004000000000030000A000101680014016802D00000B38F0D0A")); verifyAttribute(decoder, binary( |