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
29
|
package org.traccar.protocol;
import org.traccar.helper.TestDataManager;
import java.nio.ByteOrder;
import org.jboss.netty.buffer.ChannelBuffers;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.traccar.helper.ChannelBufferTools;
import static org.traccar.helper.DecoderVerifier.verify;
public class GalileoProtocolDecoderTest {
@Test
public void testDecode() throws Exception {
GalileoProtocolDecoder decoder = new GalileoProtocolDecoder(new TestDataManager(), null, null);
int[] buf1 = {0x01,0x13,(byte)0x80,0x03,0x38,0x36,0x38,0x32,0x30,0x34,0x30,0x30,0x31,0x35,0x34,0x39,0x30,0x38,0x37,0x04,0x32,0x00,(byte)0x85,(byte)0x90};
assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf1))));
int[] buf2 = {0x01,0xcf,0x03,0x04,0x46,0xba,0x10,0x63,0x03,0x20,0xa7,0x05,0x4c,0x53,0x30,0x08,0xf8,0x6c,0x8e,0x03,0x10,0x06,0x2c,0x04,0x33,0x47,0x04,0x9e,0x02,0x34,0x40,0x00,0x35,0x09,0x40,0x01,0x32,0x41,0x50,0x6b,0x42,0x8f,0x10,0x43,0x22,0x44,0xae,0xea,0x57,0x20,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x9a,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x71,0x24,0x20,0xce,0x1c,0x4b,0x53,0x30,0x09,0xb4,0xf0,0x67,0x03,0x04,0x3d,0xf4,0x03,0x33,0x81,0x03,0x7b,0x0a,0x34,0x38,0x00,0x35,0x0a,0x40,0x09,0x32,0x41,0xdb,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xc0,0x5e,0xf8,0x1f,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x88,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x70,0x24,0x20,0xc1,0x1c,0x4b,0x53,0x30,0x0a,0x54,0xf1,0x67,0x03,0xc4,0x50,0xf4,0x03,0x33,0x6e,0x03,0x4e,0x0a,0x34,0x39,0x00,0x35,0x08,0x40,0x09,0x32,0x41,0xdd,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0x91,0xea,0xf7,0x1f,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0xc2,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x6f,0x24,0x20,0xb3,0x1c,0x4b,0x53,0x30,0x0c,0xec,0xf2,0x67,0x03,0x38,0x65,0xf4,0x03,0x33,0x6a,0x03,0x30,0x0a,0x34,0x38,0x00,0x35,0x07,0x40,0x09,0x32,0x41,0xe6,0x6b,0x42,0x90,0x10,0x43,0x25,0x44,0xb4,0x46,0x58,0x20,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0xf7,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x6e,0x24,0x20,0xa6,0x1c,0x4b,0x53,0x30,0x0c,0x9c,0xf4,0x67,0x03,0x88,0x78,0xf4,0x03,0x33,0x7b,0x03,0x37,0x0a,0x34,0x38,0x00,0x35,0x07,0x40,0x09,0x32,0x41,0xb5,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xba,0x46,0xf8,0x1f,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0xc6,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x6d,0x24,0x20,0x99,0x1c,0x4b,0x53,0x30,0x0b,0xc8,0xf5,0x67,0x03,0x50,0x8c,0xf4,0x03,0x33,0x8d,0x03,0x6e,0x0a,0x34,0x37,0x00,0x35,0x08,0x40,0x09,0x32,0x41,0xd6,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xb4,0xea,0x57,0x20,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x84,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x6c,0x24,0x20,0x8c,0x1c,0x4b,0x53,0x30,0x08,0xc8,0xf5,0x67,0x03,0x70,0xa0,0xf4,0x03,0x33,0x87,0x03,0x92,0x0a,0x34,0x3a,0x00,0x35,0x0e,0x40,0x09,0x32,0x41,0xc7,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xc0,0xfe,0xf7,0x1f,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x8d,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x6b,0x24,0x20,0x7f,0x1c,0x4b,0x53,0x30,0x09,0xa4,0xf5,0x67,0x03,0x38,0xb4,0xf4,0x03,0x33,0x76,0x03,0x92,0x0a,0x34,0x3c,0x00,0x35,0x0a,0x40,0x09,0x32,0x41,0xd0,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0x91,0x46,0xa8,0x1f,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x8a,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x6a,0x24,0x20,0x72,0x1c,0x4b,0x53,0x30,0x0b,0x9c,0xf5,0x67,0x03,0xec,0xc7,0xf4,0x03,0x33,0x71,0x03,0x81,0x0a,0x34,0x3a,0x00,0x35,0x08,0x40,0x09,0x32,0x41,0xca,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xd1,0x2e,0x58,0x20,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x99,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x69,0x24,0x20,0x65,0x1c,0x4b,0x53,0x30,0x0a,0x64,0xf6,0x67,0x03,0x58,0xdb,0xf4,0x03,0x33,0x7a,0x03,0x49,0x0a,0x34,0x39,0x00,0x35,0x08,0x40,0x09,0x32,0x41,0xe5,0x6b,0x42,0x90,0x10,0x43,0x25,0x44,0xae,0xd2,0xf7,0x1f,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0xb2,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x68,0x24,0x20,0x58,0x1c,0x4b,0x53,0x30,0x09,0x4c,0xf8,0x67,0x03,0xe0,0xee,0xf4,0x03,0x33,0x81,0x03,0x0c,0x0a,0x34,0x3a,0x00,0x35,0x09,0x40,0x09,0x32,0x41,0xf9,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xcb,0x2e,0x18,0x21,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x92,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x67,0x24,0x20,0x4b,0x1c,0x4b,0x53,0x30,0x09,0xf8,0xfa,0x67,0x03,0x28,0x02,0xf5,0x03,0x33,0x7b,0x03,0xfc,0x09,0x34,0x3b,0x00,0x35,0x0a,0x40,0x09,0x32,0x41,0xd8,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xc0,0xea,0x77,0x21,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x9e,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x66,0x24,0x20,0x3e,0x1c,0x4b,0x53,0x30,0x09,0xa0,0xfd,0x67,0x03,0x68,0x15,0xf5,0x03,0x33,0x84,0x03,0xfd,0x09,0x34,0x3c,0x00,0x35,0x0a,0x40,0x09,0x32,0x41,0xa8,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xae,0x2e,0x58,0x20,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0xa8,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x65,0x24,0x20,0x31,0x1c,0x4b,0x53,0x30,0x09,0x44,0x00,0x68,0x03,0xb0,0x28,0xf5,0x03,0x33,0x80,0x03,0xff,0x09,0x34,0x3d,0x00,0x35,0x09,0x40,0x09,0x32,0x41,0xdc,0x6b,0x42,0x8e,0x10,0x43,0x25,0x44,0xa8,0xfe,0xa7,0x1f,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0xe2,0x6b,0x53,0x00,0x00,0x04,0x46,0xba,0x10,0x64,0x24,0x20,0x24,0x1c,0x4b,0x53,0x30,0x08,0xf0,0x02,0x68,0x03,0x08,0x3c,0xf5,0x03,0x33,0x8b,0x03,0xf9,0x09,0x34,0x3c,0x00,0x35,0x0d,0x40,0x09,0x32,0x41,0xd3,0x6b,0x42,0x8f,0x10,0x43,0x25,0x44,0xc0,0xea,0xa7,0x1f,0x45,0xf9,0x00,0x46,0x04,0xa0,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0xab,0x6b,0x53,0x00,0x00,0xff,0x3f};
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf2))));
int[] buf3 = {0x01,0x1e,0x83,0x04,0x32,0x00,0x10,0x27,0x02,0x20,0xdb,0xd2,0xf0,0x51,0x30,0x0a,0x90,0xcf,0x74,0x03,0x28,0xac,0x59,0x03,0x33,0x00,0x00,0x00,0x00,0x34,0x76,0x00,0x35,0x12,0x40,0x01,0x2a,0x41,0xe9,0x2e,0x42,0x50,0x0f,0x43,0x1f,0x44,0x00,0x06,0xc8,0x14,0x45,0x0f,0x00,0x46,0x00,0x20,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x00,0x00,0x53,0x00,0x00,0x54,0x00,0x00,0x55,0x00,0x00,0x56,0x00,0x00,0x57,0x00,0x00,0x58,0x00,0x00,0x60,0x00,0x00,0x61,0x00,0x00,0x62,0x00,0x00,0xa0,0x00,0xa1,0x00,0xa2,0x00,0xa3,0x00,0xa4,0x00,0xa5,0x00,0xa6,0x00,0xa7,0x00,0xa8,0x00,0xa9,0x00,0xaa,0x00,0xab,0x00,0xac,0x00,0xad,0x00,0xae,0x00,0xaf,0x00,0xb0,0x00,0x00,0xb1,0x00,0x00,0xb2,0x00,0x00,0xb3,0x00,0x00,0xb4,0x00,0x00,0xb5,0x00,0x00,0xb6,0x00,0x00,0xb7,0x00,0x00,0xb8,0x00,0x00,0xb9,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0xc1,0x00,0x00,0x00,0x00,0xc2,0x00,0x00,0x00,0x00,0xc3,0x00,0x00,0x00,0x00,0xc4,0x00,0xc5,0x00,0xc6,0x00,0xc7,0x00,0xc8,0x00,0xc9,0x00,0xca,0x00,0xcb,0x00,0xcc,0x00,0xcd,0x00,0xce,0x00,0xcf,0x00,0xd0,0x00,0xd1,0x00,0xd2,0x00,0xd4,0x71,0x02,0x00,0x00,0xd6,0x00,0x00,0xd7,0x00,0x00,0xd8,0x00,0x00,0xd9,0x00,0x00,0xda,0x00,0x00,0xdb,0x00,0x00,0x00,0x00,0xdc,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0xde,0x00,0x00,0x00,0x00,0xdf,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0xf1,0x00,0x00,0x00,0x00,0xf2,0x00,0x00,0x00,0x00,0xf3,0x00,0x00,0x00,0x00,0x04,0x32,0x00,0x10,0x26,0x02,0x20,0xbd,0xd2,0xf0,0x51,0x30,0x05,0x90,0xcf,0x74,0x03,0x28,0xac,0x59,0x03,0x33,0x00,0x00,0x00,0x00,0x34,0x76,0x00,0x35,0x14,0x40,0x09,0x0a,0x41,0xf0,0x2e,0x42,0x7b,0x0f,0x43,0x1f,0x44,0xff,0x0d,0xb8,0x14,0x45,0x0f,0x00,0x46,0x00,0x00,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x00,0x00,0x53,0x00,0x00,0x54,0x00,0x00,0x55,0x00,0x00,0x56,0x00,0x00,0x57,0x00,0x00,0x58,0x00,0x00,0x60,0x00,0x00,0x61,0x00,0x00,0x62,0x00,0x00,0xa0,0x00,0xa1,0x00,0xa2,0x00,0xa3,0x00,0xa4,0x00,0xa5,0x00,0xa6,0x00,0xa7,0x00,0xa8,0x00,0xa9,0x00,0xaa,0x00,0xab,0x00,0xac,0x00,0xad,0x00,0xae,0x00,0xaf,0x00,0xb0,0x00,0x00,0xb1,0x00,0x00,0xb2,0x00,0x00,0xb3,0x00,0x00,0xb4,0x00,0x00,0xb5,0x00,0x00,0xb6,0x00,0x00,0xb7,0x00,0x00,0xb8,0x00,0x00,0xb9,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0xc1,0x00,0x00,0x00,0x00,0xc2,0x00,0x00,0x00,0x00,0xc3,0x00,0x00,0x00,0x00,0xc4,0x00,0xc5,0x00,0xc6,0x00,0xc7,0x00,0xc8,0x00,0xc9,0x00,0xca,0x00,0xcb,0x00,0xcc,0x00,0xcd,0x00,0xce,0x00,0xcf,0x00,0xd0,0x00,0xd1,0x00,0xd2,0x00,0xd4,0x71,0x02,0x00,0x00,0xd6,0x00,0x00,0xd7,0x00,0x00,0xd8,0x00,0x00,0xd9,0x00,0x00,0xda,0x00,0x00,0xdb,0x00,0x00,0x00,0x00,0xdc,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0xde,0x00,0x00,0x00,0x00,0xdf,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0xf1,0x00,0x00,0x00,0x00,0xf2,0x00,0x00,0x00,0x00,0xf3,0x00,0x00,0x00,0x00,0x04,0x32,0x00,0x10,0x25,0x02,0x20,0x8e,0xd2,0xf0,0x51,0x30,0x0e,0xd8,0xd0,0x74,0x03,0x04,0xac,0x59,0x03,0x33,0x00,0x00,0x00,0x00,0x34,0xa5,0x00,0x35,0x0a,0x40,0x01,0x2a,0x41,0xec,0x2e,0x42,0x2d,0x0f,0x43,0x1f,0x44,0x00,0x16,0xb8,0x14,0x45,0x0f,0x00,0x46,0x00,0x20,0x50,0x00,0x00,0x51,0x00,0x00,0x52,0x00,0x00,0x53,0x00,0x00,0x54,0x00,0x00,0x55,0x00,0x00,0x56,0x00,0x00,0x57,0x00,0x00,0x58,0x00,0x00,0x60,0x00,0x00,0x61,0x00,0x00,0x62,0x00,0x00,0xa0,0x00,0xa1,0x00,0xa2,0x00,0xa3,0x00,0xa4,0x00,0xa5,0x00,0xa6,0x00,0xa7,0x00,0xa8,0x00,0xa9,0x00,0xaa,0x00,0xab,0x00,0xac,0x00,0xad,0x00,0xae,0x00,0xaf,0x00,0xb0,0x00,0x00,0xb1,0x00,0x00,0xb2,0x00,0x00,0xb3,0x00,0x00,0xb4,0x00,0x00,0xb5,0x00,0x00,0xb6,0x00,0x00,0xb7,0x00,0x00,0xb8,0x00,0x00,0xb9,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0xc1,0x00,0x00,0x00,0x00,0xc2,0x00,0x00,0x00,0x00,0xc3,0x00,0x00,0x00,0x00,0xc4,0x00,0xc5,0x00,0xc6,0x00,0xc7,0x00,0xc8,0x00,0xc9,0x00,0xca,0x00,0xcb,0x00,0xcc,0x00,0xcd,0x00,0xce,0x00,0xcf,0x00,0xd0,0x00,0xd1,0x00,0xd2,0x00,0xd4,0x4d,0x02,0x00,0x00,0xd6,0x00,0x00,0xd7,0x00,0x00,0xd8,0x00,0x00,0xd9,0x00,0x00,0xda,0x00,0x00,0xdb,0x00,0x00,0x00,0x00,0xdc,0x00,0x00,0x00,0x00,0xdd,0x00,0x00,0x00,0x00,0xde,0x00,0x00,0x00,0x00,0xdf,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0xf1,0x00,0x00,0x00,0x00,0xf2,0x00,0x00,0x00,0x00,0xf3,0x00,0x00,0x00,0x00,0x62,0x2e};
verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertArray(buf3))));
}
}
|