aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-11-28 07:10:00 -0800
committerAnton Tananaev <anton@traccar.org>2023-11-28 07:10:00 -0800
commite0d67dd1771e7b265e98bb18ab5359fc335ca9c4 (patch)
tree07c813ab5bc17493bd69a7bdbcca375a87ee5627 /src
parenta943126d3cdb4d2e8c4c314d487736267daf171e (diff)
downloadtrackermap-server-e0d67dd1771e7b265e98bb18ab5359fc335ca9c4.tar.gz
trackermap-server-e0d67dd1771e7b265e98bb18ab5359fc335ca9c4.tar.bz2
trackermap-server-e0d67dd1771e7b265e98bb18ab5359fc335ca9c4.zip
Support Glonass and GNSS NMEA
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/T55ProtocolDecoder.java10
-rw-r--r--src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java9
2 files changed, 15 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java b/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
index b18359b3f..9e7518ce5 100644
--- a/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/T55ProtocolDecoder.java
@@ -41,7 +41,8 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
}
private static final Pattern PATTERN_GPRMC = new PatternBuilder()
- .text("$GPRMC,")
+ .text("$")
+ .expression("G[PLN]RMC,")
.number("(dd)(dd)(dd).?d*,") // time (hhmmss)
.expression("([AV]),") // validity
.number("(dd)(dd.d+),") // latitude
@@ -64,7 +65,8 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
.compile();
private static final Pattern PATTERN_GPGGA = new PatternBuilder()
- .text("$GPGGA,")
+ .text("$")
+ .expression("G[PLN]GGA,")
.number("(dd)(dd)(dd).?d*,") // time (hhmmss)
.number("(d+)(dd.d+),") // latitude
.expression("([NS]),")
@@ -444,9 +446,9 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder {
}
} else if (sentence.matches("^[0-9A-F]+$")) {
getDeviceSession(channel, remoteAddress, sentence);
- } else if (sentence.startsWith("$GPRMC")) {
+ } else if (sentence.startsWith("RMC", 3)) {
return decodeGprmc(deviceSession, sentence, remoteAddress, channel);
- } else if (sentence.startsWith("$GPGGA") && deviceSession != null) {
+ } else if (sentence.startsWith("GGA", 3) && deviceSession != null) {
return decodeGpgga(deviceSession, sentence);
} else if (sentence.startsWith("$GPRMA") && deviceSession != null) {
return decodeGprma(deviceSession, sentence);
diff --git a/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
index 7b9841d68..91020714c 100644
--- a/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
@@ -18,6 +18,15 @@ public class T55ProtocolDecoderTest extends ProtocolTest {
"$PUBX,00,130209.00,3650.51159,N,01346.10602,E,785.947,D3,4.1,5.2,0.163,87.43,-0.054,7.0,0.88,1.21,0.88,24,01012,0*6D"));
verifyPosition(decoder, text(
+ "$GNRMC,164414.90,A,4650.5156500,N,01246.1059604,E,0.018,,091123,,,A,V*15"));
+
+ verifyPosition(decoder, text(
+ "$GNGGA,164414.90,4650.5156500,N,01246.1059604,E,1,12,0.84,740.729,M,44.804,M,,*4E"));
+
+ verifyNull(decoder, text(
+ "$GNGLL,4650.5156500,N,01246.1059604,E,164414.90,A,A*77"));
+
+ verifyPosition(decoder, text(
"QZE,868994033976700,35,28062020,113553,22.13673,114.57263,0,22,A,0"));
verifyNull(decoder, text(