mirror of
https://github.com/traccar/traccar.git
synced 2026-04-24 00:57:37 -04:00
Decode VL106 new message
This commit is contained in:
@@ -116,6 +116,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
public static final int MSG_ALARM = 0x95; // JC100
|
||||
public static final int MSG_PERIPHERAL = 0xF2; // VL842
|
||||
public static final int MSG_STATUS_3 = 0xA3; // GL21L
|
||||
public static final int MSG_GPS_LBS_8 = 0x38;
|
||||
|
||||
private enum Variant {
|
||||
VXT01,
|
||||
@@ -353,6 +354,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
}
|
||||
}
|
||||
|
||||
int cellType = type == MSG_GPS_LBS_8 ? buf.readUnsignedByte() : 0;
|
||||
int mcc = buf.readUnsignedShort();
|
||||
int mnc;
|
||||
if (BitUtil.check(mcc, 15) || type == MSG_GPS_LBS_6 || variant == Variant.SL4X) {
|
||||
@@ -361,19 +363,25 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
mnc = buf.readUnsignedByte();
|
||||
}
|
||||
int lac;
|
||||
if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7 || type == MSG_GPS_LBS_STATUS_5) {
|
||||
if (cellType >= 3 || type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7 || type == MSG_GPS_LBS_STATUS_5) {
|
||||
lac = buf.readInt();
|
||||
} else {
|
||||
lac = buf.readUnsignedShort();
|
||||
}
|
||||
long cid;
|
||||
if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7 || variant == Variant.SL4X || type == MSG_GPS_LBS_STATUS_5) {
|
||||
if (cellType >= 3 || type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7 || variant == Variant.SL4X
|
||||
|| type == MSG_GPS_LBS_STATUS_5) {
|
||||
cid = buf.readLong();
|
||||
} else if (type == MSG_GPS_LBS_6 || variant == Variant.SEEWORLD) {
|
||||
cid = buf.readUnsignedInt();
|
||||
} else {
|
||||
cid = buf.readUnsignedMedium();
|
||||
}
|
||||
if (cellType >= 3) {
|
||||
buf.readUnsignedShort(); // rssi
|
||||
} else if (type == MSG_GPS_LBS_8) {
|
||||
buf.readUnsignedByte(); // rssi
|
||||
}
|
||||
|
||||
position.setNetwork(new Network(CellTower.from(BitUtil.to(mcc, 15), mnc, lac, cid)));
|
||||
|
||||
@@ -1478,6 +1486,17 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
|
||||
|
||||
return position;
|
||||
|
||||
} else if (type == MSG_GPS_LBS_8) {
|
||||
|
||||
decodeGps(position, buf, false, deviceSession.get(DeviceSession.KEY_TIMEZONE));
|
||||
|
||||
buf.readUnsignedByte(); // data upload mode
|
||||
buf.readUnsignedByte(); // re-upload
|
||||
|
||||
decodeLbs(position, buf, type, false);
|
||||
|
||||
return position;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -17,6 +17,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
|
||||
verifyNull(decoder, binary(
|
||||
"78780D01086471700328358100093F040D0A"));
|
||||
|
||||
verifyPosition(decoder, binary(
|
||||
"7979003e3819050e0e0c26c5010fd98e0905f53000ccab0e000302c80100000c240000000000048b08001b002e04000015c4003b020000003c0401020001021f60220d0a"));
|
||||
|
||||
verifyAttributes(decoder, binary(
|
||||
"78780ca346000106640c01123d5f5e0d0a"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user