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/AutoFon45ProtocolDecoder.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/AutoFon45ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/AutoFon45ProtocolDecoder.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java index 3b56c8fc4..1a2ebdf4a 100644 --- a/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFon45ProtocolDecoder.java @@ -24,6 +24,7 @@ import org.jboss.netty.channel.Channel; 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; import java.util.*; @@ -70,12 +71,12 @@ public class AutoFon45ProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); short status = buf.readUnsignedByte(); - position.set("alarm", (status & 0x80) != 0); - position.set("battery", status & 0x7F); + position.set(Event.KEY_ALARM, (status & 0x80) != 0); + position.set(Event.KEY_BATTERY, status & 0x7F); buf.skipBytes(2); // remaining time - position.set("temperature", buf.readByte()); + position.set(Event.KEY_TEMPERATURE, buf.readByte()); buf.skipBytes(2); // timer (interval and units) buf.readByte(); // mode @@ -86,7 +87,7 @@ public class AutoFon45ProtocolDecoder extends BaseProtocolDecoder { // GPS status int valid = buf.readUnsignedByte(); position.setValid((valid & 0xc0) != 0); - position.set("satellites", valid & 0x3f); + position.set(Event.KEY_SATELLITES, valid & 0x3f); // Date and time int timeOfDay = buf.readUnsignedByte() << 16 | buf.readUnsignedByte() << 8 | buf.readUnsignedByte(); |