aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/AtrackProtocolDecoder.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/AtrackProtocolDecoder.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/AtrackProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index 27c5b8902..0f1eb5f8e 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -22,7 +22,6 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.Context;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -84,22 +83,22 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
for (String key : keys) {
switch (key) {
case "SA":
- position.set(Event.KEY_SATELLITES, buf.readUnsignedByte());
+ position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
break;
case "MV":
- position.set(Event.KEY_POWER, buf.readUnsignedShort());
+ position.set(Position.KEY_POWER, buf.readUnsignedShort());
break;
case "BV":
- position.set(Event.KEY_BATTERY, buf.readUnsignedShort());
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort());
break;
case "GQ":
- position.set(Event.KEY_GSM, buf.readUnsignedByte());
+ position.set(Position.KEY_GSM, buf.readUnsignedByte());
break;
case "CE":
- position.set(Event.KEY_CID, buf.readUnsignedInt());
+ position.set(Position.KEY_CID, buf.readUnsignedInt());
break;
case "LC":
- position.set(Event.KEY_LAC, buf.readUnsignedShort());
+ position.set(Position.KEY_LAC, buf.readUnsignedShort());
break;
case "CN":
buf.readUnsignedInt(); // mcc + mnc
@@ -114,16 +113,16 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
position.setAltitude(buf.readUnsignedInt());
break;
case "RP":
- position.set(Event.KEY_RPM, buf.readUnsignedShort());
+ position.set(Position.KEY_RPM, buf.readUnsignedShort());
break;
case "GS":
buf.readUnsignedByte(); // gsm status
break;
case "DT":
- position.set(Event.KEY_ARCHIVE, buf.readUnsignedByte() == 1);
+ position.set(Position.KEY_ARCHIVE, buf.readUnsignedByte() == 1);
break;
case "VN":
- position.set(Event.KEY_VIN, readString(buf));
+ position.set(Position.KEY_VIN, readString(buf));
break;
case "MF":
buf.readUnsignedShort(); // mass air flow rate
@@ -132,13 +131,13 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // engine load
break;
case "TR":
- position.set(Event.KEY_THROTTLE, buf.readUnsignedByte());
+ position.set(Position.KEY_THROTTLE, buf.readUnsignedByte());
break;
case "ET":
buf.readUnsignedShort(); // engine coolant temp
break;
case "FL":
- position.set(Event.KEY_FUEL, buf.readUnsignedByte());
+ position.set(Position.KEY_FUEL, buf.readUnsignedByte());
break;
case "ML":
buf.readUnsignedByte(); // mil status
@@ -150,7 +149,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
readString(buf); // format string
break;
case "AV1":
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
break;
case "NC":
readString(buf); // gsm neighbor cell info
@@ -225,20 +224,20 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(buf.readInt() * 0.000001);
position.setCourse(buf.readUnsignedShort());
- position.set(Event.KEY_TYPE, buf.readUnsignedByte());
- position.set(Event.KEY_ODOMETER, buf.readUnsignedInt() * 0.1);
- position.set(Event.KEY_HDOP, buf.readUnsignedShort() * 0.1);
- position.set(Event.KEY_INPUT, buf.readUnsignedByte());
+ position.set(Position.KEY_TYPE, buf.readUnsignedByte());
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 0.1);
+ position.set(Position.KEY_HDOP, buf.readUnsignedShort() * 0.1);
+ position.set(Position.KEY_INPUT, buf.readUnsignedByte());
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
- position.set(Event.KEY_OUTPUT, buf.readUnsignedByte());
- position.set(Event.PREFIX_ADC + 1, buf.readUnsignedShort() * 0.001);
+ position.set(Position.KEY_OUTPUT, buf.readUnsignedByte());
+ position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort() * 0.001);
position.set("driver", readString(buf));
- position.set(Event.PREFIX_TEMP + 1, buf.readShort() * 0.1);
- position.set(Event.PREFIX_TEMP + 2, buf.readShort() * 0.1);
+ position.set(Position.PREFIX_TEMP + 1, buf.readShort() * 0.1);
+ position.set(Position.PREFIX_TEMP + 2, buf.readShort() * 0.1);
position.set("message", readString(buf));