aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-06-25 19:09:42 +1200
committerGitHub <noreply@github.com>2017-06-25 19:09:42 +1200
commit3a24bd121c34d4046a765cd2a55e4847df423c89 (patch)
tree0dec76e30ddff5ac42eb1a6c7e97378537da1b8d /test/org/traccar/protocol
parentc771f3b021780b5a48ebd5998b27803456794c9e (diff)
parente450c36389fed6e32a6b7e9fb47c739a425e4df2 (diff)
downloadtraccar-server-3a24bd121c34d4046a765cd2a55e4847df423c89.tar.gz
traccar-server-3a24bd121c34d4046a765cd2a55e4847df423c89.tar.bz2
traccar-server-3a24bd121c34d4046a765cd2a55e4847df423c89.zip
Merge pull request #3286 from ckrey/tk013-commands
Tk103 commands
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolEncoderTest.java79
1 files changed, 79 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
index e934de04b..afc3b2387 100644
--- a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
@@ -20,4 +20,83 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
+ @Test
+ public void testEncodePositionSingle() throws Exception {
+
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_POSITION_SINGLE);
+
+ Assert.assertEquals("(123456789012345AP00)", encoder.encodeCommand(command));
+
+ }
+
+ @Test
+ public void testEncodePositionPeriodic() throws Exception {
+
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_POSITION_PERIODIC);
+ command.set(Command.KEY_FREQUENCY, 60);
+
+ Assert.assertEquals("(123456789012345AR00003C0000)", encoder.encodeCommand(command));
+
+ }
+
+ @Test
+ public void testEncodePositionStop() throws Exception {
+
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_POSITION_STOP);
+
+ Assert.assertEquals("(123456789012345AR0000000000)", encoder.encodeCommand(command));
+
+ }
+
+ @Test
+ public void testEncodeGetVersion() throws Exception {
+
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_GET_VERSION);
+
+ Assert.assertEquals("(123456789012345AP07)", encoder.encodeCommand(command));
+
+ }
+
+ @Test
+ public void testEncodeRebootDevice() throws Exception {
+
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_REBOOT_DEVICE);
+
+ Assert.assertEquals("(123456789012345AT00)", encoder.encodeCommand(command));
+
+ }
+
+ @Test
+ public void testEncodeSetOdometer() throws Exception {
+
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_SET_ODOMETER);
+
+ Assert.assertEquals("(123456789012345AX01)", encoder.encodeCommand(command));
+
+ }
+
}