From 53f1be38dc55032e73e1aae659bb94dda6414d31 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 9 Apr 2024 18:29:35 -0700 Subject: Fix GV355CEU battery decoding --- src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java | 3 +++ src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java index 775e98401..8edce9346 100644 --- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -974,6 +974,9 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { if (model.startsWith("GV") && !model.startsWith("GV6")) { position.set(Position.PREFIX_ADC + 2, v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1]) * 0.001); } + if (model.startsWith("GV355CEU")) { + index += 1; // reserved + } position.set(Position.KEY_BATTERY_LEVEL, v[index++].isEmpty() ? null : Integer.parseInt(v[index - 1])); if (model.startsWith("GL5")) { diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java index 4cccf8fa2..925a0da1c 100644 --- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java @@ -11,6 +11,10 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest { var decoder = inject(new Gl200TextProtocolDecoder(null)); + verifyAttribute(decoder, buffer( + "+RESP:GTERI,8020050704,867488060246195,,00000004,28823,10,1,1,0.0,33,10.1,10.606120,43.656780,20240408084402,0222,0010,7D53,00DD120D,02,0,0.0,,,,,100,210100,0,1,FFFFF,YS2R4X20009288827,2,H1910197,58234.30,500,1,90,H1.5,P84.00,,0,4616.20,2.28,2.16,5.64,5358,1038,0010,00,00,20240408084403,1809$"), + Position.KEY_BATTERY_LEVEL, 100); + verifyAttribute(decoder, buffer( "+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); -- cgit v1.2.3