Search in sources :

Example 21 with Command

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

the class Tk103ProtocolEncoderTest method testEncodePositionSingleAlternative.

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

Example 22 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeSosOnAlternative.

@Test
public void testEncodeSosOnAlternative() 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, true);
    assertEquals("[begin]sms2,*soson*,[end]", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 23 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeGetVersion.

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

Example 24 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeSetOdometer.

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

Example 25 with Command

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

the class Tk103ProtocolEncoderTest method testEncodePositionStop.

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