From ef3bf24ff34fbeaf60f951663db502fcc1894b7d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 2 Jul 2018 11:21:51 -0700 Subject: Decode Aplicom device time --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 14ab83788..f530c8fa5 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -218,11 +218,14 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } if ((selector & 0x0004) != 0) { - buf.skipBytes(4); // snapshot time + position.setDeviceTime(new Date(buf.readUnsignedInt() * 1000)); } if ((selector & 0x0008) != 0) { - position.setTime(new Date(buf.readUnsignedInt() * 1000)); + position.setFixTime(new Date(buf.readUnsignedInt() * 1000)); + if (position.getDeviceTime() == null) { + position.setDeviceTime(position.getFixTime()); + } position.setLatitude(buf.readInt() / 1000000.0); position.setLongitude(buf.readInt() / 1000000.0); position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte()); @@ -540,12 +543,14 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { private void decodeF(Position position, ByteBuf buf, int selector) { - getLastLocation(position, null); + Date deviceTime = null; if ((selector & 0x0004) != 0) { - buf.skipBytes(4); // snapshot time + deviceTime = new Date(buf.readUnsignedInt() * 1000); } + getLastLocation(position, deviceTime); + buf.readUnsignedByte(); // data validity if ((selector & 0x0008) != 0) { -- cgit v1.2.3