From be47cecf6bd95e85eb562fcc7a62a39be72c3d80 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 30 Oct 2015 10:50:57 +1300 Subject: Fix an issue in GoSafe decoder --- src/org/traccar/protocol/GoSafeProtocolDecoder.java | 10 +++++----- test/org/traccar/protocol/GoSafeProtocolDecoderTest.java | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/org/traccar/protocol/GoSafeProtocolDecoder.java b/src/org/traccar/protocol/GoSafeProtocolDecoder.java index 7ec395672..38901cf88 100644 --- a/src/org/traccar/protocol/GoSafeProtocolDecoder.java +++ b/src/org/traccar/protocol/GoSafeProtocolDecoder.java @@ -61,8 +61,8 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { .expression(",?") .groupEnd() .groupBegin() - .text("GSM:").expression("[^,],?") - .groupEnd("?") + .text("GSM:").expression("[^,]*,?") + .groupEnd() .groupBegin() .text("COT:") .number("(d+)") // odometer @@ -83,17 +83,17 @@ public class GoSafeProtocolDecoder extends BaseProtocolDecoder { .number("x+,?") // event status .groupEnd("?") .groupBegin() - .text("ETD:").expression("[^,],?") + .text("ETD:").expression("[^,]*,?") .groupEnd("?") .groupBegin() .text("OBD:") .number("(x+),?") .groupEnd("?") .groupBegin() - .text("FUL:").expression("[^,],?") + .text("FUL:").expression("[^,]*,?") .groupEnd("?") .groupBegin() - .text("TRU:").expression("[^,],?") + .text("TRU:").expression("[^,]*,?") .groupEnd("?") .compile(); diff --git a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java index 9f1d82b8c..1c738b6dc 100644 --- a/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java +++ b/test/org/traccar/protocol/GoSafeProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class GoSafeProtocolDecoderTest extends ProtocolDecoderTest { GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(new GoSafeProtocol()); + verifyPositions(decoder, text( + "*GS16,351535059439208,074558291015,,GPS:A;9;N31.935942;E35.867092;;345;921;1.03;1.59,GSM:1;3;416;3;A8C;368B;-78;416;3;A8C;2820;-73;416;3;BB8;2CBE;-76;416;3;A8C;368A;-76;416;3;A8C;2C26;-79,OBD:04410C122003410D0F03411C0103410547037F011203411100")); + verifyPositions(decoder, text( "*GS16,351535059439208,083515281015,,GPS:A;9;N31.959502;E35.908316;;108;890;1.05;1.79,GSM:1;4;416;3;AF0;A3A6;-59;416;3;AF0;A3A3;-50;416;3;AF0;A3A4;-56;416;3;AF0;A3A5;-62;416;3;AF0;B195;-76,OBD:04410C194603410D2303411C0103410583037F011203411115")); -- cgit v1.2.3