diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-01 21:43:45 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-01 21:43:45 -0700 |
commit | 91601b305e2ada2f5215af043a00ad50f22e79be (patch) | |
tree | 5f2a80a159ab4e531d464e039f58e936f584234c /src/main/java/org | |
parent | 08b950ea73ba142b5681aad4b208755db540cdb0 (diff) | |
download | traccar-server-91601b305e2ada2f5215af043a00ad50f22e79be.tar.gz traccar-server-91601b305e2ada2f5215af043a00ad50f22e79be.tar.bz2 traccar-server-91601b305e2ada2f5215af043a00ad50f22e79be.zip |
Decode ST300H RPM value
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 14 |
1 files changed, 14 insertions, 0 deletions
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()) { |