diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-08-18 20:42:37 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-08-18 20:42:37 -0700 |
commit | 4f0e955b7bfec804dd64ded8c3801bbc9f9a3445 (patch) | |
tree | 8d0e62e0baaac0474e22cc08d5ee1a1bbae005b9 /src/main/java/org/traccar | |
parent | 685eaa95a6633fc840bae47a7ced290f37dbd4fb (diff) | |
download | trackermap-server-4f0e955b7bfec804dd64ded8c3801bbc9f9a3445.tar.gz trackermap-server-4f0e955b7bfec804dd64ded8c3801bbc9f9a3445.tar.bz2 trackermap-server-4f0e955b7bfec804dd64ded8c3801bbc9f9a3445.zip |
Additional Xirgo attributes
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/Xt2400ProtocolDecoder.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/Xt2400ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Xt2400ProtocolDecoder.java index 819011a50..c132f194b 100644 --- a/src/main/java/org/traccar/protocol/Xt2400ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Xt2400ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,7 +59,7 @@ public class Xt2400ProtocolDecoder extends BaseProtocolDecoder { 0x26, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x57, 0x58, 0x59, 0x5a, 0x6b, 0x6f, 0x7A, 0x7B, 0x7C, 0x7d, 0x7E, 0x7F, 0x80, 0x81, 0x82, - 0x83, 0x84, 0x85, 0x86 + 0x83, 0x84, 0x85, 0x86, 0xc8 }; int[] l4 = { 0x03, 0x06, 0x07, 0x08, 0x0e, 0x0f, 0x10, 0x11, @@ -80,12 +80,13 @@ public class Xt2400ProtocolDecoder extends BaseProtocolDecoder { TAG_LENGTH_MAP.put(i, 4); } TAG_LENGTH_MAP.put(0x95, 24); + TAG_LENGTH_MAP.put(0xD0, 21); } private static int getTagLength(int tag) { Integer length = TAG_LENGTH_MAP.get(tag); if (length == null) { - throw new IllegalArgumentException("Unknown tag: " + tag); + throw new IllegalArgumentException(String.format("Unknown tag: 0x%02X", tag)); } return length; } @@ -93,7 +94,7 @@ public class Xt2400ProtocolDecoder extends BaseProtocolDecoder { private Map<Short, byte[]> formats = new HashMap<>(); public void setConfig(String configString) { - Pattern pattern = Pattern.compile(":wycfg pcr\\[\\d+\\] ([0-9a-fA-F]{2})[0-9a-fA-F]{2}([0-9a-fA-F]+)"); + Pattern pattern = Pattern.compile(":wycfg pcr\\[\\d+] ([0-9a-fA-F]{2})[0-9a-fA-F]{2}([0-9a-fA-F]+)"); Matcher matcher = pattern.matcher(configString); while (matcher.find()) { formats.put(Short.parseShort(matcher.group(1), 16), DataConverter.parseHex(matcher.group(2))); @@ -119,7 +120,8 @@ public class Xt2400ProtocolDecoder extends BaseProtocolDecoder { Position position = new Position(getProtocolName()); - for (byte tag : format) { + for (byte b : format) { + int tag = b & 0xFF; switch (tag) { case 0x03: DeviceSession deviceSession = getDeviceSession( @@ -177,6 +179,14 @@ public class Xt2400ProtocolDecoder extends BaseProtocolDecoder { case 0x65: position.set(Position.KEY_VIN, buf.readSlice(17).toString(StandardCharsets.US_ASCII)); break; + case 0x6C: + buf.readUnsignedByte(); // mil + int ecuCount = buf.readUnsignedByte(); + for (int i = 0; i < ecuCount; i++) { + buf.readUnsignedByte(); // ecu id + buf.skipBytes(buf.readUnsignedByte() * 6); + } + break; case 0x73: position.set(Position.KEY_VERSION_FW, buf.readSlice(16).toString(StandardCharsets.US_ASCII).trim()); break; |