Search in sources :

Example 41 with Command

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

the class Tk103ProtocolEncoderTest method testEncodePositionSingle.

@Test
public void testEncodePositionSingle() throws Exception {
    Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_POSITION_SINGLE);
    assertEquals("(123456789012345AP00)", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 42 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeSosOffAlternative.

@Test
public void testEncodeSosOffAlternative() throws Exception {
    Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ALARM_SOS);
    command.set(Command.KEY_ENABLE, false);
    assertEquals("[begin]sms2,*sosoff*,[end]", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 43 with Command

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

the class TotemProtocolEncoderTest method testEncode.

@Test
public void testEncode() throws Exception {
    TotemProtocolEncoder encoder = new TotemProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(2);
    command.setType(Command.TYPE_ENGINE_STOP);
    command.set(Command.KEY_DEVICE_PASSWORD, "000000");
    assertEquals("*000000,025,C,1#", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 44 with Command

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

the class CellocatorProtocolEncoderTest method testEncode.

@Ignore
@Test
public void testEncode() throws Exception {
    CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_OUTPUT_CONTROL);
    command.set(Command.KEY_INDEX, 0);
    command.set(Command.KEY_DATA, "1");
    verifyCommand(encoder, command, binary("4D434750000000000000000000000303101000000000000026"));
}
Also used : Command(org.traccar.model.Command) Ignore(org.junit.Ignore) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 45 with Command

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

the class CityeasyProtocolEncoderTest method testEncode.

@Test
public void testEncode() throws Exception {
    CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_SET_TIMEZONE);
    command.set(Command.KEY_TIMEZONE, "GMT+6");
    verifyCommand(encoder, command, binary("5353001100080001680000000B60820D0A"));
}
Also used : Command(org.traccar.model.Command) 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