Skip to content

Bugfix: Add VGN mode parameter #5523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
Map.entry("55", "GL50B"),
Map.entry("5E", "GV500MAP"),
Map.entry("6E", "GV310LAU"),
Map.entry("70", "GV50M"),
Map.entry("BD", "CV200"),
Map.entry("C2", "GV600M"),
Map.entry("DC", "GV600MG"),
Map.entry("DE", "GL500M"),
Map.entry("F1", "GV350M"),
Map.entry("F8", "GV800W"),
Map.entry("FC", "GV600W"),
Map.entry("FE", "GV53MG"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please attach full documentation for both device models.

Map.entry("802004", "GV58LAU"),
Map.entry("802005", "GV355CEU"));

Expand Down Expand Up @@ -1122,6 +1124,7 @@ private Object decodeIgn(

String model = getDeviceModel(deviceSession, protocolVersion);
index += 1; // device name
if (isVirtualIgnitionMode(type, model)) index += 1; // virtual ignition mode
index += 1; // duration of ignition on/off

index = decodeLocation(position, model, v, index);
Expand All @@ -1142,6 +1145,11 @@ private Object decodeIgn(
return position;
}

private boolean isVirtualIgnitionMode(String type, String model) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need a separate function for this. Also what does type.contains("VG") mean?

return type.contains("VG") &&
List.of("GV50M", "GV53MG").contains(model);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A set of direct comparison would make more sense here.

}

private static final Pattern PATTERN_LSW = new PatternBuilder()
.text("+RESP:").expression("GT[LT]SW,")
.expression("(?:.{6}|.{10})?,") // protocol version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public void testDecode() throws Exception {
"+RESP:GTVGN,C2010D,869653060009939,GV600M,453966,0,0.0,0,163.9,10.239379,45.931389,20231210233723,0222,0010,2F31,006D7621,,,0.0,20240107182623,143F$"),
Position.KEY_IGNITION, true);

verifyPosition(decoder, buffer(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add new test to the top of the file.

"+BUFF:GTVGN,700401,865918060953848,,2,18764,0,0.0,10,212.7,-94.599696,35.409763,20250311043241,0310,0410,600B,03DB140F,,,0.0,20250311043242,D994$"));

verifyAttribute(decoder, buffer(
"+RESP:GTIGF,8020050502,867488060278727,,509,1,0.0,184,32.6,14.003446,42.654554,20240219124629,0222,0001,0FAD,0497F715,00,,0.0,20240219124630,FD2F$"),
Position.KEY_IGNITION, false);
Expand Down