diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-02-03 16:03:07 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-02-03 16:03:07 +1300 |
commit | 1c46c37b9a2ebe856b1d4b7e2ddf3cf24526dfb6 (patch) | |
tree | 2cadc0fb484a6d52c39688e9f1c41618bb5b715e /test/org/traccar | |
parent | ff67008d5c9fb78f98c4bf821d0d8f8f064d5b5e (diff) | |
download | traccar-server-1c46c37b9a2ebe856b1d4b7e2ddf3cf24526dfb6.tar.gz traccar-server-1c46c37b9a2ebe856b1d4b7e2ddf3cf24526dfb6.tar.bz2 traccar-server-1c46c37b9a2ebe856b1d4b7e2ddf3cf24526dfb6.zip |
Added Teltonika protocol (fix #14)
Diffstat (limited to 'test/org/traccar')
-rw-r--r-- | test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java new file mode 100644 index 000000000..f896c1593 --- /dev/null +++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -0,0 +1,24 @@ +package org.traccar.protocol; + +import org.jboss.netty.buffer.ChannelBuffers; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import org.junit.Test; + +public class TeltonikaProtocolDecoderTest { + + @Test + public void testDecode() throws Exception { + + TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(null); + decoder.setDataManager(new TestDataManager()); + + byte[] buf1 = {0x00,0x0F,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x30,0x31,0x32,0x33,0x34,0x35}; + assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf1))); + + byte[] buf2 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,(byte)0xA7,0x08,0x04,0x00,0x00,0x01,0x13,(byte)0xfc,0x20,(byte)0x8d,(byte)0xff,0x00,0x0f,0x14,(byte)0xf6,0x50,0x20,(byte)0x9c,(byte)0xca,(byte)0x80,0x00,0x6f,0x00,(byte)0xd6,0x04,0x00,0x04,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x17,0x61,0x0b,0x00,0x0f,0x14,(byte)0xff,(byte)0xe0,0x20,(byte)0x9c,(byte)0xc5,(byte)0x80,0x00,0x6e,0x00,(byte)0xc0,0x05,0x00,0x01,0x00,0x04,0x03,0x01,0x01,0x15,0x03,0x16,0x01,0x00,0x01,0x46,0x00,0x00,0x01,0x5e,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x28,0x49,0x45,0x00,0x0f,0x15,0x0f,0x00,0x20,(byte)0x9c,(byte)0xd2,0x00,0x00,(byte)0x95,0x01,0x08,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5d,0x00,0x00,0x00,0x01,0x13,(byte)0xfc,0x26,0x7c,0x5b,0x00,0x0f,0x15,0x0a,0x50,0x20,(byte)0x9c,(byte)0xcc,(byte)0xc0,0x00,(byte)0x93,0x00,0x68,0x04,0x00,0x00,0x00,0x04,0x03,0x01,0x01,0x15,0x00,0x16,0x03,0x00,0x01,0x46,0x00,0x00,0x01,0x5b,0x00,0x04,0x00,0x00}; + assertNotNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(buf2))); + + } + +} |