aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java42
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;
}