aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java
blob: b6ce0bd671ebc10d4a61fe94619e827edd630c14 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package org.traccar.protocol;

import org.junit.Test;
import org.traccar.ProtocolTest;

public class EgtsProtocolDecoderTest extends ProtocolTest {

    @Test
    public void testDecodeWithOid() throws Exception {

        EgtsProtocolDecoder decoder = new EgtsProtocolDecoder(null);

        verifyNull(decoder, binary(
                "0100020b002300020001871c00020000010105190000ab0800006247396e615734366347467a63336476636d513daadf"));

        verifyNull(decoder, binary(
                "0100020b002300020001871c00020000010105190000ab0800006247396e615734366347467a63336476636d513daadf"));

        verifyNotNull(decoder, binary(
                "0100020b004600010001b81800030001f299c0d80202101500c9c52f1100552e9c80e4ca7911f5805b00000000031800040001f299c0d80202101500cbc52f1100612e9c00dbca79116c803e00000000037c13"));

        verifyNotNull(decoder, binary(
                "0100020b005e01030001ed180005000162c72c9a0202101500c4c52f1100477e9f0047c979010000ad000000000318000600017ee0710c0202101500c9c52f11003ee59f8061e97a0100801b00000000031800070001b6eeb6c00202101500c7c52f110077669d00b9707a116a015600000000031800080001b6eeb6c00202101500cdc52f11007c669d004e717a117a0158000000000318000900018b4685f70202101500c8c52f11006ee09f0027ca7c11650079000000000318000a0001f299c0d80202101500c9c52f1100552e9c80e4ca7911f5805b000000000318000b0001f299c0d80202101500cbc52f1100612e9c00dbca79116c803e000000000318000c0001731347010202101500c7c52f1100a3699a80db3c7a010000e5000000000318000d0001c85285f70202101500cbc52f1100e8979900f3497b114d0101000000000318000e0001aa4358810202101500cdc52f11002d689a80ab427a0100009300000000032b9f"));


        verifyNotNull(decoder, binary(
                "0100000b00ba036b43019014002e0d9579b00000bc23be120202120900000003000000000000150500025a0000000a002f0d9579b00000d723be120202130700030000000000001400300d9579b00000da23be120202120900000003000000000000150500025a0000001800310d9579b000005d4a0efe02021015005d4a0efe00000000000000000a00000000000030000a00320d9579b00000f523be120202130700030000000000001400330d9579b00000f923be120202120900000003000000000000150500025a0000000a00340d9579b000001324be120202130700030000000000001400350d9579b000001724be120202120900000003000000000000150500025a0000001800360d9579b000009a4a0efe02021015009a4a0efe00000000000000000a00000000000030000a00370d9579b000003224be120202130700030000000000001400380d9579b000003524be120202120900000003000000000000150500025a0000000a00390d9579b000005024be1202021307000300000000000014003a0d9579b000005324be120202120900000003000000000000150500025a00000018003b0d9579b00000d74a0efe0202101500d74a0efe00000000000000000a00000000000030000a003c0d9579b000006e24be1202021307000300000000000014003d0d9579b000007224be120202120900000003000000000000150500025a0000000a003e0d9579b000008d24be1202021307000300000000000014003f0d9579b000009024be120202120900000003000000000000150500025a0000001800400d9579b00000144b0efe0202101500144b0efe00000000000000000a00000000000030000a00410d9579b00000ab24be120202130700030000000000001400420d9579b00000ae24be120202120900000003000000000000150500025a0000000a00430d9579b00000c924be120202130700030000000000001400440d9579b00000cc24be120202120900000003000000000000150500025a0000001800450d9579b00000514b0efe0202101500514b0efe00000000000000000a00000000000030000a00460d9579b00000e724be120202130700030000000000001400470d9579b00000eb24be120202120900000003000000000000150500025a0000000a00480d9579b000000625be120202130700030000000000001400490d9579b000000925be120202120900000003000000000000150500025a00000018004a0d9579b000008e4b0efe02021015008e4b0efe00000000000000000a00000000000030000a004b0d9579b000002425be1202021307000300000000000007a1"));
        verifyNull(decoder, binary(
                "0100000b0003006c430004010000acfb0100000b0003006d430042020000fca2"));
        verifyNull(decoder, binary(
                "0100000b0003006e430088030000cc950100000b0003006f4300ce0400005c10"));
        verifyNull(decoder, binary(
                "0100000b000300704300db0500006c270100000b0003007143009d0600003c7e0100000b000300724300570700000c490100000b000300734300110800003d650100000b000300744300f20900000d520100000b000300754300b40a00005d0b0100000b0003007643007e0b00006d3c0100000b000300774300380c0000fdb9"));
        verifyNull(decoder, binary(
                "0100000b000300784300890d0000cd8e0100000b000300794300cf0e00009dd70100000b0003007a4300050f0000ade0"));
        verifyNull(decoder, binary(
                "0100000b0003007b430043100000ff8f0100000b0003007c4300a0110000cfb80100000b0003007d4300e61200009fe10100000b0003007e43002c130000afd60100000b0003007f43006a1400003f530100000b000300804300211500000f640100000b000300814300671600005f3d0100000b000300824300ad1700006f0a0100000b000300834300eb1800005e260100000b000300844300081900006e110100000b0003008543004e1a00003e480100000b000300864300841b00000e7f0100000b000300874300c21c00009efa0100000b000300884300731d0000aecd"));

        verifyPositions(decoder, binary(
                "0100000b0086035ddd016d18004f049579b000001e2fc11002021015001e2fc1107ac3919f59cc5c7a0b0000000000003000180050049579b00000242fc1100202101500242fc1100fb5919f2dbf5c7a0b0000000000003000180051049579b00000312fc1100202101500312fc110b899919f94cf5c7a0b00000000000030001e0052049579b00000ba62a2120202120900000003000000000000150500025c00000013070003000000000000180053049579b000004e2fc11002021015004e2fc11087ba919f8dd45c7a0b0000000000003000180054049579b00000552fc1100202101500552fc1106ecb919f2aec5c7a0b00000000000030001e0055049579b00000d562a2120202120900000003000000000000150500025c00000013070003000000000000180056049579b000005c2fc11002021015005c2fc11059d9919f54fa5c7a0b0000000000003000180057049579b000006e2fc11002021015006e2fc110309f919fc2db5c7a0b0000000000003000180058049579b00000762fc1100202101500762fc1104690919f94cf5c7a0b00000000000030001e0059049579b00000f662a2120202120900000003000000000000150500025c000000130700030000000000001e005a049579b000001463a2120202120900000003000000000000150500025c0000001307000300000000000018005b049579b00000b32fc1100202101500b32fc110c491919fa2c65c7a0b00000000000030001e005c049579b000003363a2120202120900000003000000000000150500025c0000001307000300000000000018005d049579b00000ca2fc1100202101500ca2fc11089b9919fd5f95c7a0b00000000000030001e005e049579b000005163a2120202120900000003000000000000150500025c000000130700030000000000001e005f049579b000006f63a2120202120900000003000000000000150500025c00000013070003000000000000180060049579b00000f42fc1100202101500f42fc11087ba919f43db5c7a0b0000000000003000180061049579b000000730c11002021015000730c110f9c3919fe1c65c7a0b0000000000003000180062049579b000000930c11002021015000930c1106ecb919f3ab65c7a0b00000000000030001e0063049579b000008d63a2120202120900000003000000000000150500025c00000013070003000000000000140064049579b00000ac63a2120202120900000003000000000000150500025c000000ce53"));

        verifyNull(decoder, binary(
                "0100000b00100091030072000100060000000002020003009203000009"));

        verifyNull(decoder, binary(
                "0100000b00030095030063100000ff8f0100000b000300960300a9100000ff8f0100000b000300970300ef100000ff8f0100000b0003009803005e100000ff8f0100000b00030099030018100000ff8f"));

        verifyNull(decoder, binary(
                "0100000b00030060dd005f010000acfb"));

    }

    @Test
    public void testDecodeWithAuth() throws Exception {

        EgtsProtocolDecoder decoder = new EgtsProtocolDecoder(null);

        verifyNull(decoder, binary(
                "0100010b002200c06401f21700c1640171360d00010101140071360d000238363539303500000000000000000047fc"));

        verifyNull(decoder, binary(
                "0100000b002400a0d601f01900030081030000000101011600030000004238363434393530333436343333373600014cdc"));

        verifyPositions(decoder, binary(
                "0100000b002700030e01211800030e8573890100845e980f0202101500f85d980fb37f50aae9653c2b193708317b00000001c51b"));

        verifyPositions(decoder, binary(
                "0100010b00a308c26401029808c3640171360d000202101800e19a7b0fcfb4c49a0bfdb87a911801b70000000010d90000180400021c0000120300000000101800f39a7b0f2fc9c39a9bf2b87a914001b50000000010da0000180400021c0000120300000000101800fa9a7b0fc663c39a21eeb87a914001b60000000010da0000180400021c0000120300000000101800069b7b0f56d8c29a26ebb87a919600ab0000000010da0000180400021c00001203000000001018000a9b7b0fb2c5c29a19f4b87a915a007d0000000010da0000180400021c0000120300000000101800089b7b0f68ccc29a21eeb87a9164008f0000000010da0000180400021c0000120300000000101800079b7b0fa0d1c29aa4ecb87a918200980000000010da0000180400021c00001203000000001018000b9b7b0f34c4c29ad3f7b87a915a00670000000010da0000180400021c00001203000000001018000f9b7b0f3dbec29aaf0fb97a91c8005e0000000010dc0000180400021c0000120300000000101800199b7b0f42bbc29a0855b97a9178006b0000000010db0000180400021c00001203000000001018001b9b7b0fc8b6c29a3c5db97a916e007e0000000010db0000180400021c00001203000000001018001a9b7b0fc4b9c29a8159b97a916e00750000000010db0000180400021c00001203000000001018001d9b7b0f94aec29a3363b97a916400930000000010db0000180400021c00001203000000001018001c9b7b0fcdb3c29a3760b97a916e008a0000000010db0000180400021c0000120300000000101800209b7b0f28a1c29af263b97a918200ba0000000010db0000180400021c00001203000000001018001f9b7b0f61a6c29af263b97a917800b30000000010db0000180400021c00001203000000001018001e9b7b0f58acc29af263b97a916400a50000000010db0000180400021c0000120300000000101800299b7b0ff26fc29ab561b97a916e00b20000000010d90000180400021c00001203000000001018002d9b7b0fd05bc29a3760b97a916e00bd0000000010d80000180400021c0000120300000000101800359b7b0f4f31c29abe5bb97a916400b50000000010d70000180400021c0000120300000000101800379b7b0f5d28c29abe5bb97a916e00b40000000010d60000180400021c0000120300000000101800369b7b0fd62cc29abe5bb97a916400bd0000000010d60000180400021c00001203000000001018003c9b7b0fca09c29a0358b97a918c00bc0000000010d50000180400021c0000120300000000101800419b7b0f38ebc19a0855b97a916e00b40000000010d60000180400021c0000120300000000101800449b7b0f4edcc19a8a53b97a916400c30000000010d60000180400021c0000120300000000101800469b7b0fded1c19acb52b97a916e00b70000000010d60000180400021c0000120300000000101800649b7b0f7a69c19a154cb97a810000bc0000000010d60000180400021c0000120300000000101800709b7b0fcc5cc19a114fb97a915000970000000010d70000180400021c0000120300000000101800729b7b0fda53c19a8a53b97a91a0007d0000000010d70000180400021c0000120300000000101800749b7b0fa24ec19a3c5db97a91a000650000000010d70000180400021c0000120300000000101800789b7b0fe74ac19aca7eb97a910e015c0000000010d80000180400021c00001203000000001018007f9b7b0f6e46c19a78e0b97a9190015c0000000010d80000180400021c0000120300000000101800869b7b0f3641c19a144eba7a9190015c0000000010d60000180400021c00001203000000001018008d9b7b0ffd3bc19a74b9ba7a9190015c0000000010d40000180400021c0000120300000000101800949b7b0fc536c19a1524bb7a9186015b0000000010d20000180400021c00001203000000001018009b9b7b0fce30c19af78dbb7a919a015c0000000010d00000180400021c0000120300000000101800a29b7b0f552cc19a93fbbb7a9172015d0000000010cd0000180400021c0000120300000000101800b09b7b0f2521c19a6ec0bc7a9186015b0000000010c90000180400021c0000120300000000101800a99b7b0f5e26c19a8759bc7a915e015b0000000010cb0000180400021c0000120300000000101800b79b7b0fa81fc19a1328bd7a9172015b0000000010c70000180400021c0000120300000000101800be9b7b0f6b1dc19ac686bd7a914a015c0000000010c60000180400021c0000120300000000101800c19b7b0fed1bc19ad2a9bd7a912201530000000010c60000180400021c0000120300000000101800c39b7b0f6223c19af4bdbd7a910401420000000010c60000180400021c0000120300000000101800c29b7b0fe91ec19a42b4bd7a910e014c0000000010c60000180400021c0000120300000000101800c59b7b0f502fc19a1acfbd7a91fa00300000000010c60000180400021c0000120300000000101800c49b7b0fdb27c19ae6c6bd7a91fa00390000000010c60000180400021c0000120300000000101800c79b7b0fb83fc19a8ad9bd7a91f000180000000010c60000180400021b0000120300000000101800c69b7b0fc536c19a52d4bd7a91f000250000000010c60000180400021b0000120300000000101800ca9b7b0fc85fc19a81dfbd7a910401030000000010c50000180400021b0000120300000000101800c89b7b0fe74ac19a86dcbd7a91fa000e0000000010c50000180400021b0000120300000000101800d29b7b0f06b7c19afbe3bd7a91a000100000000010c50000180400021c0000120300000000101800d59b7b0ff0c5c19a6beebd7a91b400410000000010c40000180400021c0000120300000000101800d49b7b0ff4c2c19af2e9bd7a91a000310000000010c40000180400021c0000120300000000101800d39b7b0f3ebcc19a79e5bd7a9196001e0000000010c40000180400021c0000120300000000101800d69b7b0f6dc7c19ae0f5bd7a91c800570000000010c40000180400021c000012030000000016b7"));

        verifyPositions(decoder, binary(
                "0100020B0025003A5701C91A003A5701CD6E68490202101700CBB4740F7617FD924364104F116A0000000000010300001EC2"),
                position("2018-03-21 05:38:19.000", true, 51.67569, 55.59189));

        verifyPositions(decoder, binary(
                "0100020B0079000000011F6A001424951CA5CB0F23B5740F020210180023B5740F0A301994DA9C524C9128000A000000100082000011040018110300120900000003150100E803001B0700010000340900001B0700420000000000001B0700430000000000001B0700440000000000001B0700450000000000001B0700460000000000008020"));

        verifyPositions(decoder, binary(
                "0100020B00F200000001D66A001224951CA5CB0FFCB4740F0202101800FCB4740F502119943D9F524C9119805C000000100084000011040018110300120900000003150100E803001B0700410000000000001B0700420000000000001B0700430000000000001B0700440000000000001B0700450000000000001B0700460000000000006A001324951CA5CB0F05B5740F020210180005B5740F222519942D9E524C9100008B000000100083000011040018110300120900000003160100E803001B0700010000310900001B0700420000000000001B0700430000000000001B0700440000000000001B0700450000000000001B070046000000000000134E"));

    }

}