aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol
diff options
context:
space:
mode:
authorChristoph Krey <krey.christoph@gmail.com>2017-06-24 09:20:41 +0200
committerChristoph Krey <krey.christoph@gmail.com>2017-06-24 09:20:41 +0200
commit6790c1b7e78543d427d8b93105e56e719f8ab6af (patch)
treec6576456e0514315521110928be1eecdafae6ace /test/org/traccar/protocol
parenta0f389cf98e42a1794355be2a44167f61ad43557 (diff)
downloadtrackermap-server-6790c1b7e78543d427d8b93105e56e719f8ab6af.tar.gz
trackermap-server-6790c1b7e78543d427d8b93105e56e719f8ab6af.tar.bz2
trackermap-server-6790c1b7e78543d427d8b93105e56e719f8ab6af.zip
add TYPE_POSITION_PERIODIC, TYPE_POSITION_STOP, TYPE_GET_VERSION, TYPE_REBOOT_DEVICE, and TYPE_SET_ODOMETER to Tk103 protocol
Diffstat (limited to 'test/org/traccar/protocol')
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolEncoderTest.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
index b198612b0..68a281003 100644
--- a/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolEncoderTest.java
@@ -50,4 +50,70 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
+ @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));
+
+ }
+
}