Search in sources :

Example 66 with Command

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

the class MeiligaoProtocolEncoderTest method testEncode.

@Test
public void testEncode() throws Exception {
    var encoder = new MeiligaoProtocolEncoder(null);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_POSITION_SINGLE);
    verifyCommand(encoder, command, binary("404000111234567890123441016cf70d0a"));
    command.setType(Command.TYPE_POSITION_PERIODIC);
    command.set(Command.KEY_FREQUENCY, 100);
    verifyCommand(encoder, command, binary("40400013123456789012344102000a2f4f0d0a"));
    command.setType(Command.TYPE_SET_TIMEZONE);
    command.set(Command.KEY_TIMEZONE, "GMT+8");
    verifyCommand(encoder, command, binary("4040001412345678901234413234383030ad0d0a"));
    command.setType(Command.TYPE_REBOOT_DEVICE);
    verifyCommand(encoder, command, binary("40400011123456789012344902d53d0d0a"));
    command.setType(Command.TYPE_ALARM_GEOFENCE);
    command.set(Command.KEY_RADIUS, 1000);
    verifyCommand(encoder, command, binary("4040001312345678901234410603e87bb00d0a"));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 67 with Command

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

the class RuptelaProtocolEncoderTest method testEncode.

@Test
public void testEncode() throws Exception {
    var encoder = new RuptelaProtocolEncoder(null);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_CUSTOM);
    command.set(Command.KEY_DATA, " Setio 2,1");
    verifyCommand(encoder, command, binary("000b6c20536574696F20322C31eb3e"));
    command.set(Command.KEY_DATA, "000b890100000000007fffffff89f0");
    verifyCommand(encoder, command, binary("000b890100000000007fffffff89f0"));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 68 with Command

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

the class NoranProtocolEncoderTest method testEncode.

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

Example 69 with Command

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

the class PortmanProtocolEncoderTest method testEncodeEngineStop.

@Test
public void testEncodeEngineStop() {
    var encoder = new PortmanProtocolEncoder(null);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ENGINE_STOP);
    assertEquals("&&123456789012345,XA5\r\n", encoder.encodeCommand(command));
}
Also used : Command(org.traccar.model.Command) ProtocolTest(org.traccar.ProtocolTest) Test(org.junit.Test)

Example 70 with Command

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

the class PstProtocolEncoderTest method testEncodeEngineStop.

@Test
public void testEncodeEngineStop() {
    var encoder = new PstProtocolEncoder(null);
    Command command = new Command();
    command.setDeviceId(1);
    command.setType(Command.TYPE_ENGINE_STOP);
    verifyCommand(encoder, command, binary("860ddf790600000001060002ffffffffe42b"));
}
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