aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/CastelProtocolDecoderTest.java
blob: fbacfb94e7b93c2bfe1cef76fd61447528e5a315 (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
package org.traccar.protocol;

import java.nio.ByteOrder;

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

public class CastelProtocolDecoderTest extends ProtocolTest {

    @Test
    public void testDecode() throws Exception {

        CastelProtocolDecoder decoder = new CastelProtocolDecoder(new CastelProtocol());

        //verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
        //        "4040590004313030303030303030303800000000000000000040010072f53f56c25240560000000078b00900000000009c3100000000030100011900030001090b0f080106c04fe40b4037310c0060e001ff018d01e05e0d0a"));

        verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "404055000431303031313132353239393837000000000000001002C1F0695230086A529C911100000000000F890000A60500000000036301014CFF000001190A0D0539191480D60488C5721800000000BF8A640D0A"));

        verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40406000043130303131313235323939383700000000000000400705000000C1F0695249F469529C9111000000000069830000D80040000400036401014C04030001190A0D04201E1480D60488C5721800000000AF0101060F000F00EA1E0D0A"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "404057000431303031313132353239393837000000000000004002C1F06952F0F169529C9111000000000069830000470000000400036401014C01030078000505210C210D210F21102101073BE8030064280AEB930D0A"));

        verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40405900043130303131313235323939383700000000000000400101C1F06952E7F069529C9111000000000069830000070000000400036401014C00030001190A0D0412041480D60488C57218000000009F01E803ED9A0D0A"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "4040B9000431303031313132353239393837000000000000004005C1F069521BF169529C9111000000000069830000130000000400036401014C0003000022032104210521062107210C210D210E210F2110211121132115211C211F21212124212E212F2130213121322133213C214221432144214521472149214A214C214D214E210100643B6232E803003E64280A3C24FE00010E010F00D5805A483C640000000000010000E02E000000066400000500000000A7710D0A"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "404043000431303031313132353239393837000000000000004006C1F0695209F169529C91110000000000698300000D0000000400036401014C00030000009AF40D0A"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "404086000431303031313132353239393837000000000000004004C1F0695200F169529C91110000000000698300000D0000000400036401014C00030022032104210521062107210C210D210E210F2110211121132115211C211F21212124212E212F2130213121322133213C214221432144214521472149214A214C214D214E219AE90D0A"));

        verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40407F000431303031313132353239393837000000000000001001C1F06952FDF069529C91110000000000698300000C0000000000036401014C00030001190A0D04121A1480D60488C5721800000000AF4944445F3231364730325F532056312E322E31004944445F3231364730325F482056312E322E31000000DF640D0A"));

        verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "404044000c3631313135303030303935360000000000000000420600011e0a0f0b1312864fcd08c07a13030100640acf000004000a000000000000007ba083a66ad80d0a"));

        verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40405c000c363131313530303030393536000000000000000040011c0a0f0e362dca53cd0860831303000000000300000000ff000000000000007ba083a650542d3639305f56312e312e320050542d3639302056312e32008a020d0a"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "4040450004323132474c31313433303035303033000000000040082ca89b55a6a99b555c57000000000000c40200000b0000001400036401111f000302f5533bd653f10d0a"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40404d0004323132474c3131343330303530303300000000004007120000002ca89b55cba99b555c57000000000000c40200000b0000000000036401111f000102000101170000000068850d0a"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "4040420004323132474c31313433303035303033000000000010022ca89b55cca99b555c57000000000000cf0200000b0000000000036401111f0000020013be0d0a"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "4040870004323132474c31313433303035303033000000000040052ca89b55e3a89b555c57000000000000c4020000040000001400036401111f0003000012042105210b210c210d210f211021112113211c2121212321242133213421422146214f212b50663603003ce9030dff060000600dffffc25865ffff9e02b43624000000003cbc0d0a"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "4040d00004323132474c31313433303035303033000000000010013ec09b5596c29b555c57000000000000de0200000f0000000000036401111f000000004944445f3231334730325f532056322e322e36004944445f3231334730325f482056322e322e360032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701288a690d0a"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40404d0004323132474c3131343330303530303300000000004007050000003ec09b5564c29b555c57000000000000de0200000f0000002000036401111f0000020001010e00000000237e0d0a"));

        verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40401F00043130303131313235323939383700000000000000100303320D0A"));

        verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40407F000431303031313132353239393837000000000000001001C1F06952FDF069529C91110000000000698300000C0000000000036401014C00030001190A0D04121A1480D60488C5721800000000AF4944445F3231364730325F532056312E322E31004944445F3231364730325F482056312E322E31000000DF640D0A"));

        verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40405900043130303131313235323939383700000000000000400101C1F06952E7F069529C9111000000000069830000070000000400036401014C00030001190A0D0412041480D60488C57218000000009F01E803ED9A0D0A"));
        
        verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
                "40405900043335343034333035303834343134330000000000400100f61a7355c11b7355710000000b00000000000000000000000400000000240e0200020106060f100b2d5a78a7076ec0fb1d00008c065f010000ac220d0a"));

    }

}