aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java6
2 files changed, 13 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 57fecc3fe..63adb1c70 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -66,7 +66,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.expression("(?:[^,]+)?,") // device name
.number("(xx),") // state
.expression("(?:[0-9F]{20})?,") // iccid
- .number("d{1,2},")
+ .number("(d{1,2}),") // rssi
.number("d{1,2},")
.expression("[01],") // external power
.number("([d.]+)?,") // odometer or external power
@@ -388,6 +388,10 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
}
private Object decodeInf(Channel channel, SocketAddress remoteAddress, String sentence) {
+
+ org.traccar.helper.PatternUtil.MatchResult matchResult =
+ org.traccar.helper.PatternUtil.checkPattern(PATTERN_INF.pattern(), sentence);
+
Parser parser = new Parser(PATTERN_INF, sentence);
Position position = initPosition(parser, channel, remoteAddress);
if (position == null) {
@@ -396,6 +400,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_STATUS, parser.next());
+ position.set(Position.KEY_RSSI, parser.nextInt());
+
parser.next(); // odometer or external power
position.set(Position.KEY_BATTERY, parser.nextDouble(0));
diff --git a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index e694022f2..9e2571916 100644
--- a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -10,6 +10,12 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(new Gl200Protocol());
+ verifyNull(decoder, buffer(
+ "+RESP:GTINF,280500,A1000043D20139,GL300VC,41,,31,0,0,,,3.87,0,1,1,,,20170802150751,70,,48.0,,,20170802112145,03AC$"));
+
+ verifyAttributes(decoder, buffer(
+ "+RESP:GTINF,2D0300,A1000043D20139,1G1JC5444R7252367,,11,,31,0,1,12986,,4.16,0,2,,,20170802145640,,,,,,+0000,0,20170802145643,CD5A$"));
+
verifyPosition(decoder, buffer(
"+RESP:GTMPN,450102,865084030001323,gb100,0,1.6,0,-93.1,121.393023,31.164105,20170619103113,0460,0000,1806,2142,00,20170619103143,0512$"));