aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-11-24 10:26:45 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-11-24 10:26:45 -0800
commite3aceea851c2c2b234b56cbef38e6c16f33726a0 (patch)
tree7fbd9bd272d6a4124d5b6bb9cb48021e497a6312 /src/main
parentf1a283153c790434087a6b5011e7a50c78a5ad55 (diff)
downloadtrackermap-server-e3aceea851c2c2b234b56cbef38e6c16f33726a0.tar.gz
trackermap-server-e3aceea851c2c2b234b56cbef38e6c16f33726a0.tar.bz2
trackermap-server-e3aceea851c2c2b234b56cbef38e6c16f33726a0.zip
Decode battery voltage
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index a1987ee5a..342edb22b 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -215,6 +215,13 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
case 0x31:
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
break;
+ case 0x33:
+ String sentence = buf.readCharSequence(length, StandardCharsets.US_ASCII).toString();
+ if (sentence.startsWith("*M00")) {
+ String lockStatus = sentence.substring(8, 8 + 7);
+ position.set(Position.KEY_BATTERY, Integer.parseInt(lockStatus.substring(2, 5)) * 0.01);
+ }
+ break;
case 0x91:
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1);
position.set(Position.KEY_RPM, buf.readUnsignedShort());
@@ -245,6 +252,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1);
break;
default:
+ System.out.print(String.format("%02x ", subtype));
break;
}
buf.readerIndex(endIndex);