aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorjcardus <asklocation.net@gmail.com>2024-03-29 01:10:06 +0000
committerjcardus <asklocation.net@gmail.com>2024-03-29 01:10:06 +0000
commit0bf22eb231e3eb9ecf912f41dcc8f5e7f7fa8865 (patch)
tree9c794c571287132152e760f2f443ee92b0f4dd22 /src/main/java
parentb6be94fef718926f5575257ab2724f5e538e215f (diff)
downloadtrackermap-server-0bf22eb231e3eb9ecf912f41dcc8f5e7f7fa8865.tar.gz
trackermap-server-0bf22eb231e3eb9ecf912f41dcc8f5e7f7fa8865.tar.bz2
trackermap-server-0bf22eb231e3eb9ecf912f41dcc8f5e7f7fa8865.zip
Fix INF message on GV310LAU
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 7a8d67cf9..b998f718e 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -122,12 +122,12 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_INF = new PatternBuilder()
.text("+").expression("(?:RESP|BUFF):GTINF,")
- .expression("(?:.{6}|.{10})?,") // protocol version
+ .expression("(.{6}|.{10})?,") // protocol version
.number("(d{15}|x{14}),") // imei
.expression("(?:[0-9A-Z]{17},)?") // vin
.expression("(?:[^,]+)?,") // device name
.number("(xx),") // state
- .expression("(?:[0-9Ff]{20})?,") // iccid
+ .expression("([0-9Ff]{20})?,") // iccid
.number("(d{1,2}),") // rssi
.number("d{1,2},")
.expression("[01]{1,2},") // external power
@@ -148,6 +148,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.expression("(?:[01])?,").optional() // pin15 mode
.number("(d+)?,") // adc1
.number("(d+)?,").optional() // adc2
+ .number("(d+)?,").optional() // adc3
.number("(xx)?,") // digital input
.number("(xx)?,") // digital output
.number("[-+]dddd,") // timezone
@@ -163,10 +164,17 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
private Object decodeInf(Channel channel, SocketAddress remoteAddress, String sentence) {
Parser parser = new Parser(PATTERN_INF, sentence);
- Position position = initPosition(parser, channel, remoteAddress);
- if (position == null) {
+ if (!parser.matches()) {
return null;
}
+ String protocolVersion = parser.next();
+ DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());
+ if (deviceSession == null) {
+ return null;
+ }
+ Position position = new Position();
+ position.setProtocol(getProtocolName());
+ position.setDeviceId(deviceSession.getDeviceId());
switch (parser.nextHexInt()) {
case 0x16:
@@ -197,9 +205,14 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
break;
}
+ position.set(Position.KEY_ICCID, parser.next());
position.set(Position.KEY_RSSI, parser.nextInt());
-
- parser.next(); // odometer or external power
+
+ if (protocolVersion.startsWith("6E")) { // GV310LAU
+ position.set(Position.KEY_POWER, parser.nextDouble() / 1000); // odometer or external power
+ } else {
+ parser.next(); // odometer or external power
+ }
position.set(Position.KEY_BATTERY, parser.nextDouble());
position.set(Position.KEY_CHARGE, parser.nextInt() == 1);
@@ -210,6 +223,9 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_ADC + 1, parser.next());
position.set(Position.PREFIX_ADC + 2, parser.next());
+ if (protocolVersion.startsWith("6E")) {
+ position.set(Position.PREFIX_ADC + 3, parser.next());
+ }
position.set(Position.KEY_INPUT, parser.next());
position.set(Position.KEY_OUTPUT, parser.next());