Search in sources :

Example 96 with Command

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

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 97 with Command

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

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)

Example 98 with Command

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

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 99 with Command

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

the class PortmanProtocolEncoderTest method testEncodeEngineResume.

@Test
public void testEncodeEngineResume() {
    var encoder = new PortmanProtocolEncoder(null);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ENGINE_RESUME);
    assertEquals("&&123456789012345,XA6\r\n", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 100 with Command

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

the class PretraceProtocolEncoderTest method testEncodePositionPeriodic.

@Test
public void testEncodePositionPeriodic() throws Exception {
    var encoder = new PretraceProtocolEncoder(null);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_POSITION_PERIODIC);
    command.set(Command.KEY_FREQUENCY, 300);
    assertEquals("(123456789012345D221300,300,,^69)", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Aggregations

Command (org.traccar.model.Command)129 Test (org.junit.Test)120 ProtocolTest (org.traccar.ProtocolTest)120 Ignore (org.junit.Ignore)4 ArrayList (java.util.ArrayList)3 Position (org.traccar.model.Position)3 BaseProtocol (org.traccar.BaseProtocol)2 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)1 QueryStringDecoder (io.netty.handler.codec.http.QueryStringDecoder)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 DeviceSession (org.traccar.DeviceSession)1 CommandsManager (org.traccar.database.CommandsManager)1 Network (org.traccar.model.Network)1