diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-23 09:19:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 09:19:16 -0700 |
commit | 48670633fd49e3ec2bd781f858b11ccd2083878d (patch) | |
tree | 330e5444b82a4b0edeae08b81eb057d56d3714be | |
parent | e2ec2d17b751dc3f3b829cee8693999d9ed08f40 (diff) | |
parent | 309218f2832b6395f9334816e02d755c854f15ad (diff) | |
download | trackermap-server-48670633fd49e3ec2bd781f858b11ccd2083878d.tar.gz trackermap-server-48670633fd49e3ec2bd781f858b11ccd2083878d.tar.bz2 trackermap-server-48670633fd49e3ec2bd781f858b11ccd2083878d.zip |
Merge pull request #4702 from Thiritin/patch-1
Make field optional for the Megastek protocol
-rw-r--r-- | src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java index fae73d931..f0c0df8a6 100644 --- a/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MegastekProtocolDecoder.java @@ -246,7 +246,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { .number("(d+.d+),") // hdop .number("(d+.d+)?,") // speed .number("(d+.d+)?,") // course - .number("(-?d+.d+),") // altitude + .number("(-?d+.d+)?,") // altitude .number("(d+.d+)?,") // odometer .number("(d+),") // mcc .number("(d+),") // mnc @@ -276,7 +276,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { .groupEnd("?").text(",") .number("(d+)?,") // rfid .number("([01])(d)?").optional() // charge and belt status - .expression("[^,]*,") + .expression("[^,]*,").optional() .number("(d+)?,") // battery .expression("([^,]*)[,;]") // alert .any() diff --git a/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java index 3747d9200..3c8377b51 100644 --- a/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java @@ -40,6 +40,9 @@ public class MegastekProtocolDecoderTest extends ProtocolTest { "$MGV002,869152024446923,869152024446923,S,240816,151631,A,5053.83335,N,00424.05702,E,00,10,00,0.88,2.645,76.09,22.7,,206,01,07D1,6600,28,,,,,,,,,01,100,Timer;!")); verifyPosition(decoder, text( + "0143$MGV002,869152024261564,,R,220621,120804,V,5152.09429,N,01051.32158,E,00,00,00,99.9,,,,,232,10,A5AE,5A4908,22,0000,0000,0,,,,,,00,093,Timer,,;!")); + + verifyPosition(decoder, text( "STX,013950007137061,$GPRMC,191959.000,A,5203.09602,N,00830.77057,E,5.73,255.27,240716,,,A*62,L,Belt Up,imei:013950007137061,0/5,,Battery=52%,,1,262,03,0084,B20E;FD")); verifyPosition(decoder, text( |