diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-29 13:41:15 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-29 13:41:15 +1200 |
commit | f7198adaf371e08a72a837d417b29531c117c6ba (patch) | |
tree | 853fb51b64cd00aaa6e53d4e510bbf69859e7765 /src/org/traccar/protocol/GatorProtocolDecoder.java | |
parent | cb0a3831c2d89a22e9f3b68d3ee17f6e2abdd424 (diff) | |
download | trackermap-server-f7198adaf371e08a72a837d417b29531c117c6ba.tar.gz trackermap-server-f7198adaf371e08a72a837d417b29531c117c6ba.tar.bz2 trackermap-server-f7198adaf371e08a72a837d417b29531c117c6ba.zip |
Store other data in position
Diffstat (limited to 'src/org/traccar/protocol/GatorProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/GatorProtocolDecoder.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/GatorProtocolDecoder.java b/src/org/traccar/protocol/GatorProtocolDecoder.java index df92f96cb..d277b4b3d 100644 --- a/src/org/traccar/protocol/GatorProtocolDecoder.java +++ b/src/org/traccar/protocol/GatorProtocolDecoder.java @@ -16,7 +16,6 @@ package org.traccar.protocol; import java.util.Calendar; -import java.util.Properties; import java.util.TimeZone; import org.jboss.netty.buffer.ChannelBuffer; @@ -24,10 +23,7 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; -import org.traccar.database.DataManager; import org.traccar.helper.ChannelBufferTools; -import org.traccar.helper.Log; -import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class GatorProtocolDecoder extends BaseProtocolDecoder { @@ -72,7 +68,7 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); + position.setProtocol(getProtocol()); // Identification if (!identify(id)) { @@ -100,24 +96,22 @@ public class GatorProtocolDecoder extends BaseProtocolDecoder { // Flags int flags = buf.readUnsignedByte(); position.setValid((flags & 0x80) != 0); - extendedInfo.set("satellites", flags & 0x0f); + position.set("satellites", flags & 0x0f); // Status - extendedInfo.set("status", buf.readUnsignedByte()); + position.set("status", buf.readUnsignedByte()); // Key switch - extendedInfo.set("key", buf.readUnsignedByte()); + position.set("key", buf.readUnsignedByte()); // Oil - extendedInfo.set("oil", buf.readUnsignedShort() / 10.0); + position.set("oil", buf.readUnsignedShort() / 10.0); // Power - extendedInfo.set("power", buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0); + position.set("power", buf.readUnsignedByte() + buf.readUnsignedByte() / 100.0); // Milage - extendedInfo.set("milage", buf.readUnsignedInt()); - - position.setExtendedInfo(extendedInfo.toString()); + position.set("milage", buf.readUnsignedInt()); return position; } |