diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-24 22:57:38 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-24 22:57:38 +1300 |
commit | 5538a83ac7eda6ad5775e582688dd0199e6c538c (patch) | |
tree | 7b261a5e9767fd807124c868d2c4a5d72315e7df /src/org/traccar/protocol/V680ProtocolDecoder.java | |
parent | be1baf2b062587099171b485ac1e3f591034816f (diff) | |
download | trackermap-server-5538a83ac7eda6ad5775e582688dd0199e6c538c.tar.gz trackermap-server-5538a83ac7eda6ad5775e582688dd0199e6c538c.tar.bz2 trackermap-server-5538a83ac7eda6ad5775e582688dd0199e6c538c.zip |
Refactor pattern builder class
Diffstat (limited to 'src/org/traccar/protocol/V680ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/V680ProtocolDecoder.java | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java index dc0dcd2f6..229861c4f 100644 --- a/src/org/traccar/protocol/V680ProtocolDecoder.java +++ b/src/org/traccar/protocol/V680ProtocolDecoder.java @@ -33,30 +33,29 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .groupBegin() - .num("#(d+)#") // imei - .xpr("([^#]*)#") // user - .groupEnd(true) - .num("(d+)#") // fix - .xpr("([^#]+)#") // password - .xpr("([^#]+)#") // event - .num("(d+)#") // packet number - .xpr("([^#]+)?#?") // gsm base station - .xpr("(?:[^#]+#)?") - .num("(d+)?(dd.d+),") // longitude - .xpr("([EW]),") - .num("(d+)?(dd.d+),") // latitude - .xpr("([NS]),") - .num("(d+.d+),") // speed - .num("(d+.?d*)?#") // course - .num("(dd)(dd)(dd)#") // date - .num("(dd)(dd)(dd)") // time + .number("#(d+)#") // imei + .expression("([^#]*)#") // user + .groupEnd("?") + .number("(d+)#") // fix + .expression("([^#]+)#") // password + .expression("([^#]+)#") // event + .number("(d+)#") // packet number + .expression("([^#]+)?#?") // gsm base station + .expression("(?:[^#]+#)?") + .number("(d+)?(dd.d+),") // longitude + .expression("([EW]),") + .number("(d+)?(dd.d+),") // latitude + .expression("([NS]),") + .number("(d+.d+),") // speed + .number("(d+.?d*)?#") // course + .number("(dd)(dd)(dd)#") // date + .number("(dd)(dd)(dd)") // time .any() .compile(); @Override protected Object decode( - Channel channel, SocketAddress remoteAddress, Object msg) - throws Exception { + Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { String sentence = (String) msg; sentence = sentence.trim(); |