aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-05-16 09:27:41 -0700
committerAnton Tananaev <anton@traccar.org>2023-05-16 09:27:52 -0700
commitb2e889abf0850aa568353f923a3b3f35008a063e (patch)
tree2bee38c35a49ab9f7ae19fa4fa64f33669bee40d /src/main/java
parentb606268baa36185a180f9e8d7a096bceebcf4d4a (diff)
downloadtrackermap-server-b2e889abf0850aa568353f923a3b3f35008a063e.tar.gz
trackermap-server-b2e889abf0850aa568353f923a3b3f35008a063e.tar.bz2
trackermap-server-b2e889abf0850aa568353f923a3b3f35008a063e.zip
Decode VL502 DTCs
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java10
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);