From 9411263d59a053347cae7feb47248b8b8d0c2d62 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 30 Aug 2020 22:12:13 -0700 Subject: Support GL501M protocol --- .../traccar/protocol/Gl200TextProtocolDecoder.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/main/java/org/traccar') diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java index 194a21bf7..cd5b41c39 100644 --- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -190,6 +190,12 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { .expression(PATTERN_LOCATION.pattern()) .expression(")+)") .groupBegin() + .number("d{1,2},,") + .number("(d{1,3}),") // battery + .number("[01],") // mode + .number("[01],") // motion + .number("(?:-?d{1,2}.d)?,") // temperature + .or() .number("(d{1,7}.d)?,") // odometer .number("(d{5}:dd:dd)?,") // hour meter .number("(x+)?,") // adc 1 @@ -214,6 +220,15 @@ 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 @@ -840,6 +855,10 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY_LEVEL, battery); } + if (parser.hasNext()) { + position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt()); + } + if (parser.hasNext()) { position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000); } -- cgit v1.2.3