aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-11-15 06:01:04 -0800
committerAnton Tananaev <anton@traccar.org>2023-11-15 06:01:12 -0800
commite398778abace08beb3b6eea2de210b000944548e (patch)
tree6b38a41068c6cc172d162ba8c32c4ea83805ff8e
parent3aa0729fba832e13da2fd0a6a1c600636fa235a9 (diff)
downloadtrackermap-server-e398778abace08beb3b6eea2de210b000944548e.tar.gz
trackermap-server-e398778abace08beb3b6eea2de210b000944548e.tar.bz2
trackermap-server-e398778abace08beb3b6eea2de210b000944548e.zip
Fix Mictrack MT710 wifi decoding
-rw-r--r--src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java5
-rw-r--r--src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
index e85bdf9b3..5ba053df3 100644
--- a/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -78,8 +78,9 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_WIFI = new PatternBuilder()
.text("#")
.number("(?:(dd)|x+)") // cell or voltage
+ .expression("#?")
.groupBegin()
- .number("#(d+),") // mcc
+ .number("(d+),") // mcc
.number("(d+),") // mnc
.number("(x+),") // lac
.number("(x+)") // cell id
@@ -230,6 +231,8 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt());
getLastLocation(position, dateBuilder.getDate());
+ } else {
+ continue;
}
} else {
diff --git a/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
index 46dc031a3..63aa3ebc0 100644
--- a/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
@@ -11,6 +11,10 @@ public class Tlt2hProtocolDecoderTest extends ProtocolTest {
var decoder = inject(new Tlt2hProtocolDecoder(null));
+ verifyPositions(decoder, false, text(
+ "#862255061825896#MT710#0000#TOWED#1\r\n",
+ "#39#$WIFI,015259.00,A,-47,7483C2DBC0B0,-48,7683C2ABC0B0,-48,7683C29BC0B0,-48,7683C2CBC0B0,-48,7683C2BBC0B0,151123*74\r\n"));
+
verifyNull(decoder, text(
"#860517049471362#MT700#0000#AUTO#1\r\n",
"#36$GPRMC,,V,,,,,,,,,,A*5C\r\n"));