From 717b60cef1e0bdeacb2f412018a8332a15c25f04 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 11 Oct 2012 18:40:42 +1300 Subject: Add alarm support to gps103 (fix #54) --- src/org/traccar/protocol/Gps103ProtocolDecoder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/org') 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("gps103"); 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(""); + extendedInfo.append(parser.group(index++)); + extendedInfo.append(""); + // 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; } -- cgit v1.2.3