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/RitiProtocolDecoder.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/RitiProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/RitiProtocolDecoder.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/org/traccar/protocol/RitiProtocolDecoder.java b/src/org/traccar/protocol/RitiProtocolDecoder.java index fa98398a9..06aa39a71 100644 --- a/src/org/traccar/protocol/RitiProtocolDecoder.java +++ b/src/org/traccar/protocol/RitiProtocolDecoder.java @@ -17,7 +17,6 @@ package org.traccar.protocol; import java.nio.charset.Charset; import java.util.Calendar; -import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -27,10 +26,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 RitiProtocolDecoder extends BaseProtocolDecoder { @@ -61,7 +57,7 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); + position.setProtocol(getProtocol()); buf.skipBytes(2); // header @@ -71,16 +67,16 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(getDeviceId()); - extendedInfo.set("mode", buf.readUnsignedByte()); - extendedInfo.set("command", buf.readUnsignedByte()); - extendedInfo.set("power", buf.readUnsignedShort()); + position.set("mode", buf.readUnsignedByte()); + position.set("command", buf.readUnsignedByte()); + position.set("power", buf.readUnsignedShort()); buf.skipBytes(5); buf.readUnsignedShort(); buf.readUnsignedShort(); - extendedInfo.set("distance", buf.readUnsignedInt()); - extendedInfo.set("milage", buf.readUnsignedInt()); + position.set("distance", buf.readUnsignedInt()); + position.set("milage", buf.readUnsignedInt()); // Parse GPRMC Integer end = ChannelBufferTools.find(buf, buf.readerIndex(), buf.readerIndex() + 80, "*"); @@ -132,8 +128,6 @@ public class RitiProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.MONTH, Integer.valueOf(parser.group(index++)) - 1); time.set(Calendar.YEAR, 2000 + Integer.valueOf(parser.group(index++))); position.setTime(time.getTime()); - - position.setExtendedInfo(extendedInfo.toString()); return position; } |