diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-08-21 22:38:58 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-08-21 22:38:58 -0700 |
commit | b90a8dc10826bc0fecc6833e44fd25433fc31081 (patch) | |
tree | 8e1480073f61c6be537860605ca4e4bc5f58810c /src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java | |
parent | b9875d4076a6c88b4da6d6b296f9496f525091fe (diff) | |
download | trackermap-server-b90a8dc10826bc0fecc6833e44fd25433fc31081.tar.gz trackermap-server-b90a8dc10826bc0fecc6833e44fd25433fc31081.tar.bz2 trackermap-server-b90a8dc10826bc0fecc6833e44fd25433fc31081.zip |
Decode StarLink sensor data
Diffstat (limited to 'src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java index 2d1613e03..f0c969870 100644 --- a/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/StarLinkProtocolDecoder.java @@ -20,11 +20,13 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; import org.traccar.Protocol; +import org.traccar.helper.DataConverter; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; import org.traccar.model.CellTower; import org.traccar.model.Network; import org.traccar.model.Position; +import org.traccar.protobuf.StarLinkMessage; import java.net.SocketAddress; import java.text.DateFormat; @@ -201,6 +203,20 @@ public class StarLinkProtocolDecoder extends BaseProtocolDecoder { case "#ENG#": position.set("engine", data[i].equals("1")); break; + case "#TD1#": + case "#TD2#": + StarLinkMessage.mEventReport_TDx message = + StarLinkMessage.mEventReport_TDx.parseFrom(DataConverter.parseBase64(data[i])); + position.set( + "sensor" + message.getSensorNumber() + "Temp", + message.getTemperature() * 0.1); + position.set( + "sensor" + message.getSensorNumber() + "Humidity", + message.getTemperature() * 0.1); + position.set( + "sensor" + message.getSensorNumber() + "Voltage", + message.getVoltage() * 0.001); + break; default: break; } |