Search in sources :

Example 86 with Command

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

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

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

the class Tk103ProtocolEncoderTest method testEncodePositionPeriodic.

@Test
public void testEncodePositionPeriodic() throws Exception {
    Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_POSITION_PERIODIC);
    command.set(Command.KEY_FREQUENCY, 60);
    assertEquals("(123456789012345AR00003C0000)", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 88 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeSosOffAlternative.

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

Example 89 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeGetVersionAlternative.

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

Example 90 with Command

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

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)

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