aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Stl060ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-09 09:57:06 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-09 09:57:06 +1200
commit1a91db44d43fe0aac0dbd56818f0b779900fa70a (patch)
tree425d61250120855c23262f2f0d18bbea20bf550f /src/org/traccar/protocol/Stl060ProtocolDecoder.java
parent38ea2292b1650c6cdfdce5096ab7258dcd8cb29b (diff)
downloadtrackermap-server-1a91db44d43fe0aac0dbd56818f0b779900fa70a.tar.gz
trackermap-server-1a91db44d43fe0aac0dbd56818f0b779900fa70a.tar.bz2
trackermap-server-1a91db44d43fe0aac0dbd56818f0b779900fa70a.zip
Add new STL060 format
Diffstat (limited to 'src/org/traccar/protocol/Stl060ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java50
1 files changed, 41 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
index 19930fa2e..f23b7be73 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -44,11 +44,25 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
"(\\d{3})(\\d{2})\\.?(\\d+)([EW])," + // Longitude
"(\\d+\\.?\\d*)," + // Speed
"(\\d+\\.?\\d*)," + // Course
- "(\\d+)," + // Odometer
+
+ "(?:(\\d+)," + // Odometer
"(\\d+)," + // Ignition
- "(\\d+)," + // DIP1
- "(\\d+)," + // DIP2
+ "(\\d+)," + // DI1
+ "(\\d+)," + // DI2
+ "(\\d+),|" + // Fuel
+
+ "([01])," + // Charging
+ "([01])," + // Ignition
+ "0,0," + // Reserved
+ "(\\d+)," + // DI
+ "([^,])," + // RFID
+ "(\\d+)," + // Odometer
+ "(\\d+)," + // Temperature
"(\\d+)," + // Fuel
+ "([01])," + // Accelerometer
+ "([01])," + // DO1
+ "([01]),)" + // DO2
+
"([AV])" + // Validity
".*");
@@ -108,12 +122,30 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
// Course
position.setCourse(Double.valueOf(parser.group(index++)));
- // Other
- position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++)));
- position.set(Event.KEY_IGNITION, Integer.valueOf(parser.group(index++)));
- position.set("dip1", Integer.valueOf(parser.group(index++)));
- position.set("dip2", Integer.valueOf(parser.group(index++)));
- position.set(Event.KEY_FUEL, Integer.valueOf(parser.group(index++)));
+ // Old format
+ if (parser.group(index) != null) {
+ position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_IGNITION, Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_INPUT, Integer.valueOf(parser.group(index++)) + Integer.valueOf(parser.group(index++)) << 1);
+ position.set(Event.KEY_FUEL, Integer.valueOf(parser.group(index++)));
+ } else {
+ index += 5;
+ }
+
+ // New format
+ if (parser.group(index) != null) {
+ position.set(Event.KEY_CHARGE, Integer.valueOf(parser.group(index++)) == 1);
+ position.set(Event.KEY_IGNITION, Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_INPUT, Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_RFID, parser.group(index++));
+ position.set(Event.KEY_ODOMETER, Integer.valueOf(parser.group(index++)));
+ position.set(Event.PREFIX_TEMP + 1, Integer.valueOf(parser.group(index++)));
+ position.set(Event.KEY_FUEL, Integer.valueOf(parser.group(index++)));
+ position.set("accel", Integer.valueOf(parser.group(index++)) == 1);
+ position.set(Event.KEY_OUTPUT, Integer.valueOf(parser.group(index++)) + Integer.valueOf(parser.group(index++)) << 1);
+ } else {
+ index += 10;
+ }
// Validity
position.setValid(parser.group(index++).compareTo("A") == 0);