From cdfc5a4881e21903e161782e751007d5b653f393 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 4 Jul 2017 05:01:07 +1200 Subject: Decode AZ735 command results --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 7 ++++++- test/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) 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")); -- cgit v1.2.3