From b44223a1bdba7c3c793600f4beac232206067b01 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 27 Sep 2017 06:05:16 +1300 Subject: Decode SunTech alerts --- .../traccar/protocol/SuntechProtocolDecoder.java | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index 3b350ba64..320df9c94 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -114,6 +114,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { switch (value) { case 1: return Position.ALARM_SOS; + case 2: + return Position.ALARM_PARKING; case 3: return Position.ALARM_POWER_CUT; case 5: @@ -128,6 +130,33 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { } } + private String decodeAlert(int value) { + switch (value) { + case 1: + return Position.ALARM_OVERSPEED; + case 5: + return Position.ALARM_GEOFENCE_EXIT; + case 6: + return Position.ALARM_GEOFENCE_ENTER; + case 14: + return Position.ALARM_LOW_BATTERY; + case 15: + return Position.ALARM_SHOCK; + case 16: + return Position.ALARM_ACCIDENT; + case 46: + return Position.ALARM_ACCELERATION; + case 47: + return Position.ALARM_BREAKING; + case 48: + return Position.ALARM_ACCIDENT; + case 50: + return Position.ALARM_JAMMING; + default: + return null; + } + } + private Position decode235( Channel channel, SocketAddress remoteAddress, String protocol, String[] values) throws ParseException { int index = 0; @@ -193,9 +222,11 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ALARM, decodeEmergency(Integer.parseInt(values[index++]))); break; case "EVT": - case "ALT": position.set(Position.KEY_EVENT, Integer.parseInt(values[index++])); break; + case "ALT": + position.set(Position.KEY_ALARM, decodeAlert(Integer.parseInt(values[index++]))); + break; default: break; } -- cgit v1.2.3