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/TeltonikaProtocolDecoder.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/org/traccar/protocol/TeltonikaProtocolDecoder.java') diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 7ca670fb3..85d1b939d 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -26,6 +26,7 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; +import org.traccar.model.Event; import org.traccar.model.Position; public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { @@ -110,17 +111,17 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { if (checkBit(locationMask, 4)) { int satellites = buf.readUnsignedByte(); - position.set("satellites", satellites); + position.set(Event.KEY_SATELLITES, satellites); position.setValid(satellites >= 3); } if (checkBit(locationMask, 5)) { position.set("area", buf.readUnsignedShort()); - position.set("cell", buf.readUnsignedShort()); + position.set(Event.KEY_CELL, buf.readUnsignedShort()); } if (checkBit(locationMask, 6)) { - position.set("gsm", buf.readUnsignedByte()); + position.set(Event.KEY_GSM, buf.readUnsignedByte()); } if (checkBit(locationMask, 7)) { @@ -139,13 +140,13 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { position.setCourse(buf.readUnsignedShort()); int satellites = buf.readUnsignedByte(); - position.set("satellites", satellites); + position.set(Event.KEY_SATELLITES, satellites); position.setValid(satellites != 0); position.setSpeed(buf.readUnsignedShort() * 0.539957); - position.set("event", buf.readUnsignedByte()); + position.set(Event.KEY_EVENT, buf.readUnsignedByte()); buf.readUnsignedByte(); // total IO data records @@ -157,7 +158,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { for (int j = 0; j < cnt; j++) { int id = buf.readUnsignedByte(); if (id == 1) { - position.set("power", buf.readUnsignedByte()); + position.set(Event.KEY_POWER, buf.readUnsignedByte()); } else { position.set("io" + id, buf.readUnsignedByte()); } -- cgit v1.2.3