aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-11-24 20:18:13 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-11-24 20:18:13 +1300
commit80d858b847cba10197ff64ffeaba8293e7a1276a (patch)
treeb8ecceb76beeb8866ba3f5f3f97461369d3be57a
parent26a22bfb11e7e71ce06628ee397eb06b2a66d231 (diff)
downloadtrackermap-server-80d858b847cba10197ff64ffeaba8293e7a1276a.tar.gz
trackermap-server-80d858b847cba10197ff64ffeaba8293e7a1276a.tar.bz2
trackermap-server-80d858b847cba10197ff64ffeaba8293e7a1276a.zip
Support GT06 ICCID decoding
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java11
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java3
2 files changed, 8 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 3bbc09e2a..9431af030 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -739,23 +739,22 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, null);
if (subType == 0x00) {
-
position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
return position;
-
} else if (subType == 0x05) {
-
int flags = buf.readUnsignedByte();
position.set(Position.KEY_DOOR, BitUtil.check(flags, 0));
position.set(Position.PREFIX_IO + 1, BitUtil.check(flags, 2));
return position;
-
+ } else if (subType == 0x0a) {
+ buf.skipBytes(8); // imei
+ buf.skipBytes(8); // imsi
+ position.set("iccid", ByteBufUtil.hexDump(buf.readSlice(8)));
+ return position;
} else if (subType == 0x0d) {
-
buf.skipBytes(6);
return decodeFuelData(position, buf.toString(
buf.readerIndex(), buf.readableBytes() - 4 - 2, StandardCharsets.US_ASCII));
-
}
} else if (type == MSG_X1_PHOTO_DATA) {
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index 44b4e8a8d..a7702b9cb 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -17,6 +17,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780D01086471700328358100093F040D0A"));
verifyPosition(decoder, binary(
+ "79790020940A035985708053908307060104900402788950301217070401538F0003E8210D0A"));
+
+ verifyPosition(decoder, binary(
"78783c3439000000120a0902093a07031f9e690529be2e00155500000016214901a30308b70000b3fb004aa82b059401a3422100000001000000007d9370b90d0a"));
verifyAttributes(decoder, binary(