From 88e777a2ceb50e34dbe9577237483d8d3cebf346 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 4 May 2015 10:53:27 +1200 Subject: Create other data keys --- src/org/traccar/protocol/Gt06ProtocolDecoder.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/org/traccar/protocol/Gt06ProtocolDecoder.java') diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index f2ccea794..c4670cc2c 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -22,6 +22,7 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.helper.Crc; +import org.traccar.model.Event; import org.traccar.model.Position; import java.util.Calendar; @@ -157,7 +158,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { // GPS length and Satellites count int gpsLength = buf.readUnsignedByte(); - position.set("satellites", gpsLength & 0xf); + position.set(Event.KEY_SATELLITES, gpsLength & 0xf); gpsLength >>= 4; // Latitude @@ -194,16 +195,16 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } // Cell information - position.set("mcc", buf.readUnsignedShort()); - position.set("mnc", buf.readUnsignedByte()); - position.set("lac", buf.readUnsignedShort()); - position.set("cell", buf.readUnsignedShort() << 8 + buf.readUnsignedByte()); + position.set(Event.KEY_MCC, buf.readUnsignedShort()); + position.set(Event.KEY_MNC, buf.readUnsignedByte()); + position.set(Event.KEY_LAC, buf.readUnsignedShort()); + position.set(Event.KEY_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) { - position.set("alarm", true); + position.set(Event.KEY_ALARM, true); int flags = buf.readUnsignedByte(); @@ -211,10 +212,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { // TODO parse other flags // Voltage - position.set("power", buf.readUnsignedByte()); + position.set(Event.KEY_POWER, buf.readUnsignedByte()); // GSM signal - position.set("gsm", buf.readUnsignedByte()); + position.set(Event.KEY_GSM, buf.readUnsignedByte()); } } @@ -223,7 +224,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes(buf.readableBytes() - 6); } int index = buf.readUnsignedShort(); - position.set("index", index); + position.set(Event.KEY_INDEX, index); sendResponse(channel, type, index); return position; } -- cgit v1.2.3