use of org.traccar.model.Command in project traccar by traccar.
the class H02ProtocolEncoderTest method testEngineResumeEncode.
@Test
public void testEngineResumeEncode() throws Exception {
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_RESUME);
assertEquals("*HQ,123456789012345,S20,010203,0,0#", encoder.encodeCommand(command, time));
}
use of org.traccar.model.Command in project traccar by traccar.
the class H02ProtocolEncoderTest method testPositionPeriodicEncode.
@Test
public void testPositionPeriodicEncode() throws Exception {
Command command = new Command();
command.setDeviceId(1);
command.set(Command.KEY_FREQUENCY, 10);
command.setType(Command.TYPE_POSITION_PERIODIC);
assertEquals("*HQ,123456789012345,S71,010203,22,10#", encoder.encodeCommand(command, time));
}
use of org.traccar.model.Command in project traccar by traccar.
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 traccar.
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 traccar.
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