diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-11-04 22:18:05 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-11-04 22:18:05 -0800 |
commit | 42af749b78de2d83a3b8ccba6974c8a8c990f77e (patch) | |
tree | 57ad768c29b04e90049111d685f1f32a24d8fb32 /src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | |
parent | 67e287767cf7935f640085314e8fa7569dc0b2ae (diff) | |
download | trackermap-server-42af749b78de2d83a3b8ccba6974c8a8c990f77e.tar.gz trackermap-server-42af749b78de2d83a3b8ccba6974c8a8c990f77e.tar.bz2 trackermap-server-42af749b78de2d83a3b8ccba6974c8a8c990f77e.zip |
Support Carscop CCTR-830G-4G
Diffstat (limited to 'src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java')
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index b9b156f93..6d57c3339 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -249,7 +249,21 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { .setSecond(BcdUtil.readInteger(buf, 2)); position.setTime(dateBuilder.getDate()); + if (buf.readableBytes() == 20) { + + buf.skipBytes(4); // remaining battery and mileage + position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000); + position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.1); + buf.readUnsignedInt(); // area id + position.set(Position.KEY_RSSI, buf.readUnsignedByte()); + buf.skipBytes(3); // reserved + + return position; + + } + while (buf.readableBytes() > 2) { + int subtype = buf.readUnsignedByte(); int length = buf.readUnsignedByte(); int endIndex = buf.readerIndex() + length; |