From f84c9bc81691c25c8715e900dd276cbd26d3fab8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 14 Apr 2019 15:20:30 -0700 Subject: Support Suntech serial data --- .../java/org/traccar/protocol/SuntechProtocolDecoder.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index a80e84728..bd485ca70 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -254,7 +254,8 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { String type = values[index++].substring(5); - if (!type.equals("STT") && !type.equals("EMG") && !type.equals("EVT") && !type.equals("ALT")) { + if (!type.equals("STT") && !type.equals("EMG") && !type.equals("EVT") + && !type.equals("ALT") && !type.equals("UEX")) { return null; } @@ -322,6 +323,17 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { case "ALT": position.set(Position.KEY_ALARM, decodeAlert(Integer.parseInt(values[index++]))); break; + case "UEX": + int remaining = Integer.parseInt(values[index++]); + while (remaining > 0) { + String value = values[index++]; + String[] pair = value.split("="); + if (pair.length >= 2) { + position.set(pair[0].toLowerCase(), pair[1].trim()); + } + remaining -= value.length() + 1; + } + break; default: break; } -- cgit v1.2.3