aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/SkypatrolProtocolDecoderTest.java
blob: b47624a25656f20cc86caaa768ca0a90f17f3db1 (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
27
28
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(new TestDataManager(), null, null);

        verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
                new int[]{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}))));

        //Enfora TT8750
        //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertArray(
        //        new int[]{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(
        //        new int[]{0x00,0x04,0x02,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30,0x31,0x31,0x37,0x32,0x32,0x30,0x30,0x31,0x31,0x38,0x35,0x31,0x37,0x38,0x20,0x31,0x32,0x20,0x24,0x47,0x50,0x52,0x4d,0x43,0x2c,0x32,0x32,0x34,0x38,0x33,0x39,0x2e,0x30,0x30,0x2c,0x41,0x2c,0x30,0x33,0x32,0x38,0x2e,0x34,0x33,0x38,0x38,0x30,0x36,0x2c,0x4e,0x2c,0x30,0x37,0x36,0x33,0x31,0x2e,0x36,0x30,0x37,0x37,0x31,0x37,0x2c,0x57,0x2c,0x30,0x2e,0x30,0x2c,0x30,0x2e,0x30,0x2c,0x31,0x39,0x30,0x37,0x31,0x34,0x2c,0x33,0x2e,0x38,0x2c,0x45,0x2c,0x41,0x2a,0x32,0x42,0x0d,0x0a,0x00}))));

    }

}