aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/BceProtocolDecoder.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/BceProtocolDecoder.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/BceProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.java28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java
index 365d51cb3..28570b63c 100644
--- a/src/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/org/traccar/protocol/BceProtocolDecoder.java
@@ -19,16 +19,12 @@ import java.nio.ByteOrder;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
-import java.util.Properties;
import org.jboss.netty.buffer.ChannelBuffer;
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.Log;
-import org.traccar.model.ExtendedInfoFormatter;
import org.traccar.model.Position;
public class BceProtocolDecoder extends BaseProtocolDecoder {
@@ -72,7 +68,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
while (buf.readerIndex() < dataEnd) {
Position position = new Position();
- ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
+ position.setProtocol(getProtocol());
position.setDeviceId(getDeviceId());
int structEnd = buf.readUnsignedByte() + buf.readerIndex();
@@ -101,24 +97,22 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(buf.readUnsignedByte());
int gps = buf.readUnsignedByte();
- extendedInfo.set("satellites", gps & 0xf);
- extendedInfo.set("hdop", gps >> 4);
+ position.set("satellites", gps & 0xf);
+ position.set("hdop", gps >> 4);
position.setCourse(buf.readUnsignedByte());
position.setAltitude(buf.readUnsignedShort());
- extendedInfo.set("milage", buf.readUnsignedInt());
-
- position.setExtendedInfo(extendedInfo.toString());
+ position.set("milage", buf.readUnsignedInt());
}
if (checkBit(mask, 1)) {
- extendedInfo.set("input", buf.readUnsignedShort());
+ position.set("input", buf.readUnsignedShort());
}
for (int i = 1; i <= 8; i++) {
if (checkBit(mask, i + 1)) {
- extendedInfo.set("adc" + i, buf.readUnsignedShort());
+ position.set("adc" + i, buf.readUnsignedShort());
}
}
@@ -128,11 +122,11 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
if (checkBit(mask, 13)) buf.skipBytes(2);
if (checkBit(mask, 14)) {
- extendedInfo.set("mcc", buf.readUnsignedShort());
- extendedInfo.set("mnc", buf.readUnsignedByte());
- extendedInfo.set("lac", buf.readUnsignedShort());
- extendedInfo.set("cell", buf.readUnsignedShort());
- extendedInfo.set("gsm", buf.readUnsignedByte());
+ position.set("mcc", buf.readUnsignedShort());
+ position.set("mnc", buf.readUnsignedByte());
+ position.set("lac", buf.readUnsignedShort());
+ position.set("cell", buf.readUnsignedShort());
+ position.set("gsm", buf.readUnsignedByte());
buf.readUnsignedByte();
}