aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-02-27 09:29:58 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-02-27 09:29:58 +1300
commite586ffd374f7a66d1077d5a9cd1d6380655a23dc (patch)
tree1c4f536604219f3279109687ec60630a57a5b36b
parentd05bee19a973798554bf9b9f5563c5a8e5ba4d5e (diff)
downloadtrackermap-server-e586ffd374f7a66d1077d5a9cd1d6380655a23dc.tar.gz
trackermap-server-e586ffd374f7a66d1077d5a9cd1d6380655a23dc.tar.bz2
trackermap-server-e586ffd374f7a66d1077d5a9cd1d6380655a23dc.zip
Support new GL200 message format
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 6902e61dd..71ccbd026 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -93,7 +93,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
.number("(d+)?,") // lac
.number("(d+)?,") // cell
.groupEnd()
- .number("d*,") // reserved
+ .number("(?:d+|(d+.d))?,") // odometer
.compile();
private static final Pattern PATTERN_OBD = new PatternBuilder()
@@ -265,6 +265,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
parser.skip(4); // alternative networks
+
+ position.set(Event.KEY_ODOMETER, parser.next());
}
private Object decodeObd(Channel channel, SocketAddress remoteAddress, String sentence) {
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index 11c069adb..6b6e763ad 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -49,7 +49,7 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest {
verifyPositions(decoder, text(
"+RESP:GTFRI,1A0401,860599000508846,,0,0,1,1,134.8,154,278.7,-76.671089,39.778885,20150623154301,0310,0260,043F,7761,,99,20150623154314,0F24$"));
- verifyPosition(decoder, text(
+ verifyPositions(decoder, text(
"+RESP:GTFRI,1A0200,860599000165464,CRI001,0,0,1,2,,41,,-71.153137,42.301634,20150328020301,,,,,280.3,55,20150327220351,320C"));
verifyPositions(decoder, text(