aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-09-01 18:59:11 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-09-01 18:59:11 -0700
commitf122c85a71603fddad2c92e48370a8dfafbddaf1 (patch)
tree189a2089b7f37db920451e8f71a640714204a783 /src
parent63904eb8ecdb9f6dfdd8656116af419c75ac63bb (diff)
downloadtrackermap-server-f122c85a71603fddad2c92e48370a8dfafbddaf1.tar.gz
trackermap-server-f122c85a71603fddad2c92e48370a8dfafbddaf1.tar.bz2
trackermap-server-f122c85a71603fddad2c92e48370a8dfafbddaf1.zip
Fix battery decoding
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java13
-rw-r--r--src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java4
2 files changed, 6 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index cd5b41c39..c42b2716b 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -45,7 +45,7 @@ import java.util.regex.Pattern;
public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
- private boolean ignoreFixTime;
+ private final boolean ignoreFixTime;
public Gl200TextProtocolDecoder(Protocol protocol) {
super(protocol);
@@ -193,7 +193,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.number("d{1,2},,")
.number("(d{1,3}),") // battery
.number("[01],") // mode
- .number("[01],") // motion
+ .number("(?:[01])?,") // motion
.number("(?:-?d{1,2}.d)?,") // temperature
.or()
.number("(d{1,7}.d)?,") // odometer
@@ -220,15 +220,6 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.text("$").optional()
.compile();
- /*
- CSQ BER <=2 0 - 7|99
-Reserved 0
-Battery Percentage <=3 0 - 100
-Mode Selection 1 0|1
-Movement Status 1 0|1
-Temperature <=5 (-)XX.X
- */
-
private static final Pattern PATTERN_ERI = new PatternBuilder()
.text("+").expression("(?:RESP|BUFF):GTERI,")
.number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version
diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index 188d4f40f..e32bea8b5 100644
--- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -12,6 +12,10 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
verifyAttribute(decoder, buffer(
+ "+RESP:GTFRI,DE0114,865284042140479,,0,0,1,1,0.0,0,28.0,-118.268093,33.975430,20200901105954,0311,0480,3500,00D07F02,18,0,,93,0,,,20200901110000,0355$"),
+ Position.KEY_BATTERY_LEVEL, 93);
+
+ verifyAttribute(decoder, buffer(
"+RESP:GTFRI,DE0114,865284041308986,,0,0,1,0,0.0,0,245.6,-117.678624,34.032081,20200825030332,0311,0480,3304,00C7F601,24,0,,85,1,1,,20200825030738,03B1$"),
Position.KEY_BATTERY_LEVEL, 85);