From 01cb6d0be635976128fade70a36a9726539bc401 Mon Sep 17 00:00:00 2001 From: Edward Valley Date: Thu, 11 Jul 2019 23:47:54 -0400 Subject: Changes after sixth review --- .../org/traccar/protocol/LaipacProtocolDecoder.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java index c3b12aa80..e03ff672c 100644 --- a/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java @@ -40,15 +40,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { public static final String DEFAULT_DEVICE_PASSWORD = "00000000"; - private static final Pattern PATTERN_ECHK = new PatternBuilder() - .text("$ECHK") - .expression(",([^,]+)") // identifier - .number(",(d+)") // sequence number - .text("*") - .number("(xx)") // checksum - .compile(); - - private static final Pattern PATTERN_AVRMC = new PatternBuilder() + private static final Pattern PATTERN = new PatternBuilder() .text("$AVRMC,") .expression("([^,]+),") // identifier .number("(dd)(dd)(dd),") // time (hhmmss) @@ -174,11 +166,6 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { private Object decodeEchk( String sentence, Channel channel, SocketAddress remoteAddress) { - Parser parser = new Parser(PATTERN_ECHK, sentence); - if (!parser.matches()) { - return null; - } - if (channel != null) { channel.writeAndFlush(new NetworkMessage(sentence + "\r\n", remoteAddress)); } @@ -189,7 +176,7 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { protected Object decodeAvrmc( String sentence, Channel channel, SocketAddress remoteAddress) { - Parser parser = new Parser(PATTERN_AVRMC, sentence); + Parser parser = new Parser(PATTERN, sentence); if (!parser.matches()) { return null; } -- cgit v1.2.3