diff options
-rw-r--r-- | src/org/traccar/protocol/MegastekProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/MegastekProtocolDecoderTest.java | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/MegastekProtocolDecoder.java b/src/org/traccar/protocol/MegastekProtocolDecoder.java index 77d24837a..0a25f0b4a 100644 --- a/src/org/traccar/protocol/MegastekProtocolDecoder.java +++ b/src/org/traccar/protocol/MegastekProtocolDecoder.java @@ -32,17 +32,15 @@ public class MegastekProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - //STX,102110830074542,$GPRMC,114229.000,A,2238.2024,N,11401.9619,E,0.00,0.00,310811,,,A*64 - //,F,LowBattery,imei:012207005553885,03,113.1,Battery=24%,,1,460,01,2531,647E;57 static private Pattern pattern = Pattern.compile( "STX," + - "\\d+," + // Identifier (not IMEI) + "[^,]+," + // Identifier (not IMEI) "\\$GPRMC," + "(\\d{2})(\\d{2})(\\d{2})\\.\\d+," + // Time (HHMMSS.SSS) "([AV])," + // Validity - "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM) + "(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM) "([NS])," + - "(\\d{3})(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM) + "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM) "([EW])," + "(\\d+\\.\\d{2})?," + // Speed "(\\d+\\.\\d{2})?," + // Course diff --git a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java index d443f934c..f4998d3f9 100644 --- a/test/org/traccar/protocol/MegastekProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MegastekProtocolDecoderTest.java @@ -10,6 +10,12 @@ public class MegastekProtocolDecoderTest { MegastekProtocolDecoder decoder = new MegastekProtocolDecoder(null); decoder.setDataManager(new TestDataManager()); + + assertNotNull(decoder.decode(null, null, + "STX,GerAL22,$GPRMC,174752.000,A,3637.060059,S,6416.2354,W,0.00,0.00,030812,,,A*55,F,,imei:861785000249353,05,180.6,Battery=100%,,1,722,310,0FA6,39D0;8F")); + + assertNotNull(decoder.decode(null, null, + "STX,GerAL22,$GPRMC,000051.000,A,3637.079590,S,6416.2148,W,1.72,332.98,010109,,,A*52,L,,imei:861785000249353,03,275.3,Battery=68%,,1,722,07,0515,1413;41")); assertNotNull(decoder.decode(null, null, "STX,102110830074542,$GPRMC,114229.000,A,2238.2024,N,11401.9619,E,0.00,0.00,310811,,,A*64,F,LowBattery,imei:012207005553885,03,113.1,Battery=24%,,1,460,01,2531,647E;57")); |