aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-08-03 20:52:00 -0600
committerIván Ávalos <avalos@disroot.org>2024-08-03 20:52:00 -0600
commit55f6d92c09a5b1d8566b53633d07be3d31010d3b (patch)
treeb86bed801b0bbadb72c7e839296dae1d28b12bbb /src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
parentc04ad7d48331253c095fc123ded1b00f6ff871d3 (diff)
parent2788174193def918a3a1a5be3bbed24c9613323f (diff)
downloadtrackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.gz
trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.tar.bz2
trackermap-server-55f6d92c09a5b1d8566b53633d07be3d31010d3b.zip
Merge tag 'tags/v6.3'
Diffstat (limited to 'src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java323
1 files changed, 146 insertions, 177 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index a1a9c3773..e25499190 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -65,6 +65,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_STRING = 0x15;
public static final int MSG_GPS_LBS_STATUS_1 = 0x16;
public static final int MSG_WIFI = 0x17;
+ public static final int MSG_GPS_LBS_RFID = 0x17;
public static final int MSG_GPS_LBS_STATUS_2 = 0x26;
public static final int MSG_GPS_LBS_STATUS_3 = 0x27;
public static final int MSG_LBS_MULTIPLE_1 = 0x28;
@@ -87,6 +88,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_X1_GPS = 0x34;
public static final int MSG_X1_PHOTO_INFO = 0x35;
public static final int MSG_X1_PHOTO_DATA = 0x36;
+ public static final int MSG_STATUS_2 = 0x36; // Jimi IoT 4G
public static final int MSG_WIFI_2 = 0x69;
public static final int MSG_GPS_MODULAR = 0x70;
public static final int MSG_WIFI_4 = 0xF3;
@@ -100,6 +102,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
public static final int MSG_GPS_LBS_7 = 0xA0; // GK310 & JM-VL03
public static final int MSG_LBS_2 = 0xA1; // GK310
public static final int MSG_WIFI_3 = 0xA2; // GK310
+ public static final int MSG_GPS_LBS_STATUS_5 = 0xA2; // LWxG
public static final int MSG_FENCE_SINGLE = 0xA3; // GK310
public static final int MSG_FENCE_MULTI = 0xA4; // GK310 & JM-LL301
public static final int MSG_LBS_ALARM = 0xA5; // GK310 & JM-LL301
@@ -125,6 +128,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
JC400,
SL4X,
SEEWORLD,
+ RFID,
+ LW4G,
}
private Variant variant;
@@ -172,9 +177,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
case MSG_GPS_LBS_STATUS_2:
case MSG_GPS_LBS_STATUS_3:
case MSG_GPS_LBS_STATUS_4:
+ case MSG_GPS_LBS_STATUS_5:
case MSG_GPS_PHONE:
case MSG_GPS_LBS_EXTEND:
case MSG_GPS_LBS_7:
+ case MSG_GPS_LBS_RFID:
case MSG_FENCE_SINGLE:
case MSG_FENCE_MULTI:
return true;
@@ -196,7 +203,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
case MSG_GPS_LBS_STATUS_2:
case MSG_GPS_LBS_STATUS_3:
case MSG_GPS_LBS_STATUS_4:
+ case MSG_GPS_LBS_STATUS_5:
case MSG_GPS_LBS_7:
+ case MSG_GPS_LBS_RFID:
case MSG_FENCE_SINGLE:
case MSG_FENCE_MULTI:
case MSG_LBS_ALARM:
@@ -210,11 +219,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
private static boolean hasStatus(int type) {
switch (type) {
case MSG_STATUS:
+ case MSG_STATUS_2:
case MSG_LBS_STATUS:
case MSG_GPS_LBS_STATUS_1:
case MSG_GPS_LBS_STATUS_2:
case MSG_GPS_LBS_STATUS_3:
case MSG_GPS_LBS_STATUS_4:
+ case MSG_GPS_LBS_STATUS_5:
case MSG_FENCE_MULTI:
case MSG_LBS_ALARM:
return true;
@@ -350,13 +361,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
mnc = buf.readUnsignedByte();
}
int lac;
- if (type == MSG_LBS_ALARM || type == MSG_GPS_LBS_7) {
+ if (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) {
+ if (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();
@@ -412,54 +423,27 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
private String decodeAlarm(short value, String model) {
boolean modelLW = model != null && model.toUpperCase().startsWith("LW");
- switch (value) {
- case 0x01:
- return Position.ALARM_SOS;
- case 0x02:
- return Position.ALARM_POWER_CUT;
- case 0x03:
- case 0x09:
- return Position.ALARM_VIBRATION;
- case 0x04:
- return Position.ALARM_GEOFENCE_ENTER;
- case 0x05:
- return Position.ALARM_GEOFENCE_EXIT;
- case 0x06:
- return Position.ALARM_OVERSPEED;
- case 0x0E:
- case 0x0F:
- return Position.ALARM_LOW_BATTERY;
- case 0x11:
- return Position.ALARM_POWER_OFF;
- case 0x0C:
- case 0x13:
- case 0x25:
- return Position.ALARM_TAMPERING;
- case 0x14:
- return Position.ALARM_DOOR;
- case 0x18:
- return modelLW ? Position.ALARM_ACCIDENT : Position.ALARM_REMOVING;
- case 0x19:
- return modelLW ? Position.ALARM_ACCELERATION : Position.ALARM_LOW_BATTERY;
- case 0x1A:
- case 0x28:
- return Position.ALARM_BRAKING;
- case 0x1B:
- case 0x2A:
- case 0x2B:
- case 0x2E:
- return Position.ALARM_CORNERING;
- case 0x23:
- return Position.ALARM_FALL_DOWN;
- case 0x29:
- return Position.ALARM_ACCELERATION;
- case 0x2C:
- return Position.ALARM_ACCIDENT;
- case 0x30:
- return Position.ALARM_JAMMING;
- default:
- return null;
- }
+ return switch (value) {
+ case 0x01 -> Position.ALARM_SOS;
+ case 0x02 -> Position.ALARM_POWER_CUT;
+ case 0x03, 0x09 -> Position.ALARM_VIBRATION;
+ case 0x04 -> Position.ALARM_GEOFENCE_ENTER;
+ case 0x05 -> Position.ALARM_GEOFENCE_EXIT;
+ case 0x06 -> Position.ALARM_OVERSPEED;
+ case 0x0E, 0x0F -> Position.ALARM_LOW_BATTERY;
+ case 0x11 -> Position.ALARM_POWER_OFF;
+ case 0x0C, 0x13, 0x25 -> Position.ALARM_TAMPERING;
+ case 0x14 -> Position.ALARM_DOOR;
+ case 0x18 -> modelLW ? Position.ALARM_ACCIDENT : Position.ALARM_REMOVING;
+ case 0x19 -> modelLW ? Position.ALARM_ACCELERATION : Position.ALARM_LOW_BATTERY;
+ case 0x1A, 0x28 -> Position.ALARM_BRAKING;
+ case 0x1B, 0x2A, 0x2B, 0x2E -> Position.ALARM_CORNERING;
+ case 0x23 -> Position.ALARM_FALL_DOWN;
+ case 0x29 -> Position.ALARM_ACCELERATION;
+ case 0x2C -> Position.ALARM_ACCIDENT;
+ case 0x30 -> Position.ALARM_JAMMING;
+ default -> null;
+ };
}
private Object decodeBasic(Channel channel, SocketAddress remoteAddress, ByteBuf buf) {
@@ -602,7 +586,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
return null;
- } else if (type == MSG_WIFI || type == MSG_WIFI_2 || type == MSG_WIFI_4) {
+ } else if ((type == MSG_WIFI && variant != Variant.RFID) || type == MSG_WIFI_2 || type == MSG_WIFI_4) {
ByteBuf time = buf.readSlice(6);
DateBuilder dateBuilder = new DateBuilder()
@@ -686,7 +670,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
} else if (type == MSG_LBS_MULTIPLE_1 || type == MSG_LBS_MULTIPLE_2 || type == MSG_LBS_MULTIPLE_3
|| type == MSG_LBS_EXTEND || type == MSG_LBS_WIFI || type == MSG_LBS_2 || type == MSG_LBS_3
- || type == MSG_WIFI_3 || type == MSG_WIFI_5) {
+ || (type == MSG_WIFI_3 && variant != Variant.LW4G) || type == MSG_WIFI_5) {
DateBuilder dateBuilder = new DateBuilder((TimeZone) deviceSession.get(DeviceSession.KEY_TIMEZONE))
.setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte())
@@ -824,11 +808,15 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
boolean hasLength = hasStatus(type)
&& type != MSG_LBS_STATUS
&& type != MSG_LBS_ALARM
- && (type != MSG_GPS_LBS_STATUS_1 || variant != Variant.VXT01);
+ && (type != MSG_GPS_LBS_STATUS_1 || variant != Variant.VXT01)
+ && type != MSG_GPS_LBS_STATUS_5;
decodeLbs(position, buf, type, hasLength);
}
if (hasStatus(type)) {
+ if (type == MSG_GPS_LBS_STATUS_5) {
+ buf.readUnsignedByte(); // network indicator
+ }
decodeStatus(position, buf);
if (variant == Variant.OBD6) {
int signal = buf.readUnsignedShort();
@@ -842,8 +830,15 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // working mode
position.set(Position.KEY_POWER, buf.readUnsignedShort() / 100.0);
} else {
+ if (type == MSG_GPS_LBS_STATUS_5) {
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+ }
int battery = buf.readUnsignedByte();
- position.set(Position.KEY_BATTERY_LEVEL, battery <= 6 ? battery * 100 / 6 : battery);
+ if (battery <= 6) {
+ position.set(Position.KEY_BATTERY_LEVEL, battery * 100 / 6);
+ } else if (battery <= 100) {
+ position.set(Position.KEY_BATTERY_LEVEL, battery);
+ }
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
short alarmExtension = buf.readUnsignedByte();
if (variant != Variant.VXT01) {
@@ -852,6 +847,28 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
}
+ if (type == MSG_STATUS_2) {
+ buf.readUnsignedByte(); // language
+ while (buf.readableBytes() > 6) {
+ int moduleType = buf.readUnsignedShort();
+ int moduleLength = buf.readUnsignedByte();
+ switch (moduleType) {
+ case 0x0018 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() / 100.0);
+ case 0x0032 -> position.set("startupStatus", buf.readUnsignedByte());
+ case 0x006A -> position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
+ default -> buf.skipBytes(moduleLength);
+ }
+ }
+ }
+
+ if (type == MSG_GPS_LBS_STATUS_5) {
+ buf.readUnsignedByte(); // language
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
+ position.set(Position.KEY_HOURS, buf.readUnsignedInt() * 1000);
+ buf.skipBytes(8); // terminal id
+ position.set(Position.KEY_INPUT, buf.readUnsignedShort());
+ }
+
if (type == MSG_GPS_LBS_1) {
if (variant == Variant.GT06E_CARD) {
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
@@ -919,32 +936,39 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.set("humidity", buf.readUnsignedShort() * 0.01);
}
- if ((type == MSG_GPS_LBS_2 || type == MSG_GPS_LBS_3 || type == MSG_GPS_LBS_4)
+ if (type == MSG_GPS_LBS_STATUS_4 && variant == Variant.SL4X) {
+ position.setAltitude(buf.readShort());
+ }
+
+ if ((type == MSG_GPS_LBS_2 || type == MSG_GPS_LBS_3 || type == MSG_GPS_LBS_4 || type == MSG_GPS_LBS_5)
&& buf.readableBytes() >= 3 + 6) {
position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0);
position.set(Position.KEY_EVENT, buf.readUnsignedByte()); // reason
position.set(Position.KEY_ARCHIVE, buf.readUnsignedByte() > 0);
+ if (variant == Variant.SL4X) {
+ if (buf.readableBytes() > 2 + 6) {
+ position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
+ }
+ position.setAltitude(buf.readShort());
+ }
}
if (type == MSG_GPS_LBS_3) {
int module = buf.readUnsignedShort();
int subLength = buf.readUnsignedByte();
switch (module) {
- case 0x0027:
- position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
- break;
- case 0x002E:
- position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
- break;
- case 0x003B:
- position.setAccuracy(buf.readUnsignedShort() * 0.01);
- break;
- default:
- buf.skipBytes(subLength);
- break;
+ case 0x0027 -> position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+ case 0x002E -> position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
+ case 0x003B -> position.setAccuracy(buf.readUnsignedShort() * 0.01);
+ default -> buf.skipBytes(subLength);
}
}
+ if (type == MSG_GPS_LBS_RFID) {
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, ByteBufUtil.hexDump(buf.readSlice(8)));
+ buf.readUnsignedByte(); // validity
+ }
+
if (buf.readableBytes() == 3 + 6 || buf.readableBytes() == 3 + 4 + 6) {
position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0);
buf.readUnsignedByte(); // upload mode
@@ -979,38 +1003,17 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
short event = buf.readUnsignedByte();
position.set(Position.KEY_EVENT, event);
switch (event) {
- case 0x01:
- position.set(Position.KEY_ALARM, extendedAlarm ? Position.ALARM_SOS : Position.ALARM_GENERAL);
- break;
- case 0x0E:
- position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER);
- break;
- case 0x76:
- position.set(Position.KEY_ALARM, Position.ALARM_TEMPERATURE);
- break;
- case 0x80:
- position.set(Position.KEY_ALARM, Position.ALARM_VIBRATION);
- break;
- case 0x87:
- position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
- break;
- case 0x88:
- position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT);
- break;
- case 0x90:
- position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION);
- break;
- case 0x91:
- position.set(Position.KEY_ALARM, Position.ALARM_BRAKING);
- break;
- case 0x92:
- position.set(Position.KEY_ALARM, Position.ALARM_CORNERING);
- break;
- case 0x93:
- position.set(Position.KEY_ALARM, Position.ALARM_ACCIDENT);
- break;
- default:
- break;
+ case 0x01 -> position.set(
+ Position.KEY_ALARM, extendedAlarm ? Position.ALARM_SOS : Position.ALARM_GENERAL);
+ case 0x0E -> position.set(Position.KEY_ALARM, Position.ALARM_LOW_POWER);
+ case 0x76 -> position.set(Position.KEY_ALARM, Position.ALARM_TEMPERATURE);
+ case 0x80 -> position.set(Position.KEY_ALARM, Position.ALARM_VIBRATION);
+ case 0x87 -> position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED);
+ case 0x88 -> position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT);
+ case 0x90 -> position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION);
+ case 0x91 -> position.set(Position.KEY_ALARM, Position.ALARM_BRAKING);
+ case 0x92 -> position.set(Position.KEY_ALARM, Position.ALARM_CORNERING);
+ case 0x93 -> position.set(Position.KEY_ALARM, Position.ALARM_ACCIDENT);
}
} else {
@@ -1136,6 +1139,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_ICCID, ByteBufUtil.hexDump(buf.readSlice(10)).replaceAll("f", ""));
return position;
+ } else if (subType == 0x0b) {
+
+ position.set("networkTechnology", buf.readByte() > 0 ? "4G" : "2G");
+ return position;
+
} else if (subType == 0x0d) {
if (buf.getByte(buf.readerIndex()) != '!') {
@@ -1203,24 +1211,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_AZ735_ALARM) {
switch (status) {
- case 0xA0:
- position.set(Position.KEY_ARMED, true);
- break;
- case 0xA1:
- position.set(Position.KEY_ARMED, false);
- break;
- case 0xA2:
- case 0xA3:
- position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
- break;
- case 0xA4:
- position.set(Position.KEY_ALARM, Position.ALARM_GENERAL);
- break;
- case 0xA5:
- position.set(Position.KEY_ALARM, Position.ALARM_DOOR);
- break;
- default:
- break;
+ case 0xA0 -> position.set(Position.KEY_ARMED, true);
+ case 0xA1 -> position.set(Position.KEY_ARMED, false);
+ case 0xA2, 0xA3 -> position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY);
+ case 0xA4 -> position.set(Position.KEY_ALARM, Position.ALARM_GENERAL);
+ case 0xA5 -> position.set(Position.KEY_ALARM, Position.ALARM_DOOR);
}
}
@@ -1245,32 +1240,14 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
String[] values = pair.split("=");
if (values.length >= 2) {
switch (Integer.parseInt(values[0].substring(0, 2), 16)) {
- case 40:
- position.set(Position.KEY_ODOMETER, Integer.parseInt(values[1], 16) * 0.01);
- break;
- case 43:
- position.set(Position.KEY_FUEL_LEVEL, Integer.parseInt(values[1], 16) * 0.01);
- break;
- case 45:
- position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(values[1], 16) * 0.01);
- break;
- case 53:
- position.set(Position.KEY_OBD_SPEED, Integer.parseInt(values[1], 16) * 0.01);
- break;
- case 54:
- position.set(Position.KEY_RPM, Integer.parseInt(values[1], 16) * 0.01);
- break;
- case 71:
- position.set(Position.KEY_FUEL_USED, Integer.parseInt(values[1], 16) * 0.01);
- break;
- case 73:
- position.set(Position.KEY_HOURS, Integer.parseInt(values[1], 16) * 0.01);
- break;
- case 74:
- position.set(Position.KEY_VIN, values[1]);
- break;
- default:
- break;
+ case 40 -> position.set(Position.KEY_ODOMETER, Integer.parseInt(values[1], 16) * 0.01);
+ case 43 -> position.set(Position.KEY_FUEL_LEVEL, Integer.parseInt(values[1], 16) * 0.01);
+ case 45 -> position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(values[1], 16) * 0.01);
+ case 53 -> position.set(Position.KEY_OBD_SPEED, Integer.parseInt(values[1], 16) * 0.01);
+ case 54 -> position.set(Position.KEY_RPM, Integer.parseInt(values[1], 16) * 0.01);
+ case 71 -> position.set(Position.KEY_FUEL_USED, Integer.parseInt(values[1], 16) * 0.01);
+ case 73 -> position.set(Position.KEY_HOURS, Integer.parseInt(values[1], 16) * 0.01);
+ case 74 -> position.set(Position.KEY_VIN, values[1]);
}
}
}
@@ -1284,16 +1261,10 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
int moduleLength = buf.readUnsignedShort();
switch (moduleType) {
- case 0x03:
- position.set(Position.KEY_ICCID, ByteBufUtil.hexDump(buf.readSlice(10)));
- break;
- case 0x09:
- position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
- break;
- case 0x0a:
- position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte());
- break;
- case 0x11:
+ case 0x03 -> position.set(Position.KEY_ICCID, ByteBufUtil.hexDump(buf.readSlice(10)));
+ case 0x09 -> position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
+ case 0x0a -> position.set(Position.KEY_SATELLITES_VISIBLE, buf.readUnsignedByte());
+ case 0x11 -> {
CellTower cellTower = CellTower.from(
buf.readUnsignedShort(),
buf.readUnsignedShort(),
@@ -1303,22 +1274,16 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
if (cellTower.getCellId() > 0) {
position.setNetwork(new Network(cellTower));
}
- break;
- case 0x18:
- position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
- break;
- case 0x28:
- position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
- break;
- case 0x29:
- position.set(Position.KEY_INDEX, buf.readUnsignedInt());
- break;
- case 0x2a:
+ }
+ case 0x18 -> position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.01);
+ case 0x28 -> position.set(Position.KEY_HDOP, buf.readUnsignedByte() * 0.1);
+ case 0x29 -> position.set(Position.KEY_INDEX, buf.readUnsignedInt());
+ case 0x2a -> {
int input = buf.readUnsignedByte();
position.set(Position.KEY_DOOR, BitUtil.to(input, 4) > 0);
position.set("tamper", BitUtil.from(input, 4) > 0);
- break;
- case 0x2b:
+ }
+ case 0x2b -> {
int event = buf.readUnsignedByte();
switch (event) {
case 0x11:
@@ -1337,11 +1302,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
break;
}
position.set(Position.KEY_EVENT, event);
- break;
- case 0x2e:
- position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
- break;
- case 0x33:
+ }
+ case 0x2e -> position.set(Position.KEY_ODOMETER, buf.readUnsignedIntLE());
+ case 0x33 -> {
position.setTime(new Date(buf.readUnsignedInt() * 1000));
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
position.setAltitude(buf.readShort());
@@ -1363,15 +1326,13 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(latitude);
position.setLongitude(longitude);
- break;
- case 0x34:
+ }
+ case 0x34 -> {
position.set(Position.KEY_EVENT, buf.readUnsignedByte());
buf.readUnsignedIntLE(); // time
buf.skipBytes(buf.readUnsignedByte()); // content
- break;
- default:
- buf.skipBytes(moduleLength);
- break;
+ }
+ default -> buf.skipBytes(moduleLength);
}
}
@@ -1486,12 +1447,20 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
variant = Variant.JC400;
} else if (header == 0x7878 && type == MSG_LBS_3 && length == 0x37) {
variant = Variant.SL4X;
+ } else if (header == 0x7878 && type == MSG_GPS_LBS_5 && length == 0x2a) {
+ variant = Variant.SL4X;
} else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_4 && length == 0x27) {
variant = Variant.SL4X;
+ } else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_4 && length == 0x29) {
+ variant = Variant.SL4X;
} else if (header == 0x7878 && type == MSG_GPS_LBS_2 && length == 0x2f) {
variant = Variant.SEEWORLD;
} else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_1 && length == 0x26) {
variant = Variant.SEEWORLD;
+ } else if (header == 0x7878 && type == MSG_GPS_LBS_RFID && length == 0x28) {
+ variant = Variant.RFID;
+ } else if (header == 0x7878 && type == MSG_GPS_LBS_STATUS_5 && length == 0x40) {
+ variant = Variant.LW4G;
} else {
variant = Variant.STANDARD;
}