diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-04 10:53:27 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-04 10:53:27 +1200 |
commit | 88e777a2ceb50e34dbe9577237483d8d3cebf346 (patch) | |
tree | 6b2058f1cf43e56a4be20d981acd8b03452bdc8e /src/org/traccar/protocol/Jt600ProtocolDecoder.java | |
parent | bbfd08e59ba23c6aee85bc1083588529a7b90ebb (diff) | |
download | trackermap-server-88e777a2ceb50e34dbe9577237483d8d3cebf346.tar.gz trackermap-server-88e777a2ceb50e34dbe9577237483d8d3cebf346.tar.bz2 trackermap-server-88e777a2ceb50e34dbe9577237483d8d3cebf346.zip |
Create other data keys
Diffstat (limited to 'src/org/traccar/protocol/Jt600ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Jt600ProtocolDecoder.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 54110b101..52b84296d 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -27,6 +27,7 @@ import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; import org.traccar.helper.ChannelBufferTools; +import org.traccar.model.Event; import org.traccar.model.Position; public class Jt600ProtocolDecoder extends BaseProtocolDecoder { @@ -92,29 +93,29 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { if (version == 1) { - position.set("satellites", buf.readUnsignedByte()); + position.set(Event.KEY_SATELLITES, buf.readUnsignedByte()); // Power - position.set("power", buf.readUnsignedByte()); + position.set(Event.KEY_POWER, buf.readUnsignedByte()); buf.readByte(); // other flags and sensors // Altitude position.setAltitude(buf.readUnsignedShort()); - position.set("cell", buf.readUnsignedShort()); - position.set("lac", buf.readUnsignedShort()); - position.set("gsm", buf.readUnsignedByte()); + position.set(Event.KEY_CELL, buf.readUnsignedShort()); + position.set(Event.KEY_LAC, buf.readUnsignedShort()); + position.set(Event.KEY_GSM, buf.readUnsignedByte()); } else if (version == 2) { int fuel = buf.readUnsignedByte() << 8; - position.set("status", buf.readUnsignedInt()); - position.set("milage", buf.readUnsignedInt()); + position.set(Event.KEY_STATUS, buf.readUnsignedInt()); + position.set(Event.KEY_ODOMETER, buf.readUnsignedInt()); fuel += buf.readUnsignedByte(); - position.set("fuel", fuel); + position.set(Event.KEY_FUEL, fuel); } return position; @@ -194,7 +195,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.setCourse(Double.valueOf(parser.group(index++))); // Power - position.set("power", Double.valueOf(parser.group(index++))); + position.set(Event.KEY_POWER, Double.valueOf(parser.group(index++))); return position; } |