aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-02-24 00:33:02 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-02-24 00:33:02 +1300
commitdebe7092f6d48abc51852b808f45144863baebde (patch)
tree44d2605815a8b36b43588e90bdcd8bc8c36c44fe
parent5741cd0fdbddb623f1807463d9a8d26cf5cc8f4d (diff)
downloadtraccar-server-debe7092f6d48abc51852b808f45144863baebde.tar.gz
traccar-server-debe7092f6d48abc51852b808f45144863baebde.tar.bz2
traccar-server-debe7092f6d48abc51852b808f45144863baebde.zip
Add another GL200 decoder test case
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java5
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 9098cbd8c..62d93ce13 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -142,6 +142,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
.expression(PATTERN_LOCATION.pattern())
.expression(")+)")
.groupBegin()
+ .number("(d{1,7}.d)?,").optional() // odometer
.number("(d{1,3})?,") // battery
.or()
.number("(d{1,7}.d)?,") // odometer
@@ -169,6 +170,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
.number("d{1,2},") // count
.expression(PATTERN_LOCATION.pattern())
.groupBegin()
+ .number("(d{1,7}.d)?,").optional() // odometer
.number("(d{1,3})?,") // battery
.or()
.number("(d{1,7}.d)?,") // odometer
@@ -334,6 +336,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
decodeLocation(position, parser);
+ position.set(Event.KEY_ODOMETER, parser.next());
position.set(Event.KEY_BATTERY, parser.next());
position.set(Event.KEY_ODOMETER, parser.next());
@@ -361,7 +364,9 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
decodeLocation(position, parser);
+ position.set(Event.KEY_ODOMETER, parser.next());
position.set(Event.KEY_BATTERY, parser.next());
+
position.set(Event.KEY_ODOMETER, parser.next());
if (parser.hasNext(6)) {
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index 4e7686da7..11c069adb 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol());
+ verifyPosition(decoder, text(
+ "+RESP:GTFRI,2C0204,867162020003125,GL300W,0,0,2,1,1.7,205,2867.0,-78.481127,-0.206828,20160215210433,0740,0000,7596,5891C,0.0,1,1.7,205,2867.0,-78.481127,-0.206828,20160215210503,0740,0000,7596,5891C,0.0,88,20160215210506,1E78$"));
+
verifyPositions(decoder, text(
"+RESP:GTFRI,060228,862894020178276,,15153,10,1,1,0.0,0,431.7,-63.169571,-17.776235,20160210153458,0736,0003,6AD4,80EF,00,34.9,00117:31:26,13442,15163,0,210101,,,,20160210113503,38EE$"));