diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-02-24 22:46:32 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-02-24 22:46:32 +1300 |
commit | 2bcaeff435d1e1fa10ab253241e3d722ad29b153 (patch) | |
tree | 3c2d3bef1caf478bd62b3134d414c1b85075a285 /src/org | |
parent | fcd74ee0e418a82fe118920d67c824bbfbe984a2 (diff) | |
download | trackermap-server-2bcaeff435d1e1fa10ab253241e3d722ad29b153.tar.gz trackermap-server-2bcaeff435d1e1fa10ab253241e3d722ad29b153.tar.bz2 trackermap-server-2bcaeff435d1e1fa10ab253241e3d722ad29b153.zip |
Decode additional GL200 protocol data
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/model/Event.java | 1 | ||||
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 11 | ||||
-rw-r--r-- | src/org/traccar/protocol/MxtProtocolDecoder.java | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java index a9f6f9204..221536530 100644 --- a/src/org/traccar/model/Event.java +++ b/src/org/traccar/model/Event.java @@ -29,6 +29,7 @@ public abstract class Event extends Extensible { public static final String KEY_ALARM = "alarm"; public static final String KEY_STATUS = "status"; public static final String KEY_ODOMETER = "odometer"; + public static final String KEY_HOURS = "hours"; public static final String KEY_INPUT = "input"; public static final String KEY_OUTPUT = "output"; public static final String KEY_POWER = "power"; diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 62d93ce13..91e8d86bc 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -135,7 +135,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { .number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version .number("(d{15}|x{14}),") // imei .expression("[^,]*,") // device name - .number("d*,") + .number("(d+)?,") // power .number("d{1,2},") // report type .number("d{1,2},") // count .expression("((?:") @@ -146,7 +146,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { .number("(d{1,3})?,") // battery .or() .number("(d{1,7}.d)?,") // odometer - .number("d{5}:dd:dd,") // hour meter + .number("(d{5}:dd:dd),") // hour meter .number("(x+)?,") // adc 1 .number("(x+)?,") // adc 2 .number("(d{1,3})?,") // battery @@ -321,6 +321,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { return null; } + int power = parser.nextInt(); + Parser itemParser = new Parser(PATTERN_LOCATION, parser.next()); while (itemParser.find()) { Position position = new Position(); @@ -336,10 +338,15 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { decodeLocation(position, parser); + if (power > 10) { + position.set(Event.KEY_POWER, power); + } + position.set(Event.KEY_ODOMETER, parser.next()); position.set(Event.KEY_BATTERY, parser.next()); position.set(Event.KEY_ODOMETER, parser.next()); + position.set(Event.KEY_HOURS, parser.next()); position.set(Event.PREFIX_ADC + 1, parser.next()); position.set(Event.PREFIX_ADC + 2, parser.next()); position.set(Event.KEY_BATTERY, parser.next()); diff --git a/src/org/traccar/protocol/MxtProtocolDecoder.java b/src/org/traccar/protocol/MxtProtocolDecoder.java index fedb7c715..53d5b8b09 100644 --- a/src/org/traccar/protocol/MxtProtocolDecoder.java +++ b/src/org/traccar/protocol/MxtProtocolDecoder.java @@ -114,7 +114,7 @@ public class MxtProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(infoGroups, 4)) { - position.set("hours", buf.readUnsignedInt()); + position.set(Event.KEY_HOURS, buf.readUnsignedInt()); } if (BitUtil.check(infoGroups, 5)) { |