diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-17 22:59:49 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-17 22:59:49 +1300 |
commit | c53feac38ec149fed84121704c620503bf1f7820 (patch) | |
tree | 4e39998168196afe3250b40870efd44c632559a8 /src/org/traccar/protocol/SuntechProtocolDecoder.java | |
parent | 8b46b34fb3e2c2635208f0cb427d45182c3fecc4 (diff) | |
download | trackermap-server-c53feac38ec149fed84121704c620503bf1f7820.tar.gz trackermap-server-c53feac38ec149fed84121704c620503bf1f7820.tar.bz2 trackermap-server-c53feac38ec149fed84121704c620503bf1f7820.zip |
Add Suntech HBM flag
Diffstat (limited to 'src/org/traccar/protocol/SuntechProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/SuntechProtocolDecoder.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/SuntechProtocolDecoder.java b/src/org/traccar/protocol/SuntechProtocolDecoder.java index 55d5c224a..e19335cb0 100644 --- a/src/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/org/traccar/protocol/SuntechProtocolDecoder.java @@ -31,11 +31,13 @@ import java.util.TimeZone; public class SuntechProtocolDecoder extends BaseProtocolDecoder { private int protocolType; + private boolean hbm; public SuntechProtocolDecoder(SuntechProtocol protocol) { super(protocol); protocolType = Context.getConfig().getInteger(getProtocolName() + ".protocolType"); + hbm = Context.getConfig().getBoolean(getProtocolName() + ".hbm"); } public void setProtocolType(int protocolType) { @@ -144,12 +146,16 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_INDEX, Integer.parseInt(values[index++])); } - if (index < values.length) { - position.set(Position.KEY_HOURS, Integer.parseInt(values[index++])); - } + if (hbm) { + + if (index < values.length) { + position.set(Position.KEY_HOURS, Integer.parseInt(values[index++])); + } + + if (index < values.length) { + position.set(Position.KEY_BATTERY, Double.parseDouble(values[index])); + } - if (index < values.length) { - position.set(Position.KEY_BATTERY, Double.parseDouble(values[index])); } return position; |