aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-07-26 02:33:25 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-07-26 02:33:25 +1200
commitc51a5b70169860c9032420381dd327c6b4b380ba (patch)
tree7b94e5c9688cb7674a1f30fa4ea5b1da618695d8
parent8c76bf440cc83e4c35548a56da5cf7c5e44d0545 (diff)
downloadtrackermap-server-c51a5b70169860c9032420381dd327c6b4b380ba.tar.gz
trackermap-server-c51a5b70169860c9032420381dd327c6b4b380ba.tar.bz2
trackermap-server-c51a5b70169860c9032420381dd327c6b4b380ba.zip
Handle GoSafe GPS without altitude
-rw-r--r--src/org/traccar/protocol/GoSafeProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/GoSafeProtocolDecoderTest.java6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
index f3900a61b..9d6a61d52 100644
--- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java
+++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java
@@ -86,7 +86,9 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(Integer.parseInt(values[index - 1])));
}
position.setCourse(Integer.parseInt(values[index++]));
- position.setAltitude(Integer.parseInt(values[index++]));
+ if (index < values.length) {
+ position.setAltitude(Integer.parseInt(values[index++]));
+ }
if (index < values.length) {
position.set(Position.KEY_HDOP, Double.parseDouble(values[index++]));
}
diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
index 5485368b9..d41d388b9 100644
--- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class GoSafeProtocolDecoderTest extends ProtocolTest {
GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(new GoSafeProtocol());
verifyPositions(decoder, text(
+ "*GS06,359913060650380,152248050718,,SYS:G3C;V1.38;V05,GPS:A;10;N31.914370;E35.914640;0;0,COT:689,ADC:0.18;3.55,DTT:4025;E6;0;0;0;1#"));
+
+ verifyPositions(decoder, text(
+ "*GS06,359913060650380,101019050718,,SYS:G3C;V1.38;V05,GPS:L;6;N31.916576;E35.908480;0;0,GSM:1;4;416;3;627A;A84B;-66,COT:188,ADC:4.31;3.88,DTT:4005;E6;0;0;0;1#"));
+
+ verifyPositions(decoder, text(
"*GS06,860078024287174,070120310318,,SYS:G3SC;V3.32;V1.1.8,GPS:A;9;N23.169946;E113.450568;0;0;23;0.86,COT:65;20,ADC:4.27;3.73;0.01;0.02,DTT:4004;E0;0;0;0;1,IWD:0;0;000000000000#"));
verifyPositions(decoder, text(