diff options
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index 4beee7696..d3c312f7e 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -41,6 +41,7 @@ import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.TimeZone; +import java.util.stream.Collectors; public class HuabaoProtocolDecoder extends BaseProtocolDecoder { @@ -919,14 +920,19 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { position.setTime(time); break; case 0x02: - count = buf.readUnsignedByte(); + List<String> codes = new LinkedList<>(); + count = buf.readUnsignedShort(); for (int i = 0; i < count; i++) { buf.readUnsignedInt(); // system id int codeCount = buf.readUnsignedShort(); for (int j = 0; j < codeCount; j++) { - buf.skipBytes(16); // code + buf.readUnsignedInt(); // dtc + buf.readUnsignedInt(); // status + codes.add(buf.readCharSequence( + buf.readUnsignedShort(), StandardCharsets.US_ASCII).toString().trim()); } } + position.set(Position.KEY_DTCS, String.join(" ", codes)); getLastLocation(position, time); decodeCoordinates(position, buf); position.setTime(time); |