diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/UproProtocolDecoder.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/UproProtocolDecoder.java b/src/org/traccar/protocol/UproProtocolDecoder.java index b4000c37a..e6cb4e132 100644 --- a/src/org/traccar/protocol/UproProtocolDecoder.java +++ b/src/org/traccar/protocol/UproProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import org.traccar.DeviceSession; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; +import org.traccar.helper.PatternUtil; import org.traccar.model.Position; import java.net.SocketAddress; @@ -34,8 +35,9 @@ public class UproProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .text("*AI20") + .expression("[01]") // ack .number("(d+),") // device id - .expression("A.+&A") + .expression(".+&A") .number("(dd)(dd)(dd)") // time .number("(dd)(dd)(dddd)") // latitude .number("(ddd)(dd)(dddd)") // longitude @@ -49,6 +51,8 @@ public class UproProtocolDecoder extends BaseProtocolDecoder { protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { + PatternUtil.MatchResult r = PatternUtil.checkPattern(PATTERN.pattern(), (String) msg); + Parser parser = new Parser(PATTERN, (String) msg); if (!parser.matches()) { return null; |