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/Gps103ProtocolDecoder.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/Gps103ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 9bd508e92..9fa71ad58 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -32,39 +32,39 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { } private static final Pattern PATTERN = new PatternBuilder() - .txt("imei:") - .num("(d+),") // imei - .xpr("([^,]+),") // alarm - .num("(dd)/?(dd)/?(dd) ?") // local date - .num("(dd):?(dd)(?:dd)?,") // local time - .nxt(",") - .xpr("[FL],") // full / low + .text("imei:") + .number("(d+),") // imei + .expression("([^,]+),") // alarm + .number("(dd)/?(dd)/?(dd) ?") // local date + .number("(dd):?(dd)(?:dd)?,") // local time + .expression("[^,]*,") + .expression("[FL],") // full / low .groupBegin() - .num("(dd)(dd)(dd).(d+)") // time utc (hhmmss.sss) + .number("(dd)(dd)(dd).(d+)") // time utc (hhmmss.sss) .or() - .opn("d{1,5}.d+") - .groupEnd(false) - .txt(",") - .xpr("([AV]),") // validity - .opx("([NS]),") - .num("(d+)(dd.d+),") // latitude (ddmm.mmmm) - .opx("([NS]),") - .opx("([EW]),") - .num("(d+)(dd.d+),") // longitude (dddmm.mmmm) - .opx("([EW])?,") - .num("(d+.?d*)?,?") // speed - .num("(d+.?d*)?,?") // course - .num("(d+.?d*)?,?") // altitude - .xpr("([^,;]+)?,?") - .xpr("([^,;]+)?,?") - .xpr("([^,;]+)?,?") - .xpr("([^,;]+)?,?") - .xpr("([^,;]+)?,?") + .number("(?:d{1,5}.d+)?") + .groupEnd() + .text(",") + .expression("([AV]),") // validity + .expression("([NS]),").optional() + .number("(d+)(dd.d+),") // latitude (ddmm.mmmm) + .expression("([NS]),").optional() + .expression("([EW]),").optional() + .number("(d+)(dd.d+),") // longitude (dddmm.mmmm) + .expression("([EW])?,").optional() + .number("(d+.?d*)?,?") // speed + .number("(d+.?d*)?,?") // course + .number("(d+.?d*)?,?") // altitude + .expression("([^,;]+)?,?") + .expression("([^,;]+)?,?") + .expression("([^,;]+)?,?") + .expression("([^,;]+)?,?") + .expression("([^,;]+)?,?") .any() .compile(); private static final Pattern PATTERN_HANDSHAKE = new PatternBuilder() - .num("##,imei:(d+),A") + .number("##,imei:(d+),A") .compile(); @Override |