Search in sources :

Example 6 with Command

use of org.traccar.model.Command in project traccar by tananaev.

the class Gps103ProtocolEncoderTest method testEncodeCustom.

@Test
public void testEncodeCustom() throws Exception {
    Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_CUSTOM);
    command.set(Command.KEY_DATA, "H,080");
    assertEquals("**,imei:123456789012345,H,080", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 7 with Command

use of org.traccar.model.Command in project traccar by tananaev.

the class H02ProtocolEncoderTest method testEngineStopEncode.

@Test
public void testEngineStopEncode() throws Exception {
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ENGINE_STOP);
    assertEquals("*HQ,123456789012345,S20,010203,1,3,10,3,5,5,3,5,3,5,3,5#", encoder.encodeCommand(command, time));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 8 with Command

use of org.traccar.model.Command in project traccar by tananaev.

the class H02ProtocolEncoderTest method testAlarmArmEncode.

@Test
public void testAlarmArmEncode() throws Exception {
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ALARM_ARM);
    assertEquals("*HQ,123456789012345,SCF,010203,0,0#", encoder.encodeCommand(command, time));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 9 with Command

use of org.traccar.model.Command in project traccar by tananaev.

the class H02ProtocolEncoderTest method testPositionPeriodicEncode.

@Test
public void testPositionPeriodicEncode() throws Exception {
    Command command = new Command();
    command.setDeviceId(1);
    command.set(Command.KEY_FREQUENCY, 10);
    command.setType(Command.TYPE_POSITION_PERIODIC);
    assertEquals("*HQ,123456789012345,S71,010203,22,10#", encoder.encodeCommand(command, time));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 10 with Command

use of org.traccar.model.Command in project traccar by tananaev.

the class HuabaoProtocolEncoderTest method testEncode.

@Ignore
@Test
public void testEncode() throws Exception {
    HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ENGINE_STOP);
    verifyCommand(encoder, command, binary("7EA0060007001403305278017701150424154610AD7E"));
}
Also used : Command(org.traccar.model.Command) Ignore(org.junit.Ignore) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Aggregations

Command (org.traccar.model.Command)52 Test (org.junit.Test)49 ProtocolTest (org.traccar.ProtocolTest)49 Ignore (org.junit.Ignore)2 ArrayList (java.util.ArrayList)1 BaseProtocol (org.traccar.BaseProtocol)1 Position (org.traccar.model.Position)1