diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-05-26 10:02:37 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-05-26 10:02:37 -0700 |
commit | d3e34416e9825833fa1db02112c56981999df039 (patch) | |
tree | d21b4414b532bfc53c9a905f3caa09f70b43b59e /src/org/traccar/protocol/AplicomProtocolDecoder.java | |
parent | ac2405f0d57fac51fe95aa755f90fe82f26f73bc (diff) | |
parent | aa12e5c750e771016545269ffa39409b06b47eee (diff) | |
download | trackermap-server-d3e34416e9825833fa1db02112c56981999df039.tar.gz trackermap-server-d3e34416e9825833fa1db02112c56981999df039.tar.bz2 trackermap-server-d3e34416e9825833fa1db02112c56981999df039.zip |
Merge pull request #1978 from Abyss777/master
Simplification of the models hierarchy
Diffstat (limited to 'src/org/traccar/protocol/AplicomProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/AplicomProtocolDecoder.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index e8e070d67..70e5d7d71 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -23,7 +23,6 @@ import org.traccar.Context; import org.traccar.helper.Checksum; import org.traccar.helper.Log; import org.traccar.helper.UnitsConverter; -import org.traccar.model.Event; import org.traccar.model.Position; import java.net.SocketAddress; @@ -132,7 +131,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { ChannelBuffer value = values.get(i); switch (buf.readInt()) { case 0x20D: - position.set(Event.KEY_RPM, ChannelBuffers.swapShort(value.readShort())); + position.set(Position.KEY_RPM, ChannelBuffers.swapShort(value.readShort())); position.set("diesel-temperature", ChannelBuffers.swapShort(value.readShort()) * 0.1); position.set("battery-voltage", ChannelBuffers.swapShort(value.readShort()) * 0.01); position.set("supply-air-temp-dep1", ChannelBuffers.swapShort(value.readShort()) * 0.1); @@ -222,7 +221,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); int event = buf.readUnsignedByte(); - position.set(Event.KEY_EVENT, event); + position.set(Position.KEY_EVENT, event); position.set("event-info", buf.readUnsignedByte()); if ((selector & 0x0008) != 0) { @@ -239,7 +238,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { position.setTime(new Date(buf.readUnsignedInt() * 1000)); position.setLatitude(buf.readInt() / 1000000.0); position.setLongitude(buf.readInt() / 1000000.0); - position.set(Event.KEY_SATELLITES, buf.readUnsignedByte()); + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); } if ((selector & 0x0010) != 0) { @@ -249,19 +248,19 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } if ((selector & 0x0040) != 0) { - position.set(Event.KEY_INPUT, buf.readUnsignedByte()); + position.set(Position.KEY_INPUT, buf.readUnsignedByte()); } if ((selector & 0x0020) != 0) { - position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort()); - position.set(Event.PREFIX_ADC + 2, buf.readUnsignedShort()); - position.set(Event.PREFIX_ADC + 3, buf.readUnsignedShort()); - position.set(Event.PREFIX_ADC + 4, buf.readUnsignedShort()); + position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort()); + position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort()); + position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort()); + position.set(Position.PREFIX_ADC + 4, buf.readUnsignedShort()); } if ((selector & 0x8000) != 0) { - position.set(Event.KEY_POWER, buf.readUnsignedShort() / 1000.0); - position.set(Event.KEY_BATTERY, buf.readUnsignedShort()); + position.set(Position.KEY_POWER, buf.readUnsignedShort() / 1000.0); + position.set(Position.KEY_BATTERY, buf.readUnsignedShort()); } // Pulse rate 1 @@ -285,11 +284,11 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } if ((selector & 0x0040) != 0) { - position.set(Event.KEY_OUTPUT, buf.readUnsignedByte()); + position.set(Position.KEY_OUTPUT, buf.readUnsignedByte()); } if ((selector & 0x0200) != 0) { - position.set(Event.KEY_RFID, (((long) buf.readUnsignedShort()) << 32) + buf.readUnsignedInt()); + position.set(Position.KEY_RFID, (((long) buf.readUnsignedShort()) << 32) + buf.readUnsignedInt()); } if ((selector & 0x0400) != 0) { |