diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-24 23:02:45 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-24 23:02:45 +1200 |
commit | 187fae2778a6b072d0fbf325d50d5d5df9fd2f01 (patch) | |
tree | 0f5b4dd0732d8c2b1f6eaa8aec0746ad0272f8f7 /src | |
parent | 85bb659197cc2395f2ff2511573af3b90292f535 (diff) | |
download | traccar-server-187fae2778a6b072d0fbf325d50d5d5df9fd2f01.tar.gz traccar-server-187fae2778a6b072d0fbf325d50d5d5df9fd2f01.tar.bz2 traccar-server-187fae2778a6b072d0fbf325d50d5d5df9fd2f01.zip |
Fix Aquila protocol decoder
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/AquilaProtocolDecoder.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java index 0bf6a805c..67ada82b2 100644 --- a/src/org/traccar/protocol/AquilaProtocolDecoder.java +++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java @@ -15,17 +15,17 @@ */ package org.traccar.protocol; -import org.jboss.netty.channel.Channel; -import org.traccar.BaseProtocolDecoder; -import org.traccar.helper.UnitsConverter; -import org.traccar.model.Event; -import org.traccar.model.Position; - import java.net.SocketAddress; import java.util.Calendar; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jboss.netty.channel.Channel; +import org.traccar.BaseProtocolDecoder; +import org.traccar.helper.PatternUtil; +import org.traccar.helper.UnitsConverter; +import org.traccar.model.Event; +import org.traccar.model.Position; public class AquilaProtocolDecoder extends BaseProtocolDecoder { @@ -45,16 +45,17 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { "([AV])," + // Validity "(\\d+)," + // GSM "(\\d+)," + // Speed + "(\\d+)," + // Distance "\\d+," + // Driver code "(\\d+)," + // Fuel - "(\\d+)," + // IO 1 + "([01])," + // IO 1 "[01]," + // Case open switch "[01]," + // Over speed start "[01]," + // Over speed end - "0,0,0," + // Reserved + "(?:\\d+,){3}" + // Reserved "([01])," + // Power status "([01])," + // IO 2 - "0," + // Reserved + "\\d+," + // Reserved "([01])," + // Ignition "[01]," + // Ignition off event ".*"); @@ -65,6 +66,8 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { throws Exception { String sentence = (String) msg; + + String r = PatternUtil.checkPattern(pattern.pattern(), sentence); Matcher parser = pattern.matcher(sentence); if (!parser.matches()) { @@ -103,6 +106,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(parser.group(index++)))); + position.set(Event.KEY_ODOMETER, parser.group(index++)); position.set(Event.KEY_FUEL, parser.group(index++)); position.set(Event.PREFIX_IO + 1, parser.group(index++)); position.set(Event.KEY_CHARGE, parser.group(index++)); |