aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-01-18 06:44:11 -0800
committerAnton Tananaev <anton@traccar.org>2024-01-18 06:44:11 -0800
commit2eba0bdf8c02036d6761667f0aa022ead9587c11 (patch)
tree8144a9152c94dab87f864cfd5db998030199e82a /src/main/java/org/traccar
parent79a4cf9355b08e0b306146a94bd65adb5ed963a5 (diff)
downloadtrackermap-server-2eba0bdf8c02036d6761667f0aa022ead9587c11.tar.gz
trackermap-server-2eba0bdf8c02036d6761667f0aa022ead9587c11.tar.bz2
trackermap-server-2eba0bdf8c02036d6761667f0aa022ead9587c11.zip
Add MT700 battery (fix #5197)
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 2e7cdde4e..79488acc0 100644
--- a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -55,7 +55,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_POSITION = new PatternBuilder()
.text("#")
- .number("(?:(dd)|x*)") // cell or voltage
+ .number("(?:(dd|dddd)|x*)") // cell or voltage
.groupBegin()
.number("#(d+),") // mcc
.number("(d+),") // mnc
@@ -77,7 +77,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_WIFI = new PatternBuilder()
.text("#")
- .number("(?:(dd)|x+)") // cell or voltage
+ .number("(?:(dd|dddd)|x+)") // cell or voltage
.expression("#?")
.groupBegin()
.number("(d+),") // mcc
@@ -179,7 +179,8 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
if (parser.matches()) {
if (parser.hasNext()) {
- position.set(Position.KEY_BATTERY, parser.nextInt() * 0.1);
+ int voltage = parser.nextInt();
+ position.set(Position.KEY_BATTERY, voltage > 100 ? voltage * 0.001 : voltage * 0.1);
}
if (parser.hasNext(4)) {
@@ -211,7 +212,8 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
if (parser.matches()) {
if (parser.hasNext()) {
- position.set(Position.KEY_BATTERY, parser.nextInt() * 0.1);
+ int voltage = parser.nextInt();
+ position.set(Position.KEY_BATTERY, voltage > 100 ? voltage * 0.001 : voltage * 0.1);
}
Network network = new Network();