aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java10
-rw-r--r--test/org/traccar/protocol/MegastekProtocolDecoderTest.java3
2 files changed, 8 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index d014869d8..ee7c5df2c 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -67,12 +67,12 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)," + // Battery
"(\\d+)," + // Flags
"(\\d+)," + // Inputs
- "(\\d+)," + // Outputs
- "(\\d\\.\\d{2})," + // ADC 1
- "(\\d\\.\\d{2})," + // ADC 2
- "(\\d\\.\\d{2})," + // ADC 3
+ "(?:(\\d+),)?" + // Outputs
+ "(\\d\\.?\\d*)," + // ADC 1
+ "(?:(\\d\\.\\d{2})," + // ADC 2
+ "(\\d\\.\\d{2}),)?" + // ADC 3
"([^;]+);" + // Alarm
- ".+"); // Checksum
+ ".*"); // Checksum
private boolean parseGPRMC(String gprmc, Position position) {
diff --git a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java
index 33ef6fe40..d1cb945a6 100644
--- a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java
@@ -26,6 +26,9 @@ public class MegastekProtocolDecoderTest {
assertNotNull(decoder.decode(null, null,
"STX123456 $GPRMC,063709.000,A,2238.1998,N,11401.9670,E,0.00,,250313,,,A*7F,460,01,2531,647E,11,87,1000,001001,0000,0.00,0.02,0.00,Timer;4A"));
+ assertNotNull(decoder.decode(null, null,
+ "STX260475 $GPRMC,104032.001,A,4022.1119,N,01811.4081,E,000.0,000.0,060913,,,A*67,222,01,815A,D455,11,99,0000,0001,0,Timer;"));
+
}
}