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/ApelProtocolDecoder.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/ApelProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/ApelProtocolDecoder.java | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java index b75bcbda3..fb473be1e 100644 --- a/src/org/traccar/protocol/ApelProtocolDecoder.java +++ b/src/org/traccar/protocol/ApelProtocolDecoder.java @@ -21,7 +21,6 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.helper.Checksum; import org.traccar.helper.UnitsConverter; -import org.traccar.model.Event; import org.traccar.model.Position; import java.net.SocketAddress; @@ -138,9 +137,9 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { int subtype = type; if (type == MSG_LOG_RECORDS) { - position.set(Event.KEY_ARCHIVE, true); + position.set(Position.KEY_ARCHIVE, true); lastIndex = buf.readUnsignedInt() + 1; - position.set(Event.KEY_INDEX, lastIndex); + position.set(Position.KEY_INDEX, lastIndex); subtype = buf.readUnsignedShort(); if (subtype != MSG_CURRENT_GPS_DATA && subtype != MSG_STATE_FULL_INFO_T104) { @@ -158,7 +157,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { int speed = buf.readUnsignedByte(); position.setValid(speed != 255); position.setSpeed(UnitsConverter.knotsFromKph(speed)); - position.set(Event.KEY_HDOP, buf.readByte()); + position.set(Position.KEY_HDOP, buf.readByte()); } else { int speed = buf.readShort(); position.setValid(speed != -1); @@ -170,20 +169,20 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { if (subtype == MSG_STATE_FULL_INFO_T104) { - position.set(Event.KEY_SATELLITES, buf.readUnsignedByte()); - position.set(Event.KEY_GSM, buf.readUnsignedByte()); - position.set(Event.KEY_EVENT, buf.readUnsignedShort()); - position.set(Event.KEY_ODOMETER, buf.readUnsignedInt()); - position.set(Event.KEY_INPUT, buf.readUnsignedByte()); - position.set(Event.KEY_OUTPUT, buf.readUnsignedByte()); + position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); + position.set(Position.KEY_GSM, buf.readUnsignedByte()); + position.set(Position.KEY_EVENT, buf.readUnsignedShort()); + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); + position.set(Position.KEY_INPUT, buf.readUnsignedByte()); + position.set(Position.KEY_OUTPUT, buf.readUnsignedByte()); for (int i = 1; i <= 8; i++) { - position.set(Event.PREFIX_ADC + i, buf.readUnsignedShort()); + position.set(Position.PREFIX_ADC + i, buf.readUnsignedShort()); } - position.set(Event.PREFIX_COUNT + 1, buf.readUnsignedInt()); - position.set(Event.PREFIX_COUNT + 2, buf.readUnsignedInt()); - position.set(Event.PREFIX_COUNT + 3, buf.readUnsignedInt()); + position.set(Position.PREFIX_COUNT + 1, buf.readUnsignedInt()); + position.set(Position.PREFIX_COUNT + 2, buf.readUnsignedInt()); + position.set(Position.PREFIX_COUNT + 3, buf.readUnsignedInt()); } positions.add(position); |