aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/model/Event.java1
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java50
-rw-r--r--src/org/traccar/protocol/Xt013ProtocolDecoder.java2
5 files changed, 45 insertions, 12 deletions
diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java
index 1829b2cc4..1781bcee4 100644
--- a/src/org/traccar/model/Event.java
+++ b/src/org/traccar/model/Event.java
@@ -74,6 +74,7 @@ public abstract class Event {
public static final String KEY_TYPE = "type";
public static final String KEY_IGNITION = "ignition";
public static final String KEY_FLAGS = "flags";
+ public static final String KEY_CHARGE = "charge";
// Starts with 1 not 0
public static final String PREFIX_TEMP = "temp";
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index 469701b24..39d851cf9 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -128,7 +128,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_FUEL, parser.group(index++));
position.set("consumption", parser.group(index++));
position.set(Event.PREFIX_TEMP + 1, parser.group(index++));
- position.set("charger", parser.group(index++));
+ position.set(Event.KEY_CHARGE, parser.group(index++));
position.set("tpl", parser.group(index++));
position.set("axle", parser.group(index++));
position.set(Event.KEY_ODOMETER, parser.group(index++));
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index 74ff67be7..3f29d8470 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -214,7 +214,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
// Charger
String charger = parser.group(index++);
if (charger != null) {
- position.set("charger", Integer.valueOf(charger) == 1);
+ position.set(Event.KEY_CHARGE, Integer.valueOf(charger) == 1);
}
position.set(Event.KEY_MCC, parser.group(index++));
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);
diff --git a/src/org/traccar/protocol/Xt013ProtocolDecoder.java b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
index 37f204bb3..9e2f1fe40 100644
--- a/src/org/traccar/protocol/Xt013ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Xt013ProtocolDecoder.java
@@ -104,7 +104,7 @@ public class Xt013ProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_GPS, parser.group(index++));
position.set(Event.KEY_GSM, parser.group(index++));
position.set(Event.KEY_BATTERY, parser.group(index++));
- position.set("charging", parser.group(index++));
+ position.set(Event.KEY_CHARGE, parser.group(index++));
return position;
}