aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java25
-rw-r--r--src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java3
2 files changed, 21 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index bfd0a4cbb..911af8d73 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -400,7 +400,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, values[index++]);
position.setDeviceId(deviceSession.getDeviceId());
- index += 1; // device name
+ String deviceName = values[index++];
index += 1; // report type
index += 1; // canbus state
long reportMask = Long.parseLong(values[index++], 16);
@@ -442,11 +442,11 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(reportMask, 11) && !values[index++].isEmpty()) {
position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(Double.parseDouble(values[index - 1])));
}
- if (BitUtil.check(reportMask, 12)) {
- position.set(Position.KEY_DRIVING_TIME, Double.parseDouble(values[index++]));
+ if (BitUtil.check(reportMask, 12) && !values[index++].isEmpty()) {
+ position.set(Position.KEY_DRIVING_TIME, Double.parseDouble(values[index - 1]));
}
- if (BitUtil.check(reportMask, 13)) {
- position.set("idleHours", Double.parseDouble(values[index++]));
+ if (BitUtil.check(reportMask, 13) && !values[index++].isEmpty()) {
+ position.set("idleHours", Double.parseDouble(values[index - 1]));
}
if (BitUtil.check(reportMask, 14) && !values[index++].isEmpty()) {
position.set("idleFuelConsumption", Double.parseDouble(values[index - 1]));
@@ -472,8 +472,19 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(reportMask, 21) && !values[index++].isEmpty()) {
position.set("engineOverspeed", Double.parseDouble(values[index - 1]));
}
- if (BitUtil.check(reportMask, 29)) {
- reportMaskExt = Long.parseLong(values[index++], 16);
+ if ("GV350M".equals(deviceName)) {
+ if (BitUtil.check(reportMask, 22)) {
+ index += 1; // impulse distance
+ }
+ if (BitUtil.check(reportMask, 23)) {
+ index += 1; // gross vehicle weight
+ }
+ if (BitUtil.check(reportMask, 24)) {
+ index += 1; // catalyst liquid level
+ }
+ }
+ if (BitUtil.check(reportMask, 29) && !values[index++].isEmpty()) {
+ reportMaskExt = Long.parseLong(values[index - 1], 16);
}
if (BitUtil.check(reportMaskExt, 0) && !values[index++].isEmpty()) {
position.set("adBlueLevel", Integer.parseInt(values[index - 1]));
diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index fcd2c6be4..f0dd10772 100644
--- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
var decoder = inject(new Gl200TextProtocolDecoder(null));
+ verifyAttributes(decoder, buffer(
+ "+RESP:GTCAN,F1040C,862599050497393,GV350M,0,0,FFFFFFFF,,1,,,,,,,,,,,,,,,,,,,,,,,0,,,1,0.0,70,2961.6,-78.691750,-0.951135,20230703191659,,,,,,20230703191659,5A4A$"));
+
verifyAttribute(decoder, buffer(
"+RESP:GTBAA,F1040C,862599050497393,GV350M,FF,3,0,04,000A,780541256AE9,3065,0,0.0,213,2908.3,-78.691944,-0.951426,20230511173150,,,,,,20230511175001,0159$"),
"accessoryVoltage", 3.065);