aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gt06ProtocolDecoder.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/Gt06ProtocolDecoder.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/Gt06ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 73c3f6004..f2ccea794 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -21,10 +21,7 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
-import org.traccar.database.DataManager;
import org.traccar.helper.Crc;
-import org.traccar.helper.Log;
-import org.traccar.model.ExtendedInfoFormatter;
import org.traccar.model.Position;
import java.util.Calendar;
@@ -145,7 +142,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
// Create new position
Position position = new Position();
position.setDeviceId(getDeviceId());
- ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
+ position.setProtocol(getProtocol());
// Date and time
Calendar time = Calendar.getInstance(timeZone);
@@ -160,7 +157,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
// GPS length and Satellites count
int gpsLength = buf.readUnsignedByte();
- extendedInfo.set("satellites", gpsLength & 0xf);
+ position.set("satellites", gpsLength & 0xf);
gpsLength >>= 4;
// Latitude
@@ -183,7 +180,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
if ((union & 0x4000) != 0) {
- extendedInfo.set("acc", (union & 0x8000) != 0);
+ position.set("acc", (union & 0x8000) != 0);
}
buf.skipBytes(gpsLength - 12); // skip reserved
@@ -197,27 +194,27 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
// Cell information
- extendedInfo.set("mcc", buf.readUnsignedShort());
- extendedInfo.set("mnc", buf.readUnsignedByte());
- extendedInfo.set("lac", buf.readUnsignedShort());
- extendedInfo.set("cell", buf.readUnsignedShort() << 8 + buf.readUnsignedByte());
+ position.set("mcc", buf.readUnsignedShort());
+ position.set("mnc", buf.readUnsignedByte());
+ position.set("lac", buf.readUnsignedShort());
+ position.set("cell", buf.readUnsignedShort() << 8 + buf.readUnsignedByte());
buf.skipBytes(lbsLength - 9);
// Status
if (type == MSG_GPS_LBS_STATUS_1 || type == MSG_GPS_LBS_STATUS_2 || type == MSG_GPS_LBS_STATUS_3) {
- extendedInfo.set("alarm", true);
+ position.set("alarm", true);
int flags = buf.readUnsignedByte();
- extendedInfo.set("acc", (flags & 0x2) != 0);
+ position.set("acc", (flags & 0x2) != 0);
// TODO parse other flags
// Voltage
- extendedInfo.set("power", buf.readUnsignedByte());
+ position.set("power", buf.readUnsignedByte());
// GSM signal
- extendedInfo.set("gsm", buf.readUnsignedByte());
+ position.set("gsm", buf.readUnsignedByte());
}
}
@@ -226,10 +223,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(buf.readableBytes() - 6);
}
int index = buf.readUnsignedShort();
- extendedInfo.set("index", index);
+ position.set("index", index);
sendResponse(channel, type, index);
-
- position.setExtendedInfo(extendedInfo.toString());
return position;
}