aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/protocol/HuabaoProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/HuabaoProtocolEncoderTest.java24
-rw-r--r--test/org/traccar/protocol/TmgProtocolDecoderTest.java24
3 files changed, 54 insertions, 0 deletions
diff --git a/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index 5dedbbaa6..996fa874d 100644
--- a/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -10,6 +10,12 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
HuabaoProtocolDecoder decoder = new HuabaoProtocolDecoder(new HuabaoProtocol());
+ verifyPosition(decoder, binary(
+ "7e0200002c00160128561400020000000000040001005de1f7065c6cef00000000000017011710044201040000a9002a02000030011b3101030c7e"));
+
+ verifyPosition(decoder, binary(
+ "7e0200002c00160128561400030000000000040007005de13c065c6cdb00160000000017011710054201040000a9002a02000030011b310104e47e"));
+
verifyNothing(decoder, binary(
"7e0100002d0141305678720024002c012f373031313142534a2d41362d424400000000000000000000003035363738373201d4c14238383838386d7e"));
diff --git a/test/org/traccar/protocol/HuabaoProtocolEncoderTest.java b/test/org/traccar/protocol/HuabaoProtocolEncoderTest.java
new file mode 100644
index 000000000..c29147a26
--- /dev/null
+++ b/test/org/traccar/protocol/HuabaoProtocolEncoderTest.java
@@ -0,0 +1,24 @@
+package org.traccar.protocol;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Command;
+
+public class HuabaoProtocolEncoderTest extends ProtocolTest {
+
+ @Ignore
+ @Test
+ public void testEncode() throws Exception {
+
+ HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_ENGINE_STOP);
+
+ verifyCommand(encoder, command, binary("7EA0060007001403305278017701150424154610AD7E"));
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/TmgProtocolDecoderTest.java b/test/org/traccar/protocol/TmgProtocolDecoderTest.java
new file mode 100644
index 000000000..fb2576f95
--- /dev/null
+++ b/test/org/traccar/protocol/TmgProtocolDecoderTest.java
@@ -0,0 +1,24 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class TmgProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ TmgProtocolDecoder decoder = new TmgProtocolDecoder(new TmgProtocol());
+
+ verifyPosition(decoder, text(
+ "$nor,L,868324023777431,17012017,001023,4,2830.2977,N,07705.2478,E,0.0,207.07,229.2,0.97,11,22,IDEA CELLULAR L,18,DCDE,0,4.09,12.9,00000111,00000000,1111,00.0-00.0,00.0-0.0,3.59,01.02,#"));
+
+ verifyPosition(decoder, text(
+ "$nor,L,868324023777431,17012017,001523,4,2830.2939,N,07705.2527,E,0.0,50.96,236.5,1.05,11,21,IDEA CELLULAR L,18,DCDE,0,4.09,12.8,00000111,00000000,1111,00.0-00.0,00.0-0.0,3.59,01.02,#"));
+
+ verifyPosition(decoder, text(
+ "$nor,L,869309999985699,24062015,094459,4,2826.1956,N,07659.7690,E,67.5,2.5,167,0.82,15,22,airtel,31,4441,1,4.1,12.7,00000011,00000011,1111,0.0,0.0, 21.3,SW00.01,#"));
+
+ }
+
+}