aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-11-28 21:49:13 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-11-28 21:49:13 -0800
commit542e70a1d4aca4fa3260b86993a1b3558d81e508 (patch)
tree4ecb381633d5f847b14c6b1bd26817b0a18d990c /src
parent091bbdebf7e8fc0e4e8623141bb25b6ceb18371a (diff)
downloadtraccar-server-542e70a1d4aca4fa3260b86993a1b3558d81e508.tar.gz
traccar-server-542e70a1d4aca4fa3260b86993a1b3558d81e508.tar.bz2
traccar-server-542e70a1d4aca4fa3260b86993a1b3558d81e508.zip
Support fault codes
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java4
2 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 af8c5ba09..297f26f51 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -322,6 +322,10 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
case 0x8E:
position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte());
break;
+ case 0xA0:
+ String codes = buf.readCharSequence(length, StandardCharsets.US_ASCII).toString();
+ position.set(Position.KEY_DTCS, codes.replace(',', ' '));
+ break;
case 0xCC:
position.set(Position.KEY_ICCID, buf.readCharSequence(20, StandardCharsets.US_ASCII).toString());
break;
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index 63ac0ce16..238799fac 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -14,6 +14,10 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"7E01000021013345678906000F002C012F373031313142534A2D4D3742203030303030303001D4C1423838383838B47E"));
+ verifyAttribute(decoder, binary(
+ "7e0200008e01917159043700b300000000800000030158990606ca0fd7000400000000211129111705010400000000cc14383938363037423831303230393031363239363830010d8001aa81021388820200858301148401aa8502189b8601338702007e8801338901148a0200998b1131323334353637383941424344454647488c04000200a88d0200828e0114a00b50353338662c5530323966037e"),
+ Position.KEY_DTCS, "P538f U029f");
+
verifyPosition(decoder, binary(
"7E020000830191715904370A2E00000000800000030158991806CA0FEB00040000010D211108194050010400000003CC14383938363034373831303230373033313836303830011A8001AA810213888202007A8301148401AA8502189B8601338702007D028801338901148A0200998B1131323334353637383941424344454647488C04000200A88D0200828E0114A0002E7E"));