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/WialonProtocolDecoder.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/WialonProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/WialonProtocolDecoder.java | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index b01dc24f7..6f0223112 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -18,7 +18,6 @@ package org.traccar.protocol; import java.util.Calendar; import java.util.LinkedList; import java.util.List; -import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -27,9 +26,6 @@ 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 WialonProtocolDecoder extends BaseProtocolDecoder { @@ -79,7 +75,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { // Create new position Position position = new Position(); - ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol()); + position.setProtocol(getProtocol()); position.setDeviceId(getDeviceId()); Integer index = 1; @@ -129,27 +125,27 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { String satellites = parser.group(index++); if (satellites != null) { position.setValid(Integer.valueOf(satellites) >= 3); - extendedInfo.set("satellites", satellites); + position.set("satellites", satellites); } else { position.setValid(false); } // Other - extendedInfo.set("hdop", parser.group(index++)); - extendedInfo.set("inputs", parser.group(index++)); - extendedInfo.set("outputs", parser.group(index++)); + position.set("hdop", parser.group(index++)); + position.set("inputs", parser.group(index++)); + position.set("outputs", parser.group(index++)); // ADC String adc = parser.group(index++); if (adc != null) { String[] values = adc.split(","); for (int i = 0; i < values.length; i++) { - extendedInfo.set("adc" + (i + 1), values[i]); + position.set("adc" + (i + 1), values[i]); } } // iButton - extendedInfo.set("ibutton", parser.group(index++)); + position.set("ibutton", parser.group(index++)); // Params String params = parser.group(index); @@ -158,14 +154,11 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { for (String param : values) { Matcher paramParser = Pattern.compile( "(.*):[1-3]:(.*)").matcher(param); if (paramParser.matches()) { - extendedInfo.set(paramParser.group(1).toLowerCase(), paramParser.group(2)); + position.set(paramParser.group(1).toLowerCase(), paramParser.group(2)); } } } - // Extended info - position.setExtendedInfo(extendedInfo.toString()); - return position; } |