diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-07 17:28:49 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-07 17:28:49 -0700 |
commit | 30d920c2e49c4022af8590c7d200907cde16d1c9 (patch) | |
tree | 7e8157b8b5709a0a8c056907e123e7266fd41e86 /src/main/java | |
parent | 09eebb35449c4ffb43b6a72bb4c3f723ec1c84be (diff) | |
download | trackermap-server-30d920c2e49c4022af8590c7d200907cde16d1c9.tar.gz trackermap-server-30d920c2e49c4022af8590c7d200907cde16d1c9.tar.bz2 trackermap-server-30d920c2e49c4022af8590c7d200907cde16d1c9.zip |
Decode Concox CRX1 serial
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index c53fbfe5a..63210b2fa 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -1004,11 +1004,16 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { } else if (subType == 0x1b) { - buf.readUnsignedByte(); // header - buf.readUnsignedByte(); // type - position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(4))); - buf.readUnsignedByte(); // checksum - buf.readUnsignedByte(); // footer + if (Character.isLetter(buf.getUnsignedByte(buf.readerIndex()))) { + String data = buf.readCharSequence(buf.readableBytes() - 6, StandardCharsets.US_ASCII).toString(); + position.set("serial", data.trim()); + } else { + buf.readUnsignedByte(); // header + buf.readUnsignedByte(); // type + position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(4))); + buf.readUnsignedByte(); // checksum + buf.readUnsignedByte(); // footer + } return position; } |