From 7fd59ea42fa31a01d1164103735691a30c711580 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 13 Jul 2019 23:51:07 -0700 Subject: Fix time decoding --- src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java | 5 +++++ .../java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java index 989aa32b9..75c8b11d3 100644 --- a/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java @@ -33,6 +33,7 @@ import org.traccar.model.WifiAccessPoint; import java.net.SocketAddress; import java.nio.charset.StandardCharsets; +import java.util.Date; public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { @@ -149,6 +150,10 @@ public class Minifinder2ProtocolDecoder extends BaseProtocolDecoder { mac.substring(0, mac.length() - 1), rssi)); } break; + case 0x24: + position.setTime(new Date(buf.readUnsignedIntLE() * 1000)); + position.set(Position.KEY_STATUS, buf.readUnsignedIntLE()); + break; case 0x40: buf.readUnsignedIntLE(); // timestamp int heartRate = buf.readUnsignedByte(); diff --git a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java index 2b1fdf988..c0ce67cb6 100644 --- a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java @@ -10,6 +10,12 @@ public class Minifinder2ProtocolDecoderTest extends ProtocolTest { Minifinder2ProtocolDecoder decoder = new Minifinder2ProtocolDecoder(null); + verifyNull(decoder, binary( + "ab10150076f1320003100133353534363530373130323933303602105a")); + + verifyPosition(decoder, binary( + "ab103f007e2533000110013335353436353037313032393330360930e09d245d210100000924b49e245d01025b201620e6c03b1ef367420400000000aa026d00c90e0000100110")); + verifyAttributes(decoder, binary( "ab1845005d39370301100133353836383830303030303338303209245b92b55c84004b610502001000002221ca00050b4a005cc30f4a0056c80f4a003ba90e4a0055c8074a005dc3034a0057c8")); -- cgit v1.2.3