aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-12-21 21:32:43 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-12-21 21:32:43 +1300
commitcceb668c8d65a638407229120791cfc415964e11 (patch)
treeed57b32cf66661114b1f23dfa695a8f0ea4a7c7f
parent4237194639161293e97d79443bb152819320c862 (diff)
downloadtraccar-server-cceb668c8d65a638407229120791cfc415964e11.tar.gz
traccar-server-cceb668c8d65a638407229120791cfc415964e11.tar.bz2
traccar-server-cceb668c8d65a638407229120791cfc415964e11.zip
Add J1939 to Intellitrac
-rw-r--r--src/org/traccar/protocol/IntellitracProtocolDecoder.java35
-rw-r--r--test/org/traccar/protocol/IntellitracProtocolDecoderTest.java1
2 files changed, 26 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
index e45c84ba9..de834965c 100644
--- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java
+++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java
@@ -47,7 +47,18 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)," + // Input
"(\\d+),?" + // Output
"(\\d+\\.\\d+)?,?" + // ADC1
- "(\\d+\\.\\d+)?" + // ADC2
+ "(\\d+\\.\\d+)?,?" + // ADC2
+ "(?:\\d{14},\\d+," +
+ "(\\d+)," + // VSS
+ "(\\d+)," + // RPM
+ "(-?\\d+)," + // Coolant
+ "(\\d+)," + // Fuel
+ "(\\d+)," + // Fuel Consumption
+ "(-?\\d+)," + // Fuel Temperature
+ "(\\d+)," + // Charger Pressure
+ "(\\d+)," + // TPL
+ "(\\d+)," + // Axle Weight
+ "(\\d+))?" + // Milage
".*");
@Override
@@ -110,17 +121,23 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("output", parser.group(index++));
// ADC1
- String adc1 = parser.group(index++);
- if (adc1 != null) {
- extendedInfo.set("adc1", adc1);
- }
+ extendedInfo.set("adc1", parser.group(index++));
// ADC2
- String adc2 = parser.group(index++);
- if (adc2 != null) {
- extendedInfo.set("adc2", adc2);
- }
+ extendedInfo.set("adc2", parser.group(index++));
+ // J1939 data
+ extendedInfo.set("vss", parser.group(index++));
+ extendedInfo.set("rpm", parser.group(index++));
+ extendedInfo.set("coolant", parser.group(index++));
+ extendedInfo.set("fuel", parser.group(index++));
+ extendedInfo.set("consumption", parser.group(index++));
+ extendedInfo.set("temperature", parser.group(index++));
+ extendedInfo.set("charger", parser.group(index++));
+ extendedInfo.set("tpl", parser.group(index++));
+ extendedInfo.set("axle", parser.group(index++));
+ extendedInfo.set("milage", parser.group(index++));
+
position.setExtendedInfo(extendedInfo.toString());
return position;
}
diff --git a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java
index 59b47ebf3..7276932d9 100644
--- a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java
@@ -54,7 +54,6 @@ public class IntellitracProtocolDecoderTest {
verify(decoder.decode(null, null,
"1003269480,20131126100258,10.32989,49.93836,0,304,217,6,2,0,0,0.000,0.000,20131126100258,0,0,0,-40,0,0,-273,0,0,0,0"));
-
}
}