aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-03-31 10:15:32 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-03-31 10:15:32 +1300
commit794a170e94454868083a78d433df84168ee8ec98 (patch)
treea1f249d7c7ca5776150b57991ccd1516fef72ef9
parent1117ee8c759b0000b180ba18da6939a194e0b78b (diff)
downloadtraccar-server-794a170e94454868083a78d433df84168ee8ec98.tar.gz
traccar-server-794a170e94454868083a78d433df84168ee8ec98.tar.bz2
traccar-server-794a170e94454868083a78d433df84168ee8ec98.zip
Implement support for Megastek clone
-rw-r--r--src/org/traccar/protocol/MegastekProtocolDecoder.java2
-rw-r--r--test/org/traccar/protocol/MegastekProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java
index c212e90fa..2eebc8d2f 100644
--- a/src/org/traccar/protocol/MegastekProtocolDecoder.java
+++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java
@@ -49,7 +49,7 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder {
.number("imei:(d+),") // imei
.number("(d+/?d*)?,") // satellites
.number("(d+.d+)?,") // altitude
- .number("Battery=(d+)%,,") // battery
+ .number("Battery=(d+)%,,?") // battery
.number("(d)?,") // charger
.number("(d+)?,") // mcc
.number("(d+)?,") // mnc
diff --git a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java
index 7f1c8f603..2b86bc149 100644
--- a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class MegastekProtocolDecoderTest extends ProtocolTest {
MegastekProtocolDecoder decoder = new MegastekProtocolDecoder(new MegastekProtocol());
+ verifyPosition(decoder, text(
+ "STX,865067021328417,$GPRMC,064721.000,A,4241.2793,N,02321.9762,E,6.74,346.90,300316,,,1*CA,F,Nil-Alarms,imei:865067021328417,9,559.8,Battery=82%,0,284,03,047E,2B5F;99"));
+
verifyNothing(decoder, text(
"0147$MGV002,354550050292669,GVT900,S,141215,031804,A,,S,,E,00,04,00,5.17,0.000,193.05,117.1,0.0,510,10,041B,0A5E,,0000,0000,22,12,0, , ,,1-1,98,Timer;!"));