aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Avl301ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-29 13:41:15 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-29 13:41:15 +1200
commitf7198adaf371e08a72a837d417b29531c117c6ba (patch)
tree853fb51b64cd00aaa6e53d4e510bbf69859e7765 /src/org/traccar/protocol/Avl301ProtocolDecoder.java
parentcb0a3831c2d89a22e9f3b68d3ee17f6e2abdd424 (diff)
downloadtrackermap-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/Avl301ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Avl301ProtocolDecoder.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/org/traccar/protocol/Avl301ProtocolDecoder.java b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
index 66db5b55a..c74e10f5e 100644
--- a/src/org/traccar/protocol/Avl301ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl301ProtocolDecoder.java
@@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
-import org.traccar.model.ExtendedInfoFormatter;
import org.traccar.model.Position;
import java.util.Calendar;
@@ -85,7 +84,7 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
position.setDeviceId(getDeviceId());
- ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
+ position.setProtocol(getProtocol());
// Date and time(6)
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
@@ -100,7 +99,7 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
// GPS length and Satellites count
int gpsLength = buf.readUnsignedByte();
- extendedInfo.set("satellites", gpsLength & 0xf);
+ position.set("satellites", gpsLength & 0xf);
gpsLength >>= 4;
//Skip Satellite numbers
@@ -122,21 +121,19 @@ public class Avl301ProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
if ((union & 0x4000) != 0) {
- extendedInfo.set("acc", (union & 0x8000) != 0);
+ position.set("acc", (union & 0x8000) != 0);
}
- extendedInfo.set("lac", buf.readUnsignedShort());
- extendedInfo.set("cell", buf.readUnsignedMedium());
- extendedInfo.set("alarm", true);
+ position.set("lac", buf.readUnsignedShort());
+ position.set("cell", buf.readUnsignedMedium());
+ position.set("alarm", true);
int flags = buf.readUnsignedByte();
- extendedInfo.set("acc", (flags & 0x2) != 0);
+ position.set("acc", (flags & 0x2) != 0);
// TODO parse other flags
- extendedInfo.set("power", buf.readUnsignedByte());
- extendedInfo.set("gsm", buf.readUnsignedByte());
-
- position.setExtendedInfo(extendedInfo.toString());
+ position.set("power", buf.readUnsignedByte());
+ position.set("gsm", buf.readUnsignedByte());
return position;
}