diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-06-12 20:46:31 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-06-12 20:46:31 -0700 |
commit | 2bbdd5604648cb699ef5c713f778b9baf1b0ea2a (patch) | |
tree | b51a59f418233c507b6b314f6bba7a49336cd6b2 /src/main/java/org/traccar/protocol | |
parent | 3d464a1486a0dd9b28538d4f3d7cbc55451cc3a8 (diff) | |
download | traccar-server-2bbdd5604648cb699ef5c713f778b9baf1b0ea2a.tar.gz traccar-server-2bbdd5604648cb699ef5c713f778b9baf1b0ea2a.tar.bz2 traccar-server-2bbdd5604648cb699ef5c713f778b9baf1b0ea2a.zip |
Fix and extend decoder
Diffstat (limited to 'src/main/java/org/traccar/protocol')
-rw-r--r-- | src/main/java/org/traccar/protocol/PluginProtocolDecoder.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java b/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java index d2bb93962..3f87a774b 100644 --- a/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/PluginProtocolDecoder.java @@ -34,7 +34,7 @@ public class PluginProtocolDecoder extends BaseProtocolDecoder { } private static final Pattern PATTERN = new PatternBuilder() - .any() + .expression("[^0-9]*") .number("(d+),") // device id .number("(dddd)(dd)(dd)") // date (yyyymmdd) .number("(dd)(dd)(dd),") // time (hhmmss) @@ -44,9 +44,16 @@ public class PluginProtocolDecoder extends BaseProtocolDecoder { .number("(d+),") // course .number("(-?d+),") // altitude .number("(-?d+),") // satellites - .number("(d+),") // event + .number("d+,") // type .number("(d+),") // odometer .number("(d+),") // status + .expression("[^,]*,") + .expression("[^,]*,") + .text("0") + .groupBegin() + .text(",+,") + .number("(d+),") // event + .groupEnd("?") .any() .compile(); @@ -76,9 +83,9 @@ public class PluginProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(parser.nextInt()); position.set(Position.KEY_SATELLITES, parser.nextInt()); - position.set(Position.KEY_EVENT, parser.nextInt()); position.set(Position.KEY_ODOMETER, parser.nextInt()); position.set(Position.KEY_STATUS, parser.nextInt()); + position.set(Position.KEY_EVENT, parser.nextInt()); return position; } |