Search in sources :

Example 56 with Command

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

the class Tk103ProtocolEncoderTest method testEncodePositionSingleAlternative.

@Test
public void testEncodePositionSingleAlternative() {
    var encoder = new Tk103ProtocolEncoder(null, 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 57 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeGetVersion.

@Test
public void testEncodeGetVersion() {
    var encoder = new Tk103ProtocolEncoder(null);
    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 58 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeIdentificationAlternative.

@Test
public void testEncodeIdentificationAlternative() {
    var encoder = new Tk103ProtocolEncoder(null, true);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_IDENTIFICATION);
    assertEquals("[begin]sms2,999999,[end]", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 59 with Command

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

the class Tk103ProtocolEncoderTest method testEncodePositionPeriodic.

@Test
public void testEncodePositionPeriodic() {
    var encoder = new Tk103ProtocolEncoder(null);
    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 60 with Command

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

the class Tk103ProtocolEncoderTest method testEncodeSetOdometer.

@Test
public void testEncodeSetOdometer() {
    var encoder = new Tk103ProtocolEncoder(null);
    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)

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