aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <atananaev@lyft.com>2020-12-30 10:41:18 -0800
committerAnton Tananaev <atananaev@lyft.com>2020-12-30 10:41:18 -0800
commitfa3d072b47be36ba011d6f48a1e3fe39bb5f2f6d (patch)
treead27817e4da87814bcd9b912a582943cf3272f78
parent6101300ab45882e02e4a0b90d30070cb904378eb (diff)
downloadtrackermap-server-fa3d072b47be36ba011d6f48a1e3fe39bb5f2f6d.tar.gz
trackermap-server-fa3d072b47be36ba011d6f48a1e3fe39bb5f2f6d.tar.bz2
trackermap-server-fa3d072b47be36ba011d6f48a1e3fe39bb5f2f6d.zip
Fix time decoding
-rw-r--r--src/main/java/org/traccar/protocol/IotmProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java b/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
index ac92b299f..88641081e 100644
--- a/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/IotmProtocolDecoder.java
@@ -150,7 +150,7 @@ public class IotmProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
- position.setTime(new Date(record.readUnsignedIntLE()));
+ position.setTime(new Date(record.readUnsignedIntLE() * 1000));
while (record.readableBytes() > 0) {
int sensorType = record.readUnsignedByte();
diff --git a/src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java
index 9647b3723..f3962efd5 100644
--- a/src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/IotmProtocolDecoderTest.java
@@ -16,6 +16,9 @@ public class IotmProtocolDecoderTest extends ProtocolTest {
"123456789012345").build());
verifyPositions(decoder, false, MqttMessageBuilders.publish().payload(binary(
+ "020208004f6af053901403000135007715ec5f0d02b000485cea73083041040b30ee050030ae38040020120e00d0d34bc9412e9c5d4212000806ee00feff011300006d006e")).qos(MqttQoS.EXACTLY_ONCE).messageId(1).build());
+
+ verifyPositions(decoder, false, MqttMessageBuilders.publish().payload(binary(
"020208009188752DE7120300013A002000AD59050030B135030340030C300301A00302A00E00D0B9AB5B420334C04100001F060000320004072064008C000162002000C004476F6F440109002100AD59050030BA359B")).qos(MqttQoS.EXACTLY_ONCE).messageId(1).build());
verifyPositions(decoder, false, MqttMessageBuilders.publish().payload(binary(