From 98e9a26fd916bcdace022af1d9f7dd80d1a2d2fe Mon Sep 17 00:00:00 2001 From: Kevin Goos Date: Tue, 20 Mar 2018 09:14:19 +0100 Subject: Fixed formatting --- .../traccar/protocol/LaipacProtocolDecoder.java | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/org/traccar/protocol') diff --git a/src/org/traccar/protocol/LaipacProtocolDecoder.java b/src/org/traccar/protocol/LaipacProtocolDecoder.java index 7f26f225b..4fc0201ef 100644 --- a/src/org/traccar/protocol/LaipacProtocolDecoder.java +++ b/src/org/traccar/protocol/LaipacProtocolDecoder.java @@ -35,34 +35,35 @@ public class LaipacProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .text("$AVRMC,") - .expression("([^,]+),") // identifier - .number("(dd)(dd)(dd),") // time (hhmmss) - .expression("([AVRPavrp]),") // validity - .number("(dd)(dd.d+),") // latitude + .expression("([^,]+),") // identifier + .number("(dd)(dd)(dd),") // time (hhmmss) + .expression("([AVRPavrp]),") // validity + .number("(dd)(dd.d+),") // latitude .expression("([NS]),") - .number("(ddd)(dd.d+),") // longitude + .number("(ddd)(dd.d+),") // longitude .number("([EW]),") - .number("(d+.d+),") // speed - .number("(d+.d+),") // course - .number("(dd)(dd)(dd),") // date (ddmmyy) - .expression("([abZXTSMHFE86430]),") // event code + .number("(d+.d+),") // speed + .number("(d+.d+),") // course + .number("(dd)(dd)(dd),") // date (ddmmyy) + .expression("([abZXTSMHFE86430]),") // event code .number("(d+)").expression("(\\.?)").number("(d*),") // battery voltage - .number("(d+),") // current mileage - .number("(d),") // GPS on/off (1 = on, 0 = off) - .number("(d+),") // Analog port 1 - .number("(d+)") // Analog port 2 - .expression(",([0-9a-fA-F]{4})") // Cell 1 - Cell Net Code - .expression("([0-9a-fA-F]{4}),") // Cell 1 - Cell ID Code - .number("(d{3})") // Cell 2 - Country Code - .number("(d{3})") // Cell 2 - Operator Code + .number("(d+),") // current mileage + .number("(d),") // GPS on/off (1 = on, 0 = off) + .number("(d+),") // Analog port 1 + .number("(d+)") // Analog port 2 + .expression(",([0-9a-fA-F]{4})") // Cell 1 - Cell Net Code + .expression("([0-9a-fA-F]{4}),") // Cell 1 - Cell ID Code + .number("(d{3})") // Cell 2 - Country Code + .number("(d{3})") // Cell 2 - Operator Code .optional(4) .text("*") - .number("(xx)") // checksum + .number("(xx)") // checksum .compile(); @Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { + String sentence = (String) msg; if (sentence.startsWith("$ECHK") && channel != null) { -- cgit v1.2.3