From aa12e5c750e771016545269ffa39409b06b47eee Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 26 May 2016 09:30:43 +0500 Subject: - Simplification of the hierarchy of models classes - Removed automatically founded unnecessary imports --- src/org/traccar/protocol/AutoFonProtocolDecoder.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/org/traccar/protocol/AutoFonProtocolDecoder.java') 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(); -- cgit v1.2.3