diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-07-02 11:21:51 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-07-02 11:21:51 -0700 |
commit | ef3bf24ff34fbeaf60f951663db502fcc1894b7d (patch) | |
tree | 294db0e61c689e58253dff4bdc0f7cca7cb9da11 /src | |
parent | 3ceee5bc5d3d5c94045e1f2ff14e0cd801bfa5d4 (diff) | |
download | traccar-server-ef3bf24ff34fbeaf60f951663db502fcc1894b7d.tar.gz traccar-server-ef3bf24ff34fbeaf60f951663db502fcc1894b7d.tar.bz2 traccar-server-ef3bf24ff34fbeaf60f951663db502fcc1894b7d.zip |
Decode Aplicom device time
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/AplicomProtocolDecoder.java | 13 |
1 files changed, 9 insertions, 4 deletions
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) { |