aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-12-31 10:10:08 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2018-12-31 10:10:08 -0800
commitff6a7b59b84dbb648f35e08f013f8852060e321d (patch)
tree108f907135111486ed498a9c168e6598105fe577
parent969ab169322f8a20f5c87b37eb3651914e4c5102 (diff)
downloadtraccar-server-ff6a7b59b84dbb648f35e08f013f8852060e321d.tar.gz
traccar-server-ff6a7b59b84dbb648f35e08f013f8852060e321d.tar.bz2
traccar-server-ff6a7b59b84dbb648f35e08f013f8852060e321d.zip
Handle Queclink GTSTC messages (fix #4173)
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 97cc8f987..31ff4a670 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -1079,9 +1079,11 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- int hdop = parser.nextInt();
- position.setValid(hdop > 0);
- position.set(Position.KEY_HDOP, hdop);
+ if (parser.hasNext()) {
+ int hdop = parser.nextInt();
+ position.setValid(hdop > 0);
+ position.set(Position.KEY_HDOP, hdop);
+ }
position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));
position.setCourse(parser.nextDouble(0));
diff --git a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index d68479097..ae4201f94 100644
--- a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
+ verifyAttributes(decoder, buffer(
+ "+BUFF:GTSTC,410301,864802030022424,,,0,,,,,,,0228,0002,4EE8,1BFF489,00,20181207134332,EC90$"));
+
verifyPositions(decoder, buffer(
"+RESP:GTFRI,1A0900,860599000306845,G3-313,0,0,4,1,2.1,0,426.7,8.611466,47.681639,20181214134603,0228,0001,077F,4812,25.2,1,5.7,34,437.3,8.611600,47.681846,20181214134619,0228,0001,077F,4812,25.2,1,4.4,62,438.2,8.611893,47.681983,20181214134633,0228,0001,077F,4812,25.2,1,4.8,78,436.6,8.612236,47.682040,20181214134648,0228,0001,077F,4812,25.2,83,20181214134702,0654$"));