use of org.traccar.model.Command in project traccar by tananaev.
the class Tk103ProtocolEncoderTest method testEncodeRebootDeviceAlternative.
@Test
public void testEncodeRebootDeviceAlternative() {
var encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_REBOOT_DEVICE);
assertEquals("[begin]sms2,88888888,[end]", encoder.encodeCommand(command));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class Tk103ProtocolEncoderTest method testEncodePositionStop.
@Test
public void testEncodePositionStop() {
var encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_STOP);
assertEquals("(123456789012345AR0000000000)", encoder.encodeCommand(command));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class PretraceProtocolEncoderTest method testEncodeCustom.
@Test
public void testEncodeCustom() throws Exception {
var encoder = new PretraceProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_CUSTOM);
command.set(Command.KEY_DATA, "D21012");
assertEquals("(123456789012345D21012^44)", encoder.encodeCommand(command));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class Pt502ProtocolEncoderTest method testEncodeOutputControl.
@Test
public void testEncodeOutputControl() throws Exception {
var encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
command.set(Command.KEY_INDEX, 2);
command.set(Command.KEY_DATA, "1");
assertEquals("#OPC2,1\r\n", encoder.encodeCommand(command));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class Pt502ProtocolEncoderTest method testEncodeAlarmSpeed.
@Test
public void testEncodeAlarmSpeed() throws Exception {
var encoder = new Pt502ProtocolEncoder(null);
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