diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-11-05 15:18:56 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-11-05 15:18:56 +1300 |
commit | f1d305a44c0ab0a87019e6b7634fc8d094fe52d2 (patch) | |
tree | 7651089529c74d66953bb625eefa915572b54f80 /src/org/traccar | |
parent | c62dd84c7ad4061c0c6d8a521c63857ccde461ba (diff) | |
download | trackermap-server-f1d305a44c0ab0a87019e6b7634fc8d094fe52d2.tar.gz trackermap-server-f1d305a44c0ab0a87019e6b7634fc8d094fe52d2.tar.bz2 trackermap-server-f1d305a44c0ab0a87019e6b7634fc8d094fe52d2.zip |
More MT-60X alarm types
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/MegastekProtocolDecoder.java | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index 3ef52acd1..ca9185d4c 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -340,30 +340,38 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { } private String decodeAlarm(String value) { - switch (value) { - case "SOS": - case "Help": + value = value.toLowerCase(); + if (value.startsWith("geo")) { + if (value.endsWith("in")) { + return Position.ALARM_GEOFENCE_ENTER; + } else if (value.endsWith("out")) { + return Position.ALARM_GEOFENCE_EXIT; + } + } + switch (value.toLowerCase()) { + case "poweron": + return Position.ALARM_POWER_ON; + case "poweroff": + return Position.ALARM_POWER_ON; + case "sos": + case "help": return Position.ALARM_SOS; - case "Over Speed": - case "OverSpeed": + case "over speed": + case "overspeed": return Position.ALARM_OVERSPEED; - case "LowSpeed": + case "lowspeed": return Position.ALARM_LOW_SPEED; - case "Low Battery": - case "LowBattery": + case "low battery": + case "lowbattery": return Position.ALARM_LOW_BATTERY; - case "VIB": + case "vib": return Position.ALARM_VIBRATION; - case "Move in": - case "Geo in": - case "Geo1 in": - case "Geo2 in": + case "move in": return Position.ALARM_GEOFENCE_ENTER; - case "Move out": - case "Geo out": - case "Geo1 out": - case "Geo2 out": + case "move out": return Position.ALARM_GEOFENCE_EXIT; + case "error": + return Position.ALARM_FAULT; default: return null; } |