From b2e889abf0850aa568353f923a3b3f35008a063e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 16 May 2023 09:27:41 -0700 Subject: Decode VL502 DTCs --- src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/java/org') 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 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); -- cgit v1.2.3