diff options
author | jon-stumpf <jon.stumpf@gmail.com> | 2017-02-20 10:54:34 -0500 |
---|---|---|
committer | jon-stumpf <jon.stumpf@gmail.com> | 2017-02-20 10:54:34 -0500 |
commit | 888c392af40187f3a0ecc3395495db9acd85b827 (patch) | |
tree | beb74dff8b8052ffb4a7d3c894b2b4e5a4434973 /src/org/traccar/protocol/TmgProtocolDecoder.java | |
parent | 38249673287b908c0ca55847a35ca16a7b6a0c50 (diff) | |
parent | 2449895139fa658d082c1085185003a001225bc3 (diff) | |
download | trackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.tar.gz trackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.tar.bz2 trackermap-server-888c392af40187f3a0ecc3395495db9acd85b827.zip |
Resolved conflict with master;
Diffstat (limited to 'src/org/traccar/protocol/TmgProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TmgProtocolDecoder.java | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/TmgProtocolDecoder.java b/src/org/traccar/protocol/TmgProtocolDecoder.java index 9fa8759a0..3b73a1516 100644 --- a/src/org/traccar/protocol/TmgProtocolDecoder.java +++ b/src/org/traccar/protocol/TmgProtocolDecoder.java @@ -35,7 +35,7 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .text("$") - .expression("...,") // type + .expression("(...),") // type .expression("[LH],") // history .number("(d+),") // imei .number("(dd)(dd)(dddd),") // date @@ -53,7 +53,7 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder { .number("(d+),") // visible satellites .number("([^,]*),") // operator .number("(d+),") // rssi - .number("x+,") // cid + .number("[^,]*,") // cid .expression("([01]),") // ignition .number("(d+.?d*),") // battery .number("(d+.?d*),") // power @@ -72,6 +72,8 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder { return null; } + String type = parser.next(); + DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next()); if (deviceSession == null) { return null; @@ -81,6 +83,31 @@ public class TmgProtocolDecoder extends BaseProtocolDecoder { position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); + switch (type) { + case "rmv": + position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); + break; + case "ebl": + position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER); + break; + case "ibl": + position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); + break; + case "tmp": + case "smt": + case "btt": + position.set(Position.KEY_ALARM, Position.ALARM_TAMPERING); + break; + case "ion": + position.set(Position.KEY_IGNITION, true); + break; + case "iof": + position.set(Position.KEY_IGNITION, false); + break; + default: + break; + } + DateBuilder dateBuilder = new DateBuilder() .setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); |