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/TestIdentityManager.java15
-rw-r--r--src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java25
-rw-r--r--src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java22
-rw-r--r--src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java10
-rw-r--r--src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java25
-rw-r--r--src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java12
-rw-r--r--src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java9
-rw-r--r--src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java13
-rw-r--r--src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java26
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java24
-rw-r--r--src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java9
-rw-r--r--src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java25
-rw-r--r--src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java21
-rw-r--r--src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java37
-rw-r--r--src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java19
-rw-r--r--src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java30
-rw-r--r--src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java32
-rw-r--r--src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java27
-rw-r--r--src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/Pt215FrameDecoderTest.java27
-rw-r--r--src/test/java/org/traccar/protocol/Pt215ProtocolDecoderTest.java21
-rw-r--r--src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java14
-rw-r--r--src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java21
-rw-r--r--src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java26
-rw-r--r--src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java14
-rw-r--r--src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java7
-rw-r--r--src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java5
-rw-r--r--src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java13
-rw-r--r--src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java23
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java54
-rw-r--r--src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java4
-rw-r--r--src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java17
-rw-r--r--src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java7
-rw-r--r--src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java2
-rw-r--r--src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java6
-rw-r--r--src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java8
-rw-r--r--src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java5
83 files changed, 705 insertions, 141 deletions
diff --git a/src/test/java/org/traccar/TestIdentityManager.java b/src/test/java/org/traccar/TestIdentityManager.java
index 0f7405dbd..af5dd22df 100644
--- a/src/test/java/org/traccar/TestIdentityManager.java
+++ b/src/test/java/org/traccar/TestIdentityManager.java
@@ -30,6 +30,11 @@ public final class TestIdentityManager implements IdentityManager {
}
@Override
+ public String getDevicePassword(long id, String protocol, String defaultPassword) {
+ return defaultPassword;
+ }
+
+ @Override
public Position getLastPosition(long deviceId) {
return null;
}
@@ -41,31 +46,31 @@ public final class TestIdentityManager implements IdentityManager {
@Override
public boolean lookupAttributeBoolean(
- long deviceId, String attributeName, boolean defaultValue, boolean lookupConfig) {
+ long deviceId, String attributeName, boolean defaultValue, boolean lookupServer, boolean lookupConfig) {
return defaultValue;
}
@Override
public String lookupAttributeString(
- long deviceId, String attributeName, String defaultValue, boolean lookupConfig) {
+ long deviceId, String attributeName, String defaultValue, boolean lookupServer, boolean lookupConfig) {
return "alarm,result";
}
@Override
public int lookupAttributeInteger(
- long deviceId, String attributeName, int defaultValue, boolean lookupConfig) {
+ long deviceId, String attributeName, int defaultValue, boolean lookupServer, boolean lookupConfig) {
return defaultValue;
}
@Override
public long lookupAttributeLong(
- long deviceId, String attributeName, long defaultValue, boolean lookupConfig) {
+ long deviceId, String attributeName, long defaultValue, boolean lookupServer, boolean lookupConfig) {
return defaultValue;
}
@Override
public double lookupAttributeDouble(
- long deviceId, String attributeName, double defaultValue, boolean lookupConfig) {
+ long deviceId, String attributeName, double defaultValue, boolean lookupServer, boolean lookupConfig) {
return defaultValue;
}
diff --git a/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
index cb0a31ceb..fd6214c57 100644
--- a/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/AdmProtocolEncoderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2019 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Anatoliy Golubev (darth.naihil@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +27,7 @@ public class AdmProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- AdmProtocolEncoder encoder = new AdmProtocolEncoder();
+ AdmProtocolEncoder encoder = new AdmProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java
index 793b2c646..489024ed5 100644
--- a/src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AquilaProtocolDecoderTest.java
@@ -51,29 +51,4 @@ public class AquilaProtocolDecoderTest extends ProtocolTest {
}
- @Test
- public void testDecodeB() throws Exception {
-
- AquilaProtocolDecoder decoder = new AquilaProtocolDecoder(null);
-
- verifyPosition(decoder, text(
- "$Header,nliven,EMR,861693034634154,NM,09112017155133,A,12.976495,N,77.549713,E,906.0,0.0,23,G,KA01I2000,+919844098440*4B"));
-
- verifyPosition(decoder, text(
- "$EPB,iTriangle1,EMR,864495034445822,SP,03082018110730,A,22.829292,N,75.935806,E,543.0,0.0,0,G,KA01G1234,+9164061023*13"));
-
- verifyPosition(decoder, text(
- "$Header,iTriangle,1_37T02B0164MAIS_2,NR,1,L,864495034490141,KA01I2000,1,19042018,102926,22.846401,N,75.948952,E,0.0,311,5,578.0,3.80,3.67,AirTel,0,1,12.5,4.3,1,C,14,404,93,0456,16db,29,ebd8,0458,28,3843,18ab,25,072e,18ab,22,35da,0458,0000,00,031181,0.0,0.0,0,()*34"));
-
- verifyPosition(decoder, text(
- "$Header,nliven,1_37T02B0164MAIS,BR,6,L,861693034634154,KA01I2000,1,09112017,160702,12.976593,N,77.549782,E,25.1,344,15,911.0,1.04,0.68,Airtel,1,1,11.8,3.8,1,C,24,404,45,61b4,9ad9,31,9adb,61b4,35,ffff,0000,33,ffff,0000,31,ffff,0000,0001,00,000014,0.0,0.1,4,()*1E"));
-
- verifyPosition(decoder, text(
- "$Header,iTriangle,1_37T02B0164MAIS_2,NR,1,L,864495034490141,KA01I2000,1,31032018,122247,22.845999,N,75.949005,E,0.0,44,16,545.0,1.19,0.65,AirTel,1,1,12.0,4.3,0,C,13,404,93,0456,16db,27,16dd,0456,22,3843,18ab,19,ebd8,0458,14,072c,18ab,0101,00,003735,0.0,0.0,0,()*48"));
-
- verifyNull(decoder, text(
- "$Header,nliven,KA01I2000,861693034634154,1_37T02B0164MAIS,AIS140,12.976545,N,77.549759,E*50"));
-
- }
-
}
diff --git a/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
index 3a9382086..6b3dc3010 100644
--- a/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AtrackProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class AtrackProtocolDecoderTest extends ProtocolTest {
AtrackProtocolDecoder decoder = new AtrackProtocolDecoder(null);
verifyPositions(decoder, buffer(
+ "@P,93D1,419,0,357766091026083,1557178589,1557178590,1557178590,-121899637,37406241,338,230,2809,8,0,0,0,0,,2000,2000,\r\n"));
+
+ verifyPositions(decoder, buffer(
"@P,3A34,146,41431,353816057242284,20180622015809,20180622015809,20180622015809,9720689,4014230,61,2,0,20,1,0,0,0,0,2000,2000,12160,42,624,002,20009,20014,\r\n"));
verifyPositions(decoder, buffer(
@@ -96,4 +99,23 @@ public class AtrackProtocolDecoderTest extends ProtocolTest {
}
+ @Test
+ public void testDecodeCustom() throws Exception {
+
+ AtrackProtocolDecoder decoder = new AtrackProtocolDecoder(null);
+
+ decoder.setCustom(true);
+
+ decoder.setForm("%AT%BV%MV%SA%VN%PD%IA%MP%EL%ET%FC%FL%RP%ML%MF%TR%EH%DL%EG%HA%HB%HC%IP%MT");
+
+ verifyPositions(decoder, buffer(
+ "@P,7E02,186,0,357766091026083,1558908265,1558908266,1558908266,-121900220,37407524,175,2,6,6,1,39,0,0,,2000,2000, ,3,40,142,12,JN8AZ1MU1BW066090,0,30,0,58,90,22,72,1187,0,1232,9,409,0,1,0,0,0,0,1\r\n"));
+
+ decoder.setForm("%AT%BV%CD%CE%CM%CN%DT%GN%GQ%GS%GV%LC%ME%MV%RL%SA%SM%CS%HT%VN%PD%IA%MP%EL%ET%FC%FL%RP%ML%MF%TR%EH%CR%DL%EG%HA%HB%HC%IP%MT%PF");
+
+ verifyPositions(decoder, buffer(
+ "@P,DCCE,422,5818,357766091026083,1557904779,1557904780,1557904780,-121899644,37406291,129,2,21,10,0,0,0,0,,2000,2000,,13,40,8942310017000752067,21096194,295050910083206,310260,0,FF00001F0393FF01001E0395FF01001E0394FF01001F0393FF02001D0393FF00001F0394FF0100200394FF01001F0393FF02001F0395FF0100200394,20,10,002C005C03B4,14953,357766091026083,125,38,11,0,1,Device:Fail,JN8AZ1MU1BW066090,0,0,0,0,0,99,0,0,0,0,0,264,5,0,0,0,0,0,0,0,0\r\n"));
+
+ }
+
}
diff --git a/src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java
index d3be0b6d6..71bc83b4f 100644
--- a/src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/AvemaProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class AvemaProtocolDecoderTest extends ProtocolTest {
@@ -10,7 +11,14 @@ public class AvemaProtocolDecoderTest extends ProtocolTest {
AvemaProtocolDecoder decoder = new AvemaProtocolDecoder(null);
- verifyNull(decoder, text(
+ verifyAttribute(decoder, text(
+ "1000000000,20190527072358,121.646024,25.062135,0,0,0,0,10,0.0,1,0.02,12.32,0,0,15,2,466-5,10275,0,0.01,65EB812A000104E0,8000001234,NormanChang"),
+ Position.KEY_DRIVER_UNIQUE_ID, "65EB812A000104E0");
+
+ verifyNotNull(decoder, text(
+ "1000000000,20190522093835,121.645898,25.062268,0,0,0,0,3,0.0,1,0.02,11.48,0,0,19,4,466-5,65534,56589841,0.01"));
+
+ verifyNotNull(decoder, text(
"8,20180927150956,19.154864,49.124862,7,56,0,12,3,0.0,0,0.02,14.01,0,0,26,0,219-2,65534,10255884,0.01"));
verifyPosition(decoder, text(
diff --git a/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
index 40ffbe5a5..9801b56cc 100644
--- a/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
@@ -13,6 +13,12 @@ public class BceProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"3ab90b71bc1503000300c10bff11"));
+ verifyPositions(decoder, binary(
+ "cdc3440cf31403001902a58c0a06e0ceb0009f4e4452419417e0ceb08bc0ffcf428014463627b24018104b425b1c508b00d16a9743d188da6e0110ce001455069262002e4c5adabb810200418728157501004229460377000bb4d04b10c000ffff335aa800000000000000000000000000a912963d0042313130303030313236313432303031202020202020202020202020202020203f2946030301f70100007b0400009f130000762700000a26e0ceb06f074e4452419427e0ceb08bc0ffcf42801446ee28b240a40f4b425c1c518a00df414c42d188936eff0fce001455069262002e4c5adabb810200417b28157501004c294603770008b4d04b10c000ffff4c5a89000000000000000000000000009a2c8c3b004231313030303031323631343230303120202020202020202020202020202020492946030301f80100007c040000a9130000802700009477e0ceb08bc0ffcf42801446eb2fb2405c0d4b425d1c53830089e07e43d188a56eff0fce001455069262002eb35700bb810200415227167501007e294603780000b4d04b10c000ffff995700000000000000000000000000008bd9f43b004231313030303031323631343230303120202020202020202020202020202020802946030301fd01000081040000e0130000b72700000a86e0ceb064464e4452410a96e0ceb000a54e4452410aa6e0ceb000914e4452410ab6e0ceb068334e4452410ac6e0ceb0009f4e4452410ac6e0ceb06f074e445241f4"));
+
+ verifyPositions(decoder, binary(
+ "cc2c5792c6160300b000a5520aa6c813ae64465343513840a7c813ae0bc0fd800080040036093f427884ea41001c900e00000000009088c562a301024156d12a004c00006df80c0000000086fb0200562a08005a000000000ac6c813ae0091534351380af6c813ae009f534351380af6c813ae6f075343513840f7c813ae0bc0fd800080040036093f427884ea41001c900e00000000009088f162a301024156d12a004c00006df80c0000000086fb0200562a08005a000000003f"));
+
verifyPositions(decoder, false, binary(
"76145792c61603003402a59b59a7f722aa8ac00080c086000121800000280f9401056804d181006222ea4201000000000000008081008081008081008081000022ea4201000000000000ffffffffffff00000000ffffffffffff00000000ffffffffffff000059f7f722aa8ac00080c086000121800000260f9401056804d181006222ea4201000000000000008081008081008081008081000022ea4201000000000000ffffffffffff00000000ffffffffffff00000000ffffffffffff00000a16f822aa6f07534352325917f822aa8ac00080c086000120800000190f9401056804d181006222ea4201000000000000008081008081008081008081000022ea4201000000000000ffffffffffff00000000ffffffffffff00000000ffffffffffff00005957f822aa8ac00080c086000121800000240f9401056804d181006222ea4201000000000000008081008081008081008081000022ea4201000000000000ffffffffffff00000000ffffffffffff00000000ffffffffffff00000a66f822aa6f07534352325967f822aa8ac00080c086000121a00000160f9401056804d181006222ea4201000000000000008081008081008081008081000022ea4201000000000000ffffffffffff00000000ffffffffffff00000000ffffffffffff000059b7f822aa8ac00080c086000121800000170f9401056804d181006222ea4201000000000000008081008081008081008081000022ea4201000000000000ffffffffffff00000000ffffffffffff00000000ffffffffffff0000ef"));
diff --git a/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
index bdcc1f9e8..be5877193 100644
--- a/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/BceProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class BceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- BceProtocolEncoder encoder = new BceProtocolEncoder();
-
+ BceProtocolEncoder encoder = new BceProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
diff --git a/src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java
index 5ed3f5dc8..7640484d4 100644
--- a/src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CalAmpProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class CalAmpProtocolDecoderTest extends ProtocolTest {
CalAmpProtocolDecoder decoder = new CalAmpProtocolDecoder(null);
verifyPosition(decoder, binary(
+ "8308352648068863398f01070102039c5cfc4dcd5cfc4dcd19913f5dcce1291e000033fa0000005801110800019aff9d6f0e13003e0b02000000000000000000"));
+
+ verifyPosition(decoder, binary(
"83051633033459010101028afd59ae7c1459ae7c140b06bbce2c01520e0000d916000001b900450900005affa50f091f00260d040000000f24000001b90000000000003714"));
verifyPosition(decoder, binary(
diff --git a/src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java
index 27f503b34..3c35398a6 100644
--- a/src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CastelProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class CastelProtocolDecoderTest extends ProtocolTest {
@@ -10,6 +11,13 @@ public class CastelProtocolDecoderTest extends ProtocolTest {
CastelProtocolDecoder decoder = new CastelProtocolDecoder(null);
+ verifyAttribute(decoder, binary(
+ "40403a00043231334744503230313830323133343300000000a002000001000001012011004d414c43333831434d4b4d353637313438c8fc0d0a"),
+ Position.KEY_RESULT, "MALC381CMKM567148");
+
+ verifyAttributes(decoder, binary(
+ "404043000432313357503230313830303138323400000000004005f064d95c8365d95c9f2f0100c50200004006000000000000040003440068000000000100f3660d0a"));
+
verifyAttributes(decoder, binary(
"40403a00043231335750323031373030363135360000000000a00200000100000101201100344a474446364545374a4230373632363056ff0d0a"));
diff --git a/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
index bcb93a010..1864d9e84 100644
--- a/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CastelProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class CastelProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CastelProtocolEncoder encoder = new CastelProtocolEncoder();
-
+ CastelProtocolEncoder encoder = new CastelProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java
index d3066aa2d..523ad1d5c 100644
--- a/src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/CellocatorProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class CellocatorProtocolDecoderTest extends ProtocolTest {
CellocatorProtocolDecoder decoder = new CellocatorProtocolDecoder(null);
verifyPosition(decoder, binary(
+ "4d4347500bde66220048165400cb0000000000080600000124161400061300050402095501aaf8218787fcac390100010000070700013133150f07131905001e000100000293001e00697e6f24148240040000000083400400000000844004000000008540040000000086400400000000874004000000008840040000000089400400000000814004000000008c4004000000008d4004000000008e4004000000009140040000000090400400000000804004000000008a400400000000974004000000008b4004000000009d4004000000009b400400000000da"));
+
+ verifyPosition(decoder, binary(
"4D4347500BA9880B00880A3900EE00000000000806000001210A140002B6001E0034419B1B1900400401000000014004000000000240046000000003400480000000044004DA0A0000054004000000000640045E000000074004310000000840042B000000094004870000000B4004B10B00000C4004590000000D40040000000010400465000000114004780C000012400465650700144004A4000000154004207F000016400400000000174004000000001E4004000000001F40040000000020400400000000214004000000002440040000000006130003040211D67DA4F7883AAF028403000001000007070001250A1004090E1905001E0001000062"));
verifyPosition(decoder, binary(
diff --git a/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
index 89850fb5f..616640116 100644
--- a/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CellocatorProtocolEncoderTest.java
@@ -11,8 +11,8 @@ public class CellocatorProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder();
-
+ CellocatorProtocolEncoder encoder = new CellocatorProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
diff --git a/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
index 7c03b7d5b..f0eede4bf 100644
--- a/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/CityeasyProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class CityeasyProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder();
+ CityeasyProtocolEncoder encoder = new CityeasyProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
index ae5e9353c..8977cf194 100644
--- a/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/DmtProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class DmtProtocolDecoderTest extends ProtocolTest {
"0255003300001b00003335333232393032373533393235310038393931353030303030303030313330343539340000000403041910780603"));
verifyPositions(decoder, false, binary(
+ "025504ab013d00c21a00004829900c0300154929900cbd163617b08a94c7fa003c07032c131a0302080300000000000300060f019b14037e0e0463000558140607213d00c31a0000ca29900c030015ca29900ca3033817bbb895c71401be0603b310190302080300000000000300060f019b14036d0e0463000558140607213d00c41a0000472a900c030015472a900c8d453817423e96c7fa000200040013270302080300000000000300060f019b1403840e0463000546140606213d00c51a0000c52a900c030015c52a900c184c3817c35296c724010400050016180302080300000000000300060f019b1403750e0463000547140606213d00c61a0000462b900c030015462b900cbd8a361703b495c710018c07085a10210302080300000000000300060f019b1403630e0463000546140606213d00c71a0000c52b900c030015c52b900cf6d63517455a94c7e9004c05035a10240302080300000000000300060f019b14036e0e0463000545140606213d00c81a00004b2c900c0300154b2c900c766d3517ddf093c7320107000d00102e0302080300000000000300060f019b1403750e046300054314060521"));
+
+ verifyPositions(decoder, false, binary(
"02551040000eaca40d00d2b8e562c51f9912f39a6bee00007e420091090903070100000000008b1065360000000000007fd401c4fcf2feffffffffffffffffee0000003f1b"));
verifyPositions(decoder, false, binary(
diff --git a/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java
index e3cff9525..e24da3173 100644
--- a/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EelinkProtocolDecoderTest.java
@@ -14,6 +14,10 @@ public class EelinkProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"454C0027E753035254407167747167670100180002035254407167747100200205020500010432000086BD"));
+ verifyAttribute(decoder, binary(
+ "6767070006000e0077035d"),
+ Position.KEY_IGNITION, true);
+
verifyAttributes(decoder, binary(
"676707006502df5c89fde800bc3fa8030302005555045b555555057a5555550b225555550c105c55550d115555550e7e5555550f4555555510017b5555112b5555551f01ed5555208005b0012100005555407ad000004237f5555589000000498a0000aef78b00000000"));
diff --git a/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java
index e4502f919..616ca0b52 100644
--- a/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/EelinkProtocolEncoderTest.java
@@ -13,9 +13,9 @@ public class EelinkProtocolEncoderTest extends ProtocolTest {
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
- verifyCommand(new EelinkProtocolEncoder(false), command, binary("676780000f0000010000000052454c41592c3123"));
+ verifyCommand(new EelinkProtocolEncoder(null, false), command, binary("676780000f0000010000000052454c41592c3123"));
- verifyCommand(new EelinkProtocolEncoder(true), command, binary("454c001eb41a0123456789012345676780000f0000010000000052454c41592c3123"));
+ verifyCommand(new EelinkProtocolEncoder(null, true), command, binary("454c001eb41a0123456789012345676780000f0000010000000052454c41592c3123"));
}
diff --git a/src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java b/src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java
index 237c849c5..523d095f2 100644
--- a/src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EgtsFrameDecoderTest.java
@@ -14,6 +14,9 @@ public class EgtsFrameDecoderTest extends ProtocolTest {
binary("0100020B0025003A5701C91A003A5701CD6E68490202101700CBB4740F7617FD924364104F116A0000000000010300001EC2"),
decoder.decode(null, null, binary("0100020B0025003A5701C91A003A5701CD6E68490202101700CBB4740F7617FD924364104F116A0000000000010300001EC2")));
+ verifyFrame(
+ binary("0100000b000300704300db0500006c27"),
+ decoder.decode(null, null, binary("0100000b000300704300db0500006c270100000b0003007143009d0600003c7e")));
}
}
diff --git a/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java
index 2210893e7..2afb72e08 100644
--- a/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/EgtsProtocolDecoderTest.java
@@ -6,7 +6,30 @@ import org.traccar.ProtocolTest;
public class EgtsProtocolDecoderTest extends ProtocolTest {
@Test
- public void testDecode() throws Exception {
+ public void testDecodeWithObjectId() throws Exception {
+
+ EgtsProtocolDecoder decoder = new EgtsProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "0100020b002300020001871c00020000010105190000ab0800006247396e615734366347467a63336476636d513daadf"));
+
+ verifyPositions(decoder, binary(
+ "0100020b004600010001b81800030001f299c0d80202101500c9c52f1100552e9c80e4ca7911f5805b00000000031800040001f299c0d80202101500cbc52f1100612e9c00dbca79116c803e00000000037c13"));
+
+ verifyPositions(decoder, binary(
+ "0100020b005e01030001ed180005000162c72c9a0202101500c4c52f1100477e9f0047c979010000ad000000000318000600017ee0710c0202101500c9c52f11003ee59f8061e97a0100801b00000000031800070001b6eeb6c00202101500c7c52f110077669d00b9707a116a015600000000031800080001b6eeb6c00202101500cdc52f11007c669d004e717a117a0158000000000318000900018b4685f70202101500c8c52f11006ee09f0027ca7c11650079000000000318000a0001f299c0d80202101500c9c52f1100552e9c80e4ca7911f5805b000000000318000b0001f299c0d80202101500cbc52f1100612e9c00dbca79116c803e000000000318000c0001731347010202101500c7c52f1100a3699a80db3c7a010000e5000000000318000d0001c85285f70202101500cbc52f1100e8979900f3497b114d0101000000000318000e0001aa4358810202101500cdc52f11002d689a80ab427a0100009300000000032b9f"));
+
+ verifyNull(decoder, binary("0100000b0003006c430004010000acfb"));
+
+ verifyPositions(decoder, binary(
+ "0100000b0086035ddd016d18004f049579b000001e2fc11002021015001e2fc1107ac3919f59cc5c7a0b0000000000003000180050049579b00000242fc1100202101500242fc1100fb5919f2dbf5c7a0b0000000000003000180051049579b00000312fc1100202101500312fc110b899919f94cf5c7a0b00000000000030001e0052049579b00000ba62a2120202120900000003000000000000150500025c00000013070003000000000000180053049579b000004e2fc11002021015004e2fc11087ba919f8dd45c7a0b0000000000003000180054049579b00000552fc1100202101500552fc1106ecb919f2aec5c7a0b00000000000030001e0055049579b00000d562a2120202120900000003000000000000150500025c00000013070003000000000000180056049579b000005c2fc11002021015005c2fc11059d9919f54fa5c7a0b0000000000003000180057049579b000006e2fc11002021015006e2fc110309f919fc2db5c7a0b0000000000003000180058049579b00000762fc1100202101500762fc1104690919f94cf5c7a0b00000000000030001e0059049579b00000f662a2120202120900000003000000000000150500025c000000130700030000000000001e005a049579b000001463a2120202120900000003000000000000150500025c0000001307000300000000000018005b049579b00000b32fc1100202101500b32fc110c491919fa2c65c7a0b00000000000030001e005c049579b000003363a2120202120900000003000000000000150500025c0000001307000300000000000018005d049579b00000ca2fc1100202101500ca2fc11089b9919fd5f95c7a0b00000000000030001e005e049579b000005163a2120202120900000003000000000000150500025c000000130700030000000000001e005f049579b000006f63a2120202120900000003000000000000150500025c00000013070003000000000000180060049579b00000f42fc1100202101500f42fc11087ba919f43db5c7a0b0000000000003000180061049579b000000730c11002021015000730c110f9c3919fe1c65c7a0b0000000000003000180062049579b000000930c11002021015000930c1106ecb919f3ab65c7a0b00000000000030001e0063049579b000008d63a2120202120900000003000000000000150500025c00000013070003000000000000140064049579b00000ac63a2120202120900000003000000000000150500025c000000ce53"));
+
+ verifyNull(decoder, binary("0100000b00100091030072000100060000000002020003009203000009"));
+
+ }
+
+ @Test
+ public void testDecodeWithAuth() throws Exception {
EgtsProtocolDecoder decoder = new EgtsProtocolDecoder(null);
diff --git a/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
index 16f00d69b..7bf4f844e 100644
--- a/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/EsealProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class EsealProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- EsealProtocolEncoder encoder = new EsealProtocolEncoder();
+ EsealProtocolEncoder encoder = new EsealProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
index 11492fb6f..88a460854 100644
--- a/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FifotrackProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class FifotrackProtocolDecoderTest extends ProtocolTest {
@@ -10,6 +11,17 @@ public class FifotrackProtocolDecoderTest extends ProtocolTest {
FifotrackProtocolDecoder decoder = new FifotrackProtocolDecoder(null);
+ verifyPosition(decoder, buffer(
+ "$$116,869270049149999,5,A01,4,190925080127,V,-15.804260,35.061506,0,0,1198,0,0,900000C0,02,0,650|10|12C|B24,18B|4C8|72,1,*01"));
+
+ verifyAttribute(decoder, buffer(
+ "$$123,869467049296388,B996,A01,2,190624131813,V,22.333746,113.590670,0,124,-1,26347,0,0004,00,0,460|0|2694|5A5D,174|0|0|0,B48CEB,*77"),
+ Position.KEY_ALARM, Position.ALARM_SOS);
+
+ verifyAttribute(decoder, buffer(
+ "$$125,869467049296388,548,A01,38,190619025856,A,22.333905,113.590261,0,12,60,16666,0,0000,00,0,460|0|2694|13F8,1A2|4C1|0|0,B4A067,*7A"),
+ Position.KEY_DRIVER_UNIQUE_ID, "11837543");
+
verifyNull(decoder, buffer(
"$$79,868345037864709,382,D05,190220085833,22.643210,114.018176,1,1,1,13152,23FFD339*25"));
diff --git a/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
index 53ae8510a..b60313956 100644
--- a/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/FifotrackProtocolEncoderTest.java
@@ -11,8 +11,8 @@ public class FifotrackProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- FifotrackProtocolEncoder encoder = new FifotrackProtocolEncoder();
-
+ FifotrackProtocolEncoder encoder = new FifotrackProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_REQUEST_PHOTO);
diff --git a/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
index 34423578d..6a68752bb 100644
--- a/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/GalileoProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class GalileoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- GalileoProtocolEncoder encoder = new GalileoProtocolEncoder();
+ GalileoProtocolEncoder encoder = new GalileoProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
index e2be99cb9..7e1ccb79d 100644
--- a/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GatorProtocolDecoderTest.java
@@ -20,6 +20,9 @@ public class GatorProtocolDecoderTest extends ProtocolTest {
GatorProtocolDecoder decoder = new GatorProtocolDecoder(null);
verifyAttributes(decoder, binary(
+ "242480002600341cad190917022021812497260280594200000000c047010000135400009bb600ff00b90d"));
+
+ verifyAttributes(decoder, binary(
"2424800026364101b31608041108380273453415301532000000008000010000122800000124000000c40d"));
verifyNull(decoder, binary(
diff --git a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index 35a96a6cf..12e64cd6d 100644
--- a/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -11,6 +11,13 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(null);
+ verifyPositions(decoder, buffer(
+ "+RESP:GTFRI,423031,355154083021002,Bolt4G,0,0,0,0,1,1.0,0.2,0,245.3,-85.630193,42.975280,20190729185934,310,410,500b,B0E320F,31,-1,100,20190729185934,0010$"));
+
+ verifyAttribute(decoder, buffer(
+ "+RESP:GTCTN,440200,866427030007379,NOKIA3,0,0,2,,9,1,0.1,174,48.7,-1.061812,51.435270,20190717080549,0234,0015,0025,145A,,,0000,20190717081008,1D3B$"),
+ Position.KEY_BATTERY_LEVEL, 9);
+
verifyAttribute(decoder, buffer(
"+RESP:GTHBM,4B0101,135790246811220,,,10,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,2000.0,20090214093254,11F0$"),
Position.KEY_ALARM, Position.ALARM_BRAKING);
@@ -203,7 +210,7 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
verifyPositions(decoder, buffer(
"+RESP:GTFRI,210102,A10000499AEF9B,,0,1,1,9,0.5,0,288.0,-76.902364,39.578828,20161101134124,,,,,00,73,20161101134123,009D$"));
- verifyAttributes(decoder, buffer(
+ verifyPositions(decoder, buffer(
"+RESP:GTRTL,210102,A10000499AEF9B,,0,0,1,10,0.2,0,305.4,-76.902274,39.578517,20161101155001,,,,,00,73,20161101155001,00A6$"));
verifyAttributes(decoder, buffer(
diff --git a/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
index 70c86bb23..2ad080219 100644
--- a/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GoSafeProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class GoSafeProtocolDecoderTest extends ProtocolTest {
@@ -10,6 +11,18 @@ public class GoSafeProtocolDecoderTest extends ProtocolTest {
GoSafeProtocolDecoder decoder = new GoSafeProtocolDecoder(null);
+ verifyAttribute(decoder, text(
+ "*GS06,356449068350122,013519070819,,SYS:G6S;V3.37;V1.1.8,GPS:A;12;N23.169866;E113.450728;0;255;54;0.79,COT:18779;,ADC:12.66;0.58,DTT:4084;E1;0;0;0;1,IWD:0;1;ad031652643fff28;23.2;1;1;86031652504fff28;24.3;2;1;e603165252a5ff28;24.2;3;1;bb0416557da6ff28;24.0#"),
+ Position.PREFIX_TEMP + 3, 24.0);
+
+ verifyAttribute(decoder, text(
+ "*GS06,351535058659335,081234310719,,SYS:G6S;V3.37;V1.1.8,GPS:A;10;N23.169758;E113.450640;0;323;47;0.82,COT:18539;,ADC:10.81;4.07,DTT:4000;E0;0;0;0;1,IWD:0;1;9f00000655705d28;22.5#"),
+ Position.PREFIX_TEMP + 0, 22.5);
+
+ verifyAttribute(decoder, text(
+ "*GS06,359568052580548,091946150719,1C,SYS:G3C;V1.40;V1.0.4,GPS:A;5;S25.750200;E28.204858;0;0;1337;1.68,COT:,ADC:13.12;4.06,DTT:4004;C6;0;0;10000000;0$091948150719,,SYS:G3C;V1.40;V1.0.4,GPS:A;5;S25.750200;E28.204858;0;0;1337;1.68,COT:,ADC:12.96;4.06,DTT:4004;C6;0;0;0;1#"),
+ Position.KEY_EVENT, 0x1C);
+
verifyPositions(decoder, text(
"*GS06,860078024226974,101437211218,,SYS:G3SC;V3.36;V1.1.8,GPS:A;7;N3.052302;E101.787216;16;137;48;1.58,COT:4261733103,ADC:22.86;0.58;0.01,DTT:4004;E1;0;0;0;3$101439211218,,SYS:G3SC;V3.36;V1.1.8,GPS:A;8;N3.052265;E101.787200;12;152;46;1.31,COT:4261733103,ADC:22.98;0.58;0.01,DTT:4004;E1;0;0;0;3$101441211218,,SYS:G3SC;V3.36;V1.1.8,GPS:A;8;N3.052247;E101.787232;8;131;46;1.34,COT:4261733103,ADC:23.13;0.58;0.01,DTT:4004;E1;0;0;0;3$101510211218,,SYS:G3SC;V3.36;V1.1.8,GPS:A;8;N3.052150;E101.787152;0;131;40;0.97,COT:4261733160,ADC:22.88;0.58;0.01,DTT:4000;E1;0;0;0;1$101540211218,,SYS:G3SC;V3.36;V1.1.8,GPS:A;7;N3.052150;E101.787152;0;131;40;0.97,COT:4261733160,ADC:22.91;0.58;0.00,DTT:4000;E1;0;0;0;1#"));
diff --git a/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java
index ca3ddfda8..23762f572 100644
--- a/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/GotopProtocolDecoderTest.java
@@ -17,6 +17,9 @@ public class GotopProtocolDecoderTest extends ProtocolTest {
"353327020412763,CMD-X"));
verifyPosition(decoder, text(
+ "867688038677542,ALM-D1,V,DATE:190709,TIME:185214,LAT:50.0422838N,LON:014.4504646E,Speed:004.3,081-20,05.68"));
+
+ verifyPosition(decoder, text(
"013226009991924,CMD-T,A,DATE:130802,TIME:153721,LAT:25.9757433S,LOT:028.1087816E,Speed:000.0,X-X-X-X-81-26,000,65501-00A0-4B8E"));
verifyPosition(decoder, text(
diff --git a/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
index f888ee252..23a05fcee 100644
--- a/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gps103ProtocolEncoderTest.java
@@ -11,13 +11,13 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() throws Exception {
- Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder();
-
+ Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
command.set(Command.KEY_FREQUENCY, 300);
-
+
assertEquals("**,imei:123456789012345,C,05m", encoder.encodeCommand(command));
}
@@ -25,7 +25,7 @@ public class Gps103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder();
+ Gps103ProtocolEncoder encoder = new Gps103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index a6008e682..d31cac534 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -17,6 +17,21 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"78780D01086471700328358100093F040D0A"));
+ verifyAttribute(decoder, binary(
+ "78780c95130a071223200100013ad10d0a"),
+ Position.KEY_ALARM, Position.ALARM_GENERAL);
+
+ verifyAttribute(decoder, binary(
+ "797900a87000000001020035000101003300125d7e3a180600d504b598f708814b3a001d1500340006125d7e39dc000011000a012e02620000000000000001000803537601000129800002000803102608593397620003000a89012608522933976266001800020172002b000114002c00045d7df3c70009000106000a000109002800010d002e00040000f25d002a000111002900040000017e0030000a000100b4000a00b402d0000591250d0a"),
+ Position.KEY_ALARM, Position.ALARM_REMOVING);
+
+ verifyPosition(decoder, binary(
+ "797900a87000000001020035000100003300125d62bf3a0800e804b5994308814a87001d5d00340006115d62bf29000011000a012e02620000000000000001000803537601000129800002000803102608593397620003000a8901260852293397626600180002017d002b000116002c00045d6278ea0009000108000a00010b002800010b002e00040000f0c1002a00010000290004000000be0030000a000100b4000a00b402d00006c5490d0a"));
+
+ verifyAttribute(decoder, binary(
+ "797900149b03023539303042343843454238410300139ba40d0a"),
+ Position.KEY_DRIVER_UNIQUE_ID, "5900B48CEB");
+
verifyPosition(decoder, binary(
"787821121303120b2524c70138e363085b549003d43301940057d200cd52c000006aa1ca0d0a"));
@@ -289,6 +304,17 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"7878058A000688290D0A"));
+ verifyAttribute(decoder, binary(
+ "78780c95130a0209321c90000112800d0a"),
+ Position.KEY_ALARM, Position.ALARM_ACCELERATION);
+
+ verifyAttribute(decoder, binary(
+ "78780c95130a0209321c90000112800d0a"),
+ "alarmValue", 1);
+
+ verifyAttribute(decoder, binary(
+ "78780c95130a0209321c91000112800d0a"),
+ Position.KEY_ALARM, Position.ALARM_BRAKING);
}
}
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
index aceaef434..178c7b763 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class Gt06ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- Gt06ProtocolEncoder encoder = new Gt06ProtocolEncoder();
-
+ Gt06ProtocolEncoder encoder = new Gt06ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
index c69dffce7..31e4f2dee 100644
--- a/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
H02ProtocolDecoder decoder = new H02ProtocolDecoder(null);
+ verifyNull(decoder, buffer(
+ "*HQ,135790246811220,HTBT#"));
+
verifyPosition(decoder, binary(
"24702802061601234020031910125482600612695044000000ffffbbff000000000000000001760d04e2c9934d"));
diff --git a/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
index a7ce3fc7e..155869b24 100644
--- a/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/H02ProtocolEncoderTest.java
@@ -14,7 +14,7 @@ import static org.junit.Assert.assertEquals;
public class H02ProtocolEncoderTest extends ProtocolTest {
- private H02ProtocolEncoder encoder = new H02ProtocolEncoder();
+ private H02ProtocolEncoder encoder = new H02ProtocolEncoder(null);
private Date time = Date.from(
LocalDateTime.of(LocalDate.now(), LocalTime.of(1, 2, 3)).atZone(ZoneOffset.systemDefault()).toInstant());
diff --git a/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
index 319d34e4c..6033bc744 100644
--- a/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuaShengProtocolDecoderTest.java
@@ -17,6 +17,9 @@ public class HuaShengProtocolDecoderTest extends ProtocolTest {
"c000000077aa0200000000000e000100143347315f48312e315f56312e30372e54000300133335353835353035303434303635380004000b3531323030303000050005010006000400070004000800050000090018383936313032353431343533333239313833360d000a000f796573696e7465726e6574c0"));
verifyPosition(decoder, binary(
+ "c000000060aa000000000000fa8000000031393037303431363434323700e9900affd61c1b00000000003a000000010015ffffff0000000000000004c2ffffffffff0005000a0d080000ca6a000900155741555a5a5a344730454e313133373233c0"));
+
+ verifyPosition(decoder, binary(
"c00000004baa0000000000000f8000000031363130323030373236333600e6d4f9ffcc78c700000022003600000001001500000000000000000000059bffffffffff0005000a040300000253c0"));
verifyPosition(decoder, binary(
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
index 771e6d28c..d0a0427c8 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolEncoderTest.java
@@ -11,8 +11,8 @@ public class HuabaoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder();
-
+ HuabaoProtocolEncoder encoder = new HuabaoProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
index 1992892df..4126c4e4f 100644
--- a/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/ItsProtocolDecoderTest.java
@@ -12,6 +12,12 @@ public class ItsProtocolDecoderTest extends ProtocolTest {
ItsProtocolDecoder decoder = new ItsProtocolDecoder(null);
verifyPosition(decoder, text(
+ "$,ID01,SAT,1.0.0,NR,1,L,868345034056903,DL3CAB1021,1,27052019,040234,28.359895,N,76.927879,E,0.0,285.6,12,254.9,1.4,0.7,IDEA,1,1,12.6,3.8,0,25,404,04,0138,0927,4ECD,0138,41,1C2B,0138,37,D77A,0138,34,D843,0138,33,0000,00,0.03,0.00,000091,A3,*"));
+
+ verifyPosition(decoder, text(
+ "$NMP,GPSBOX,1.6.8,NR,H,868997035844834,0000,1,220519,035419,28.6291409,N,77.3928299,E,015.2,157.40,07,197.86,2.1,1.0,airtel,1,1,13.3,4.1,0,O,31,404,10,0099,79b4,(-57,0099,334c,x,x,x,x,x,x,x,x,x),0012,00,000348,2,08.4,00.3,(0,0,0),CD*"));
+
+ verifyPosition(decoder, text(
"$RLP,N.A,2.0.2,NR,01,L,869867030181814,N.A,28022019,180155,1,28.688226,N,076.993570,E,0.0,80.26,17,201.0,0.89,0.60,VODAFONE I,0,1,25.0,4.20,0,C,14,404,11,415,F34A,51f7,415,13,840b,415,8,a3f7,0c2,5,ef77,415,5,0001,00,17888,47,*"));
verifyAttribute(decoder, text(
@@ -67,6 +73,24 @@ public class ItsProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"$,04,XYZ123,0.0.1,BR,06,L,861359034137271,MH12AB1234,0,00,00,0000,00,00,00,000.000000,N,000.000000,E,000.0,000.00,00,000.0,00.00,00.00,IDEAIN,1,1,00.0,3.8,1,O,17,404,22,2797,11b7,11b9,2797,-093,11b8,2797,-098,0000,0000,0000,0000,0000,0000,1000,00,000006,abd26284,"));
+ verifyNull(decoder, text(
+ "$Header,nliven,EMR,861693034634154,NM,09112017155133,A,12.976495,N,77.549713,E,906.0,0.0,23,G,KA01I2000,+919844098440*4B"));
+
+ verifyNull(decoder, text(
+ "$EPB,iTriangle1,EMR,864495034445822,SP,03082018110730,A,22.829292,N,75.935806,E,543.0,0.0,0,G,KA01G1234,+9164061023*13"));
+
+ verifyPosition(decoder, text(
+ "$Header,iTriangle,1_37T02B0164MAIS_2,NR,1,L,864495034490141,KA01I2000,1,19042018,102926,22.846401,N,75.948952,E,0.0,311,5,578.0,3.80,3.67,AirTel,0,1,12.5,4.3,1,C,14,404,93,0456,16db,29,ebd8,0458,28,3843,18ab,25,072e,18ab,22,35da,0458,0000,00,031181,0.0,0.0,0,()*34"));
+
+ verifyPosition(decoder, text(
+ "$Header,nliven,1_37T02B0164MAIS,BR,6,L,861693034634154,KA01I2000,1,09112017,160702,12.976593,N,77.549782,E,25.1,344,15,911.0,1.04,0.68,Airtel,1,1,11.8,3.8,1,C,24,404,45,61b4,9ad9,31,9adb,61b4,35,ffff,0000,33,ffff,0000,31,ffff,0000,0001,00,000014,0.0,0.1,4,()*1E"));
+
+ verifyPosition(decoder, text(
+ "$Header,iTriangle,1_37T02B0164MAIS_2,NR,1,L,864495034490141,KA01I2000,1,31032018,122247,22.845999,N,75.949005,E,0.0,44,16,545.0,1.19,0.65,AirTel,1,1,12.0,4.3,0,C,13,404,93,0456,16db,27,16dd,0456,22,3843,18ab,19,ebd8,0458,14,072c,18ab,0101,00,003735,0.0,0.0,0,()*48"));
+
+ verifyNull(decoder, text(
+ "$Header,nliven,KA01I2000,861693034634154,1_37T02B0164MAIS,AIS140,12.976545,N,77.549759,E*50"));
+
}
}
diff --git a/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
index e7c4318b3..225edd643 100644
--- a/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/ItsProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class ItsProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- ItsProtocolEncoder encoder = new ItsProtocolEncoder();
+ ItsProtocolEncoder encoder = new ItsProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java
index ae0948987..e695624a9 100644
--- a/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java
@@ -11,6 +11,10 @@ public class Jt600FrameDecoderTest extends ProtocolTest {
Jt600FrameDecoder decoder = new Jt600FrameDecoder();
verifyFrame(
+ binary("2478905197081711003405101917164812492365028134847d0a1c000002640c0000000020c032759600731000000f0f0f0f0f0f0f0f0f0f000702850274"),
+ decoder.decode(null, null, binary("2478905197081711003405101917164812492365028134847d0a1c000002640c0000000020c032759600731000000f0f0f0f0f0f0f0f0f0f000702850274")));
+
+ verifyFrame(
binary("24315011626912001b21111718095900000000000000000e0000005c000000000000000000"),
decoder.decode(null, null, binary("24315011626912001b21111718095900000000000000000e0000005c00000000000000000024315011626912001b22111708130400000000000000000e0000005a00000000000000000024315011626912001b22111708140400000000000000000e0000005a000000723e18a61b01")));
diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java
index 1ffa2a429..4a3c752cd 100644
--- a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java
@@ -12,6 +12,15 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest {
Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(null);
verifyPositions(decoder, binary(
+ "2478807035371711003419081920061851380856003256223b000000000000070000000020c0ff965d54de1800000f0f0f0f0f0f0f0f0f0f02d600ea0a21"));
+
+ verifyPositions(decoder, binary(
+ "2475201509261611002313101503464722331560113555309F00000000002D0500CB206800F064109326381A03"));
+
+ verifyPositions(decoder, binary(
+ "2475810297431713003401010000030100000000000000000e000000000001000000000020e0641aba1b6f1b00000f0f0f0f0f0f0f0f0f0f000001942803"));
+
+ verifyPositions(decoder, binary(
"2440811188882400A209060908045322564025113242329F0598000001003F0000002D0009060908050322564025113242329F0598000001003F0000002D0009060908051322564025113242329F0598000001003F0000002D0009060908052322564025113242329F0598000001003F0000002D0009060908053322564025113242329F0598000001003F0000002D0009060908054322564025113242329F0598000001003F0000002D001F"));
verifyPositions(decoder, binary(
diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
index 100d7492a..c0b399c63 100644
--- a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java
@@ -7,7 +7,7 @@ import org.traccar.ProtocolTest;
import org.traccar.model.Command;
public class Jt600ProtocolEncoderTest extends ProtocolTest {
- Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder();
+ Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder(null);
Command command = new Command();
@Test
diff --git a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
index ab858041a..390defe6f 100644
--- a/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/KhdProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class KhdProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- KhdProtocolEncoder encoder = new KhdProtocolEncoder();
-
+ KhdProtocolEncoder encoder = new KhdProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java
index 31a0434bc..5b66ed865 100644
--- a/src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/LaipacProtocolDecoderTest.java
@@ -15,14 +15,14 @@ public class LaipacProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, text(
"$AVSYS,99999999,V1.50,SN0000103,32768*15"));
-
+
verifyNull(decoder, text(
"$ECHK,99999999,0*35"));
-
+
verifyNull(decoder, text(
"$AVSYS,MSG00002,14406,7046811160,64*1A"));
- verifyNull(decoder, text(
+ verifyAttributes(decoder, text(
"$EAVSYS,MSG00002,8931086013104404999,,Owner,0x52014406*76"));
verifyNull(decoder, text(
@@ -85,10 +85,10 @@ public class LaipacProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"$AVRMC,MSG00002,125517,R,5053.0442,N,00557.8694,E,0.00,0.00,240614,H,4076,167,1,0,0,0D7AB913,020408*75"));
-
+
verifyPosition(decoder, text(
"$AVRMC,MSG00002,043104,p,5114.4664,N,00534.3308,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*52"));
-
+
verifyPosition(decoder, text(
"$AVRMC,MSG00002,050601,P,5114.4751,N,00534.3175,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*7D"));
@@ -104,22 +104,29 @@ public class LaipacProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"$AVRMC,999999999999999,084514,r,5050.1314,N,00419.9719,E,0.68,306.39,120318,0,3882,84,1,0,0,3EE4A617,020610*4D"));
- //Alarm button
+ // Alarm button
verifyPosition(decoder, text(
"$AVRMC,358174067149865,142945,R,5050.1254,N,00420.0490,E,0.00,0.00,190318,3,3455,119,1,0,0,3EE4A617,020610*53"));
- //G-Sensor
+ // G-Sensor
verifyPosition(decoder, text(
"$AVRMC,358174067149865,143407,R,5050.1254,N,00420.0490,E,0.00,0.00,190318,8,3455,119,1,0,0,3EE4A617,020610*52"));
- //Powered off
+ // Powered off
verifyPosition(decoder, text(
"$AVRMC,358174067149865,143648,A,5050.1141,N,00420.0525,E,1.24,174.38,190318,H,3455,119,1,0,0,3EE4A617,020610*3E"));
- //No network
+ // No network
verifyPosition(decoder, text(
"$AVRMC,358174067149865,143747,R,5050.1124,N,00420.0542,E,1.34,161.96,190318,a,3416,119,1,0,0*7D"));
+ // Zero LAC, CID, MCC, MNC
+ verifyPosition(decoder, text(
+ "$AVRMC,358174067149865,143747,P,5050.1124,N,00420.0542,E,1.34,161.96,190318,A,3416,119,1,0,0,0,0*5F"));
+
+ // New unknown parameters
+ verifyPosition(decoder, text(
+ "$AVRMC,358174067149865,143747,P,5050.1124,N,00420.0542,E,1.34,161.96,190318,A,3416,119,1,0,0,0,0,0,0*5F"));
}
}
diff --git a/src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java
new file mode 100644
index 000000000..7fe405ea8
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/LeafSpyProtocolDecoderTest.java
@@ -0,0 +1,21 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class LeafSpyProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ LeafSpyProtocolDecoder decoder = new LeafSpyProtocolDecoder(null);
+
+ verifyNull(decoder, request(
+ "/?Lat=60.0&Long=30.0"));
+
+ verifyPosition(decoder, request(
+ "/?user=driver&pass=123456&DevBat=80&Gids=200&Lat=60.0&Long=30.0&Elv=5&Seq=50&Trip=1&Odo=10000&SOC=99.99&AHr=55.00&BatTemp=15.2&Amb=12.0&Wpr=12&PlugState=0&ChrgMode=0&ChrgPwr=0&VIN=ZE0-000000&PwrSw=1&Tunits=C&RPM=1000"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
index ee4a869f9..d7aa25be8 100644
--- a/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeiligaoProtocolEncoderTest.java
@@ -9,7 +9,7 @@ public class MeiligaoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder();
+ MeiligaoProtocolEncoder encoder = new MeiligaoProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
index b63ce5051..2b5054cee 100644
--- a/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MeitrackProtocolEncoderTest.java
@@ -11,8 +11,8 @@ public class MeitrackProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MeitrackProtocolEncoder encoder = new MeitrackProtocolEncoder();
-
+ MeitrackProtocolEncoder encoder = new MeitrackProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_SINGLE);
diff --git a/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java
new file mode 100644
index 000000000..794b2b57e
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java
@@ -0,0 +1,37 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class MictrackProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ MictrackProtocolDecoder decoder = new MictrackProtocolDecoder(null);
+
+ verifyPosition(decoder, text(
+ "MT;6;866425031361423;R0;10+190109091803+22.63827+114.02922+2.14+69+2+3744+113"),
+ position("2019-01-09 09:18:03.000", true, 22.63827, 114.02922));
+
+ verifyAttributes(decoder, text(
+ "MT;6;866425031377981;R1;190108024848+6a:db:54:5a:79:6d,-91,00:9a:cd:a2:e6:21,-94+3+3831+0"));
+
+ verifyAttributes(decoder, text(
+ "MT;1;866425031379169;R2;181129081017+0,21681,20616,460+4+3976+0"));
+
+ verifyAttributes(decoder, text(
+ "MT;1;866425031379169;R3;181129081017+0,167910723,14924,460,176+4+3976+0"));
+
+ verifyAttributes(decoder, text(
+ "MT;6;866425031377981;R12;190108024848+6a:db:54:5a:79:6d,-91,00:9a:cd:a2:e6:21,-94+0,21681,20616,460+3+3831+0"));
+
+ verifyAttributes(decoder, text(
+ "MT;6;866425031377981;R13;190108024848+6a:db:54:5a:79:6d,-91,00:9a:cd:a2:e6:21,-94+0,167910723,14924,460,176+3+3831+0"));
+
+ verifyAttributes(decoder, text(
+ "MT;5;866425031379169;RH;5+190116112648+0+0+0+0+11+3954+1"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
index e9422da9f..5de1346a2 100644
--- a/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/MiniFinderProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class MiniFinderProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder();
+ MiniFinderProtocolEncoder encoder = new MiniFinderProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java
index 2b1fdf988..c0ce67cb6 100644
--- a/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Minifinder2ProtocolDecoderTest.java
@@ -10,6 +10,12 @@ public class Minifinder2ProtocolDecoderTest extends ProtocolTest {
Minifinder2ProtocolDecoder decoder = new Minifinder2ProtocolDecoder(null);
+ verifyNull(decoder, binary(
+ "ab10150076f1320003100133353534363530373130323933303602105a"));
+
+ verifyPosition(decoder, binary(
+ "ab103f007e2533000110013335353436353037313032393330360930e09d245d210100000924b49e245d01025b201620e6c03b1ef367420400000000aa026d00c90e0000100110"));
+
verifyAttributes(decoder, binary(
"ab1845005d39370301100133353836383830303030303338303209245b92b55c84004b610502001000002221ca00050b4a005cc30f4a0056c80f4a003ba90e4a0055c8074a005dc3034a0057c8"));
diff --git a/src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java b/src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java
new file mode 100644
index 000000000..450f77144
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/NavisetFrameDecoderTest.java
@@ -0,0 +1,19 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class NavisetFrameDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ NavisetFrameDecoder decoder = new NavisetFrameDecoder();
+
+ verifyFrame(
+ binary("1310e4073836383230343030353935383436362a060716"),
+ decoder.decode(null, null, binary("1310e4073836383230343030353935383436362a060716")));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java
new file mode 100644
index 000000000..09ea10f1f
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/NavisetProtocolDecoderTest.java
@@ -0,0 +1,30 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class NavisetProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ NavisetProtocolDecoder decoder = new NavisetProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "1310e4073836383230343030353935383436362a060716"));
+
+ verifyPositions(decoder, binary(
+ "6b511a203f95162b7822515d78a92503042df6030000ff040000c4003f1922471000001af3000030e4503490e8ff00000000000000000000000000000000ff27000000000000808080808080808000000000ffdd0000000000000000000000000000000000000000000000210000000000ff00000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096160b7d22515d3ca92503e42cf6030000ff040000c7001ef521471000001af3000070e44034e0e8ff00000000000000000000000000000000ff27000000000000808080808080808000000000ffdd0000000000000000000000000000000000000000000000210000000000ff00000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000664a"));
+
+ verifyPositions(decoder, binary(
+ "b7501a203fab0d0bffcf4b5df0a82503a02cf6030000ff0c4200ba0007462a3a10000098280000f0f610fc4042ff00000000000000000000000000000000ff26000000000000808080808080808000000000ff000000000000000000000000000000000000000000000000000000000000ff00000000000000000000000000000000000000000000ff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008bff"));
+
+ verifyPositions(decoder, binary(
+ "b7501a203fda0d097fdc4b5d70aa2503c42cf6030000ff0fb40dea0006b12a3a100000b228000080f210044041ff00000000000000000000000000000000ff25000000000000808080808080808000000000ff1201000000000000000000000000000000000000000000001a0000000000ff00000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b603"));
+
+ verifyPositions(decoder, binary(
+ "14501a2000a50c0955a64b5db8a92503fc2cf603000084ab"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
index 38599e0ba..4991f1371 100644
--- a/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/NoranProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class NoranProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- NoranProtocolEncoder encoder = new NoranProtocolEncoder();
-
+ NoranProtocolEncoder encoder = new NoranProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
diff --git a/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
new file mode 100644
index 000000000..ade2804da
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
@@ -0,0 +1,32 @@
+package org.traccar.protocol;
+
+import io.netty.buffer.Unpooled;
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+import static org.junit.Assert.assertEquals;
+
+public class PacificTrackProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testReadBitExt() {
+
+ assertEquals(0x35, PacificTrackProtocolDecoder.readBitExt(
+ Unpooled.wrappedBuffer(new byte[] { (byte) 0b10110101 })));
+
+ assertEquals(0x135, PacificTrackProtocolDecoder.readBitExt(
+ Unpooled.wrappedBuffer(new byte[] { (byte) 0b00000010, (byte) 0b10110101 })));
+ }
+
+
+ @Test
+ public void testDecode() throws Exception {
+
+ PacificTrackProtocolDecoder decoder = new PacificTrackProtocolDecoder(null);
+
+ verifyPosition(decoder, binary(
+ "fb82e80280883527530900009110818202c0909308990b122519076138fc03b3480205a3e80003a0834dd19fb08112c08f0143000e020000000100000014000101929f806328c0000f4240810a858ce011314334424a57464758444c3533313737330190868102100828cf"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java
new file mode 100644
index 000000000..582ed9a5a
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/PluginProtocolDecoderTest.java
@@ -0,0 +1,27 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class PluginProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ PluginProtocolDecoder decoder = new PluginProtocolDecoder(null);
+
+ verifyPosition(decoder, text(
+ "$$STATUS,fleet40,20190704122622,26.259431,-29.027889,0,9,0,-1,2,19719,805315969,0,0,0"));
+
+ verifyPosition(decoder, text(
+ "$$ALARM801739,20190612121950,28.254067,-25.860494,0,0,0,-1,2,2,12595331,0,0,0,+,22,0,0,0,0,0,,0,0"));
+
+ verifyPosition(decoder, text(
+ "$$STATUS801739,20190528143943,28.254086,-25.860665,0,0,0,-1,2,78,11395,0,0,0"));
+
+ verifyPosition(decoder, text(
+ "50000,20150623184513,113.828759,22.709578,70,190,0,-1,2,155135681,805327235,1.32,-32.1,0"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
index 1b2780325..aa08ecea2 100644
--- a/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/PretraceProtocolEncoderTest.java
@@ -11,13 +11,13 @@ public class PretraceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() throws Exception {
- PretraceProtocolEncoder encoder = new PretraceProtocolEncoder();
-
+ PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
command.set(Command.KEY_FREQUENCY, 300);
-
+
assertEquals("(123456789012345D221300,300,,^69)", encoder.encodeCommand(command));
}
@@ -25,7 +25,7 @@ public class PretraceProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- PretraceProtocolEncoder encoder = new PretraceProtocolEncoder();
+ PretraceProtocolEncoder encoder = new PretraceProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Pt215FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Pt215FrameDecoderTest.java
new file mode 100644
index 000000000..2e3600b99
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/Pt215FrameDecoderTest.java
@@ -0,0 +1,27 @@
+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/Pt215ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Pt215ProtocolDecoderTest.java
new file mode 100644
index 000000000..59574aeee
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/Pt215ProtocolDecoderTest.java
@@ -0,0 +1,21 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class Pt215ProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ Pt215ProtocolDecoder decoder = new Pt215ProtocolDecoder(null);
+
+ verifyNull(decoder, binary(
+ "58580d010359339075435451010d0a"));
+
+ verifyNull(decoder, binary(
+ "585801080d0a"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
index a6c8bb50f..9e4a8a9a0 100644
--- a/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Pt502ProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
+ Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,22 +25,22 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeOutputControl() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
-
+ Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
command.set(Command.KEY_INDEX, 2);
command.set(Command.KEY_DATA, "1");
-
+
assertEquals("#OPC2,1\r\n", encoder.encodeCommand(command));
}
-
+
@Test
public void testEncodeTimezone() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
+ Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -55,7 +55,7 @@ public class Pt502ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeAlarmSpeed() throws Exception {
- Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder();
+ Pt502ProtocolEncoder encoder = new Pt502ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java
new file mode 100644
index 000000000..318cbdb51
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/RaceDynamicsProtocolDecoderTest.java
@@ -0,0 +1,21 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class RaceDynamicsProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ RaceDynamicsProtocolDecoder decoder = new RaceDynamicsProtocolDecoder(null);
+
+ verifyNull(decoder, text(
+ "$GPRMC,12,260819,100708,862549040661129,"));
+
+ verifyPositions(decoder, text(
+ "$GPRMC,15,04,H,#,100632,A,1255.5106,N,07738.2954,E,001,260819,0887,06,1,00011,%,0000000000000000,000,000,0,0,1,0713,0,416,0,255,000,0,000,3258,000,000,00,0000,000,00000,0,F3VF01,%,#,#,100633,A,1255.5107,N,07738.2955,E,001,260819,0887,06,1,00012,%,0000000000000000,000,000,0,0,1,0713,0,416,0,255,000,0,000,3453,000,000,00,0000,000,00000,0,F3VF01,%,#,#,100634,A,1255.5106,N,07738.2964,E,001,260819,0887,06,1,00013,%,0000000000000000,000,000,0,0,1,0713,0,392,0,255,000,0,000,3651,000,000,00,0000,000"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java
new file mode 100644
index 000000000..66286776a
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/RstProtocolDecoderTest.java
@@ -0,0 +1,26 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
+
+public class RstProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ RstProtocolDecoder decoder = new RstProtocolDecoder(null);
+
+ verifyAttribute(decoder, text(
+ "RST;A;RST-MINIv2;V7.00;008033985;1;7;30-08-2019 11:31:38;30-08-2019 11:31:15;-23.645868;-46.637741;0;226;828;0;10;0;00;20;00;1A;02;0.02;3.40;0;0;FE;0000;04;80;11;0;FIM;"),
+ Position.KEY_BATTERY, 3.40);
+
+ verifyPosition(decoder, text(
+ "RST;A;RST-MINIv2;V7.00;008033985;1;7;30-08-2019 11:31:38;30-08-2019 11:31:15;-23.645868;-46.637741;0;226;828;0;10;0;00;20;00;1A;02;0.02;3.40;0;0;FE;0000;04;80;11;0;FIM;"));
+
+ verifyPosition(decoder, text(
+ "RST;A;RST-MINIv2;V7.00;008033985;6;47;30-08-2019 19:01:13;30-08-2019 19:01:14;-23.645851;-46.637817;0;294;811;1;11;0;00;30;00;1A;02;3.82;4.16;0;0;FE;0000;02;40;71;000001F60A55;FIM;"));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
index 8a00caa09..5868b07df 100644
--- a/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/RuptelaProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class RuptelaProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder();
-
+ RuptelaProtocolEncoder encoder = new RuptelaProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_CUSTOM);
diff --git a/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
index 48adb0ccb..a2cb021ef 100644
--- a/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
@@ -3,6 +3,7 @@ package org.traccar.protocol;
import io.netty.handler.codec.http.HttpMethod;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class SigfoxProtocolDecoderTest extends ProtocolTest {
@@ -12,6 +13,19 @@ public class SigfoxProtocolDecoderTest extends ProtocolTest {
SigfoxProtocolDecoder decoder = new SigfoxProtocolDecoder(null);
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, "/",
+ buffer("{ \"device\": \"40D310\", \"payload\": \"62\", \"time\": 1563043532, \"seqNumber\": 1076 }")),
+ Position.KEY_ALARM, Position.ALARM_SOS);
+
+ verifyAttributes(decoder, request(HttpMethod.POST, "/",
+ buffer("{ \"device\": \"40D310\", \"payload\": \"20061494480389f956042a\", \"time\": 1563043532, \"seqNumber\": 1076 }")));
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
+ buffer("{ \"device\": \"1CEDCE\", \"payload\": \"2002419b4a91c2c6580e0564\", \"time\": 1559924939, \"seqNumber\": 87 }")));
+
+ verifyPosition(decoder, request(HttpMethod.POST, "/",
buffer("%7B++%22device%22%3A%222BF839%22%2C++%22time%22%3A1510605882%2C++%22duplicate%22%3Afalse%2C++%22snr%22%3A45.61%2C++%22station%22%3A%2235A9%22%2C++%22data%22%3A%2200bd6475e907398e562d01b9%22%2C++%22avgSnr%22%3A45.16%2C++%22lat%22%3A-38.0%2C++%22lng%22%3A145.0%2C++%22rssi%22%3A-98.00%2C++%22seqNumber%22%3A228+%7D=")));
}
diff --git a/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
index 70e173284..97246a665 100644
--- a/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/StarLinkProtocolDecoderTest.java
@@ -49,6 +49,11 @@ public class StarLinkProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"$SLU006968,06,375154,170117052613,04,170117052612,+3203.2079,+03448.1369,000.0,300,085725,1,1,0,0,0,0,0,0,10422,36201,14.287,04.084,,1,0*5B"));
+ decoder.setFormat("#EDT#,#EID#,#PDT#,#LAT#,#LONG#,#SPD#,#HEAD#,#ODO#,#LAC#,#CID#,#VIN#,#VBAT#");
+
+ verifyPosition(decoder, text(
+ "$SLU352353083185436,06,85,190527214903,01,190527214903,+0614.1883,-07535.5033,000.0,000,000082.505,5070,50473,0,12.148,03.507,,100,0.02,35.0,1,1513,60,1,99*30"));
+
}
}
diff --git a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
index cb5df63e6..304bc0fed 100644
--- a/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SuntechProtocolDecoderTest.java
@@ -59,6 +59,13 @@ public class SuntechProtocolDecoderTest extends ProtocolTest {
SuntechProtocolDecoder decoder = new SuntechProtocolDecoder(null);
verifyPosition(decoder, text(
+ "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(
+ "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(
"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(
diff --git a/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
index f21acdee7..c0511f2a1 100644
--- a/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/T55ProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class T55ProtocolDecoderTest extends ProtocolTest {
@@ -13,6 +14,10 @@ public class T55ProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, text(
"$DEVID,0x0103846677F21422*41"));
+ verifyAttribute(decoder, text(
+ "$GPIOP,01000000,00000000,0.00,0.00,0.00,0.00,4.69,4.24*49"),
+ Position.KEY_BATTERY, 4.24);
+
verifyPosition(decoder, text(
"660420156A0066AA$GPRMC,122806.0,A,0119.212178,N,10355.000942,E,0.0,,230119,0.0,E,A*27"));
diff --git a/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java
index bfe06b5cd..28b3fc5c6 100644
--- a/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/T800xProtocolDecoderTest.java
@@ -11,6 +11,19 @@ public class T800xProtocolDecoderTest extends ProtocolTest {
T800xProtocolDecoder decoder = new T800xProtocolDecoder(null);
+ verifyPosition(decoder, binary(
+ "2727040049001b0866425039645728c916190604005240000000007739d2c25b681f420000000080000081000020174105000005458216001e000000f01e00001e30d0000000000000"));
+
+ verifyAttribute(decoder, binary(
+ "272705005e000108664250328807851905301107481054002d004d006f00620069006c006500074341542d4e42310a4c54452042414e4420340f333130323430323030303032333030143839303132343032303531303030323330303746"),
+ Position.KEY_OPERATOR, "T-Mobile");
+
+ verifyPosition(decoder, binary(
+ "272702004904a90866425032880785c800190530080350000000000705eec29bf50842000000000008008090502a003700000a9e358002003c000003841900001e3f90000000000000272702004904aa0866425032880785c800190530081851000000000705eec29bf50842000000000008008090602e003700000a9e358002003c000003841900001e3f90000000000000"));
+
+ verifyNull(decoder, binary(
+ "2727010017000108806168988888881016010207110111"));
+
verifyNull(decoder, binary(
"252501001504050880061689888888111111250350"));
diff --git a/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
index e41b91281..9a628cdb6 100644
--- a/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/T800xProtocolEncoderTest.java
@@ -9,14 +9,16 @@ public class T800xProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- T800xProtocolEncoder encoder = new T800xProtocolEncoder();
-
+ T800xProtocolEncoder encoder = new T800xProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_CUSTOM);
command.set(Command.KEY_DATA, "RELAY,0000,On#");
- verifyCommand(encoder, command, binary("252581001e000101234567890123450152454c41592c303030302c4f6e23"));
+ verifyFrame(
+ binary("232381001e000101234567890123450152454c41592c303030302c4f6e23"),
+ encoder.encodeCommand(null, command));
}
diff --git a/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
index bdbaec8aa..0b9eacb8d 100644
--- a/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TaipProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class TaipProtocolDecoderTest extends ProtocolTest {
TaipProtocolDecoder decoder = new TaipProtocolDecoder(null);
+ verifyNull(decoder, text(
+ ">RLN25601000+297185103-0955755990+000059150000+0000000012000000000000000000000000000000000000000000000000000000000012;ID=3580;*48<"));
+
verifyPosition(decoder, text(
">RGP211217112154-2748332-058946350000000FF7F2100;ID=AA01;#0002;*2D<"));
diff --git a/src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java
index 0fdd26a47..767f175fe 100644
--- a/src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TechTltProtocolDecoderTest.java
@@ -11,11 +11,11 @@ public class TechTltProtocolDecoderTest extends ProtocolTest {
TechTltProtocolDecoder decoder = new TechTltProtocolDecoder(null);
verifyPosition(decoder, text(
- "002422269*POS=Y,16:21:20,25/11/09,3809.8063N,01444.7438E,4.17,117.23,0.4,09,40076,56341"),
+ "002422269*POS=Y,16:21:20,25/11/09,3809.8063N,01444.7438E,4.17,117.23,0.4,09,40076,56341\r\n"),
position("2009-11-25 16:21:20.000", true, 38.16344, 14.74573));
- verifyNull(decoder, text(
- "002422269,INFOGPRS,V Bat=13.8,TEMP=23,I TIM,15"));
+ verifyAttributes(decoder, text(
+ "002422269,INFOGPRS,V Bat=13.8,TEMP=23,I TIM,15\r\n"));
}
diff --git a/src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java
new file mode 100644
index 000000000..8d2e70bd4
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/TeltonikaFrameDecoderTest.java
@@ -0,0 +1,23 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class TeltonikaFrameDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ TeltonikaFrameDecoder decoder = new TeltonikaFrameDecoder();
+
+ verifyFrame(
+ binary("000F313233343536373839303132333435"),
+ decoder.decode(null, null, binary("FF000F313233343536373839303132333435")));
+
+ verifyFrame(
+ binary("000F313233343536373839303132333435"),
+ decoder.decode(null, null, binary("000F313233343536373839303132333435")));
+
+ }
+
+}
diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
index b515fbdc6..827e12a96 100644
--- a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
@@ -16,6 +16,9 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
"000F313233343536373839303132333435"));
verifyPositions(decoder, false, binary(
+ "000000000000004f0c01060000004755555555777730362e343b30342e323b30302e303b30302e303b30302e303b30302e303b30302e303b30302e303b30312e333b30302e303b31302e373b30302e303b5353530d0a010000e371"));
+
+ verifyPositions(decoder, false, binary(
"00000000000000100C010600000008010300010015D5C5010000D988"));
verifyPositions(decoder, binary(
diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
index 5dc78c012..0318b9896 100644
--- a/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class TeltonikaProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- TeltonikaProtocolEncoder encoder = new TeltonikaProtocolEncoder();
-
+ TeltonikaProtocolEncoder encoder = new TeltonikaProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_CUSTOM);
diff --git a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
index 34b2acf86..d1dad8c92 100644
--- a/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Tk103ProtocolEncoderTest.java
@@ -11,7 +11,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeOutputControl() {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -25,8 +25,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeEngineStop() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_ENGINE_STOP);
@@ -38,8 +38,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionSingle() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_SINGLE);
@@ -51,8 +51,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
@@ -65,8 +65,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionStop() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_STOP);
@@ -78,8 +78,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeGetVersion() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_GET_VERSION);
@@ -91,8 +91,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeRebootDevice() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_REBOOT_DEVICE);
@@ -104,8 +104,8 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSetOdometer() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
-
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_SET_ODOMETER);
@@ -117,7 +117,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionSingleAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -130,7 +130,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodicAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -143,7 +143,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionStopAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -156,7 +156,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeGetVersionAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -169,7 +169,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeRebootDeviceAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -182,7 +182,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeIdentificationAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -195,7 +195,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosOnAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -209,7 +209,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosOffAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -223,7 +223,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder();
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
@@ -237,7 +237,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustomAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -251,7 +251,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSetConnectionAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
@@ -266,7 +266,7 @@ public class Tk103ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeSosNumberAlternative() throws Exception {
- Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(true);
+ Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(null, true);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
index 5a47f74cc..d8c54afbe 100644
--- a/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/TotemProtocolEncoderTest.java
@@ -11,13 +11,13 @@ public class TotemProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- TotemProtocolEncoder encoder = new TotemProtocolEncoder();
-
+ TotemProtocolEncoder encoder = new TotemProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(2);
command.setType(Command.TYPE_ENGINE_STOP);
command.set(Command.KEY_DEVICE_PASSWORD, "000000");
-
+
assertEquals("*000000,025,C,1#", encoder.encodeCommand(command));
}
diff --git a/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
index 2fdb86218..aceb9e122 100644
--- a/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TrvProtocolDecoderTest.java
@@ -13,6 +13,9 @@ public class TrvProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, text(
"TRVAP00352121088015548"));
+ verifyPosition(decoder, text(
+ "TRVYP03190805A1828.9242N07353.9423E000.0150716029.0010000810020201112,404,27,184,10229"));
+
verifyNotNull(decoder, text(
"IWAP02,zh_cn,0,6,260,1,11002|39252|9,11002|35112|23,11002|11043|24,11002|39253|24,11002|13751|24,11018|8102|26,3,a|c0-4a-00-b6-9c-f5|64&a|c0-4a-00-b6-9c-f5|64&a|18-a6-f7-92-35-da|84"));
diff --git a/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
index bd1fc71f4..f90497292 100644
--- a/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TzoneProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class TzoneProtocolDecoderTest extends ProtocolTest {
TzoneProtocolDecoder decoder = new TzoneProtocolDecoder(null);
verifyAttributes(decoder, binary(
+ "545A004B2424041302000000086706003324776413030C0A1A2900180513030C0A1A25080F7E1028CAC830000A000F0000000005000AA53201633D05046000010009AA201737019408973B0032B0260D0A"));
+
+ verifyAttributes(decoder, binary(
"545a005b24240406010800000866050033819630120911071824000472bd8e5b0008aac01b07019b04bb002f00040b06161154000e100132ff2006161152000e080096ff4606161151000e1e0101ff1406161156000db6405bff490024469e0d0a"));
verifyAttributes(decoder, binary(
diff --git a/src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java b/src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java
index d3d0429d6..01d63bfa3 100644
--- a/src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/UlbotechFrameDecoderTest.java
@@ -12,15 +12,15 @@ public class UlbotechFrameDecoderTest extends ProtocolTest {
UlbotechFrameDecoder decoder = new UlbotechFrameDecoder();
- assertEquals(
+ verifyFrame(
binary("f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8"),
decoder.decode(null, null, binary("f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8")));
- assertEquals(
+ verifyFrame(
binary("2a545330312c33353430343330353133383934363023"),
decoder.decode(null, null, binary("2a545330312c33353430343330353133383934363023")));
- assertEquals(
+ verifyFrame(
binary("f8010108679650230646339de69054010e015ee17506bde2c60000000000ac0304024000000404000009f705060390181422170711310583410c0000310d00312f834131018608040003130a100101136cf8"),
decoder.decode(null, null, binary("f8010108679650230646339de69054010e015ee17506bde2c60000000000ac0304024000000404000009f70005060390181422170711310583410c0000310d00312f834131018608040003130a100101136cf8")));
diff --git a/src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java
index 1c29ccd4a..8c820183b 100644
--- a/src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/UlbotechProtocolDecoderTest.java
@@ -17,6 +17,10 @@ public class UlbotechProtocolDecoderTest extends ProtocolTest {
"*TS01,868323025245751,134955140317,WFE:0#"));
verifyPosition(decoder, binary(
+ "f801010868323028799515251e10d3010e03b52df8ff99fde500000000270f030402020000040402c62a7e0506057c1929220d060800000000000000000f040071eb621001018536f8"),
+ position("2019-09-25 11:49:39.000", false, 62.20543, -6.68521));
+
+ verifyPosition(decoder, binary(
"f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8"));
verifyPosition(decoder, binary(
diff --git a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
index dbbe4591f..e43ff322e 100644
--- a/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/UproProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class UproProtocolDecoderTest extends ProtocolTest {
@@ -10,6 +11,22 @@ public class UproProtocolDecoderTest extends ProtocolTest {
UproProtocolDecoder decoder = new UproProtocolDecoder(null);
+ verifyAttribute(decoder, buffer(
+ "*VK200867282036729446,BA&A1759265051877702037465660022210819&B0000000000&W00&G000030&M830&N26&O1706&o11&T0783#"),
+ Position.KEY_BATTERY_LEVEL, 83.0);
+
+ verifyAttributes(decoder, buffer(
+ "*VK201867282035754650,AH&B0000000000&W00&M990&N31&Z02&b2&T0458#"));
+
+ verifyAttributes(decoder, buffer(
+ "*VK201867282035455779,AH&B0000000000&W00&M940&N30&Z02&Y12922&T0268#"));
+
+ verifyPosition(decoder, buffer(
+ "*VK200867282035455779,BA&A0850065052928902036605660013170719&B0000000000&W00&G000030&M850&N20&O1808&o10&Y12922&T0081#"));
+
+ verifyAttributes(decoder, buffer(
+ "*VK200867282035455779,BA&X260,6,1016,13931,60;1016,13929,81;1016,14174,82;1016,13930,82&E190717103920&B0100000000&W00&G000030&M900&N23&O0000&o07&Y14014&T0015#"));
+
verifyPosition(decoder, buffer(
"*HQ200861810538000002,BA&A0206033302618209658563620115180119&B0100000040&C6328680=&F0039&R2710&V0036&T09&K50000&N04&P0200#"));
diff --git a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
index 539e63253..c5753dc4d 100644
--- a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
@@ -16,6 +16,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest {
WatchProtocolDecoder decoder = new WatchProtocolDecoder(null);
verifyPosition(decoder, buffer(
+ "[3G*2104134718*00A1*UD_WCDMA,161019,134938,A,43.373367,N,71.157615,W,22.0,350.206,279.717,17,28,79,0,0,00000000,1,1,310,410,23999,132013696,28,1,Home2,60:45:cb:cb:34:68,-93,8.263865]"));
+
+ verifyPosition(decoder, buffer(
"[ZJ*014111001332708*0075*0064*AL,040418,052156,A,22.536207,N,113.938673,E,0,0,0,5,100,82,1000,50,00100000,1,255,460,0,9340,3663,35]"));
verifyPosition(decoder, buffer(
@@ -24,6 +27,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest {
verifyAttributes(decoder, buffer(
"[3G*4700609403*0013*bphrt,120,79,73,,,,]"));
+ verifyAttributes(decoder, buffer(
+ "[ZJ*357653059860416*0007*000c*BLOOD,109,68]"));
+
verifyPosition(decoder, buffer(
"[3G*8308373902*0080*AL,230817,095346,A,47.083950,N,15.4821850,E,7.60,273.8,0.0,4,15,44,0,0,00200010,2,255,232,1,7605,42530,118,7605,58036,119,0,65.8]"));
diff --git a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
index a0631be3b..798213c7b 100644
--- a/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchProtocolEncoderTest.java
@@ -9,8 +9,8 @@ public class WatchProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- WatchProtocolEncoder encoder = new WatchProtocolEncoder();
-
+ WatchProtocolEncoder encoder = new WatchProtocolEncoder(null);
+
Command command;
command = new Command();
@@ -60,7 +60,7 @@ public class WatchProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeTimezone() {
- WatchProtocolEncoder encoder = new WatchProtocolEncoder();
+ WatchProtocolEncoder encoder = new WatchProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java
index 40b0469ea..72e56fb44 100644
--- a/src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WialonProtocolDecoderTest.java
@@ -26,6 +26,9 @@ public class WialonProtocolDecoderTest extends ProtocolTest {
"#D#101118;061143;0756.0930;N;12338.6403;E;18.223;99.766;-4.000;10;0.800;NA;NA;NA;NA;101_521347:1:521249,101_521126:1:6593598,101_521127:1:774780,101_521072_21.1:1:0,101_521072_21.2:1:71353;F24A"));
verifyPosition(decoder, text(
+ "99999999#D#101118;061143;0756.0930;N;12338.6403;E;18.223;99.766;-4.000;10;0.800;NA;NA;NA;NA;101_521347:1:521249,101_521126:1:6593598,101_521127:1:774780,101_521072_21.1:1:0,101_521072_21.2:1:71353;F24A"));
+
+ verifyPosition(decoder, text(
"#D#151216;135910;5321.1466;N;04441.7929;E;87;156;265.000000;12;1.000000;241;NA;NA;NA;odo:2:0.000000,total_fuel:1:430087,can_fls:1:201,can_taho:1:11623,can_mileage:1:140367515"));
verifyPosition(decoder, text(
@@ -36,6 +39,10 @@ public class WialonProtocolDecoderTest extends ProtocolTest {
position("2013-04-27 20:56:01.000", true, 55.74338, 37.66139));
verifyPosition(decoder, text(
+ "99999999#SD#270413;205601;5544.6025;N;03739.6834;E;1;2;3;4"),
+ position("2013-04-27 20:56:01.000", true, 55.74338, 37.66139));
+
+ verifyPosition(decoder, text(
"#SD#021214;065947;2237.7552;N;11404.8851;E;0.000;;170.9;5"));
verifyPosition(decoder, text(
diff --git a/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
index 8209fc412..41fee2723 100644
--- a/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/WondexProtocolEncoderTest.java
@@ -10,7 +10,7 @@ public class WondexProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- WondexProtocolEncoder encoder = new WondexProtocolEncoder();
+ WondexProtocolEncoder encoder = new WondexProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(2);
diff --git a/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
index dd2e939c9..0ff47cad3 100644
--- a/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/XirgoProtocolEncoderTest.java
@@ -11,14 +11,14 @@ public class XirgoProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncode() throws Exception {
- XirgoProtocolEncoder encoder = new XirgoProtocolEncoder();
-
+ XirgoProtocolEncoder encoder = new XirgoProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_OUTPUT_CONTROL);
command.set(Command.KEY_INDEX, 0);
command.set(Command.KEY_DATA, 1);
-
+
assertEquals("+XT:7005,2,1", encoder.encodeCommand(command));
}
diff --git a/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
index 49476d694..27efbd6db 100644
--- a/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Xrb28ProtocolEncoderTest.java
@@ -11,13 +11,13 @@ public class Xrb28ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodePositionPeriodic() {
- Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder();
-
+ Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(null);
+
Command command = new Command();
command.setDeviceId(1);
command.setType(Command.TYPE_POSITION_PERIODIC);
command.set(Command.KEY_FREQUENCY, 300);
-
+
assertEquals("\u00ff\u00ff*SCOS,OM,123456789012345,D1,300#\n", encoder.encodeCommand(null, command));
}
@@ -25,7 +25,7 @@ public class Xrb28ProtocolEncoderTest extends ProtocolTest {
@Test
public void testEncodeCustom() {
- Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder();
+ Xrb28ProtocolEncoder encoder = new Xrb28ProtocolEncoder(null);
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java
index f4a78b5bd..6d49f2516 100644
--- a/src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Xt2400ProtocolDecoderTest.java
@@ -10,6 +10,11 @@ public class Xt2400ProtocolDecoderTest extends ProtocolTest {
Xt2400ProtocolDecoder decoder = new Xt2400ProtocolDecoder(null);
+ decoder.setConfig("\n::wycfg pcr[1] 012801030405060708090a1213c8545657585a656e7d2cd055595d5e71797a7b7c7e7f80818285866b\n");
+
+ verifyPosition(decoder, binary(
+ "010ae85be10801a05d52d590030b12d1f9330be9290a0000ff10008b00000000000000000000000000000000000000000000000000000000000000000000000000003839333032363930323031303036363039373733000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000"));
+
decoder.setConfig("\n:wycfg pcr[0] 001001030406070809570a13121714100565\n");
verifyPosition(decoder, binary(