aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
blob: 427c092a925acb12f9a6f44f4004bd7fcd4fc4e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package org.traccar.protocol;

import org.traccar.helper.TestDataManager;
import org.jboss.netty.buffer.ChannelBuffers;
import static org.traccar.helper.DecoderVerifier.verify;
import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;

public class SkypatrolProtocolDecoderTest {

    @Test
    public void testDecode() throws Exception {

        SkypatrolProtocolDecoder decoder = new SkypatrolProtocolDecoder(null);
        decoder.setDataManager(new TestDataManager());

        int[] buf1 = {0x00,0x05,0x02,0x10,0x04,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x0D,0x31,0x31,0x34,0x37,0x37,0x35,0x38,0x33,0x00,0xCB,0x00,0x00,0x00,0x00,0x0E,0x11,0x07,0x0C,0x01,0x01,0x84,0xD0,0x32,0xFB,0x38,0x41,0x37,0x00,0x00,0x00,0x00,0x16,0x07,0x2B,0x00,0x00,0x17,0x05,0x00,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x4E,0x0C,0x07,0x11,0x16,0x07,0x2C,0x10,0x59,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x03,0x10,0x02,0x60,0xB7,0x36,0x3B,0x63,0x06,0xC1,0x1A,0x00,0xB7,0x36,0x37,0xF2,0x06,0xBF,0x19,0xB7,0x36,0x37,0xF1,0x06,0xB5,0x0E,0xB7,0x36,0x38,0xB1,0x06,0xBB,0x0B,0xB7,0x36,0x3B,0x61,0x06,0xB8,0x0A,0xB7,0x36,0x37,0xF3,0x06,0xB7,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C};
        verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf1))));

        //Enfora TT8750
        //int[] buf2 = {0x00,0x05,0x02,0x00,0x00,0x00,0xf1,0x14,0x30,0x35,0x30,0x30,0x31,0x39,0x30,0x31,0xd1,0xdf,0x00,0x2f,0x00,0x00,0x0d,0x01,0x87,0x12,0x01,0x15,0xe5,0x56,0xff,0x76,0x2a,0xa9,0x00,0x00,0x00,0x00,0x00,0xaa,0xe4,0x00,0x05,0xd2,0x00,0x0e,0xe1,0xbc,0x0e,0x01,0x0a,0x04,0x25,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x04,0x00,0x00,0x02,0x23,0x3c,0x09,0x6c,0x00,0xee,0x2a,0x00,0x23,0x3c,0x00,0x85,0x00,0xf0,0x22,0x23,0x3c,0x0b,0x05,0x00,0xf2,0x1d,0x23,0x3c,0x00,0x00,0x00,0xfb,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
        //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(buf2))));

    }

}