Search in sources :

Example 46 with Command

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

the class EelinkProtocolEncoderTest method testEncode.

@Test
public void testEncode() throws Exception {
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ENGINE_STOP);
    verifyCommand(new EelinkProtocolEncoder(false), command, binary("676780000f0000010000000052454c41592c3123"));
    verifyCommand(new EelinkProtocolEncoder(true), command, binary("454c001eb41a0123456789012345676780000f0000010000000052454c41592c3123"));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 47 with Command

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

the class Gt06ProtocolEncoderTest method testEncode.

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

Example 48 with Command

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

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

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

the class H02ProtocolEncoderTest method testAlarmDisarmEncode.

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

Example 50 with Command

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

the class MeitrackProtocolEncoderTest method testEncode.

@Test
public void testEncode() throws Exception {
    MeitrackProtocolEncoder encoder = new MeitrackProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_POSITION_SINGLE);
    assertEquals("@@Q25,123456789012345,A10*68\r\n", encoder.encodeCommand(command));
    command.setDeviceId(1);
    command.setType(Command.TYPE_REQUEST_PHOTO);
    assertEquals("@@D46,123456789012345,D03,1,camera_picture.jpg*1F\r\n", encoder.encodeCommand(command));
    command.setDeviceId(1);
    command.setType(Command.TYPE_SEND_SMS);
    command.set(Command.KEY_PHONE, "15360853789");
    command.set(Command.KEY_MESSAGE, "Meitrack");
    assertEquals("@@f48,123456789012345,C02,0,15360853789,Meitrack*B0\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)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