diff options
Diffstat (limited to 'src/org/traccar/protocol/TotemProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TotemProtocolDecoder.java | 65 |
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()); |