diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-25 04:05:22 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-25 04:05:22 +1300 |
commit | 4216e038468184a58e9fa10cb9eaff28450de743 (patch) | |
tree | 5e06de9ffc5577cf78eabd8d27f2e1f1df244550 /src/org/traccar | |
parent | 98b6e3f4d727e8504d035bcc779be8eb3aa8feae (diff) | |
download | trackermap-server-4216e038468184a58e9fa10cb9eaff28450de743.tar.gz trackermap-server-4216e038468184a58e9fa10cb9eaff28450de743.tar.bz2 trackermap-server-4216e038468184a58e9fa10cb9eaff28450de743.zip |
Fix U-pro decoder patter
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; |