From b9c27acb7f4d6f81dbc783365ed58d3708f8e7a2 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Tue, 25 May 2021 03:10:49 +0200 Subject: Fix and add tests and add alert event types --- .../org/traccar/protocol/MegastekProtocolDecoder.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/traccar') 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; -- cgit v1.2.3