diff options
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolDecoder.java | 7 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 261c86825..357256d76 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -485,7 +485,12 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { data = buf.readBytes(buf.readableBytes() - 6).toString(StandardCharsets.UTF_16BE); } - return decodeLocationString(position, data); + if (decodeLocationString(position, data) == null) { + getLastLocation(position, null); + position.set(Position.KEY_RESULT, data); + } + + return position; } else if (type == MSG_INFO) { diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 6523c5105..85ce9d8f2 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")); + verifyAttributes(decoder, binary( + "7979006f210000000001426174746572793a352e3536562c4e4f524d414c3b20475052532a4c696e6b2055702047534d205369676e616c204c6576656c3a5374726f6e673b204750533a4f46463b2020204c4f434b3a4f46463b204254204d41433a4234413832383034343436323b007260880d0a")); + verifyPosition(decoder, binary( "7979004a321106170c1b180cc900a875580b7ab4f00010350901fe0a007c0009112424007c000912240081004efe2100c500100f1200000000000000000000000000000000000000000000bc7c900d0a")); |