aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MxtProtocolDecoder.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-05-26 09:30:43 +0500
committerAbyss777 <abyss@fox5.ru>2016-05-26 09:30:43 +0500
commitaa12e5c750e771016545269ffa39409b06b47eee (patch)
treed21b4414b532bfc53c9a905f3caa09f70b43b59e /src/org/traccar/protocol/MxtProtocolDecoder.java
parentac2405f0d57fac51fe95aa755f90fe82f26f73bc (diff)
downloadtrackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.tar.gz
trackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.tar.bz2
trackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.zip
- Simplification of the hierarchy of models classes
- Removed automatically founded unnecessary imports
Diffstat (limited to 'src/org/traccar/protocol/MxtProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MxtProtocolDecoder.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java
index 600be753d..92e941e6d 100644
--- a/src/org/traccar/protocol/MxtProtocolDecoder.java
+++ b/src/org/traccar/protocol/MxtProtocolDecoder.java
@@ -21,7 +21,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -60,7 +59,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // protocol
int infoGroups = buf.readUnsignedByte();
- position.set(Event.KEY_INDEX, buf.readUnsignedShort());
+ position.set(Position.KEY_INDEX, buf.readUnsignedShort());
DateBuilder dateBuilder = new DateBuilder().setDate(2000, 1, 1);
@@ -80,13 +79,13 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(buf.readInt() / 1000000.0);
long flags = buf.readUnsignedInt();
- position.set(Event.KEY_IGNITION, BitUtil.check(flags, 0));
- position.set(Event.KEY_ALARM, BitUtil.check(flags, 1));
- position.set(Event.KEY_INPUT, BitUtil.between(flags, 2, 7));
- position.set(Event.KEY_OUTPUT, BitUtil.between(flags, 7, 10));
+ position.set(Position.KEY_IGNITION, BitUtil.check(flags, 0));
+ position.set(Position.KEY_ALARM, BitUtil.check(flags, 1));
+ position.set(Position.KEY_INPUT, BitUtil.between(flags, 2, 7));
+ position.set(Position.KEY_OUTPUT, BitUtil.between(flags, 7, 10));
position.setCourse(BitUtil.between(flags, 10, 13) * 45);
//position.setValid(BitUtil.check(flags, 15));
- position.set(Event.KEY_CHARGE, BitUtil.check(flags, 20));
+ position.set(Position.KEY_CHARGE, BitUtil.check(flags, 20));
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
@@ -101,21 +100,21 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(infoGroups, 2)) {
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
- position.set(Event.KEY_HDOP, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_HDOP, buf.readUnsignedByte());
buf.readUnsignedByte(); // GPS accuracy
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
buf.readUnsignedShort(); // time since boot
buf.readUnsignedByte(); // input voltage
- position.set(Event.PREFIX_TEMP + 1, buf.readByte());
+ position.set(Position.PREFIX_TEMP + 1, buf.readByte());
}
if (BitUtil.check(infoGroups, 3)) {
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
}
if (BitUtil.check(infoGroups, 4)) {
- position.set(Event.KEY_HOURS, buf.readUnsignedInt());
+ position.set(Position.KEY_HOURS, buf.readUnsignedInt());
}
if (BitUtil.check(infoGroups, 5)) {
@@ -123,12 +122,12 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder {
}
if (BitUtil.check(infoGroups, 6)) {
- position.set(Event.KEY_POWER, buf.readUnsignedShort() * 0.001);
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
}
if (BitUtil.check(infoGroups, 7)) {
- position.set(Event.KEY_RFID, buf.readUnsignedInt());
+ position.set(Position.KEY_RFID, buf.readUnsignedInt());
}
return position;