diff options
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 3 |
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")); |