aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-01-12 22:03:44 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-12 22:03:44 -0800
commit9453cb6f684b26cc87a8d81c46b714319ff0cbaa (patch)
tree3eb3d1865623385aee763eaaf99e1d8185c92b61 /src/main/java/org
parentad102cd882dd9ec6f7e4ffedad34c793184ea23b (diff)
downloadtrackermap-server-9453cb6f684b26cc87a8d81c46b714319ff0cbaa.tar.gz
trackermap-server-9453cb6f684b26cc87a8d81c46b714319ff0cbaa.tar.bz2
trackermap-server-9453cb6f684b26cc87a8d81c46b714319ff0cbaa.zip
Support iStartek OBD data
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/StartekProtocolDecoder.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java b/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
index 042518cb2..c1869def2 100644
--- a/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 Anton Tananaev (anton@traccar.org)
+ * Copyright 2021 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,14 +70,23 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
.number("(x+),") // outputs
.number("(x+)|") // power
.number("(x+)") // battery
- .groupBegin()
- .text("|")
- .expression("([^,]+)").optional() // adc
+ .expression("([^,]+)?") // adc
.groupBegin()
.text(",")
.number("d,") // extended
.expression("([^,]+)?,") // fuel
- .expression("([^,]+)?,?") // temperature
+ .expression("([^,]+)?") // temperature
+ .groupBegin()
+ .text(",")
+ .number("(d+)|") // rpm
+ .number("(d+)|") // engine load
+ .number("d+|") // maf flow
+ .number("d+|") // intake pressure
+ .number("d+|") // intake temperature
+ .number("(d+)|") // throttle
+ .number("(d+)|") // coolant temperature
+ .number("(d+)|") // instant fuel
+ .number("(d+)") // fuel level
.groupEnd("?")
.groupEnd("?")
.any()
@@ -181,7 +190,7 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext()) {
String[] adc = parser.next().split("\\|");
- for (int i = 0; i < adc.length; i++) {
+ for (int i = 1; i < adc.length; i++) {
position.set(Position.PREFIX_ADC + (i + 1), Integer.parseInt(adc[i], 16) * 0.01);
}
}
@@ -208,6 +217,15 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
}
}
+ if (parser.hasNext(6)) {
+ position.set(Position.KEY_RPM, parser.nextInt());
+ position.set(Position.KEY_ENGINE_LOAD, parser.nextInt());
+ position.set(Position.KEY_THROTTLE, parser.nextInt());
+ position.set(Position.KEY_COOLANT_TEMP, parser.nextInt() - 40);
+ position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextInt() * 0.1);
+ position.set(Position.KEY_FUEL_LEVEL, parser.nextInt());
+ }
+
return position;
}