aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TotemProtocolDecoder.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/TotemProtocolDecoder.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/TotemProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java65
1 files changed, 32 insertions, 33 deletions
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index 95cb37138..bf24706c6 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -21,7 +21,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;
@@ -186,7 +185,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
if (pattern == PATTERN1 || pattern == PATTERN2) {
- position.set(Event.KEY_ALARM, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
DateBuilder dateBuilder = new DateBuilder();
int year = 0;
@@ -213,76 +212,76 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
}
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_HDOP, parser.next());
- position.set(Event.PREFIX_IO + 1, parser.next());
- position.set(Event.KEY_BATTERY, parser.next());
- position.set(Event.KEY_POWER, parser.nextDouble());
- position.set(Event.PREFIX_ADC + 1, parser.next());
+ position.set(Position.KEY_HDOP, parser.next());
+ position.set(Position.PREFIX_IO + 1, parser.next());
+ position.set(Position.KEY_BATTERY, parser.next());
+ position.set(Position.KEY_POWER, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
int lac = parser.nextInt(16);
int cid = parser.nextInt(16);
if (lac != 0 && cid != 0) {
- position.set(Event.KEY_LAC, lac);
- position.set(Event.KEY_CID, cid);
+ position.set(Position.KEY_LAC, lac);
+ position.set(Position.KEY_CID, cid);
}
- position.set(Event.PREFIX_TEMP + 1, parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
} else if (pattern == PATTERN3) {
- position.set(Event.KEY_ALARM, parser.next());
+ position.set(Position.KEY_ALARM, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt())
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.PREFIX_IO + 1, parser.next());
- position.set(Event.KEY_BATTERY, parser.nextDouble() / 10);
- position.set(Event.KEY_POWER, parser.nextDouble());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.PREFIX_ADC + 2, parser.next());
- position.set(Event.PREFIX_TEMP + 1, parser.next());
- position.set(Event.PREFIX_TEMP + 2, parser.next());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
+ position.set(Position.PREFIX_IO + 1, parser.next());
+ position.set(Position.KEY_BATTERY, parser.nextDouble() / 10);
+ position.set(Position.KEY_POWER, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.PREFIX_ADC + 2, parser.next());
+ position.set(Position.PREFIX_TEMP + 1, parser.next());
+ position.set(Position.PREFIX_TEMP + 2, parser.next());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
position.setValid(parser.next().equals("A"));
- position.set(Event.KEY_SATELLITES, parser.next());
+ position.set(Position.KEY_SATELLITES, parser.next());
position.setCourse(parser.nextDouble());
position.setSpeed(parser.nextDouble());
position.set("pdop", parser.next());
- position.set(Event.KEY_ODOMETER, parser.next());
+ position.set(Position.KEY_ODOMETER, parser.next());
position.setLatitude(parser.nextCoordinate());
position.setLongitude(parser.nextCoordinate());
} else if (pattern == PATTERN4) {
- position.set(Event.KEY_STATUS, parser.next());
+ position.set(Position.KEY_STATUS, parser.next());
DateBuilder dateBuilder = new DateBuilder()
.setDate(parser.nextInt(), parser.nextInt(), parser.nextInt())
.setTime(parser.nextInt(), parser.nextInt(), parser.nextInt());
position.setTime(dateBuilder.getDate());
- position.set(Event.KEY_BATTERY, parser.nextDouble() / 10);
- position.set(Event.KEY_POWER, parser.nextDouble());
- position.set(Event.PREFIX_ADC + 1, parser.next());
- position.set(Event.KEY_LAC, parser.nextInt(16));
- position.set(Event.KEY_CID, parser.nextInt(16));
- position.set(Event.KEY_SATELLITES, parser.nextInt());
- position.set(Event.KEY_GSM, parser.nextInt());
+ position.set(Position.KEY_BATTERY, parser.nextDouble() / 10);
+ position.set(Position.KEY_POWER, parser.nextDouble());
+ position.set(Position.PREFIX_ADC + 1, parser.next());
+ position.set(Position.KEY_LAC, parser.nextInt(16));
+ position.set(Position.KEY_CID, parser.nextInt(16));
+ position.set(Position.KEY_SATELLITES, parser.nextInt());
+ position.set(Position.KEY_GSM, parser.nextInt());
position.setCourse(parser.nextDouble());
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));
- position.set(Event.KEY_HDOP, parser.nextDouble());
- position.set(Event.KEY_ODOMETER, parser.nextInt());
+ position.set(Position.KEY_HDOP, parser.nextDouble());
+ position.set(Position.KEY_ODOMETER, parser.nextInt());
position.setValid(true);
position.setLatitude(parser.nextCoordinate());