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/AutoFonProtocolDecoder.java | |
parent | ac2405f0d57fac51fe95aa755f90fe82f26f73bc (diff) | |
parent | aa12e5c750e771016545269ffa39409b06b47eee (diff) | |
download | traccar-server-d3e34416e9825833fa1db02112c56981999df039.tar.gz traccar-server-d3e34416e9825833fa1db02112c56981999df039.tar.bz2 traccar-server-d3e34416e9825833fa1db02112c56981999df039.zip |
Merge pull request #1978 from Abyss777/master
Simplification of the models hierarchy
Diffstat (limited to 'src/org/traccar/protocol/AutoFonProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/AutoFonProtocolDecoder.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java index 011a6542b..b80fd6bcb 100644 --- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java @@ -22,7 +22,6 @@ import org.jboss.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.helper.BitUtil; import org.traccar.helper.DateBuilder; -import org.traccar.model.Event; import org.traccar.model.Position; import java.net.SocketAddress; @@ -72,7 +71,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { if (!history) { buf.readUnsignedShort(); } - position.set(Event.KEY_BATTERY, buf.readUnsignedByte()); + position.set(Position.KEY_BATTERY, buf.readUnsignedByte()); buf.skipBytes(6); // time if (!history) { @@ -83,8 +82,8 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { } } - position.set(Event.PREFIX_TEMP + 1, buf.readByte()); - position.set(Event.KEY_GSM, buf.readUnsignedByte()); + position.set(Position.PREFIX_TEMP + 1, buf.readByte()); + position.set(Position.KEY_GSM, buf.readUnsignedByte()); buf.readUnsignedShort(); // mcc buf.readUnsignedShort(); // mnc buf.readUnsignedShort(); // lac @@ -92,7 +91,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { int valid = buf.readUnsignedByte(); position.setValid((valid & 0xc0) != 0); - position.set(Event.KEY_SATELLITES, valid & 0x3f); + position.set(Position.KEY_SATELLITES, valid & 0x3f); DateBuilder dateBuilder = new DateBuilder() .setDateReverse(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()) @@ -105,7 +104,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(buf.readUnsignedByte()); position.setCourse(buf.readUnsignedByte() * 2.0); - position.set(Event.KEY_HDOP, buf.readUnsignedShort()); + position.set(Position.KEY_HDOP, buf.readUnsignedShort()); buf.readUnsignedShort(); // reserved buf.readUnsignedByte(); // checksum @@ -162,12 +161,12 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(getDeviceId()); short status = buf.readUnsignedByte(); - position.set(Event.KEY_ALARM, BitUtil.check(status, 7)); - position.set(Event.KEY_BATTERY, BitUtil.to(status, 7)); + position.set(Position.KEY_ALARM, BitUtil.check(status, 7)); + position.set(Position.KEY_BATTERY, BitUtil.to(status, 7)); buf.skipBytes(2); // remaining time - position.set(Event.PREFIX_TEMP + 1, buf.readByte()); + position.set(Position.PREFIX_TEMP + 1, buf.readByte()); buf.skipBytes(2); // timer (interval and units) buf.readByte(); // mode @@ -177,7 +176,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { int valid = buf.readUnsignedByte(); position.setValid(BitUtil.from(valid, 6) != 0); - position.set(Event.KEY_SATELLITES, BitUtil.from(valid, 6)); + position.set(Position.KEY_SATELLITES, BitUtil.from(valid, 6)); int time = buf.readUnsignedMedium(); int date = buf.readUnsignedMedium(); |