aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-05-21 23:09:02 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-05-21 23:09:02 +1200
commit1db9f7f27f9d4779dbd1a4a55a3be450604204a4 (patch)
tree89649ae403abae93068347ec5918ed3b336c0ce9
parent7b37d4f85a5a2c751f26860ccdb700e3ba42644a (diff)
downloadtraccar-server-1db9f7f27f9d4779dbd1a4a55a3be450604204a4.tar.gz
traccar-server-1db9f7f27f9d4779dbd1a4a55a3be450604204a4.tar.bz2
traccar-server-1db9f7f27f9d4779dbd1a4a55a3be450604204a4.zip
Fix Meitrack decoder (fix #419)
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java2
-rw-r--r--test/org/traccar/protocol/MeitrackProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index ab12d510b..7f63b4b64 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -65,7 +65,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
"(\\p{XDigit}+)?\\|" + // ADC3
"(\\p{XDigit}+)\\|" + // Battery
"(\\p{XDigit}+)," + // Power
- ".*"); // TODO: parse other stuff
+ ".*(\r\n)?");
private Position decodeRegularMessage(ChannelBuffer buf) {
diff --git a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
index 43a2fbe95..f02c18a78 100644
--- a/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeitrackProtocolDecoderTest.java
@@ -46,6 +46,9 @@ public class MeitrackProtocolDecoderTest {
verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
"$$E150,013777001165479,AAA,35,10.296601,123.872115,140501161505,A,4,22,1,170,1.4,77,39097,393563,515|3|A0CC|ED96,0000,0008|0003|0000|09D5|0000,,,1,0009*1E", Charset.defaultCharset())));
+ verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
+ "$$B140,013777001293701,AAA,35,-7.266760,112.743550,140521095314,A,3,22,0,275,2.7,45,1984,8059,510|1|3504|EBFE,0000,0000|0000|0000|0914|0002,,*F9\r\n", Charset.defaultCharset())));
+
int[] buf1 = {0x24,0x24,0x47,0x39,0x37,0x30,0x2c,0x33,0x36,0x39,0x38,0x30,0x30,0x30,0x31,0x33,0x34,0x36,0x30,0x36,0x37,0x34,0x2c,0x43,0x43,0x43,0x2c,0x02,0x01,0x34,0x00,0x5b,0x00,0x00,0x00,0x01,0x0c,0xe3,0x04,0x03,0x5d,0xb9,0xe0,0x00,0xec,0x6f,0x59,0x1a,0x00,0x00,0x13,0x00,0x00,0x00,0x00,0x0c,0x00,0x18,0x01,0xed,0xb7,0x02,0x00,0xc9,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x01,0x00,0x03,0x00,0xa1,0x01,0xc2,0x04,0x00,0x00,0x00,0x00,0x01,0x0c,0xe3,0x04,0x03,0x5d,0xb9,0xe0,0x00,0xee,0x6f,0x59,0x1a,0x00,0x00,0x13,0x00,0x00,0x00,0x00,0x0c,0x00,0x18,0x01,0xed,0xb7,0x02,0x00,0xca,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x01,0x00,0x03,0x00,0xa1,0x01,0xc2,0x04,0x00,0x00,0x00,0x00,0x01,0x0c,0xe3,0x04,0x03,0x5d,0xb9,0xe0,0x00,0xef,0x6f,0x59,0x1a,0x00,0x00,0x13,0x00,0x00,0x00,0x00,0x0c,0x00,0x18,0x01,0xed,0xb7,0x02,0x00,0xcc,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x01,0x00,0x03,0x00,0xa1,0x01,0xc2,0x04,0x00,0x00,0x00,0x00,0x02,0x0c,0xe3,0x04,0x03,0x5d,0xb9,0xe0,0x00,0xf7,0x6f,0x59,0x1a,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x0c,0x00,0x18,0x01,0xed,0xb7,0x02,0x00,0xd3,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa1,0x01,0xbf,0x04,0x00,0x00,0x00,0x00,0x0a,0x0c,0xe3,0x04,0x03,0x5d,0xb9,0xe0,0x00,0xf7,0x6f,0x59,0x1a,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x0c,0x00,0x18,0x01,0xed,0xb7,0x02,0x00,0xd4,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x00,0x00,0x03,0x00,0xa1,0x01,0xbf,0x04,0x00,0x00,0x00,0x00,0x02,0x0c,0xe3,0x04,0x03,0x5d,0xb9,0xe0,0x00,0xfb,0x6f,0x59,0x1a,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x0c,0x00,0x18,0x01,0xed,0xb7,0x02,0x00,0xd8,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa1,0x01,0x76,0x04,0x00,0x00,0x00,0x00,0x18,0x0c,0xe3,0x04,0x03,0x5d,0xb9,0xe0,0x00,0xfc,0x6f,0x59,0x1a,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x8c,0x00,0xed,0xb7,0x02,0x00,0xd9,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa1,0x01,0x76,0x04,0x00,0x00,0x00,0x00,0x19,0xb1,0xe2,0x04,0x03,0x23,0xb9,0xe0,0x00,0x0b,0x70,0x59,0x1a,0x01,0x05,0x15,0x06,0x00,0xbb,0x00,0x12,0x00,0x29,0x01,0xed,0xb7,0x02,0x00,0xe7,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x70,0x05,0x00,0x00,0x00,0x00,0x20,0x23,0xe3,0x04,0x03,0x1f,0xb9,0xe0,0x00,0x10,0x70,0x59,0x1a,0x01,0x06,0x15,0x07,0x00,0x27,0x01,0x0d,0x00,0x16,0x01,0xfc,0xb7,0x02,0x00,0xec,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x80,0x05,0x00,0x00,0x00,0x00,0x20,0x1f,0xe3,0x04,0x03,0x02,0xb9,0xe0,0x00,0x11,0x70,0x59,0x1a,0x01,0x06,0x15,0x09,0x00,0x19,0x01,0x0d,0x00,0x15,0x01,0xfe,0xb7,0x02,0x00,0xed,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x80,0x05,0x00,0x00,0x00,0x00,0x20,0x18,0xe3,0x04,0x03,0xdc,0xb8,0xe0,0x00,0x12,0x70,0x59,0x1a,0x01,0x06,0x15,0x0b,0x00,0x11,0x01,0x0d,0x00,0x15,0x01,0x00,0xb8,0x02,0x00,0xee,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x80,0x05,0x00,0x00,0x00,0x00,0x20,0x36,0xe3,0x04,0x03,0x45,0xb8,0xe0,0x00,0x15,0x70,0x59,0x1a,0x01,0x07,0x15,0x0b,0x00,0x2d,0x01,0x0b,0x00,0x13,0x01,0x0a,0xb8,0x02,0x00,0xf1,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x80,0x05,0x00,0x00,0x00,0x00,0x20,0x53,0xe3,0x04,0x03,0x26,0xb8,0xe0,0x00,0x16,0x70,0x59,0x1a,0x01,0x07,0x15,0x0d,0x00,0x41,0x01,0x0b,0x00,0x13,0x01,0x0e,0xb8,0x02,0x00,0xf2,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x80,0x05,0x00,0x00,0x00,0x00,0x20,0x70,0xe3,0x04,0x03,0x10,0xb8,0xe0,0x00,0x17,0x70,0x59,0x1a,0x01,0x07,0x15,0x0e,0x00,0x4f,0x01,0x0b,0x00,0x13,0x01,0x11,0xb8,0x02,0x00,0xf3,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x80,0x05,0x00,0x00,0x00,0x00,0x20,0x95,0xe3,0x04,0x03,0x06,0xb8,0xe0,0x00,0x18,0x70,0x59,0x1a,0x01,0x07,0x15,0x0d,0x00,0x5a,0x01,0x0b,0x00,0x14,0x01,0x15,0xb8,0x02,0x00,0xf4,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x80,0x05,0x00,0x00,0x00,0x00,0x20,0xb3,0xe3,0x04,0x03,0x05,0xb8,0xe0,0x00,0x19,0x70,0x59,0x1a,0x01,0x07,0x15,0x0b,0x00,0x60,0x01,0x0b,0x00,0x14,0x01,0x18,0xb8,0x02,0x00,0xf5,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x83,0x05,0x00,0x00,0x00,0x00,0x20,0xcf,0xe3,0x04,0x03,0x08,0xb8,0xe0,0x00,0x1a,0x70,0x59,0x1a,0x01,0x07,0x15,0x0b,0x00,0x66,0x01,0x0b,0x00,0x14,0x01,0x1b,0xb8,0x02,0x00,0xf6,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x83,0x05,0x00,0x00,0x00,0x00,0x20,0xee,0xe3,0x04,0x03,0x0c,0xb8,0xe0,0x00,0x1b,0x70,0x59,0x1a,0x01,0x06,0x17,0x0b,0x00,0x04,0x00,0x0d,0x00,0x14,0x01,0x1e,0xb8,0x02,0x00,0xf7,0x6d,0x01,0x00,0xe6,0x00,0x01,0x00,0x48,0x38,0x57,0x65,0x02,0x00,0x03,0x00,0xa2,0x01,0x83,0x05,0x00,0x00,0x00,0x00,0x2a,0x62,0x35,0x0d,0x0a};
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf1))));