aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-07-13 23:51:07 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-07-13 23:51:07 -0700
commit7fd59ea42fa31a01d1164103735691a30c711580 (patch)
treec7ab3264d3f65563e2cc19fd903024380cd18d01
parent5f2fc476b549fa8555d6d764dbd8279fa754fc49 (diff)
downloadtrackermap-server-7fd59ea42fa31a01d1164103735691a30c711580.tar.gz
trackermap-server-7fd59ea42fa31a01d1164103735691a30c711580.tar.bz2
trackermap-server-7fd59ea42fa31a01d1164103735691a30c711580.zip
Fix time decoding
-rw-r--r--src/main/java/org/traccar/protocol/Minifinder2ProtocolDecoder.java5
-rw-r--r--src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java6
2 files changed, 11 insertions, 0 deletions
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"));