diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-11 18:40:42 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-10-11 18:40:42 +1300 |
commit | 717b60cef1e0bdeacb2f412018a8332a15c25f04 (patch) | |
tree | fe60125a88cf2fdff81e1ed22c6e677124721169 /src/org/traccar | |
parent | f9da745ca13052396c40c4e8f99da7cd4ed14d3c (diff) | |
download | trackermap-server-717b60cef1e0bdeacb2f412018a8332a15c25f04.tar.gz trackermap-server-717b60cef1e0bdeacb2f412018a8332a15c25f04.tar.bz2 trackermap-server-717b60cef1e0bdeacb2f412018a8332a15c25f04.zip |
Add alarm support to gps103 (fix #54)
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 2578065c1..6a666fc86 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -43,7 +43,7 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder { static private Pattern pattern = Pattern.compile( "imei:" + "([\\d]+)," + // IMEI - "[^,]+," + + "([^,]+)," + // Alarm "(\\d{2})(\\d{2})(\\d{2})[\\d]+," + // Date "[^,]*," + "[FL]," + // F - full / L - low @@ -85,6 +85,7 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder { // Create new position Position position = new Position(); + StringBuilder extendedInfo = new StringBuilder("<protocol>gps103</protocol>"); Integer index = 1; @@ -92,6 +93,11 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder { String imei = parser.group(index++); position.setDeviceId(getDataManager().getDeviceByImei(imei).getId()); + // Alarm message + extendedInfo.append("<alarm>"); + extendedInfo.append(parser.group(index++)); + extendedInfo.append("</alarm>"); + // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); time.clear(); @@ -128,6 +134,9 @@ public class Gps103ProtocolDecoder extends GenericProtocolDecoder { position.setSpeed(Double.valueOf(parser.group(index++))); position.setCourse(0.0); + // Extended info + position.setExtendedInfo(extendedInfo.toString()); + return position; } |