aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Tk103ProtocolDecoder.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/Tk103ProtocolDecoder.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/Tk103ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Tk103ProtocolDecoder.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/org/traccar/protocol/Tk103ProtocolDecoder.java b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
index 760b089de..9512910f2 100644
--- a/src/org/traccar/protocol/Tk103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tk103ProtocolDecoder.java
@@ -23,7 +23,6 @@ import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
-import org.traccar.model.Event;
import org.traccar.model.Position;
import java.net.SocketAddress;
@@ -117,12 +116,12 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
int battery = parser.nextInt();
if (battery != 65535) {
- position.set(Event.KEY_BATTERY, battery);
+ position.set(Position.KEY_BATTERY, battery);
}
int power = parser.nextInt();
if (power != 65535) {
- position.set(Event.KEY_POWER, battery);
+ position.set(Position.KEY_POWER, battery);
}
return position;
@@ -137,10 +136,10 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
- position.set(Event.KEY_MCC, parser.nextInt());
- position.set(Event.KEY_MNC, parser.nextInt());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_MCC, parser.nextInt());
+ position.set(Position.KEY_MNC, parser.nextInt());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
return position;
}
@@ -157,7 +156,7 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
int alarm = sentence.indexOf("BO01");
if (alarm != -1) {
- position.set(Event.KEY_ALARM, Integer.parseInt(sentence.substring(alarm + 4, alarm + 5)));
+ position.set(Position.KEY_ALARM, Integer.parseInt(sentence.substring(alarm + 4, alarm + 5)));
}
DateBuilder dateBuilder = new DateBuilder();
@@ -185,16 +184,16 @@ public class Tk103ProtocolDecoder extends BaseProtocolDecoder {
// Status
String status = parser.next();
if (status != null) {
- position.set(Event.KEY_STATUS, status); // binary status
+ position.set(Position.KEY_STATUS, status); // binary status
int value = Integer.parseInt(new StringBuilder(status).reverse().toString(), 2);
- position.set(Event.KEY_CHARGE, !BitUtil.check(value, 0));
- position.set(Event.KEY_IGNITION, BitUtil.check(value, 1));
+ position.set(Position.KEY_CHARGE, !BitUtil.check(value, 0));
+ position.set(Position.KEY_IGNITION, BitUtil.check(value, 1));
}
- position.set(Event.KEY_STATUS, parser.next()); // hex status
+ position.set(Position.KEY_STATUS, parser.next()); // hex status
if (parser.hasNext()) {
- position.set(Event.KEY_ODOMETER, parser.nextLong(16));
+ position.set(Position.KEY_ODOMETER, parser.nextLong(16));
}
return position;