From 046076aeb6f0c79bb59ef9aead4ebbc23e286c63 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 3 Jan 2023 09:36:23 -0800 Subject: Handle ZX303 variation --- src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 2 +- src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index 15588c89b..ef09677bf 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -803,7 +803,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { getLastLocation(position, null); } - if (hasLbs(type)) { + if (hasLbs(type) && buf.readableBytes() > 6) { decodeLbs(position, buf, type, hasStatus(type) && type != MSG_LBS_ALARM); } diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 9d0716c7d..23c29b0d3 100644 --- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -17,6 +17,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "78780D01086471700328358100093F040D0A")); + verifyPosition(decoder, binary( + "78781511170103100e1f9904efe30400a97f88003410ffdd000d0a")); + verifyAttribute(decoder, binary( "787819a5012ed0000075df000000000098661502050413000019a12b0d0a"), Position.KEY_ALARM, Position.ALARM_TAMPERING); -- cgit v1.2.3