diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-12-26 10:33:44 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-12-26 10:33:44 +1300 |
commit | ba9f54789326436879a85effff2131de9d7023f5 (patch) | |
tree | 1d328c40011cbac6b41e91c5f931c6e2ab397d68 | |
parent | fe9f9b034713cb98531d73698a65bd03d18a771c (diff) | |
download | traccar-server-ba9f54789326436879a85effff2131de9d7023f5.tar.gz traccar-server-ba9f54789326436879a85effff2131de9d7023f5.tar.bz2 traccar-server-ba9f54789326436879a85effff2131de9d7023f5.zip |
Fix meiligao regex pattern
-rw-r--r-- | src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 4 | ||||
-rw-r--r-- | test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 3d8fbef75..0ba9568ba 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -46,6 +46,7 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder { /** * Regular expressions pattern */ + //"020600.930,A,2309.2051,N,11318.8449,E,0.00,0.00,090710,,,A*6A|2.6|96.7|0000|0000,3FFF|000000000" //"155422.000,V,2230.7623,N,11403.4218,E,0.00,0,060211,,*1A|0.0|26|0000|0000,0000|0000000000000000|63|00000000" static private Pattern pattern = Pattern.compile( "(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time (HHMMSS.SSS) @@ -58,7 +59,7 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder { "(\\d+\\.?\\d*)?," + // Course "(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY) "[^\\|]+\\|(\\d+\\.\\d)\\|" + // Dilution of precision - "(\\d+)\\|" + // Altitude + "(\\d+\\.?\\d*)\\|" + // Altitude "([0-9a-fA-F]+)" + // State ".*"); // TODO: parse ADC @@ -88,6 +89,7 @@ public class MeiligaoProtocolDecoder extends GenericProtocolDecoder { /** * Decode message */ + @Override protected Object decode( ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java index 74df4dac6..11ca13aef 100644 --- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java +++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java @@ -31,6 +31,9 @@ public class MeiligaoProtocolDecoderTest { byte[] buf6 = {(byte)0x86,0x21,0x70,0x01,0x42,0x45,(byte)0x8F,(byte)0x99,(byte)0x99,0x50,0x31,0x39,0x32,0x39,0x35,0x38,0x2E,0x30,0x30,0x30,0x2C,0x41,0x2C,0x33,0x36,0x32,0x37,0x2E,0x31,0x36,0x39,0x39,0x2C,0x4E,0x2C,0x30,0x31,0x30,0x34,0x33,0x2E,0x35,0x36,0x32,0x37,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x32,0x33,0x39,0x2C,0x30,0x39,0x31,0x32,0x31,0x32,0x2C,0x2C,0x2A,0x30,0x46,0x7C,0x31,0x2E,0x30,0x7C,0x37,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x31,0x41,0x39,0x2C,0x30,0x31,0x39,0x37,0x7C,0x30,0x32,0x35,0x44,0x30,0x30,0x30,0x32,0x30,0x30,0x35,0x41,0x38,0x36,0x39,0x46,0x7C,0x31,0x32,0x7C,0x30,0x30,0x30,0x33,0x33,0x42,0x42,0x33,(byte)0xE2,0x48,0x0D,0x0A}; assertNotNull(decoder.decode(null, null, factory.getBuffer(buf6, 0, buf6.length))); + + byte[] buf7 = {0x12,0x34,0x56,0x78,(byte)0x9F,(byte)0xFF,(byte)0xFF,(byte)0x99,0x55,0x30,0x32,0x30,0x36,0x30,0x30,0x2E,0x39,0x33,0x30,0x2C,0x41,0x2C,0x32,0x33,0x30,0x39,0x2E,0x32,0x30,0x35,0x31,0x2C,0x4E,0x2C,0x31,0x31,0x33,0x31,0x38,0x2E,0x38,0x34,0x34,0x39,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x30,0x2E,0x30,0x30,0x2C,0x30,0x39,0x30,0x37,0x31,0x30,0x2C,0x2C,0x2C,0x41,0x2A,0x36,0x41,0x7C,0x32,0x2E,0x36,0x7C,0x39,0x36,0x2E,0x37,0x7C,0x30,0x30,0x30,0x30,0x7C,0x30,0x30,0x30,0x30,0x2C,0x33,0x46,0x46,0x46,0x7C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,(byte)0xC4,0x52,0x0D,0x0A}; + assertNotNull(decoder.decode(null, null, factory.getBuffer(buf7, 0, buf7.length))); } |