diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-20 06:32:59 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-20 06:32:59 +1200 |
commit | 6f569b6d62b110c2679772c4a56122db6a614ed9 (patch) | |
tree | 7bb933ecbb8b3c31574b1ff2b9ddda0e8871f98b | |
parent | 8ab0f580a24851454ec4a763d81363cc968c78a1 (diff) | |
download | trackermap-server-6f569b6d62b110c2679772c4a56122db6a614ed9.tar.gz trackermap-server-6f569b6d62b110c2679772c4a56122db6a614ed9.tar.bz2 trackermap-server-6f569b6d62b110c2679772c4a56122db6a614ed9.zip |
Support Aplicom E driver info
-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(
|