diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-14 15:20:30 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-14 15:20:30 -0700 |
commit | f84c9bc81691c25c8715e900dd276cbd26d3fab8 (patch) | |
tree | a68db990b04f74623247eca0479d57e3b1715361 /src/main/java/org/traccar/protocol | |
parent | 9a404bd07c221912fff3b8e498caab0645fa4d2b (diff) | |
download | traccar-server-f84c9bc81691c25c8715e900dd276cbd26d3fab8.tar.gz traccar-server-f84c9bc81691c25c8715e900dd276cbd26d3fab8.tar.bz2 traccar-server-f84c9bc81691c25c8715e900dd276cbd26d3fab8.zip |
Support Suntech serial data
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 14 |
1 files changed, 13 insertions, 1 deletions
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; } |