aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/SuntechProtocolDecoderTest.java3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java
index 48eb3a71d..ad1da537b 100644
--- a/src/org/traccar/protocol/SuntechProtocolDecoder.java
+++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java
@@ -317,9 +317,11 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder {
}
if (includeAdc) {
- position.set(Position.PREFIX_ADC + 1, Double.parseDouble(values[index++]));
- position.set(Position.PREFIX_ADC + 2, Double.parseDouble(values[index++]));
- position.set(Position.PREFIX_ADC + 3, Double.parseDouble(values[index++]));
+ for (int i = 1; i <= 3; i++) {
+ if (!values[index++].isEmpty()) {
+ position.set(Position.PREFIX_ADC + i, Double.parseDouble(values[index - 1]));
+ }
+ }
}
if (values.length - index >= 2) {
diff --git a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java
index 7e4de91d6..daf011206 100644
--- a/test/org/traccar/protocol/SuntechProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SuntechProtocolDecoderTest.java
@@ -20,6 +20,9 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"ST300EVT;205173382;07;564;20160322;23:23:18;232e19;+19.288278;-099.128750;000.122;000.00;9;1;478391;11.53;000100;2;1;9498;079324;4.3;1;0.00;0.00;0.00;00000000000000;0;2898E16006000058:-20.8;2861626006000039:+2.5;:"));
+ verifyPosition(decoder, text(
+ "ST600STT;008349958;35;523;20181112;00:49:30;0bf10d4e;334;20;2f19;22;+20.552718;-100.824478;050.021;095.41;12;1;1303603;14.30;10000000;4;8911;001987;4.1;0;0.00;;;;00000000000000;0;2826C8A70800000C:+26.6;:;:"));
+
}
@Test