aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/AutoFonProtocolDecoder.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/AutoFonProtocolDecoder.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/AutoFonProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/AutoFonProtocolDecoder.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
index 48e30b72b..ceeb0b29d 100644
--- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java
@@ -20,10 +20,7 @@ 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.database.DataManager;
import org.traccar.helper.ChannelBufferTools;
-import org.traccar.helper.Log;
-import org.traccar.model.ExtendedInfoFormatter;
import org.traccar.model.Position;
import java.util.*;
@@ -48,7 +45,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
- ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
+ position.setProtocol(getProtocol());
position.setDeviceId(getDeviceId());
if (!history) {
@@ -59,7 +56,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
if (!history) {
buf.readUnsignedShort();
}
- extendedInfo.set("battery", buf.readUnsignedByte());
+ position.set("battery", buf.readUnsignedByte());
buf.skipBytes(6); // time
// Timers
@@ -71,8 +68,8 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
}
}
- extendedInfo.set("temperature", buf.readByte());
- extendedInfo.set("gsm", buf.readUnsignedByte());
+ position.set("temperature", buf.readByte());
+ position.set("gsm", buf.readUnsignedByte());
buf.readUnsignedShort(); // mcc
buf.readUnsignedShort(); // mnc
buf.readUnsignedShort(); // lac
@@ -81,7 +78,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
// GPS status
int valid = buf.readUnsignedByte();
position.setValid((valid & 0xc0) != 0);
- extendedInfo.set("satellites", valid & 0x3f);
+ position.set("satellites", valid & 0x3f);
// Date and time
Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
@@ -101,12 +98,10 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedByte());
position.setCourse(buf.readUnsignedByte() * 2.0);
- extendedInfo.set("hdop", buf.readUnsignedShort());
+ position.set("hdop", buf.readUnsignedShort());
buf.readUnsignedShort(); // reserved
buf.readUnsignedByte(); // checksum
-
- position.setExtendedInfo(extendedInfo.toString());
return position;
}