diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-23 20:34:43 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-03-23 20:34:43 +1300 |
commit | 35701e0a14782d67320a7c667d7afd980bbc5dd0 (patch) | |
tree | 94827428211420c812c0e956396d92e3c3af9d4a /src/org/traccar/protocol/Gps103ProtocolDecoder.java | |
parent | 43943e450f58501f61faecd466f88aa5d3eb4482 (diff) | |
download | trackermap-server-35701e0a14782d67320a7c667d7afd980bbc5dd0.tar.gz trackermap-server-35701e0a14782d67320a7c667d7afd980bbc5dd0.tar.bz2 trackermap-server-35701e0a14782d67320a7c667d7afd980bbc5dd0.zip |
Save GPS103 extra data
Diffstat (limited to 'src/org/traccar/protocol/Gps103ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index 24a1c525d..815ee3192 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2012 - 2014 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. @@ -33,7 +33,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "imei:" + "(\\d+)," + // IMEI "([^,]+)," + // Alarm @@ -48,8 +48,12 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM) "([EW])?," + "(\\d+\\.?\\d*)," + // Speed - "(\\d+\\.?\\d*)?(?:," + // Course - "(\\d+\\.?\\d*)?)?" + // Altitude + "(\\d+\\.?\\d*)?,?" + // Course + "(\\d+\\.?\\d*)?,?" + // Altitude + "([^,]+)?,?" + + "([^,]+)?,?" + + "([^,]+)?,?" + + "([^,]+)?,?" + ".*"); @Override @@ -129,7 +133,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { position.setTime(time.getTime()); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Latitude Double latitude = Double.valueOf(parser.group(index++)); @@ -165,6 +169,12 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(0.0); } + // Additional data + extendedInfo.set("io1", parser.group(index++)); + extendedInfo.set("io2", parser.group(index++)); + extendedInfo.set("io3", parser.group(index++)); + extendedInfo.set("io4", parser.group(index++)); + // Extended info position.setExtendedInfo(extendedInfo.toString()); |