aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-03-30 23:08:59 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-03-30 23:08:59 +1300
commit770295e24f31ab58b94cd417d5f59f601f07244c (patch)
treef9bf7e2d20ec0e56835792355102701b9d393cff
parentd5589821cd437fcce5f12e82a6dfe05f57262542 (diff)
downloadtrackermap-server-770295e24f31ab58b94cd417d5f59f601f07244c.tar.gz
trackermap-server-770295e24f31ab58b94cd417d5f59f601f07244c.tar.bz2
trackermap-server-770295e24f31ab58b94cd417d5f59f601f07244c.zip
Add GL200 milage value
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java12
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java3
2 files changed, 10 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index f8f32effd..0ce8bff5e 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -52,7 +52,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
"(\\d{4})?," + // MNC
"(\\p{XDigit}{4})?," + // LAC
"(\\p{XDigit}{4})?," + // Cell
- "(?:.*,(\\d{1,3}),\\d{14},)?" + // Battery
+ "(?:(\\d+\\.\\d)?," + // Milage
+ "(\\d{1,3})?)?" + // Battery
".*");
@Override
@@ -133,11 +134,12 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("lac", parser.group(index++));
extendedInfo.set("cell", parser.group(index++));
- // Battery
- String battery = parser.group(index++);
- if (battery != null) {
- extendedInfo.set("battery", Integer.valueOf(battery));
+ // Other
+ String milage = parser.group(index++);
+ if (milage != null && Double.valueOf(milage) != 0) {
+ extendedInfo.set("milage", milage);
}
+ extendedInfo.set("battery", parser.group(index++));
position.setExtendedInfo(extendedInfo.toString());
return position;
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index 5ee7919a9..e57ad8007 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -13,6 +13,9 @@ public class Gl200ProtocolDecoderTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new TestDataManager(), null, null);
verify(decoder.decode(null, null,
+ "+RESP:GTFRI,1A0200,860599000165464,CRI001,0,0,1,2,,41,,-71.153137,42.301634,20150328020301,,,,,280.3,55,20150327220351,320C"));
+
+ verify(decoder.decode(null, null,
"+RESP:GTFRI,02010D,867844001675407,,0,0,1,2,0.0,0,28.9,8.591011,56.476397,20140915213209,0238,0001,03CB,2871,,97,20140915213459,009A"));
assertNull(decoder.decode(null, null,