Search in sources :

Example 16 with Command

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

the class Pt502ProtocolEncoderTest method testEncodeOutputControl.

@Test
public void testEncodeOutputControl() throws Exception {
    Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_OUTPUT_CONTROL);
    command.set(Command.KEY_INDEX, 2);
    command.set(Command.KEY_DATA, 1);
    assertEquals("#OPC2,1\r\n", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 17 with Command

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

the class RuptelaProtocolEncoderTest method testEncode.

@Test
public void testEncode() throws Exception {
    RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_CUSTOM);
    command.set(Command.KEY_DATA, " Setio 2,1");
    verifyCommand(encoder, command, binary("000b6c20536574696F20322C31eb3e"));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 18 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeRebootDeviceAlternative.

@Test
public void testEncodeRebootDeviceAlternative() throws Exception {
    Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_REBOOT_DEVICE);
    assertEquals("[begin]sms2,88888888,[end]", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 19 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeSetConnectionAlternative.

@Test
public void testEncodeSetConnectionAlternative() throws Exception {
    Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_SET_CONNECTION);
    command.set(Command.KEY_SERVER, "1.2.3.4");
    command.set(Command.KEY_PORT, "5555");
    assertEquals("[begin]sms2,*setip*1*2*3*4*5555*,[end]", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 20 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeRebootDevice.

@Test
public void testEncodeRebootDevice() throws Exception {
    Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_REBOOT_DEVICE);
    assertEquals("(123456789012345AT00)", encoder.encodeCommand(command));
}
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