aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-07 17:28:49 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-07 17:28:49 -0700
commit30d920c2e49c4022af8590c7d200907cde16d1c9 (patch)
tree7e8157b8b5709a0a8c056907e123e7266fd41e86 /src/main
parent09eebb35449c4ffb43b6a72bb4c3f723ec1c84be (diff)
downloadtrackermap-server-30d920c2e49c4022af8590c7d200907cde16d1c9.tar.gz
trackermap-server-30d920c2e49c4022af8590c7d200907cde16d1c9.tar.bz2
trackermap-server-30d920c2e49c4022af8590c7d200907cde16d1c9.zip
Decode Concox CRX1 serial
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java15
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;
}