aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/StartekProtocolDecoder.java16
-rw-r--r--src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java4
2 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java b/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
index d08bb92a8..9c749c8d9 100644
--- a/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StartekProtocolDecoder.java
@@ -72,12 +72,10 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
.number("(x+)") // battery
.expression("([^,]+)?") // adc
.groupBegin()
- .text(",")
- .number("d,") // extended
- .expression("([^,]+)?") // fuel
+ .number(",d+") // extended
+ .expression(",([^,]+)?") // fuel
.groupBegin()
- .text(",")
- .expression("([^,]+)?") // temperature
+ .expression(",([^,]+)?") // temperature
.groupBegin()
.text(",")
.groupBegin()
@@ -91,9 +89,11 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
.number("(d+)?|") // instant fuel
.number("(d+)[%L]").optional() // fuel level
.groupEnd("?")
+ .number(",(d+)").optional() // hours
.groupEnd("?")
.groupEnd("?")
.groupEnd("?")
+ .any()
.compile();
private String decodeAlarm(int value) {
@@ -224,7 +224,7 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
}
}
- if (parser.hasNextAny(6)) {
+ if (parser.hasNextAny(9)) {
position.set(Position.KEY_RPM, parser.nextInt());
position.set(Position.KEY_ENGINE_LOAD, parser.nextInt());
position.set("airFlow", parser.nextInt());
@@ -242,6 +242,10 @@ public class StartekProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_FUEL_LEVEL, parser.nextInt());
}
+ if (parser.hasNext()) {
+ position.set(Position.KEY_HOURS, parser.nextInt() * 1000L);
+ }
+
return position;
}
diff --git a/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java
index 361e6e6f2..9b1362f5d 100644
--- a/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java
@@ -12,6 +12,10 @@ public class StartekProtocolDecoderTest extends ProtocolTest {
var decoder = inject(new StartekProtocolDecoder(null));
verifyAttribute(decoder, text(
+ "&&s148,868703050178631,000,37,,230704040211,A,22.678565,114.046011,31,0.5,0,339,77,8,460|0|249F|0AC2620D,27,0000001D,02,00,04F2|01A1|0000|0000,129,,,,949037"),
+ Position.KEY_HOURS, 9490000L);
+
+ verifyAttribute(decoder, text(
"&&x164,869926040743375,000,0,,220705205955,A,33.326001,44.445318,10,1.2,0,57,8,925,418|40|038C|000083CD,31,00000015,00,00,0016|016A|0000|0000,1,,,686|33||44|99|14|124|11|8D"),
Position.KEY_FUEL_CONSUMPTION, 1.1);