diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-09-12 22:46:45 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-09-12 22:47:08 +1200 |
commit | 32ff541cc909d14bdf8c8721114b083d5d30728d (patch) | |
tree | ec4432325d3ffd56ed0bc897f76ddcd51ce5af8a /src/org/traccar/protocol | |
parent | b7210be4600bca6731700702c4f135ff9e263a89 (diff) | |
download | traccar-server-32ff541cc909d14bdf8c8721114b083d5d30728d.tar.gz traccar-server-32ff541cc909d14bdf8c8721114b083d5d30728d.tar.bz2 traccar-server-32ff541cc909d14bdf8c8721114b083d5d30728d.zip |
Support SunTech IO decoding
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/SuntechProtocolDecoder.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index 3025bbdd5..39804159f 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -173,7 +173,15 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, Integer.parseInt(values[index++])); position.set(Position.KEY_POWER, Double.parseDouble(values[index++])); - position.set(Position.PREFIX_IO + 1, values[index++]); + String io = values[index++]; + if (io.length() == 6) { + position.set(Position.KEY_IGNITION, io.charAt(0) == '1'); + position.set(Position.PREFIX_IN + 1, io.charAt(1) == '1'); + position.set(Position.PREFIX_IN + 2, io.charAt(2) == '1'); + position.set(Position.PREFIX_IN + 3, io.charAt(3) == '1'); + position.set(Position.PREFIX_OUT + 1, io.charAt(4) == '1'); + position.set(Position.PREFIX_OUT + 2, io.charAt(5) == '1'); + } switch (type) { case "STT": |