Search in sources :

Example 91 with Command

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

the class H02ProtocolEncoderTest method testEngineResumeEncode.

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

Example 92 with Command

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

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

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

the class NoranProtocolEncoderTest method testEncode.

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

Example 94 with Command

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

the class KhdProtocolEncoderTest method testEncode.

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

Example 95 with Command

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

the class Pt502ProtocolEncoderTest method testEncodeAlarmSpeed.

@Test
public void testEncodeAlarmSpeed() throws Exception {
    Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ALARM_SPEED);
    command.set(Command.KEY_DATA, 120);
    assertEquals("#SPD120\r\n", 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