aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-11-11 20:44:24 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-11-11 20:44:24 -0800
commitee709450564299831dc90e648f6f11bb9e19b6d0 (patch)
tree82ba563e834b11716fbd739a6cbba2401066f819 /src/main/java/org
parent113f9a7a1295eb84174c40cb7f4bed61bdec2423 (diff)
downloadtraccar-server-ee709450564299831dc90e648f6f11bb9e19b6d0.tar.gz
traccar-server-ee709450564299831dc90e648f6f11bb9e19b6d0.tar.bz2
traccar-server-ee709450564299831dc90e648f6f11bb9e19b6d0.zip
Support new GT06 variation
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index 45218aba2..0dcdab892 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -56,7 +56,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_LOGIN = 0x01;
public static final int MSG_GPS = 0x10;
- public static final int MSG_LBS = 0x11;
+ public static final int MSG_GPS_LBS_6 = 0x11;
public static final int MSG_GPS_LBS_1 = 0x12;
public static final int MSG_GPS_LBS_2 = 0x22;
public static final int MSG_GPS_LBS_3 = 0x37;
@@ -124,6 +124,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
case MSG_GPS_LBS_3:
case MSG_GPS_LBS_4:
case MSG_GPS_LBS_5:
+ case MSG_GPS_LBS_6:
case MSG_GPS_LBS_STATUS_1:
case MSG_GPS_LBS_STATUS_2:
case MSG_GPS_LBS_STATUS_3:
@@ -141,13 +142,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
private static boolean hasLbs(int type) {
switch (type) {
- case MSG_LBS:
case MSG_LBS_STATUS:
case MSG_GPS_LBS_1:
case MSG_GPS_LBS_2:
case MSG_GPS_LBS_3:
case MSG_GPS_LBS_4:
case MSG_GPS_LBS_5:
+ case MSG_GPS_LBS_6:
case MSG_GPS_LBS_STATUS_1:
case MSG_GPS_LBS_STATUS_2:
case MSG_GPS_LBS_STATUS_3:
@@ -275,7 +276,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
return true;
}
- private boolean decodeLbs(Position position, ByteBuf buf, boolean hasLength) {
+ private boolean decodeLbs(Position position, ByteBuf buf, int type, boolean hasLength) {
int length = 0;
if (hasLength) {
@@ -296,10 +297,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
int mcc = buf.readUnsignedShort();
- int mnc = BitUtil.check(mcc, 15) ? buf.readUnsignedShort() : buf.readUnsignedByte();
+ int mnc = BitUtil.check(mcc, 15) || type == MSG_GPS_LBS_6 ? buf.readUnsignedShort() : buf.readUnsignedByte();
+ int lac = buf.readUnsignedShort();
+ long cid = type == MSG_GPS_LBS_6 ? buf.readUnsignedInt() : buf.readUnsignedMedium();
- position.setNetwork(new Network(CellTower.from(
- BitUtil.to(mcc, 15), mnc, buf.readUnsignedShort(), buf.readUnsignedMedium())));
+ position.setNetwork(new Network(CellTower.from(BitUtil.to(mcc, 15), mnc, lac, cid)));
if (length > 9) {
buf.skipBytes(length - 9);
@@ -885,7 +887,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
if (hasLbs(type)) {
- decodeLbs(position, buf, hasStatus(type));
+ decodeLbs(position, buf, type, hasStatus(type));
}
if (hasStatus(type)) {
@@ -1053,7 +1055,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, position.getDeviceTime());
}
- if (decodeLbs(position, buf, true)) {
+ if (decodeLbs(position, buf, type, true)) {
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
}