aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MxtProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-05-26 10:02:37 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2016-05-26 10:02:37 -0700
commitd3e34416e9825833fa1db02112c56981999df039 (patch)
treed21b4414b532bfc53c9a905f3caa09f70b43b59e /src/org/traccar/protocol/MxtProtocolDecoder.java
parentac2405f0d57fac51fe95aa755f90fe82f26f73bc (diff)
parentaa12e5c750e771016545269ffa39409b06b47eee (diff)
downloadtrackermap-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/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;