aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorOliver Schramm <oliver.schramm97@gmail.com>2021-05-25 03:10:49 +0200
committerOliver Schramm <oliver.schramm97@gmail.com>2021-05-25 03:10:49 +0200
commitb9c27acb7f4d6f81dbc783365ed58d3708f8e7a2 (patch)
treefb549b61c36cf56a5f045257b8befb23242be732 /src/main
parentb2cca44879abd12492054bde4d84b8b8ae1c3cea (diff)
downloadtraccar-server-b9c27acb7f4d6f81dbc783365ed58d3708f8e7a2.tar.gz
traccar-server-b9c27acb7f4d6f81dbc783365ed58d3708f8e7a2.tar.bz2
traccar-server-b9c27acb7f4d6f81dbc783365ed58d3708f8e7a2.zip
Fix and add tests and add alert event types
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java
index fc27d3502..074523a76 100644
--- a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -281,9 +281,8 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
.groupEnd("?")
.expression("[^,]*,")
.number("(d+)?,") // battery
- .expression("([^,]*),?") // alert
+ .expression("([^,]*)[,;]") // alert
.any()
- .text(";")
.compile();
private Position decodeNew(Channel channel, SocketAddress remoteAddress, String sentence) {
@@ -387,6 +386,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
}
}
switch (value) {
+ case "pw on":
case "poweron":
return Position.ALARM_POWER_ON;
case "poweroff":
@@ -402,12 +402,26 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
case "low battery":
case "lowbattery":
return Position.ALARM_LOW_BATTERY;
+ case "low extern voltage":
+ return Position.ALARM_LOW_POWER;
+ case "gps cut":
+ return Position.ALARM_GPS_ANTENNA_CUT;
case "vib":
return Position.ALARM_VIBRATION;
case "move in":
return Position.ALARM_GEOFENCE_ENTER;
case "move out":
return Position.ALARM_GEOFENCE_EXIT;
+ case "corner":
+ return Position.ALARM_CORNERING;
+ case "fatigue":
+ return Position.ALARM_FATIGUE_DRIVING;
+ case "psd":
+ return Position.ALARM_POWER_CUT;
+ case "psr":
+ return Position.ALARM_POWER_RESTORED;
+ case "hit":
+ return Position.ALARM_SHOCK;
case "belt on":
case "belton":
return Position.ALARM_LOCK;