aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-11-04 22:07:44 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-11-04 22:07:44 -0800
commit0abf58c15f3aaaf14a08694741162d60b6f08c99 (patch)
tree8da6eeb4efa8a9caa4d613488563542b53760774 /src
parent82ab9abbefbf1145382fa3ee3141de7386cba30c (diff)
downloadtrackermap-server-0abf58c15f3aaaf14a08694741162d60b6f08c99.tar.gz
trackermap-server-0abf58c15f3aaaf14a08694741162d60b6f08c99.tar.bz2
trackermap-server-0abf58c15f3aaaf14a08694741162d60b6f08c99.zip
Fix ST600STT ignition decoding
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
index 04113c51e..197e93602 100644
--- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -304,7 +304,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, Double.parseDouble(values[index++]));
String io = values[index++];
- if (io.length() == 6) {
+ 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');
diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
index 910be0c88..f2a28558d 100644
--- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
@@ -15,6 +15,10 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
decoder.setIncludeAdc(true);
decoder.setIncludeTemp(true);
+ verifyAttribute(decoder, buffer(
+ "ST600STT;008350848;35;523;20191102;13:49:46;0bf14fdb;334;20;2f19;57;+20.466737;-100.825455;000.006;000.00;11;1;10274175;11.36;00000000;1;0300;018353;4.2;1;0.00;;;;00000000000000;0;28EE56B911160234:+13.7;:;:"),
+ Position.PREFIX_TEMP + 2, 13.7);
+
verifyPosition(decoder, buffer(
"ST300STT;205173382;07;564;20160322;23:23:18;232e19;+19.288278;-099.128750;000.122;000.00;9;1;478391;11.53;000100;1;9498;079324;4.3;1;0.00;0.00;0.00;00000000000000;0;2898E16006000058:-20.8;2861626006000039:+2.5;:"));