aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/SuntechProtocolDecoder.java16
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;