use of org.traccar.model.Command in project traccar by tananaev.
the class KhdProtocolEncoderTest method testEncode.
@Test
public void testEncode() throws Exception {
KhdProtocolEncoder encoder = new KhdProtocolEncoder();
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
verifyCommand(encoder, command, binary("29293900065981972d5d0d"));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class MeiligaoProtocolEncoderTest method testEncode.
@Test
public void testEncode() throws Exception {
MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder();
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"));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class MiniFinderProtocolEncoderTest method testEncode.
@Test
public void testEncode() throws Exception {
MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder();
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_SET_TIMEZONE);
command.set(Command.KEY_TIMEZONE, "GMT+1");
assertEquals("123456L+01", encoder.encodeCommand(command));
command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_SOS_NUMBER);
command.set(Command.KEY_INDEX, 2);
command.set(Command.KEY_PHONE, "1111111111");
assertEquals("123456C1,1111111111", encoder.encodeCommand(command));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class NoranProtocolEncoderTest method testEncode.
@Test
public void testEncode() throws Exception {
NoranProtocolEncoder encoder = new NoranProtocolEncoder();
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
verifyCommand(encoder, command, binary("0d0a2a4b5700440002000000000000002a4b572c3030302c3030372c3030303030302c302300000000000000000000000000000000000000000000000000000000000d0a"));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class Pt502ProtocolEncoderTest method testEncodeAlarmSpeed.
@Test
public void testEncodeAlarmSpeed() throws Exception {
Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ALARM_SPEED);
command.set(Command.KEY_DATA, 120);
assertEquals("#SPD120\r\n", encoder.encodeCommand(command));
}
Aggregations