From c53feac38ec149fed84121704c620503bf1f7820 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 17 Mar 2017 22:59:49 +1300 Subject: Add Suntech HBM flag --- src/org/traccar/protocol/SuntechProtocolDecoder.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/org/traccar') 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; -- cgit v1.2.3