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

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

public class Xexun2ProtocolEncoderTest extends ProtocolTest {

    @Test
    public void testEncode() throws Exception {

        var encoder = inject(new Xexun2ProtocolEncoder(null));

        Command command;

        command = new Command();
        command.setDeviceId(604080829351806311L);
        command.setType(Command.TYPE_POWER_OFF);
        verifyCommand(encoder, command, binary("FAAF0007000186220505123456700004FEBC6F663D31FAAF"));

        command = new Command();
        command.setDeviceId(604080829351806311L);
        command.setType(Command.TYPE_POSITION_PERIODIC);
        command.set(Command.KEY_FREQUENCY, 150);
        verifyCommand(encoder, command, binary("FAAF0007000186220505123456700015F90E747261636B696E675F73656E643D3135302C313530FAAF"));

    }

}