From 6f569b6d62b110c2679772c4a56122db6a614ed9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 20 Jun 2017 06:32:59 +1200 Subject: Support Aplicom E driver info --- src/org/traccar/protocol/AplicomProtocolDecoder.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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) { -- cgit v1.2.3