aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-01-27 18:26:29 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-27 18:26:29 -0800
commitc45b4d8d1e29227937afa9114ead5ae16f548aa0 (patch)
treefc401bb39c9b475224cfeea83b6ab59b20193866 /src/main/java/org/traccar
parentdecc6d4c592b9511fda3db943f43e4a6d29841f0 (diff)
downloadtrackermap-server-c45b4d8d1e29227937afa9114ead5ae16f548aa0.tar.gz
trackermap-server-c45b4d8d1e29227937afa9114ead5ae16f548aa0.tar.bz2
trackermap-server-c45b4d8d1e29227937afa9114ead5ae16f548aa0.zip
Support Armoli OBD data
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
index 400e4ad89..50af039d6 100644
--- a/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/ArmoliProtocolDecoder.java
@@ -20,6 +20,7 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
+import org.traccar.helper.ObdDecoder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
import org.traccar.helper.UnitsConverter;
@@ -51,12 +52,13 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
.number("(xx)") // max speed
.number("(x{6})") // distance
.number("(dd)?") // hdop
- .number("xx") // idle
+ .number("x{4}") // idle
.number(":(x+)").optional() // alarms
.number("G(x{6})").optional() // g-sensor
.number("H(x{3})").optional() // power
.number("E(x{3})").optional() // battery
.number("!(x+)").optional() // driver
+ .expression("@A([>0-9A-F]+)").optional() // obd
.any()
.compile();
@@ -133,6 +135,15 @@ public class ArmoliProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext()) {
position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());
}
+ if (parser.hasNext()) {
+ String[] values = parser.next().split(">");
+ for (int i = 1; i < values.length; i++) {
+ String value = values[i];
+ position.add(ObdDecoder.decodeData(
+ Integer.parseInt(value.substring(4, 6), 16),
+ Long.parseLong(value.substring(6), 16), true));
+ }
+ }
return position;
}