From 91601b305e2ada2f5215af043a00ad50f22e79be Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 1 Apr 2019 21:43:45 -0700 Subject: Decode ST300H RPM value --- .../java/org/traccar/protocol/SuntechProtocolDecoder.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main/java/org/traccar/protocol') diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 922431021..a80e84728 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -37,6 +37,7 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { private int protocolType; private boolean hbm; private boolean includeAdc; + private boolean includeRpm; private boolean includeTemp; public SuntechProtocolDecoder(Protocol protocol) { @@ -70,6 +71,15 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { deviceId, getProtocolName() + ".includeAdc", includeAdc, true); } + public void setIncludeRpm(boolean includeRpm) { + this.includeRpm = includeRpm; + } + + public boolean isIncludeRpm(long deviceId) { + return Context.getIdentityManager().lookupAttributeBoolean( + deviceId, getProtocolName() + ".includeRpm", includeRpm, true); + } + public void setIncludeTemp(boolean includeTemp) { this.includeTemp = includeTemp; } @@ -338,6 +348,10 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { } } + if (isIncludeRpm(deviceSession.getDeviceId()) && index < values.length) { + position.set(Position.KEY_RPM, Integer.parseInt(values[index++])); + } + if (values.length - index >= 2) { String driverUniqueId = values[index++]; if (values[index++].equals("1") && !driverUniqueId.isEmpty()) { -- cgit v1.2.3