Search in sources :

Example 81 with Command

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

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

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

the class Tk103ProtocolEncoderTest method testEncodePositionSingle.

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

Example 83 with Command

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

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)

Example 84 with Command

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

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)

Example 85 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeEngineStop.

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