aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-06-04 09:48:38 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2017-06-04 09:48:51 -0700
commit0d5b1440503ee50127554e0664b0ae7cbf9a25fd (patch)
treeb9d2045cda946dc31be67cb00ef376e45806b35a
parent40cb222dddfe3c0acdf6043617e00d7deaa4646c (diff)
downloadtraccar-server-0d5b1440503ee50127554e0664b0ae7cbf9a25fd.tar.gz
traccar-server-0d5b1440503ee50127554e0664b0ae7cbf9a25fd.tar.bz2
traccar-server-0d5b1440503ee50127554e0664b0ae7cbf9a25fd.zip
Fix MU-201 message decoding (fix #3220)
-rw-r--r--src/org/traccar/protocol/SanavProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/SanavProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/SanavProtocolDecoder.java b/src/org/traccar/protocol/SanavProtocolDecoder.java
index c736b2ba3..151c55795 100644
--- a/src/org/traccar/protocol/SanavProtocolDecoder.java
+++ b/src/org/traccar/protocol/SanavProtocolDecoder.java
@@ -38,7 +38,7 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder {
.number("(d+)") // imei
.expression("&?rmc[:=]")
.text("$GPRMC,")
- .number("(dd)(dd)(dd).(ddd),") // time (hhmmss.sss)
+ .number("(dd)(dd)(dd).d+,") // time (hhmmss.sss)
.expression("([AV]),") // validity
.number("(d+)(dd.d+),") // latitude
.expression("([NS]),")
@@ -69,7 +69,7 @@ public class SanavProtocolDecoder extends BaseProtocolDecoder {
position.setDeviceId(deviceSession.getDeviceId());
DateBuilder dateBuilder = new DateBuilder()
- .setTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
+ .setTime(parser.nextInt(0), parser.nextInt(0), parser.nextInt(0));
position.setValid(parser.next().equals("A"));
position.setLatitude(parser.nextCoordinate());
diff --git a/test/org/traccar/protocol/SanavProtocolDecoderTest.java b/test/org/traccar/protocol/SanavProtocolDecoderTest.java
index be7b3bbf4..903f0aec0 100644
--- a/test/org/traccar/protocol/SanavProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/SanavProtocolDecoderTest.java
@@ -9,6 +9,9 @@ public class SanavProtocolDecoderTest extends ProtocolTest {
public void testDecode() throws Exception {
SanavProtocolDecoder decoder = new SanavProtocolDecoder(new SanavProtocol());
+
+ verifyPosition(decoder, text(
+ "imei=1234567890&rmc=$GPRMC,091950.00,V,5300.10000,N,00900.14000,E,0.160,,200513,,,A*68,STOP,V3.872;67%,S4,H8.3,D2.38"));
verifyPosition(decoder, text(
"imei=352024028982787&rmc=$GPRMC,103048.000,A,4735.0399,N,01905.2895,E,0.00,0.00,171013,,*05,AUTO-4095mv"),