diff options
-rw-r--r-- | src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 12 | ||||
-rw-r--r-- | test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 6b48b41fa..388565207 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -46,15 +46,15 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder { * Regular expressions pattern */ static private Pattern pattern = Pattern.compile( - "([\\d]{2})([\\d]{2})([\\d]{2}).([\\d]{3})," + // Time (HHMMSS.SSS) + "(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time (HHMMSS.SSS) "([AV])," + // Validity - "([\\d]{2})([\\d]{2}.[\\d]{4})," + // Latitude (DDMM.MMMM) + "(\\d{2})(\\d{2}\\.\\d{4})," + // Latitude (DDMM.MMMM) "([NS])," + - "([\\d]{3})([\\d]{2}.[\\d]{4})," + // Longitude (DDDMM.MMMM) + "(\\d{3})(\\d{2}\\.\\d{4})," + // Longitude (DDDMM.MMMM) "([EW])," + - "([\\d]+.[\\d]+)," + // Speed - "([\\d]+.[\\d]+)?," + // Course - "([\\d]{2})([\\d]{2})([\\d]{2})," + // Date (DDMMYY) + "(\\d+.\\d+)," + // Speed + "(\\d+\\.?\\d+)?," + // Course + "(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY) "[^\\|]+\\|(\\d+.\\d)\\|" + // Dilution of precision "(\\d+)\\|" + // Altitude "([0-9a-fA-F]+)\\|" + // State diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 881f6df19..7a0fcc3d0 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -19,6 +19,9 @@ public class MeiligaoProtocolDecoderTest { byte[] buf2 = {0x12,0x34,0x56,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0x99,0x55,0x30,0x33,0x35,0x36,0x34,0x34,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x32,0x32,0x33,0x32,0x2E,0x36,0x30,0x38,0x33,0x2C,0x4E,0x2C,0x31,0x31,0x34,0x30,0x34,0x2E,0x38,0x31,0x33,0x37,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x2C,0x30,0x31,0x30,0x38,0x30,0x39,0x2C,0x2C,0x2A,0x31,0x43,0x7C,0x31,0x31,0x2E,0x35,0x7C,0x31,0x39,0x34,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x30,0x30,0x30,0x30,0x69,0x62,0x0D,0x0A}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf2, 0, buf2.length))); + + byte[] buf3 = {0x33,0x58,0x01,(byte)0x97,0x03,0x58,0x1F,(byte)0x99,0x55,0x31,0x33,0x34,0x33,0x35,0x31,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x30,0x39,0x32,0x35,0x2E,0x35,0x30,0x32,0x35,0x2C,0x4E,0x2C,0x30,0x36,0x39,0x31,0x34,0x2E,0x38,0x31,0x30,0x37,0x2C,0x57,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x32,0x33,0x2C,0x33,0x30,0x31,0x30,0x31,0x32,0x2C,0x2C,0x2A,0x32,0x43,0x7C,0x30,0x2E,0x38,0x7C,0x31,0x38,0x36,0x7C,0x32,0x30,0x30,0x30,0x7C,0x30,0x31,0x32,0x36,0x2C,0x30,0x30,0x46,0x46,0x7C,0x30,0x32,0x44,0x45,0x30,0x30,0x30,0x32,0x44,0x38,0x43,0x44,0x42,0x34,0x31,0x35,0x7C,0x30,0x36,0x7C,0x30,0x30,0x46,0x44,0x36,0x42,0x37,0x39,(byte)0x95,(byte)0x82,0x0D,0x0A}; + assertNotNull(decoder.decode(null, null, factory.getBuffer(buf3, 0, buf3.length))); } |