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

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

public class TopinProtocolDecoderTest extends ProtocolTest {

    @Test
    public void testDecode() throws Exception {

        var decoder = new TopinProtocolDecoder(null);

        verifyNull(decoder, binary(
                "787801080D0A"));

        verifyNull(decoder, binary(
                "78780d0103593390754169634d0d0a"));

        verifyAttribute(decoder, binary(
                "7878006921120412565802010601071e4a9764071e4a9864010d0a"),
                Position.KEY_ALARM, Position.ALARM_VIBRATION);

        verifyAttribute(decoder, binary(
                "787801940D0A"),
                Position.KEY_ALARM, Position.ALARM_VIBRATION);

        verifyAttributes(decoder, binary(
                "78780A13424008196400041F000D0A"));

        verifyPosition(decoder, binary(
                "78781510120B05030D2498038077200BE2078F0034000102030D0A"));

        verifyPosition(decoder, binary(
                "7878200813081A0733211608C8D1710DED1D1608DFFB710E06D51039050100286489000D0A"));

        verifyPosition(decoder, binary(
                "78782008140709121f36300d769f02058cfd300d771202058c6f0000000300005c99000d0a"));

        verifyPosition(decoder, binary(
                "787812100A03170F32179C026B3F3E0C22AD651F34600D0A"));

        verifyAttributes(decoder, binary(
                "78780a132827010063000000000d0a"));

        verifyNotNull(decoder, binary(
                "7878001719111120141807019456465111aa3c465111ab464651c1a550465106b150465342f750465342f65a465111a95a000d0a"));

        verifyPosition(decoder, binary(
                "787812100a03170f32179c026b3f3e0c22ad651f34600d0a"));

        verifyAttributes(decoder, binary(
                "78780713514d0819640d0a"));

        verifyNull(decoder, binary(
                "787801300d0a"));

    }

}