aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-11-02 21:23:14 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-11-02 21:23:14 -0800
commitc2f3554886b62690b2dc705e037517b34da99340 (patch)
tree9e3601171837d35cfef042f23157006a5f8f9f68 /src/main
parent9cc1c29ec08cdc4369b010ac17b270bf3c3d7ead (diff)
downloadtrackermap-server-c2f3554886b62690b2dc705e037517b34da99340.tar.gz
trackermap-server-c2f3554886b62690b2dc705e037517b34da99340.tar.bz2
trackermap-server-c2f3554886b62690b2dc705e037517b34da99340.zip
More StarLink attributes
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
index 7ba41ad56..ba079bff0 100644
--- a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java
@@ -23,6 +23,7 @@ import org.traccar.Protocol;
import org.traccar.helper.DataConverter;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
+import org.traccar.helper.UnitsConverter;
import org.traccar.model.CellTower;
import org.traccar.model.Network;
import org.traccar.model.Position;
@@ -144,6 +145,11 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
String[] dataTags = getFormat(deviceSession.getDeviceId());
DateFormat dateFormat = getDateFormat(deviceSession.getDeviceId());
+ /*
+29.0 (#TVI #),
+0 (#OUTC #),
+ */
+
for (int i = 0; i < Math.min(data.length, dataTags.length); i++) {
if (data[i].isEmpty()) {
continue;
@@ -162,6 +168,9 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_IGNITION, false);
}
break;
+ case "#EDSC#":
+ position.set("reason", data[i]);
+ break;
case "#PDT#":
position.setFixTime(dateFormat.parse(data[i]));
break;
@@ -174,12 +183,21 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
case "#SPD#":
position.setSpeed(Double.parseDouble(data[i]));
break;
+ case "#SPDK#":
+ position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(data[i])));
+ break;
case "#HEAD#":
position.setCourse(Integer.parseInt(data[i]));
break;
case "#ODO#":
position.set(Position.KEY_ODOMETER, (long) (Double.parseDouble(data[i]) * 1000));
break;
+ case "#BATC#":
+ position.set(Position.KEY_BATTERY_LEVEL, Integer.parseInt(data[i]));
+ break;
+ case "#TVI#":
+ position.set(Position.KEY_DEVICE_TEMP, Double.parseDouble(data[i]));
+ break;
case "#IN1#":
case "#IN2#":
case "#IN3#":
@@ -190,7 +208,13 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
case "#OUT2#":
case "#OUT3#":
case "#OUT4#":
- position.set(Position.PREFIX_OUT + dataTags[i].charAt(3), Integer.parseInt(data[i]));
+ position.set(Position.PREFIX_OUT + dataTags[i].charAt(4), Integer.parseInt(data[i]));
+ break;
+ case "#OUTA#":
+ case "#OUTB#":
+ case "#OUTC#":
+ case "#OUTD#":
+ position.set(Position.PREFIX_OUT + (dataTags[i].charAt(4) - 'A' + 1), Integer.parseInt(data[i]));
break;
case "#LAC#":
if (!data[i].isEmpty()) {
@@ -215,11 +239,16 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder {
position.set("destination", data[i]);
break;
case "#IGN#":
+ case "#IGNL#":
position.set(Position.KEY_IGNITION, data[i].equals("1"));
break;
case "#ENG#":
position.set("engine", data[i].equals("1"));
break;
+ case "#DUR#":
+ case "#TDUR#":
+ position.set(Position.KEY_HOURS, Integer.parseInt(data[i]));
+ break;
case "#SATU#":
position.set(Position.KEY_SATELLITES, Integer.parseInt(data[i]));
break;