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/SkypatrolProtocolDecoder.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/SkypatrolProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/SkypatrolProtocolDecoder.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java b/src/org/traccar/protocol/SkypatrolProtocolDecoder.java index 6fdacb871..09eacacd3 100644 --- a/src/org/traccar/protocol/SkypatrolProtocolDecoder.java +++ b/src/org/traccar/protocol/SkypatrolProtocolDecoder.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 org.jboss.netty.buffer.ChannelBuffer; @@ -25,9 +24,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.Log; -import org.traccar.model.ExtendedInfoFormatter; import org.traccar.model.Position; public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { @@ -79,11 +76,11 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); + position.setProtocol(getProtocol()); // Status code if (checkBit(mask, 1)) { - extendedInfo.set("status", buf.readUnsignedInt()); + position.set("status", buf.readUnsignedInt()); } // Device id @@ -174,7 +171,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { // Satellites if (checkBit(mask, 16)) { - extendedInfo.set("satellites", buf.readUnsignedByte()); + position.set("satellites", buf.readUnsignedByte()); } // Battery percentage @@ -184,12 +181,12 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { // Trip milage if (checkBit(mask, 20)) { - extendedInfo.set("trip", buf.readUnsignedInt()); + position.set("trip", buf.readUnsignedInt()); } // Milage if (checkBit(mask, 21)) { - extendedInfo.set("milage", buf.readUnsignedInt()); + position.set("milage", buf.readUnsignedInt()); } // Time of message generation @@ -199,7 +196,7 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { // Battery level if (checkBit(mask, 24)) { - extendedInfo.set("power", buf.readUnsignedShort() / 1000.0); + position.set("power", buf.readUnsignedShort() / 1000.0); } // GPS overspeed @@ -214,12 +211,9 @@ public class SkypatrolProtocolDecoder extends BaseProtocolDecoder { // Sequence number if (checkBit(mask, 28)) { - extendedInfo.set("index", buf.readUnsignedShort()); + position.set("index", buf.readUnsignedShort()); } - // Extended info - position.setExtendedInfo(extendedInfo.toString()); - return position; } |