From e586ffd374f7a66d1077d5a9cd1d6380655a23dc Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 27 Feb 2016 09:29:58 +1300 Subject: Support new GL200 message format --- src/org/traccar/protocol/Gl200ProtocolDecoder.java | 4 +++- test/org/traccar/protocol/Gl200ProtocolDecoderTest.java | 2 +- 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( -- cgit v1.2.3