aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
diff options
context:
space:
mode:
authoruser <user@laptop.(none)>2012-10-21 21:42:46 +1300
committeruser <user@laptop.(none)>2012-10-21 21:42:46 +1300
commit0af1cebf1e2f3f719edf5391252fcd4004a75157 (patch)
treed897174c4890a8f4039e24f44020c02411c7c902 /test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
parenta3441d3bcd02ec48e408957dfdc61dc6850bc339 (diff)
downloadtrackermap-server-0af1cebf1e2f3f719edf5391252fcd4004a75157.tar.gz
trackermap-server-0af1cebf1e2f3f719edf5391252fcd4004a75157.tar.bz2
trackermap-server-0af1cebf1e2f3f719edf5391252fcd4004a75157.zip
JT600 protocol fix
Diffstat (limited to 'test/org/traccar/protocol/Jt600ProtocolDecoderTest.java')
-rw-r--r--test/org/traccar/protocol/Jt600ProtocolDecoderTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
new file mode 100644
index 000000000..c08ca0605
--- /dev/null
+++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
@@ -0,0 +1,32 @@
+package org.traccar.protocol;
+
+import java.nio.charset.Charset;
+import org.jboss.netty.buffer.ChannelBuffers;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
+
+public class Jt600ProtocolDecoderTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new TestDataManager(), 0);
+
+ byte[] buf1 = {0x24,0x31,0x10,0x21,0x60,0x01,0x11,0x00,0x1B,0x16,0x02,0x11,0x05,0x59,0x10,0x22,0x32,(byte)0x98,0x62,0x11,0x40,0x46,0x22,0x7B,0x05,(byte)0x98,0x09,0x50,(byte)0x80,0x01,0x23,0x27,(byte)0x95,0x14,0x35,0x16,0x1F};
+ assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1)));
+
+ byte[] buf2 = {0x24,0x31,0x20,(byte)0x82,0x00,0x29,0x11,0x00,0x1B,0x17,0x10,0x12,0x05,0x28,0x31,0x24,0x38,0x10,0x12,0x02,0x55,0x33,0x64,0x25,0x00,0x19,0x07,0x19,0x00,0x03,(byte)0xFD,0x2B,(byte)0x91,0x04,0x4D,0x1F,(byte)0xA0};
+ assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2)));
+
+ byte[] buf3 = {0x24,0x31,0x20,(byte)0x82,0x00,0x29,0x11,0x00,0x1B,0x17,0x10,0x12,0x05,0x33,0x05,0x24,0x38,0x09,(byte)0x97,0x02,0x55,0x33,0x58,0x45,0x00,0x04,0x06,0x1E,0x00,0x03,(byte)0xEE,0x00,0x00,0x00,0x00,0x0C,0x00};
+ assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2)));
+
+ assertNotNull(decoder.decode(null, null,
+ ChannelBuffers.copiedBuffer("(3110312099,W01,11404.6204,E,2232.9961,N,A,040511,063736,4,7,100,4,17,1,1,company)", Charset.defaultCharset())));
+
+ assertNotNull(decoder.decode(null, null,
+ ChannelBuffers.copiedBuffer("(3120820029,W01,02553.3555,E,2438.0997,S,A,171012,053339,0,8,20,6,31,5,20,20)", Charset.defaultCharset())));
+
+ }
+
+}