From dc3559a9cc49206e87f26349b8f8a41398f299b5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 15 Sep 2018 13:49:57 +1200 Subject: Decode alternative GT06 info message --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 11 +++++++++++ test/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index e3be8d5ab..9570eac96 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -516,6 +516,17 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { return decodeWifi(buf, deviceSession); + } else if (type == MSG_INFO) { + + Position position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + getLastLocation(position, null); + + position.set(Position.KEY_POWER, buf.readShort() * 0.01); + + return position; + } else { return decodeBasicOther(channel, buf, deviceSession, type, dataLength); diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 8c884f366..bb7e2bdba 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( + "7878079404eb001c705d0d0a")); + verifyNotNull(decoder, binary( "78781219028f0a29e10036f12003040102000875dc0d0a")); -- cgit v1.2.3