aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-03-22 23:22:30 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-03-22 23:22:30 -0700
commitaf56a55f89bc3d8f1d6d653ab509f920f9ed6637 (patch)
treed432c3781ce81d4233796201994d3e787b9d4fb0
parentada088e6fc4fc9d2197d2179deba11642999c03d (diff)
downloadtrackermap-server-af56a55f89bc3d8f1d6d653ab509f920f9ed6637.tar.gz
trackermap-server-af56a55f89bc3d8f1d6d653ab509f920f9ed6637.tar.bz2
trackermap-server-af56a55f89bc3d8f1d6d653ab509f920f9ed6637.zip
Decode fuel level
-rw-r--r--src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java8
-rw-r--r--src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java6
2 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
index 882bed81b..82f0e4061 100644
--- a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2021 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.
@@ -193,6 +193,12 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
case "#TVI#":
position.set(Position.KEY_DEVICE_TEMP, Double.parseDouble(data[i]));
break;
+ case "#CFL#":
+ position.set(Position.KEY_FUEL_LEVEL, Integer.parseInt(data[i]));
+ break;
+ case "#CFL2#":
+ position.set("fuel2", Integer.parseInt(data[i]));
+ break;
case "#IN1#":
case "#IN2#":
case "#IN3#":
diff --git a/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
index c15e9e48a..b8c1291c3 100644
--- a/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class StarLinkProtocolDecoderTest extends ProtocolTest {
StarLinkProtocolDecoder decoder = new StarLinkProtocolDecoder(null);
+ decoder.setFormat("#IMEI#,#EDT#,#PDT#,#LAT#,#LONG#,#SPD#,#IGN#,#ODO#,#DUR#,#TDUR#,#LAC#,#CID#,#VIN#,#VBAT#,#EID#,#EDSC#,#DRV#,#SATU#,#CSS#,#OUT1#,#OUT2#,#CFL#");
+
+ verifyAttribute(decoder, text(
+ "$SLU0AF334,06,14260,352353088342073,210322083942,210322083940,+0937.2191,+04151.8206,000.0,0,006782,,30707,14010,11685,12.994,04.159,01,Location,0,20,64,0,0,12,0,2*7F"),
+ Position.KEY_FUEL_LEVEL, 12);
+
decoder.setFormat("#IMEI#,#EDT#,#EDSC#,#EID#,#PDT#,#LAT#,#LONG#,#SPDK#,#IGNL#,#HEAD#,#ODO#,#DUR#,#TDUR#,#VIN#,#VBAT#,#BATC#,#SATU#,#CSS#,#IN2#,#TVI#,#OUT1#,#OUT2#,#OUT3#,#OUTC#");
verifyAttributes(decoder, text(