diff options
author | Anton Tananaev <anton@traccar.org> | 2023-07-13 07:00:45 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-07-13 07:00:51 -0700 |
commit | 105873ab5256a774ef07ca7ee459da0917829591 (patch) | |
tree | 199e223de5b92fafaa2355a6f3aea3654fa675a2 | |
parent | 2be2a4558ace9825a69aecf6329305490eb5fe5e (diff) | |
download | trackermap-server-105873ab5256a774ef07ca7ee459da0917829591.tar.gz trackermap-server-105873ab5256a774ef07ca7ee459da0917829591.tar.bz2 trackermap-server-105873ab5256a774ef07ca7ee459da0917829591.zip |
Add Eview Pet result support
-rw-r--r-- | src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java | 17 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java | 5 |
2 files changed, 22 insertions, 0 deletions
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 { @@ -15,6 +16,10 @@ public class Minifinder2ProtocolDecoderTest extends ProtocolTest { "barkCount", 12L); verifyAttribute(decoder, binary( + "ab00030008c700007f0100"), + Position.KEY_RESULT, "0"); + + verifyAttribute(decoder, binary( "ab102600080f1400011001383633393231303339393833343736092429b347633003a96409020000008027b34763"), "bark", true); |