aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java7
-rw-r--r--src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java22
-rw-r--r--src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/Pt215FrameDecoderTest.java27
-rw-r--r--src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java21
-rw-r--r--src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java108
-rw-r--r--src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java38
-rw-r--r--src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java27
-rw-r--r--src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java4
14 files changed, 190 insertions, 93 deletions
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index d31cac534..fd5d55a50 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -17,11 +17,18 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"78780D01086471700328358100093F040D0A"));
+ verifyAttributes(decoder, binary(
+ "797900B2700000000102003500010400330012000000000000000000000000000000000000003400061354A48DFF00003400061154A48E56000011000A000000000000000000000001000803537601000282180002000802140743044211890003000A89340752000038689636001800020182002B000116002C000454A4FF350009000100000A0001010028000100002E000400000000002A00010000290004000000000030000A000101680014016802D00000B38F0D0A"));
+
verifyAttribute(decoder, binary(
"78780c95130a071223200100013ad10d0a"),
Position.KEY_ALARM, Position.ALARM_GENERAL);
verifyAttribute(decoder, binary(
+ "78783c3400000000130a1906011105029b4d450b1828d5001c00000000009e7d014e140fc000004e990000000004c301a442210000020101c001c0000591aa0d"),
+ Position.PREFIX_ADC + 1, 4.48);
+
+ verifyAttribute(decoder, binary(
"797900a87000000001020035000101003300125d7e3a180600d504b598f708814b3a001d1500340006125d7e39dc000011000a012e02620000000000000001000803537601000129800002000803102608593397620003000a89012608522933976266001800020172002b000114002c00045d7df3c70009000106000a000109002800010d002e00040000f25d002a000111002900040000017e0030000a000100b4000a00b402d0000591250d0a"),
Position.KEY_ALARM, Position.ALARM_REMOVING);
diff --git a/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
index 31e4f2dee..687a2a68c 100644
--- a/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, buffer(
"*HQ,135790246811220,HTBT#"));
+ verifyPosition(decoder, buffer(
+ "*HQ,865205035331981,V1,132926,A,1935.3933,N,07920.4134,E, 3.34,342,280519,FFFFFFFF#"));
+
verifyPosition(decoder, binary(
"24702802061601234020031910125482600612695044000000ffffbbff000000000000000001760d04e2c9934d"));
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index d4ae3b50c..8050d07a1 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class HuabaoProtocolDecoderTest extends ProtocolTest {
@@ -13,6 +14,13 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"7E01000021013345678906000F002C012F373031313142534A2D4D3742203030303030303001D4C1423838383838B47E"));
+ verifyAttribute(decoder, binary(
+ "7e02000054086031592715006e0000000000000002015a3c1a06c8733800000000000019103022183633362a4d30302c34352c31313338363030526f79314f70656e26303030303030303030303030263132333435363738393031323334353623ff7e"),
+ Position.KEY_BATTERY, 3.86);
+
+ verifyPosition(decoder, binary(
+ "7e0200004e08026300003006480000000000000007021477d90841920700000000005019110515194001040000167130011631010cd00400000400d3020027d4013fd6143839363130313832303030343833363532383330da0104897e"));
+
verifyPosition(decoder, binary(
"7e020000400303000002280042000000000000000301618ab406c31ec800000000000518092116145701040000047830011031010aeb16000c00b28986011780108622216500060089ffffffffc37e"));
diff --git a/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java
new file mode 100644
index 000000000..12f0106f9
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/OutsafeProtocolDecoderTest.java
@@ -0,0 +1,22 @@
+package org.traccar.protocol;
+
+import io.netty.handler.codec.http.HttpMethod;
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class OutsafeProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ OutsafeProtocolDecoder decoder = new OutsafeProtocolDecoder(null);
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer("{\"device\":\"862061044762093\",\"owner\":\"\",\"data\":{\"cmd\":\"GEO\",\"ms1\":82,\"ms2\":80,\"ms3\":5266,\"ms4\":-68,\"observation\":\"$NMEA 323455\",\"content\":null},\"time\":null,\"origin\":\"TCP\",\"latitude\":19.334734,\"longitude\":-99.307236,\"altitude\":2000,\"heading\":0,\"rssi\":123}")));
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer("{\"device\":\"1e09d88a-fe8e-4dee-90b9-6297088ff3de\",\"owner\":\"\",\"data\":{\"cmd\":\"GEO\",\"ms1\":82,\"ms2\":80,\"ms3\":5266,\"ms4\":-68,\"observation\":\"$NMEA 323455\",\"content\":null},\"time\":null,\"origin\":\"TCP\",\"latitude\":19.334734,\"longitude\":-99.307236,\"altitude\":2000,\"heading\":0,\"rssi\":123}")));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java
index 582ed9a5a..0fe3a3a01 100644
--- a/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class PluginProtocolDecoderTest extends ProtocolTest {
@@ -10,6 +11,13 @@ public class PluginProtocolDecoderTest extends ProtocolTest {
PluginProtocolDecoder decoder = new PluginProtocolDecoder(null);
+ verifyAttribute(decoder, text(
+ "$$STATUS,60925,20190829123115,28.254151,-25.860605,0.0,0,0,-1,2,0.000,13699,0.00,0,0,28.4,23.4,0,0,0,0,0,0,0,0,0"),
+ Position.PREFIX_TEMP + 1, 28.4);
+
+ verifyPosition(decoder, text(
+ "$$STATUS,60550,20191014084650,28.254258,-25.860355,0.0,236,0,-1,2,7472.967,13697,0.00,0,0,0.0,0.0,0,0,0,0,0,0,0,0,0"));
+
verifyPosition(decoder, text(
"$$STATUS,fleet40,20190704122622,26.259431,-29.027889,0,9,0,-1,2,19719,805315969,0,0,0"));
diff --git a/src/test/java/org/traccar/protocol/Pt215FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Pt215FrameDecoderTest.java
deleted file mode 100644
index 2e3600b99..000000000
--- a/src/test/java/org/traccar/protocol/Pt215FrameDecoderTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.traccar.protocol;
-
-import org.junit.Test;
-import org.traccar.ProtocolTest;
-
-public class Pt215FrameDecoderTest extends ProtocolTest {
-
- @Test
- public void testDecode() throws Exception {
-
- Pt215FrameDecoder decoder = new Pt215FrameDecoder();
-
- verifyFrame(
- binary("58580d010359339075799656010d0a"),
- decoder.decode(null, null, binary("58580d010359339075799656010d0a")));
-
- verifyFrame(
- binary("5858071340010819640d0a"),
- decoder.decode(null, null, binary("5858071340010819640d0a")));
-
- verifyFrame(
- binary("585815101309160d0f0c9902b7015405f0e82404347afff7000d0a"),
- decoder.decode(null, null, binary("585815101309160d0f0c9902b7015405f0e82404347afff7000d0a")));
-
- }
-
-}
diff --git a/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
index a2cb021ef..4ab343876 100644
--- a/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
@@ -13,6 +13,9 @@ public class SigfoxProtocolDecoderTest extends ProtocolTest {
SigfoxProtocolDecoder decoder = new SigfoxProtocolDecoder(null);
verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer("{ \"device\" : \"33827B\", \"data\" : \"1f03198e63807f08836402ff\", \"time\" : \"1574346702\", \"snr\" : \"8.82\", \"station\" : \"140A\", \"avgSnr\" : \"11.28\", \"lat\" : \"52.0\", \"lng\" : \"-8.0\", \"rssi\" : \"-141.00\", \"seqNumber\" : \"3662\"}")));
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
buffer("{ \"device\": \"49F941\", \"location\": {\"lat\":19.48954345634299,\"lng\":-99.09340606338463,\"radius\":1983,\"source\":2,\"status\":1} }")));
verifyAttribute(decoder, request(HttpMethod.POST, "/",
diff --git a/src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java
new file mode 100644
index 000000000..b040d4ecf
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/SolarPoweredProtocolDecoderTest.java
@@ -0,0 +1,21 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class SolarPoweredProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ SolarPoweredProtocolDecoder decoder = new SolarPoweredProtocolDecoder(null);
+
+ verifyPosition(decoder, binary(
+ "7e850256553304728011003e811319130b0b11211f01a2e6be091fa0e10114cc1582020f00831000004e7400000044000000223819020c84114161726f6e34475630312d313931303331127e"));
+
+ verifyPosition(decoder, binary(
+ "7e850256553304728011003e811319130b0d160e2901a2e66f091fa0ab0014c39482020f0083100002f42c00000287000000fc2719021484114161726f6e34475630312d313931303331e67e"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
index ccd9139f4..1c84b5c89 100644
--- a/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechFrameDecoderTest.java
@@ -11,6 +11,10 @@ public class SuntechFrameDecoderTest extends ProtocolTest {
SuntechFrameDecoder decoder = new SuntechFrameDecoder();
verifyFrame(
+ binary("81004e05200013383fffff3401000301130a0512080400000000000000000000000047f9d5846a06810072225214010100020300a8002604c1000004b000000470000025a100000000000025c4000000a6"),
+ decoder.decode(null, null, binary("81004e05200013383fffff3401000301130a0512080400000000000000000000000047f9d5846a06810072225214010100020300a8002604c1000004b000000470000025a100000000000025c4000000a6")));
+
+ verifyFrame(
binary("5354363030414c563b303038373238333237"),
decoder.decode(null, null, binary("5354363030414c563b3030383732383332370d")));
diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
index 304bc0fed..da1ef8ab4 100644
--- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
@@ -15,13 +15,17 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
decoder.setIncludeAdc(true);
decoder.setIncludeTemp(true);
- verifyPosition(decoder, text(
+ verifyAttribute(decoder, buffer(
+ "ST600STT;008350848;35;523;20191102;13:49:46;0bf14fdb;334;20;2f19;57;+20.466737;-100.825455;000.006;000.00;11;1;10274175;11.36;00000000;1;0300;018353;4.2;1;0.00;;;;00000000000000;0;28EE56B911160234:+13.7;:;:"),
+ Position.PREFIX_TEMP + 2, 13.7);
+
+ verifyPosition(decoder, buffer(
"ST300STT;205173382;07;564;20160322;23:23:18;232e19;+19.288278;-099.128750;000.122;000.00;9;1;478391;11.53;000100;1;9498;079324;4.3;1;0.00;0.00;0.00;00000000000000;0;2898E16006000058:-20.8;2861626006000039:+2.5;:"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST300EVT;205173382;07;564;20160322;23:23:18;232e19;+19.288278;-099.128750;000.122;000.00;9;1;478391;11.53;000100;2;1;9498;079324;4.3;1;0.00;0.00;0.00;00000000000000;0;2898E16006000058:-20.8;2861626006000039:+2.5;:"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST600STT;008349958;35;523;20181112;00:49:30;0bf10d4e;334;20;2f19;22;+20.552718;-100.824478;050.021;095.41;12;1;1303603;14.30;10000000;4;8911;001987;4.1;0;0.00;;;;00000000000000;0;2826C8A70800000C:+26.6;:;:"));
}
@@ -34,7 +38,7 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
decoder.setHbm(true);
decoder.setIncludeRpm(true);
- verifyAttribute(decoder, text(
+ verifyAttribute(decoder, buffer(
"ST300STT;907131077;04;706;20190227;23:59:34;cc719;-12.963490;-038.499587;000.067;000.00;7;1;57095;12.50;000000;1;0337;000207;0.0;1;0;012E717F010000;1"),
Position.KEY_RPM, 0);
@@ -47,7 +51,7 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
decoder.setHbm(true);
- verifyAttribute(decoder, text(
+ verifyAttribute(decoder, buffer(
"ST300ALT;007239104;40;313;20190112;01:07:16;c99139;+04.703287;-074.148897;000.000;189.72;21;1;425512;12.61;100000;33;003188;4.1;1"),
Position.KEY_HOURS, 3188 * 60000L);
@@ -58,135 +62,145 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null);
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
+ "ST390STT;007579860;18;302;20191101;11:28:51;145b49;-23.267030;-047.298142;000.000;000.00;9;1;5;11.93;000000;2;0003;000002;4.03;0;20010000;22470;724;05;-58;5211;1"));
+
+ verifyAttribute(decoder, binary(
+ "81004e05200013383fffff3401000300130b020b2a0500000000000000000000000047f9ec846a06500000000012010200000123a1002904ba00010fb40000000000000000000000000000000000005989"),
+ Position.KEY_IGNITION, false);
+
+ verifyPosition(decoder, binary(
+ "81004e05200013383fffff3401000301130a0512080400000000000000000000000047f9d5846a06810072225214010100020300a8002604c1000004b000000470000025a100000000000025c4000000a6"));
+
+ verifyPosition(decoder, buffer(
"ALT;0520000295;3FFFFF;52;1.0.2;0;20190703;01:03:24;00004697;732;101;0002;59;+4.682583;-74.128142;0.00;0.00;6;1;00000000;00000000;9;1;;4.1;12.92;103188"));
- verifyAttribute(decoder, text(
+ verifyAttribute(decoder, buffer(
"ST300UEX;109003241;08;1026;20190425;17:36:04;04402;+04.722553;-074.052583;000.020;000.00;10;1;0;12.04;010000;51;CabAVL\"CabMensaje,0,58.5,-1.0,,,FinMensaje\"FinAVL\r\n;B1;0000000000;4.1;1"),
"fuel1", 58.5);
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST600UEX;008728327;20;520;20190218;10:56:51;0bf1a893;334;20;2f19;18;+20.514195;-100.743597;000.015;000.00;9;1;3720808;12.89;000000;44;t_0=0D;N_0=0551.0;t_1=14;N_1=039F.0;Q_D=0B\r\n;9E;010440;4.1;1"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST600UEX;100850000;01;010;20081017;07:41:56;0000004f;450;20;0023;24;+37.478519;+126.886819;000.012;000.00;9;1;0;15.30;001100;25;Welcome to Suntech World!;12;0;4.5;1"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST300STT;007238270;40;313;20190220;12:05:04;c99e48;+04.644623;-074.076922;010.390;202.77;20;1;997100;14.10;100000;2;8384;003634;4.1;1"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST300STT;109002029;08;1080;20190220;13:00:55;85405;+04.645710;-074.078525;007.760;005.19;10;1;6520802;13.86;100100;4;1716;0000039863;4.1;1;0.00;0000;0000;0;0"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200STT;608945;129;20190215;15:04:53;3dce071558;+22.006721;-098.771016;001.198;000.00;11;1;2632589;12.21;010000;1;3211"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST410STT;007272376;408;01;10217;732;103;-87;51511;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;3.8;1;2503;6;20181031;20:12:58;+04.741277;-074.048238;052.375;189.87;20;1"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST410STT;007272376;408;01;21651;732;123;-65;1824;1;21654;732;123;1824;0;0;22542;732;123;1824;0;0;21656;732;123;1824;0;0;21655;732;123;1824;0;0;22541;732;123;1824;0;0;0;0;0;0;0;0;3.7;1;0156;1;20180816;05:18:52;+04.722322;-074.052776;000.074;000.00;10;1"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST600STT;008084783;20;419;20180308;18:00:36;0032cc3e;736;3;445c;41;-16.530023;-068.084267;018.640;267.99;10;1;11655;13.33;100000;2;0336;000061;4.5;0;0.00"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST600STT;107850496;20;419;20180227;14:30:45;00462b08;736;3;4524;50;-16.479091;-068.119119;000.346;000.00;4;1;0;13.89;000000;1;0223;000003;0.0;0;0.00"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST600STT;100850000;01;010;20081017;07:41:56;0000004f;450;20;0023;24;+37.478519;+126.886819;000.012;000.00;9;1;0;15.30;00110000;1;0072;0;4.5;1;12.35"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"STT;100850000;3FFFFF;26;010;1;20161117;08:37:39;0000004F;450;0;0014;20;+37.479323;+126.887827;62.03;65.43;10;1;00000101;00001000;1;2;0492"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"STT;6009999006;3FFFFF;26;398;0;20170827;20:04:37;087d4760;310;410;0ba0;23;+40.123420;-074.995971;000.031;000.00;8;1;00000001;00000000;1;1;0006"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST500STT;205450135;07;843;20170816;23:24:45;+19.338432;-099.179817;000.283;000.00;6;1;141121;12.89;0;0;1;4659;002.795;0;001.891;611;4.0"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST300STT;205170303;12;561;20170816;09:10:34;173f53;+19.082370;-098.214287;006.776;000.00;0;0;52982186;12.75;100000;2;6328;155747;4.2;1;0.00;0;0.00;0.00;00000000000000;0;28F2B7600600005D:+5.2;:;:"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Location;205576803;500;20170319;12:18:17;-22.846014;-046.322176;000.000;000.00;0;3.8;0;1;9159"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Emergency;205576803;500;20170319;12:15:22;-22.846014;-046.322176;000.000;000.00;0;2"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Location;205576803;500;20170312;12:56:52;-22.846014;-046.322176;000.000;000.00;0;3.8;0;0;0019"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST300STT;100850000;01;010;20081017;07:41:56;00100;+37.478519;+126.886819;000.012;000.00;9;1;0;15.30;001100;1;0072;0;4.5;1;1750;012497F1160000;1;004f001454;450;00;-320;20;255;1"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST300STT;205589913;05;527;20170304;02:21:33;be139;-25.398868;-049.325636;000.476;000.00;6;1;427;12.57;100000010;1;0172;017.159;0;002.327;12;4.0"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200STT;638947;803;20170117;07:40:44;5d309;-01.287213;-047.917462;000.035;000.00;10;1;2036194;12.57;000000;1;0376;010360;4.2;1"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST300ALT;205174410;14;712;20110101;00:00:07;00000;+20.593923;-100.336716;000.000;000.00;0;0;0;16.57;000000;81;000000;4.0;0;0.00;0000;0000;0;0"));
- verifyNull(decoder, text(
+ verifyNull(decoder, buffer(
"SA200ALV;317652"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Alert;123456;410;20141018;18:30:12;+37.478774;+126.889690;000.000;000.00;0;4.0;1;6002"),
position("2014-10-18 18:30:12.000", false, 37.47877, 126.88969));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Alert;123456;410;20141018;18:30:12;+37.478774;+126.889690;000.000;000.00;0;4.0;1;6002;02;0;0310000100;450;01;-282;70;255;3;0"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200STT;317652;042;20120718;15:37:12;16d41;-15.618755;-056.083241;000.024;000.00;8;1;41548;12.17;100000;2;1979"),
position("2012-07-18 15:37:12.000", true, -15.61876, -56.08324));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200STT;317652;042;20120721;19:04:30;16d41;-15.618743;-056.083221;000.001;000.00;12;1;41557;12.21;000000;1;3125"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200STT;317652;042;20120722;00:24:23;4f310;-15.618767;-056.083214;000.011;000.00;11;1;41557;12.21;000000;1;3205"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200STT;315198;042;20120808;20:37:34;3fac25;-15.618731;-056.083216;000.007;000.00;12;1;48;0.00;000000;1;0127"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200STT;315198;042;20120809;13:43:34;4f310;-15.618709;-056.083223;000.025;000.00;8;1;49;12.10;100000;2;0231"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200EMG;317652;042;20120718;15:35:41;16d41;-15.618740;-056.083252;000.034;000.00;8;1;41548;12.17;110000;1"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200ALT;317652;042;20120829;14:25:58;16d41;-15.618770;-056.083242;000.029;000.00;0;0;2404240;0.00;000000;10"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"SA200STT;430070;133;20130615;22:22:32;151347;+02.860514;-060.653351;000.003;000.00;12;1;0;12.39;000000;1;0208"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Location;344506;017;20130727;14:10:00;-25.398714;-049.296818;000.187;000.00;1;4.32;1;1;0001"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST300STT;205027329;03;374;20150108;17:54:42;177b38;-23.566052;-046.477588;000.000;000.00;0;0;0;12.11;000000;1;0312"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Emergency;205283272;500;20150716;19:12:01;-23.659019;-046.695403;000.602;000.00;0;4.2;1;1;02;10820;2fdb090736;724;05;0;2311;255;0;100"));
decoder.setProtocolType(1);
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Location;907510186;552;20180504;23:15:45;3af54e5331;+19.301833;-099.190657;000.246;000.00;1;28462;80;1;0;0423;02;334;05;-215;20051;1;4;100"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Alert;485195;20170409;22:37:41;3be0133057;+24.882410;-107.509152;000.070;000.00;1;286734;72;02;295;05;-415;4912;255;10;10"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Location;485195;528;20170410;01:18:57;f1dd134840;+24.787139;-107.434679;000.020;000.00;1;286734;100;1;0;0188;02;295;05;-339;4936;255;4;74"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Location;560266;500;20161207;21:33:11;af910be101;-25.504234;-049.278003;000.080;000.00;1;10054889;70;1;1;1311;02;724;06;-317;3041;2;10;92"));
- verifyPosition(decoder, text(
+ verifyPosition(decoder, buffer(
"ST910;Emergency;238569;528;20170403;00:02:09;7574160020;+19.661292;-099.144473;000.176;000.00;1;228638;1"));
}
diff --git a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
index d1dad8c92..82e0e0d88 100644
--- a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
@@ -23,7 +23,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeEngineStop() throws Exception {
+ public void testEncodeEngineStop() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -36,7 +36,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionSingle() throws Exception {
+ public void testEncodePositionSingle() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -49,7 +49,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionPeriodic() throws Exception {
+ public void testEncodePositionPeriodic() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -63,7 +63,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionStop() throws Exception {
+ public void testEncodePositionStop() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -76,7 +76,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeGetVersion() throws Exception {
+ public void testEncodeGetVersion() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -89,7 +89,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeRebootDevice() throws Exception {
+ public void testEncodeRebootDevice() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -102,7 +102,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSetOdometer() throws Exception {
+ public void testEncodeSetOdometer() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -115,7 +115,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionSingleAlternative() throws Exception {
+ public void testEncodePositionSingleAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -128,7 +128,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionPeriodicAlternative() throws Exception {
+ public void testEncodePositionPeriodicAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -141,7 +141,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodePositionStopAlternative() throws Exception {
+ public void testEncodePositionStopAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -154,7 +154,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeGetVersionAlternative() throws Exception {
+ public void testEncodeGetVersionAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -167,7 +167,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeRebootDeviceAlternative() throws Exception {
+ public void testEncodeRebootDeviceAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -180,7 +180,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeIdentificationAlternative() throws Exception {
+ public void testEncodeIdentificationAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -193,7 +193,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSosOnAlternative() throws Exception {
+ public void testEncodeSosOnAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -207,7 +207,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSosOffAlternative() throws Exception {
+ public void testEncodeSosOffAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -221,7 +221,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeCustom() throws Exception {
+ public void testEncodeCustom() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
@@ -235,7 +235,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeCustomAlternative() throws Exception {
+ public void testEncodeCustomAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -249,7 +249,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSetConnectionAlternative() throws Exception {
+ public void testEncodeSetConnectionAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
@@ -264,7 +264,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
}
@Test
- public void testEncodeSosNumberAlternative() throws Exception {
+ public void testEncodeSosNumberAlternative() {
Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
diff --git a/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
new file mode 100644
index 000000000..08bc8f699
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
@@ -0,0 +1,27 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class TopinProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ TopinProtocolDecoder decoder = new TopinProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "78780d0103593390754169634d0d0a"));
+
+ verifyNotNull(decoder, binary(
+ "7878001719111120141807019456465111aa3c465111ab464651c1a550465106b150465342f750465342f65a465111a95a000d0a"));
+
+ verifyPosition(decoder, binary(
+ "787812100a03170f32179c026b3f3e0c22ad651f34600d0a"));
+
+ verifyAttributes(decoder, binary(
+ "78780713514d0819640d0a"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
index e43ff322e..e758725f2 100644
--- a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class UproProtocolDecoderTest extends ProtocolTest {
UproProtocolDecoder decoder = new UproProtocolDecoder(null);
+ verifyPosition(decoder, buffer(
+ "*HQ201861909268000132,BA&A1820223307024309650492530000311019&B0100000000&F0000&V0036&R0500&J000182&M0052&W00000091&I231026027BD39090827BD5ACA04&X(501E0)(B0000)(E0136)(J01E0)(L3)(k8937204016201240376F)&K00200&T85&N01#"));
+
verifyAttribute(decoder, buffer(
"*VK200867282036729446,BA&A1759265051877702037465660022210819&B0000000000&W00&G000030&M830&N26&O1706&o11&T0783#"),
Position.KEY_BATTERY_LEVEL, 83.0);
diff --git a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
index 798213c7b..a4a795050 100644
--- a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
@@ -78,6 +78,10 @@ public class WatchProtocolEncoderTest extends ProtocolTest {
command.set(Command.KEY_TIMEZONE, "GMT-11:30");
verifyFrame(buffer("[CS*123456789012345*0009*LZ,,-11.5]"), encoder.encodeCommand(null, command));
+ command.set(Command.KEY_LANGUAGE, 0);
+ command.set(Command.KEY_TIMEZONE, "GMT+05:45");
+ verifyFrame(buffer("[CS*123456789012345*000a*LZ,0,+5.75]"), encoder.encodeCommand(null, command));
+
}
}