aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-02-28 15:51:36 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2021-02-28 15:51:36 -0800
commit166852601ab6b4f0e7917ae7c53a216ce3ffb054 (patch)
treef712532d1b28d2da8134f7949726f2c8be0545a7 /src
parent74555e6c149dd4782afd28efea3f45a876892b2c (diff)
downloadtraccar-server-166852601ab6b4f0e7917ae7c53a216ce3ffb054.tar.gz
traccar-server-166852601ab6b4f0e7917ae7c53a216ce3ffb054.tar.bz2
traccar-server-166852601ab6b4f0e7917ae7c53a216ce3ffb054.zip
Support GV200 temperature
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java22
-rw-r--r--src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java3
2 files changed, 20 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
index d438aa33d..a95c90616 100644
--- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -237,8 +237,14 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.number("(d{5}:dd:dd)?,") // hour meter
.number("(x+)?,") // adc 1
.number("(x+)?,").optional() // adc 2
+ .groupBegin()
+ .number("(x+)?,") // adc 3
+ .number("(xx),") // inputs
+ .number("(xx),") // outputs
+ .or()
.number("(d{1,3})?,") // battery
.number("(?:(xx)(xx)(xx))?,") // device status
+ .groupEnd()
.expression("(.*)") // additional data
.or()
.number("d*,,")
@@ -920,15 +926,21 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_POWER, power * 0.001);
}
- if (parser.hasNext(9)) {
+ if (parser.hasNext(12)) {
position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
position.set(Position.KEY_HOURS, parseHours(parser.next()));
position.set(Position.PREFIX_ADC + 1, parser.next());
position.set(Position.PREFIX_ADC + 2, parser.next());
- position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());
-
- decodeStatus(position, parser);
+ position.set(Position.PREFIX_ADC + 3, parser.next());
+ if (parser.hasNext(2)) {
+ position.set(Position.KEY_INPUT, parser.nextHexInt());
+ position.set(Position.KEY_OUTPUT, parser.nextHexInt());
+ }
+ if (parser.hasNext(4)) {
+ position.set(Position.KEY_BATTERY_LEVEL, parser.nextInt());
+ decodeStatus(position, parser);
+ }
int index = 0;
String[] data = parser.next().split(",");
diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index 915876609..b35b78992 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 {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
+ verifyPositions(decoder, buffer(
+ "+RESP:GTERI,040A00,862894022579562,gv200,00000002,,10,1,1,96.1,180,749.7,39.222692,24.165463,20210225065756,0420,0004,759C,3360,00,15529.8,,,2789,,01,00,2,2,282BD47A0B000063,1,FFE2,281FDD5D0B000057,1,FFC8,20210225065800,6974$"));
+
verifyAttribute(decoder, buffer(
"+RESP:GTERI,DE0115,865284042104863,gl500m,00000100,0,0,1,2,0.0,0,36.9,-1.844589,52.177779,20201006125701,0234,0015,0135,34A1,19,0,,79,1,,0,20201006125723,184D$"),
Position.KEY_BATTERY_LEVEL, 79);