use of org.traccar.model.Command in project traccar by tananaev.
the class Pt502ProtocolEncoderTest method testEncodeOutputControl.
@Test
public void testEncodeOutputControl() throws Exception {
Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
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 RuptelaProtocolEncoderTest method testEncode.
@Test
public void testEncode() throws Exception {
RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder();
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"));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class Tk103ProtocolEncoderTest method testEncodeRebootDeviceAlternative.
@Test
public void testEncodeRebootDeviceAlternative() throws Exception {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(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 testEncodeSetConnectionAlternative.
@Test
public void testEncodeSetConnectionAlternative() throws Exception {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_SET_CONNECTION);
command.set(Command.KEY_SERVER, "1.2.3.4");
command.set(Command.KEY_PORT, "5555");
assertEquals("[begin]sms2,*setip*1*2*3*4*5555*,[end]", encoder.encodeCommand(command));
}
use of org.traccar.model.Command in project traccar by tananaev.
the class Tk103ProtocolEncoderTest method testEncodeRebootDevice.
@Test
public void testEncodeRebootDevice() throws Exception {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_REBOOT_DEVICE);
assertEquals("(123456789012345AT00)", encoder.encodeCommand(command));
}
Aggregations