aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/SuntechProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-17 22:59:49 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-03-17 22:59:49 +1300
commitc53feac38ec149fed84121704c620503bf1f7820 (patch)
tree4e39998168196afe3250b40870efd44c632559a8 /src/org/traccar/protocol/SuntechProtocolDecoder.java
parent8b46b34fb3e2c2635208f0cb427d45182c3fecc4 (diff)
downloadtrackermap-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.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;