diff options
-rw-r--r-- | src/org/traccar/protocol/AplicomProtocolDecoder.java | 13 | ||||
-rw-r--r-- | test/org/traccar/protocol/AplicomProtocolDecoderTest.java | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 03d7dbd6b..eb8d77011 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -350,6 +350,19 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { if ((selector & 0x0800) != 0) { position.set(Position.KEY_VIN, buf.readBytes(18).toString(StandardCharsets.US_ASCII).trim()); } + + if ((selector & 0x10000) != 0) { + int count = buf.readUnsignedByte(); + for (int i = 1; i <= count; i++) { + ChannelBuffer driver = buf.readBytes(22); + int endIndex = driver.indexOf(0, driver.writerIndex(), (byte) 0); + if (endIndex < 0) { + endIndex = driver.writerIndex(); + } + position.set("driver" + i, driver.toString(0, endIndex, StandardCharsets.US_ASCII).trim()); + position.set("driverTime" + i, buf.readUnsignedInt()); + } + } } private void decodeH(Position position, ChannelBuffer buf, int selector) { diff --git a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java index 70e4e3e36..3c71e86b3 100644 --- a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class AplicomProtocolDecoderTest extends ProtocolTest { AplicomProtocolDecoder decoder = new AplicomProtocolDecoder(new AplicomProtocol());
verifyAttributes(decoder, binary(
+ "45c20144f667c07287008c01ffff6d01000059368963d0340a0616207d7f4b10c0c019e6000039d7000039d71f40ffff5001574442393036363035533132333435363700014142432d33343520202020202000011231303331373139343039303030303031000000000000000000000000000000000000000000000000000001011231303331373139343039303030303031000000000000005a"));
+
+ verifyAttributes(decoder, binary(
"46c30144f667c1711f00340007ff750058b8f77701037c06b8000000330033000000000b760000425e0100640000b3a90185d5823155000131070204000219641004"));
verifyAttributes(decoder, binary(
|