Add GL320M GTERI support (fix #5727)

This commit is contained in:
Anton Tananaev
2025-12-24 04:43:44 +08:00
parent a3dd3afd6e
commit de41a4838b
2 changed files with 13 additions and 2 deletions

View File

@@ -83,6 +83,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
Map.entry("6E", "GV310LAU"),
Map.entry("BD", "CV200"),
Map.entry("C2", "GV600M"),
Map.entry("C3", "GL320M"),
Map.entry("DC", "GV600MG"),
Map.entry("DE", "GL500M"),
Map.entry("F1", "GV350M"),
@@ -962,6 +963,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (!model.startsWith("GL5")) {
position.set(Position.KEY_ODOMETER, v[index++].isEmpty() ? null : Double.parseDouble(v[index - 1]) * 1000);
}
if (!model.startsWith("GL5") && !model.equals("GL320M")) {
position.set(Position.KEY_HOURS, parseHours(v[index++]));
if (!v[index++].isEmpty()) {
decodeAnalog(position, 1, v[index - 1]);
@@ -989,6 +992,11 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_INPUT, v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1], 16));
position.set(Position.KEY_OUTPUT, v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1], 16));
index += 1; // uart device type
} else if (model.equals("GL320M")) {
position.set(Position.KEY_BATTERY_LEVEL, v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1]));
if (BitUtil.check(mask, 7)) {
position.set("externalBattery", v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1]));
}
} else {
position.set(Position.KEY_BATTERY_LEVEL, v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1]));
if (!v[index++].isEmpty()) {
@@ -1045,7 +1053,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
}
}
if (BitUtil.check(mask, 7)) {
if (BitUtil.check(mask, 7) && !model.equals("GL320M")) {
int deviceCount = Integer.parseInt(v[index++]);
for (int i = 1; i <= deviceCount; i++) {
index += 1; // serial number
@@ -1057,7 +1065,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
}
}
if (BitUtil.check(mask, 8)) {
if (BitUtil.check(mask, 8) && !model.equals("GL320M")) {
int deviceCount = Integer.parseInt(v[index++]);
for (int i = 1; i <= deviceCount; i++) {
index += 1; // index

View File

@@ -14,6 +14,9 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, buffer(
"+RESP:GTIGN,BD0221,861778061565387,CV200,,0,140944,0,0.0,358,17.6,-2.223488,51.882342,20251222020123,0234,0015,6093,000F830E,,,5810.9,20251222070035,20251222070035,C60E$"));
verifyPositions(decoder, buffer(
"+RESP:GTERI,C30303,860201068142036,,00000100,0,0,1,1,0.0,0,219.7,8.111111,50.111111,20251221144733,,,,,,97,1,32.4,20251221144735,18B6$"));
verifyPositions(decoder, buffer(
"+RESP:GTERI,80201E0100,860201067144330,,00000100,,10,1,1,0.0,0,30.2,121.348427,31.163316,20251126093749,0460,0000,1807,00775892,00,0.0,,,,,99,210100,,1,00,6,4,0D1C099A,283F,WMS301_Test,7805414BA78A,1,3453,24,33,24.58,100,20251126093751,77E4$"));