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/AtrackProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java9
-rw-r--r--src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/NavtelecomProtocolDecoderTest.java18
-rw-r--r--src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java9
-rw-r--r--src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java21
-rw-r--r--src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java3
13 files changed, 96 insertions, 1 deletions
diff --git a/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
index b329f59f3..dc3f532b6 100644
--- a/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
@@ -44,6 +44,9 @@ public class AtrackProtocolDecoderTest extends ProtocolTest {
decoder.setCustom(true);
verifyPositions(decoder, buffer(
+ "@P,7A66,153,9022,863003048505515,20210207000103,20210207000103,20210207000103,103939276,1348903,97,2,5628,8,0,0,0,0,,2000,2000,\u001a,%CI%BC,3:224:F128833445E6002C09C6\r\n"));
+
+ verifyPositions(decoder, buffer(
"@P,9493,402,143,356961075931165,1546830150,1546830151,1546830151,-88429209,44271154,54,10,0,10,1,0,0,0,1858AE010000,2000,2000,\u001A,%CI%FL%ML%VN%PD%FC%EL%ET%AT%MF%MV%BV%DT%GN%GV%ME%RL%RP%SA%SM%TR%IA%MP,0,0,2T1KR32E28C706185,0,1,0,7,251,89,118,41,0,00A5001A040800A5001A040B00A5001A040C00A5001A040900A4001C040D00A50019040900A60019040900A4001B040B00A5001A040900A7001A040E\u001A,008CFE7C03C4\u001A,356961075931165,0,0,12,0,18,5,0\n"));
verifyPositions(decoder, buffer(
diff --git a/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
index 8977cf194..efcd06218 100644
--- a/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
@@ -13,6 +13,9 @@ public class DmtProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"0255003300001b00003335333232393032373533393235310038393931353030303030303030313330343539340000000403041910780603"));
+ verifyPositions(decoder, binary(
+ "0255047a003d0035020000fbb53a0f030015fbb53a0f3c210e2145deeb051e001a0901940c070302080300000000000300060f011d1003400804180005e80f062e1c3d003602000086b93a0f03001586b93a0fe5421c21bbe1be051700c30901a50d070302080300000000000300060f011d1003bb0804180005e80f062e1c"));
+
verifyPositions(decoder, false, binary(
"025504ab013d00c21a00004829900c0300154929900cbd163617b08a94c7fa003c07032c131a0302080300000000000300060f019b14037e0e0463000558140607213d00c31a0000ca29900c030015ca29900ca3033817bbb895c71401be0603b310190302080300000000000300060f019b14036d0e0463000558140607213d00c41a0000472a900c030015472a900c8d453817423e96c7fa000200040013270302080300000000000300060f019b1403840e0463000546140606213d00c51a0000c52a900c030015c52a900c184c3817c35296c724010400050016180302080300000000000300060f019b1403750e0463000547140606213d00c61a0000462b900c030015462b900cbd8a361703b495c710018c07085a10210302080300000000000300060f019b1403630e0463000546140606213d00c71a0000c52b900c030015c52b900cf6d63517455a94c7e9004c05035a10240302080300000000000300060f019b14036e0e0463000545140606213d00c81a00004b2c900c0300154b2c900c766d3517ddf093c7320107000d00102e0302080300000000000300060f019b1403750e046300054314060521"));
diff --git a/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
index 48b74c904..08a5ec244 100644
--- a/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
@@ -11,6 +11,10 @@ public class FifotrackProtocolDecoderTest extends ProtocolTest {
FifotrackProtocolDecoder decoder = new FifotrackProtocolDecoder(null);
+ verifyAttribute(decoder, buffer(
+ "$$25,863003046473534,1,B03,OK*4D"),
+ Position.KEY_RESULT, "OK");
+
verifyPosition(decoder, buffer(
"$$118,863003046473534,258,A01,,201007231735,V,3.067783,101.672858,0,176,96,189890,0,A0,03,0,502|19|5C1|93349F,196|4E0|6C,1,*13"));
diff --git a/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
index a84c4e357..39d378322 100644
--- a/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class FreematicsProtocolDecoderTest extends ProtocolTest {
FreematicsProtocolDecoder decoder = new FreematicsProtocolDecoder(null);
+ verifyPositions(decoder, text(
+ "M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5"));
+
verifyNull(decoder, text(
"1#EV=2,TS=1871902,ID=ESP32305C06C40A24*AC"));
@@ -31,6 +34,12 @@ public class FreematicsProtocolDecoderTest extends ProtocolTest {
verifyPositions(decoder, text(
"1#0=68338,10D=79,30=1010,105=199,10C=4375,104=56,111=62,20=0;-1;95,10=6454200,A=-32.727482,B=150.150301,C=159,D=0,F=5,24=1250*7A"));
+ verifyPositions(decoder, false, text(
+ "M0ZR4X0#0:566624,24:1246,20:0;0;0*D"));
+
+ verifyNull(decoder, text(
+ "M0ZR4X0#DF=4208,SSI=-71,EV=1,TS=20866,ID=M0ZR4X0*9E"));
+
}
}
diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index 915876609..cd8a11b0d 100644
--- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
+ verifyAttributes(decoder, buffer(
+ "+RESP:GTINF,DC0103,865284049247079,gv600mg,21,89883070000007211665,22,0,11,12913,12917,4.26,0,1,,,20210216154607,1,79,,01,00,,,20210216104606,1EBE$"));
+
+ verifyPositions(decoder, buffer(
+ "+RESP:GTERI,040A00,862894022579562,gv200,00000002,,10,1,1,96.1,180,749.7,39.222692,24.165463,20210225065756,0420,0004,759C,3360,00,15529.8,,,2789,,01,00,2,2,282BD47A0B000063,1,FFE2,281FDD5D0B000057,1,FFC8,20210225065800,6974$"));
+
verifyAttribute(decoder, buffer(
"+RESP:GTERI,DE0115,865284042104863,gl500m,00000100,0,0,1,2,0.0,0,36.9,-1.844589,52.177779,20201006125701,0234,0015,0135,34A1,19,0,,79,1,,0,20201006125723,184D$"),
Position.KEY_BATTERY_LEVEL, 79);
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index eeafbbdc4..1f92f5a26 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -18,6 +18,10 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780D01086471700328358100093F040D0A"));
verifyAttribute(decoder, binary(
+ "7878151330802b00000642014f0008720000802b5ee4d4c90d0a"),
+ Position.KEY_BATTERY_LEVEL, 6);
+
+ verifyAttribute(decoder, binary(
"7878281520000000003c49434349443a38393838323339303030303039373330323635303e00020d446f260d0a"),
Position.KEY_ICCID, "89882390000097302650");
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index 552b5bb2d..e8bd92f8c 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"7E01000021013345678906000F002C012F373031313142534A2D4D3742203030303030303001D4C1423838383838B47E"));
+ verifyNotNull(decoder, binary(
+ "7e07040226046110426684002b000601005f0000000000000000000000000000000000000000000021031410530001040000000030011b310101e4020064e50101e60100e7080000000000000000eb2101cc00253510260100000000000000000000000000000000000000000000000000005f00000000004c0001000000000000000000000000000021031410531401040000000030011f310103e4020064e50101e60100e7080000000000000000eb2101cc0025351026012535100f32263d11f931000000000000000000000000000000005f00000000004c0001000000000000000000000000000021031410534001040000000030011f310104e4020064e50101e60100e7080000000000000000eb2101cc002535102601263d11f92d0000000000000000000000000000000000000000005f00000000004c00010000000000000000000000000000210314105350010400000000300118310104e4020064e50101e60100e7080000000000000000eb2101cc002535102601263d11f92e25350f6f2c263d120d2c00000000000000000000005f00000000004c0001000000000000000000000000000021031410540001040000000030011d310105e4020064e50101e60100e7080000000000000000eb2101cc002535102601263d11f93025350f6f2e263d120d2e00000000000000000000003c00000000004c0003015ae3e106c82ab900000010010b21031410540901040000000030011b310105e4020064e50101e60100e7080000000000000000f97e"));
+
verifyAttribute(decoder, binary(
"7e02000033421030000018004c000200000004000201556dcb06c4d41d000c00f100fc210118095853010400000000fe0140ff0c01cc000000002694000055d87a7e"),
Position.KEY_ALARM, Position.ALARM_TAMPERING);
@@ -109,6 +112,9 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, binary(
"7e020000220014012499170007000000000000400e012af16f02cbd2ba000000000000150101194257010400000077a97e"));
+ verifyNull(decoder, binary(
+ "7e0002000004304832546500b7ca7e"));
+
}
}
diff --git a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
index 390defe6f..043bf4d9a 100644
--- a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
@@ -13,10 +13,13 @@ public class KhdProtocolEncoderTest extends ProtocolTest {
Command command = new Command();
command.setDeviceId(1);
- command.setType(Command.TYPE_ENGINE_STOP);
+ command.setType(Command.TYPE_ENGINE_STOP);
verifyCommand(encoder, command, binary("29293900065981972d5d0d"));
+ command.setType(Command.TYPE_POSITION_SINGLE);
+ verifyCommand(encoder, command, binary("29293000065981972d540d"));
+
}
}
diff --git a/src/test/java/org/traccar/protocol/NavtelecomProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NavtelecomProtocolDecoderTest.java
new file mode 100644
index 000000000..444752fb7
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/NavtelecomProtocolDecoderTest.java
@@ -0,0 +1,18 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class NavtelecomProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ NavtelecomProtocolDecoder decoder = new NavtelecomProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "404e5443010000000000000013004e452a3e533a383636373935303331343130363839"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java
index 3a91d8482..79c7d888b 100644
--- a/src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SiwiProtocolDecoderTest.java
@@ -11,6 +11,15 @@ public class SiwiProtocolDecoderTest extends ProtocolTest {
SiwiProtocolDecoder decoder = new SiwiProtocolDecoder(null);
verifyPosition(decoder, text(
+ "$SIWI,868957040831465,44,E,,,1,1,1,16.79,0,0,5,A,17.204447,78.355087,534,44,140955,180221,11,1,15,5,4322,0,0,0,0,0,0,1.0,1.6CPTASF_6.60,0!"));
+
+ verifyPosition(decoder, text(
+ "$SIWI,868957040777510,13,E,,,0,1,1,24.15,1118097,0,18,A,16.080666,80.331451,0,29,142451,180221,24,1,15,5,4282,2269,0,0,0,0,0,1.0,1.6CPASF_6.60,0!"));
+
+ verifyPosition(decoder, text(
+ "$RTPL,1234567890123,45,E,,89917650642221590319,0,1,0,12.36,141313,0,9,A,21.981985,85.221165,804,280,105113,220420,17,1,13,5,4071,1,0,8,0,0,0,1.0,1.2CPLUS_6.52,0!"));
+
+ verifyPosition(decoder, text(
"$SIWI,9803932,23992,E,0,,0,1,1,0,5055,0,5,A,22.289887,70.807192,152,168,102922,090317,28,1,12,5,4098,1,0,13,0,0,0,1.0,3.1CHKS_4.82,0!"));
verifyPosition(decoder, text(
diff --git a/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
index c15e9e48a..b8c1291c3 100644
--- a/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class StarLinkProtocolDecoderTest extends ProtocolTest {
StarLinkProtocolDecoder decoder = new StarLinkProtocolDecoder(null);
+ decoder.setFormat("#IMEI#,#EDT#,#PDT#,#LAT#,#LONG#,#SPD#,#IGN#,#ODO#,#DUR#,#TDUR#,#LAC#,#CID#,#VIN#,#VBAT#,#EID#,#EDSC#,#DRV#,#SATU#,#CSS#,#OUT1#,#OUT2#,#CFL#");
+
+ verifyAttribute(decoder, text(
+ "$SLU0AF334,06,14260,352353088342073,210322083942,210322083940,+0937.2191,+04151.8206,000.0,0,006782,,30707,14010,11685,12.994,04.159,01,Location,0,20,64,0,0,12,0,2*7F"),
+ Position.KEY_FUEL_LEVEL, 12);
+
decoder.setFormat("#IMEI#,#EDT#,#EDSC#,#EID#,#PDT#,#LAT#,#LONG#,#SPDK#,#IGNL#,#HEAD#,#ODO#,#DUR#,#TDUR#,#VIN#,#VBAT#,#BATC#,#SATU#,#CSS#,#IN2#,#TVI#,#OUT1#,#OUT2#,#OUT3#,#OUTC#");
verifyAttributes(decoder, text(
diff --git a/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java
new file mode 100644
index 000000000..98e6863e2
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/StartekProtocolDecoderTest.java
@@ -0,0 +1,21 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class StartekProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ StartekProtocolDecoder decoder = new StartekProtocolDecoder(null);
+
+ verifyPosition(decoder, text(
+ "&&A147,021104023195429,000,0,,180106093046,A,22.646430,114.065730,8,0.9,54,86,76,326781,460|0|27B3|0EA7,27,0000000F,02,01,04E2|018C|01C8|0000,1,0104B0,01013D|02813546"));
+
+ verifyPosition(decoder, text(
+ "&&y139,860262050009146,000,0,,210323131512,A,22.678655,114.046223,14,1.1,0,231,71,5,460|0|249F|0099C257,28,0000003D,00,00,0493|0199|0000|0000,1,,33"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
index 8320b1388..191d27b8a 100644
--- a/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TopinProtocolDecoderTest.java
@@ -17,6 +17,9 @@ public class TopinProtocolDecoderTest extends ProtocolTest {
"78780d0103593390754169634d0d0a"));
verifyPosition(decoder, binary(
+ "78781510120B05030D2498038077200BE2078F0034000102030D0A"));
+
+ verifyPosition(decoder, binary(
"7878200813081A0733211608C8D1710DED1D1608DFFB710E06D51039050100286489000D0A"));
verifyPosition(decoder, binary(