aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-01-26 21:42:03 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-01-26 21:42:03 -0800
commit25bdd38bb7fb6afa1eb32a9108ed37f13d6079b6 (patch)
treee7ffa3371b8c222378d59c207652ed728ae81f4e /src/main/java/org
parent050941422cc6fe9581ac87f8cbd7196ed304ede8 (diff)
downloadtraccar-server-25bdd38bb7fb6afa1eb32a9108ed37f13d6079b6.tar.gz
traccar-server-25bdd38bb7fb6afa1eb32a9108ed37f13d6079b6.tar.bz2
traccar-server-25bdd38bb7fb6afa1eb32a9108ed37f13d6079b6.zip
Decode ICCID result
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index 755cfe33e..c5e8809e3 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2021 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.
@@ -719,9 +719,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
int commandLength = buf.readUnsignedByte();
if (commandLength > 0) {
- buf.readUnsignedByte(); // server flag (reserved)
- position.set(Position.KEY_RESULT,
- buf.readSlice(commandLength - 1).toString(StandardCharsets.US_ASCII));
+ buf.readUnsignedInt(); // server flag (reserved)
+ String data = buf.readSlice(commandLength - 4).toString(StandardCharsets.US_ASCII);
+ if (data.startsWith("<ICCID:")) {
+ position.set(Position.KEY_ICCID, data.substring(7, 27));
+ } else {
+ position.set(Position.KEY_RESULT, data);
+ }
}
} else if (type == MSG_BMS || type == MSG_BMS_2) {