From 105873ab5256a774ef07ca7ee459da0917829591 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 13 Jul 2023 07:00:45 -0700 Subject: Add Eview Pet result support --- .../traccar/protocol/Minifinder2ProtocolDecoder.java | 17 +++++++++++++++++ .../protocol/Minifinder2ProtocolDecoderTest.java | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java index 85589b064..6289bd2eb 100644 --- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java @@ -324,6 +324,23 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { return positions; + } else if (type == MSG_RESPONSE) { + + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); + if (deviceSession == null) { + return null; + } + + Position position = new Position(getProtocolName()); + position.setDeviceId(deviceSession.getDeviceId()); + + getLastLocation(position, null); + + buf.readUnsignedByte(); // length + position.set(Position.KEY_RESULT, String.valueOf(buf.readUnsignedByte())); + + return position; + } return null; diff --git a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java index 587a520d1..64d245a8e 100644 --- a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java @@ -2,6 +2,7 @@ package org.traccar.protocol; import org.junit.jupiter.api.Test; import org.traccar.ProtocolTest; +import org.traccar.model.Position; public class Minifinder2ProtocolDecoderTest extends ProtocolTest { @@ -14,6 +15,10 @@ public class Minifinder2ProtocolDecoderTest extends ProtocolTest { "ab101c00d6f61e000110013836333932313033393939363038300937efd201640c000000"), "barkCount", 12L); + verifyAttribute(decoder, binary( + "ab00030008c700007f0100"), + Position.KEY_RESULT, "0"); + verifyAttribute(decoder, binary( "ab102600080f1400011001383633393231303339393833343736092429b347633003a96409020000008027b34763"), "bark", true); -- cgit v1.2.3