diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-19 13:15:15 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-19 13:15:15 +1200 |
commit | d5640d4a672c0b23bea3a697fc3412fbe7e93350 (patch) | |
tree | db970d388a731082d06b1c30db0fc11e1c4fa6b8 /src/org/traccar | |
parent | 9e75f24dc7ddeac4a7059829cd0c24a4f43e988f (diff) | |
download | trackermap-server-d5640d4a672c0b23bea3a697fc3412fbe7e93350.tar.gz trackermap-server-d5640d4a672c0b23bea3a697fc3412fbe7e93350.tar.bz2 trackermap-server-d5640d4a672c0b23bea3a697fc3412fbe7e93350.zip |
Parse battery for Suntech devices
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/SuntechProtocolDecoder.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index aade44e4f..7ba6020f5 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -20,10 +20,7 @@ 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.jboss.netty.channel.ChannelHandlerContext; - import org.traccar.BaseProtocolDecoder; import org.traccar.helper.UnitsConverter; import org.traccar.model.Event; @@ -35,7 +32,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { super(protocol); } - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "S.\\d{3}(?:\\w{3})?;" + // Header "(?:[^;]+;)?" + "(\\d{6,});" + // Device ID @@ -44,10 +41,12 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { "(\\d{4})(\\d{2})(\\d{2});" + // Date (YYYYMMDD) "(\\d{2}):(\\d{2}):(\\d{2});" + // Time (HH:MM:SS) "(?:(\\p{XDigit}+);)?" + // Cell - "([-\\+]\\d{2}.\\d+);" + // Latitude - "([-\\+]\\d{3}.\\d+);" + // Longitude - "(\\d{3}.\\d{3});" + // Speed - "(\\d{3}.\\d{2});" + // Course + "([-\\+]\\d{2}\\.\\d+);" + // Latitude + "([-\\+]\\d{3}\\.\\d+);" + // Longitude + "(\\d{3}\\.\\d{3});" + // Speed + "(\\d{3}\\.\\d{2});" + // Course + "(?:\\d+;)?" + + "(\\d+\\.\\d+)?" + // Battery ".*"); // Full format @Override @@ -101,6 +100,9 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { // Course position.setCourse(Double.valueOf(parser.group(index++))); + + // Battery + position.set(Event.KEY_BATTERY, parser.group(index++)); return position; } |