diff options
author | Edward Valley <ed.valley@yandex.com> | 2019-07-11 23:47:54 -0400 |
---|---|---|
committer | Edward Valley <ed.valley@yandex.com> | 2019-07-11 23:47:54 -0400 |
commit | 01cb6d0be635976128fade70a36a9726539bc401 (patch) | |
tree | 3d660dec7069232b2f230f3a40b7fe0bd18a016b | |
parent | c00703abad85ae27dbd26ffffd6908813bcb5e49 (diff) | |
download | trackermap-server-01cb6d0be635976128fade70a36a9726539bc401.tar.gz trackermap-server-01cb6d0be635976128fade70a36a9726539bc401.tar.bz2 trackermap-server-01cb6d0be635976128fade70a36a9726539bc401.zip |
Changes after sixth review
-rw-r--r-- | src/main/java/org/traccar/protocol/LaipacProtocolDecoder.java | 17 |
1 files changed, 2 insertions, 15 deletions
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; } |