aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'test/org/traccar')
-rw-r--r--test/org/traccar/BaseTest.java (renamed from test/org/traccar/EventHandlerTest.java)2
-rw-r--r--test/org/traccar/FilterHandlerTest.java18
-rw-r--r--test/org/traccar/ProtocolTest.java38
-rw-r--r--test/org/traccar/WebDataHandlerTest.java2
-rw-r--r--test/org/traccar/events/AlertEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/CommandResultEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/IgnitionEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/MotionEventHandlerTest.java4
-rw-r--r--test/org/traccar/location/CellInfoTest.java36
-rw-r--r--test/org/traccar/notification/NotificiationMailTest.java57
-rw-r--r--test/org/traccar/protocol/AplicomProtocolDecoderTest.java9
-rw-r--r--test/org/traccar/protocol/AstraProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/CalAmpProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/CastelProtocolDecoderTest.java18
-rw-r--r--test/org/traccar/protocol/CguardProtocolDecoderTest.java21
-rw-r--r--test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java12
-rw-r--r--test/org/traccar/protocol/EelinkProtocolEncoderTest.java22
-rw-r--r--test/org/traccar/protocol/ExtremTracProtocolDecoderTest.java30
-rw-r--r--test/org/traccar/protocol/FifotrackProtocolDecoderTest.java27
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java60
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/H02FrameDecoderTest.java23
-rw-r--r--test/org/traccar/protocol/H02ProtocolDecoderTest.java23
-rw-r--r--test/org/traccar/protocol/HuaShengProtocolDecoderTest.java12
-rw-r--r--test/org/traccar/protocol/Jt600FrameDecoderTest.java12
-rw-r--r--test/org/traccar/protocol/Jt600ProtocolDecoderTest.java56
-rw-r--r--test/org/traccar/protocol/Jt600ProtocolEncoderTest.java37
-rw-r--r--test/org/traccar/protocol/LaipacProtocolDecoderTest.java7
-rw-r--r--test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/NavisProtocolDecoderTest.java4
-rw-r--r--test/org/traccar/protocol/Pt502ProtocolDecoderTest.java9
-rw-r--r--test/org/traccar/protocol/RuptelaProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/SmokeyProtocolDecoderTest.java30
-rw-r--r--test/org/traccar/protocol/Tk102ProtocolDecoderTest.java45
-rw-r--r--test/org/traccar/protocol/Tk103ProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/TotemProtocolDecoderTest.java6
-rw-r--r--test/org/traccar/protocol/TrakMateProtocolDecoderTest.java24
-rw-r--r--test/org/traccar/protocol/TramigoProtocolDecoderTest.java9
-rw-r--r--test/org/traccar/protocol/UlbotechFrameDecoderTest.java4
-rw-r--r--test/org/traccar/protocol/UlbotechProtocolDecoderTest.java3
-rw-r--r--test/org/traccar/protocol/UproProtocolDecoderTest.java22
-rw-r--r--test/org/traccar/protocol/V680ProtocolDecoderTest.java7
-rw-r--r--test/org/traccar/protocol/WatchProtocolDecoderTest.java3
43 files changed, 640 insertions, 94 deletions
diff --git a/test/org/traccar/EventHandlerTest.java b/test/org/traccar/BaseTest.java
index 423a5084f..0d74f50e5 100644
--- a/test/org/traccar/EventHandlerTest.java
+++ b/test/org/traccar/BaseTest.java
@@ -4,7 +4,7 @@ import org.traccar.database.IdentityManager;
import org.traccar.model.Device;
import org.traccar.model.Position;
-public class EventHandlerTest {
+public class BaseTest {
static {
Context.init(new IdentityManager() {
diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java
index b1e4fcb16..ea06a490d 100644
--- a/test/org/traccar/FilterHandlerTest.java
+++ b/test/org/traccar/FilterHandlerTest.java
@@ -6,17 +6,27 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Before;
import org.junit.Test;
+import org.traccar.database.IdentityManager;
import org.traccar.model.Position;
+import org.traccar.model.Device;
-public class FilterHandlerTest {
+public class FilterHandlerTest extends BaseTest {
private FilterHandler filtingHandler;
private FilterHandler passingHandler;
@Before
public void setUp() {
- filtingHandler = new FilterHandler(true, true, true, true, true, 10, 10);
- passingHandler = new FilterHandler(false, false, false, false, false, 0, 0);
+ passingHandler = new FilterHandler();
+ filtingHandler = new FilterHandler();
+ filtingHandler.setFilterInvalid(true);
+ filtingHandler.setFilterZero(true);
+ filtingHandler.setFilterDuplicate(true);
+ filtingHandler.setFilterFuture(true);
+ filtingHandler.setFilterApproximate(true);
+ filtingHandler.setFilterStatic(true);
+ filtingHandler.setFilterDistance(10);
+ filtingHandler.setFilterLimit(10);
}
@After
@@ -24,7 +34,7 @@ public class FilterHandlerTest {
filtingHandler = null;
passingHandler = null;
}
-
+
private Position createPosition(
long deviceId,
Date time,
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index c6c957679..756393288 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -22,41 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.TimeZone;
-public class ProtocolTest {
-
- static {
- Context.init(new IdentityManager() {
-
- private Device createDevice() {
- Device device = new Device();
- device.setId(1);
- device.setName("test");
- device.setUniqueId("123456789012345");
- return device;
- }
-
- @Override
- public Device getDeviceById(long id) {
- return createDevice();
- }
-
- @Override
- public Device getDeviceByUniqueId(String uniqueId) {
- return createDevice();
- }
-
- @Override
- public Position getLastPosition(long deviceId) {
- return null;
- }
-
- @Override
- public boolean isLatestPosition(Position position) {
- return true;
- }
-
- });
- }
+public class ProtocolTest extends BaseTest {
protected Position position(String time, boolean valid, double lat, double lon) throws ParseException {
@@ -96,7 +62,7 @@ public class ProtocolTest {
}
protected ChannelBuffer buffer(String... data) {
- return ChannelBuffers.copiedBuffer(concatenateStrings(data), StandardCharsets.US_ASCII);
+ return ChannelBuffers.copiedBuffer(concatenateStrings(data), StandardCharsets.ISO_8859_1);
}
protected DefaultHttpRequest request(String url) {
diff --git a/test/org/traccar/WebDataHandlerTest.java b/test/org/traccar/WebDataHandlerTest.java
index e68eaf74e..2a8205ad1 100644
--- a/test/org/traccar/WebDataHandlerTest.java
+++ b/test/org/traccar/WebDataHandlerTest.java
@@ -14,7 +14,7 @@ public class WebDataHandlerTest extends ProtocolTest {
WebDataHandler handler = new WebDataHandler("http://localhost/?fixTime={fixTime}&gprmc={gprmc}&name={name}");
Assert.assertEquals(
- "http://localhost/?fixTime=1451610123000&gprmc=$GPRMC,010203.000,A,2000.0000,N,03000.0000,E,0.00,0.00,010116,,*21&name=test",
+ "http://localhost/?fixTime=1451610123000&gprmc=$GPRMC,010203.000,A,2000.0000,N,03000.0000,E,0.00,0.00,010116,,*05&name=test",
handler.formatRequest(p));
}
diff --git a/test/org/traccar/events/AlertEventHandlerTest.java b/test/org/traccar/events/AlertEventHandlerTest.java
index c6d5e07d9..77128f066 100644
--- a/test/org/traccar/events/AlertEventHandlerTest.java
+++ b/test/org/traccar/events/AlertEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class AlertEventHandlerTest extends EventHandlerTest {
+public class AlertEventHandlerTest extends BaseTest {
@Test
public void testAlertEventHandler() throws Exception {
diff --git a/test/org/traccar/events/CommandResultEventHandlerTest.java b/test/org/traccar/events/CommandResultEventHandlerTest.java
index b09898b4a..f028e86ee 100644
--- a/test/org/traccar/events/CommandResultEventHandlerTest.java
+++ b/test/org/traccar/events/CommandResultEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class CommandResultEventHandlerTest extends EventHandlerTest {
+public class CommandResultEventHandlerTest extends BaseTest {
@Test
public void testCommandResultEventHandler() throws Exception {
diff --git a/test/org/traccar/events/IgnitionEventHandlerTest.java b/test/org/traccar/events/IgnitionEventHandlerTest.java
index 96df6e1ed..ad329d139 100644
--- a/test/org/traccar/events/IgnitionEventHandlerTest.java
+++ b/test/org/traccar/events/IgnitionEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class IgnitionEventHandlerTest extends EventHandlerTest{
+public class IgnitionEventHandlerTest extends BaseTest {
@Test
public void testIgnitionEventHandler() throws Exception {
diff --git a/test/org/traccar/events/MotionEventHandlerTest.java b/test/org/traccar/events/MotionEventHandlerTest.java
index 34b2c481d..622680d91 100644
--- a/test/org/traccar/events/MotionEventHandlerTest.java
+++ b/test/org/traccar/events/MotionEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class MotionEventHandlerTest extends EventHandlerTest {
+public class MotionEventHandlerTest extends BaseTest {
@Test
public void testMotionEventHandler() throws Exception {
diff --git a/test/org/traccar/location/CellInfoTest.java b/test/org/traccar/location/CellInfoTest.java
new file mode 100644
index 000000000..e78ce51fb
--- /dev/null
+++ b/test/org/traccar/location/CellInfoTest.java
@@ -0,0 +1,36 @@
+package org.traccar.location;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CellInfoTest {
+
+ @Test
+ public void testToString() {
+
+ CellInfo info = new CellInfo();
+ info.addCell(0, 0, 1000, 2000);
+ info.addCell(400, 1, 3000, 4000);
+
+ Assert.assertEquals("[{\"lac\":1000,\"cid\":2000},{\"mcc\":400,\"mnc\":1,\"lac\":3000,\"cid\":4000}]", info.toString());
+
+ }
+
+ @Test
+ public void testFromString() {
+
+ CellInfo info = CellInfo.fromString("[{\"lac\":1000,\"cid\":2000}]");
+
+ Assert.assertEquals(1, info.getCells().size());
+
+ CellInfo.Cell cell = info.getCells().get(0);
+
+ Assert.assertEquals(0, cell.getMcc());
+ Assert.assertEquals(0, cell.getMnc());
+ Assert.assertEquals(1000, cell.getLac());
+ Assert.assertEquals(2000, cell.getCid());
+ Assert.assertEquals(0, cell.getSignal());
+
+ }
+
+}
diff --git a/test/org/traccar/notification/NotificiationMailTest.java b/test/org/traccar/notification/NotificiationMailTest.java
new file mode 100644
index 000000000..975505a3a
--- /dev/null
+++ b/test/org/traccar/notification/NotificiationMailTest.java
@@ -0,0 +1,57 @@
+package org.traccar.notification;
+
+import org.junit.Test;
+
+import javax.mail.Message;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import java.util.Properties;
+
+public class NotificiationMailTest {
+
+ private static final String FROM = "notification@traccar.org";
+ private static final String TO = "anton@traccar.org";
+
+ private static final String BODY = "Test email body.";
+ private static final String SUBJECT = "Test";
+
+ private static final String SMTP_USERNAME = "username";
+ private static final String SMTP_PASSWORD = "password";
+
+ private static final String HOST = "email-smtp.us-west-2.amazonaws.com";
+
+ private static final int PORT = 25;
+
+ //@Test
+ public void test() throws Exception {
+
+ Properties props = System.getProperties();
+ props.put("mail.transport.protocol", "smtps");
+ props.put("mail.smtp.port", PORT);
+
+ props.put("mail.smtp.auth", "true");
+ props.put("mail.smtp.starttls.enable", "true");
+ props.put("mail.smtp.starttls.required", "true");
+
+ Session session = Session.getInstance(props);
+
+ MimeMessage msg = new MimeMessage(session);
+ msg.setFrom(new InternetAddress(FROM));
+ msg.setRecipient(Message.RecipientType.TO, new InternetAddress(TO));
+ msg.setSubject(SUBJECT);
+ msg.setContent(BODY, "text/plain");
+
+ Transport transport = session.getTransport();
+
+ try {
+ transport.connect(HOST, SMTP_USERNAME, SMTP_PASSWORD);
+ transport.sendMessage(msg, msg.getAllRecipients());
+ } finally {
+ transport.close();
+ }
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java
index d6a29c6dd..cb39b5d2e 100644
--- a/test/org/traccar/protocol/AplicomProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AplicomProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class AplicomProtocolDecoderTest extends ProtocolTest {
AplicomProtocolDecoder decoder = new AplicomProtocolDecoder(new AplicomProtocol());
verifyAttributes(decoder, binary(
+ "48C1014143B4493145004900203F6D014B5557C20003000015060110FF00C800000000000000003D01141E283C500100260404010200000000000000000000000000C8000000000000010200110019001E0064019003E8"));
+
+ verifyAttributes(decoder, binary(
+ "48c10144b9de54e6b2008700205f710a57d23ec957d23b8d00000000300d0106ff00000000000000000000000000000000000000000000000000000000000000010a141e28323c46505a646e7801000f020104ff000000000000000000010102000f020104ff000000000000000000010103000f020104ff000000000000000000010105000f020104ff0000000000000000000101"));
+
+ verifyAttributes(decoder, binary(
"45c20145931876ffb2007100ffff6d00000057c6dd1970230d087b1f7d7f0000d0c1000000003580000035801f40ffff5001574442393036363035533132333435363700014142432d333435202020202020000000000000000000000000000000000000000000000001123130343632343639373030303030303100000000"));
verifyAttributes(decoder, binary(
@@ -19,9 +25,6 @@ public class AplicomProtocolDecoderTest extends ProtocolTest {
verifyAttributes(decoder, binary(
"45c20145931876ffb2007100ffff6d00000057c6de0970270d087b1f7d7f0000d0c1000000003580000035801f40ffff5001574442393036363035533132333435363700014142432d333435202020202020000000000000000000000000000000000000000000000001123130343632343639373030303030303100000000"));
- verifyNothing(decoder, binary(
- "48c10144b9de54e6b2008700205f710a57d23ec957d23b8d00000000300d0106ff00000000000000000000000000000000000000000000000000000000000000010a141e28323c46505a646e7801000f020104ff000000000000000000010102000f020104ff000000000000000000010103000f020104ff000000000000000000010105000f020104ff0000000000000000000101"));
-
verifyAttributes(decoder, binary(
"44c3014645e8ecff3c00ea03ffffbc00f457d68a6557d68a6303bb55fa018843da1100009881000000000000000000000000000000000000000000000000000000000000000000000000000000ff0056007600000000000000014542016d0001010095070e14014645e8ecff3c57d68a6403bb55fa018843dac0010d14ff050102030405060708090a0b0c0d0e0f10112a01010730343f3c1ff5cf01020700007d007d23010103022f2e01060c67452301efcdab8967452301010b10000000007d007d007d7dffffffffffff010a2400000000000000010000000000000000ffffffffffffffff00010001ffff00000000ffff010c02fec6"));
diff --git a/test/org/traccar/protocol/AstraProtocolDecoderTest.java b/test/org/traccar/protocol/AstraProtocolDecoderTest.java
index e8a9b12b5..3531be5a8 100644
--- a/test/org/traccar/protocol/AstraProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AstraProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class AstraProtocolDecoderTest extends ProtocolTest {
AstraProtocolDecoder decoder = new AstraProtocolDecoder(new AstraProtocol());
verifyPositions(decoder, binary(
+ "4b00700529c0c265976b8202cba9ff00676d864554a9c30000000020073401006436000300030008000000000000a0000100001920c43d00009600428302cba9ff00676d864554aa3e000000002007240100643b000300020008000000000000b0000100001920c43d00009600420f0e"));
+
+ verifyPositions(decoder, binary(
"4b00320524c1da58769e6d0322617effe874024453065600a800000100080000643e0000000000000000000000069500e7bb"));
verifyPositions(decoder, binary(
diff --git a/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java b/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
index 9ed4c4a43..8d7d5f9fe 100644
--- a/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CalAmpProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class CalAmpProtocolDecoderTest extends ProtocolTest {
CalAmpProtocolDecoder decoder = new CalAmpProtocolDecoder(new CalAmpProtocol());
verifyPosition(decoder, binary(
+ "8305133303910501010102004557E5AB2457E3B3E01FD828DBFE9E3465000028C90000004201310704001EFFA12F0B22081BCA05000000000000000F87000E8E2F00EA029E0000082D"));
+
+ verifyPosition(decoder, binary(
+ "8305313301481601010102045557ea2eba57ea2eba1ebf06db005f2e5e0000220c00000000000006200000ff8f000a00000bca06000000000000000f1b000f35ef00ea02900000087000000060"));
+
+ verifyPosition(decoder, binary(
"8305454205067001010102008157a9bddc57a96aaa17cdb98fccc1a457000056ac00000000000007250000ff8f000e00082711570000000000ffff101b00003148000010680000000000000000000000050000000000000000000005b0000000000000289600000000000000000000069b00000000000008e400000000000000000000000000000003000000010000070f"));
verifyPosition(decoder, binary(
diff --git a/test/org/traccar/protocol/CastelProtocolDecoderTest.java b/test/org/traccar/protocol/CastelProtocolDecoderTest.java
index e2f2c26bf..4ecb263ba 100644
--- a/test/org/traccar/protocol/CastelProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CastelProtocolDecoderTest.java
@@ -13,6 +13,24 @@ public class CastelProtocolDecoderTest extends ProtocolTest {
CastelProtocolDecoder decoder = new CastelProtocolDecoder(new CastelProtocol());
verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "404043000432313345503230313630303035383500000000004006a2021d5810031d58ae940400da050000f6040000070000000400076401680000000001001bd20d0a"));
+
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4040d0000432313345503230313630303035383500000000001001831c1c58b1fc1c58ae94040012220000f60400005800000000000763016800008484004944445f3231335730315f532056312e302e37004944445f3231335730315f482056312e302e370032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f0121022101260127012861780d0a"));
+
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "404029000432313345503230313630303035383500000000009001ffffffff0000b4fc1c582b6e0d0a"));
+
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "40406000043231334550323031363030303538350000000000400708000000831c1c58f4fb1c58ae94040012220000f604000058000000200007630168000084c401040b10090c3532db3f07f07f7520090100000101010e00000000c7920d0a"));
+
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "404042000432313345503230313630303035383500000000001002831c1c58b7fc1c58ae94040012220000f604000058000000000007630168000084840072a20d0a"));
+
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "4040d0000432313345503230313630303035383500000000001001831c1c5805fe1c58ae94040012220000f60400005800000000000763016800008484004944445f3231335730315f532056312e302e37004944445f3231335730315f482056312e302e370032000110021003100410051006100710081009100a100b100c100d100e1011100111021103110411051106110711011202120312041201130213031301160216011701180218011b011c011d011e011f021f031f041f051f061f071f012102210126012701284eb10d0a"));
+
+ verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"40405700043231334e583230313630303131373700000000004002c458ce572159ce57a9e2020082030000500c00000f0000000400036401240e0403023c000505210c210d210f21102101075b14030121330269430d0a"));
verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
diff --git a/test/org/traccar/protocol/CguardProtocolDecoderTest.java b/test/org/traccar/protocol/CguardProtocolDecoderTest.java
index 49d037f8f..ff9ecb9be 100644
--- a/test/org/traccar/protocol/CguardProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/CguardProtocolDecoderTest.java
@@ -14,15 +14,24 @@ public class CguardProtocolDecoderTest extends ProtocolTest {
"IDRO:354868050655283"));
verifyPosition(decoder, text(
+ "NV:161007 122043:55.812730:37.733689:3.62:NAN:244.05:143.4"));
+
+ verifyPosition(decoder, text(
+ "NV:161007 122044:55.812732:37.733670:3.97:NAN:260.95:143.9"));
+
+ verifyAttributes(decoder, text(
+ "BC:161007 122044:CSQ1:77:NSQ1:18:BAT1:100"));
+
+ verifyPosition(decoder, text(
"NV:160711 044023:54.342907:48.582590:0:NAN:0:110.1"));
verifyPosition(decoder, text(
"NV:160711 044023:54.342907:-148.582590:0:NAN:0:110.1"));
- verifyNothing(decoder, text(
+ verifyAttributes(decoder, text(
"BC:160711 044023:CSQ1:48:NSQ1:7:NSQ2:1:BAT1:98:PWR1:11.7:CLG1:NAN"));
- verifyNothing(decoder, text(
+ verifyAttributes(decoder, text(
"BC:160711 044524:CSQ1:61:NSQ1:18:BAT1:98:PWR1:11.7:CLG1:NAN"));
verifyNothing(decoder, text(
@@ -31,19 +40,19 @@ public class CguardProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"NV:160420 101902:55.799425:37.674033:0.94:NAN:213.59:156.6"));
- verifyNothing(decoder, text(
+ verifyAttributes(decoder, text(
"BC:160628 081024:CSQ1:32:NSQ1:10:BAT1:100"));
- verifyNothing(decoder, text(
+ verifyAttributes(decoder, text(
"BC:160628 081033:NSQ2:0"));
verifyPosition(decoder, text(
"NV:160630 151537:55.799913:37.674267:0.7:NAN:10.21:174.9"));
- verifyNothing(decoder, text(
+ verifyAttributes(decoder, text(
"BC:160630 153316:BAT1:76"));
- verifyNothing(decoder, text(
+ verifyAttributes(decoder, text(
"BC:160630 153543:NSQ2:0"));
verifyNothing(decoder, text(
diff --git a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
index 41c747ad6..51c515544 100644
--- a/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EasyTrackProtocolDecoderTest.java
@@ -10,6 +10,18 @@ public class EasyTrackProtocolDecoderTest extends ProtocolTest {
EasyTrackProtocolDecoder decoder = new EasyTrackProtocolDecoder(new EasyTrackProtocol());
+ verifyPosition(decoder, text(
+ "*ET,358155100054249,HB,A,100b06,053318,803a0b51,03d507c9,0017,0000,00400000,07,100,0000,1435,63"));
+
+ verifyNothing(decoder, text(
+ "*ET,358155100054249,MQ"));
+
+ verifyNothing(decoder, text(
+ "*ET,358155100054249,TX,A,100b06,053230"));
+
+ verifyPosition(decoder, text(
+ "*ET,358155100054249,HB,A,100b06,053212,803a0b20,03d507a2,0054,0000,40400000,06,100,0000,1435,44"));
+
verifyNothing(decoder, text(
"*ET,135790246811221,GZ,0001,0005"));
diff --git a/test/org/traccar/protocol/EelinkProtocolEncoderTest.java b/test/org/traccar/protocol/EelinkProtocolEncoderTest.java
new file mode 100644
index 000000000..8a8cd5f6b
--- /dev/null
+++ b/test/org/traccar/protocol/EelinkProtocolEncoderTest.java
@@ -0,0 +1,22 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Command;
+
+public class EelinkProtocolEncoderTest extends ProtocolTest {
+
+ @Test
+ public void testEncode() throws Exception {
+
+ EelinkProtocolEncoder encoder = new EelinkProtocolEncoder();
+
+ Command command = new Command();
+ command.setDeviceId(1);
+ command.setType(Command.TYPE_ENGINE_STOP);
+
+ verifyCommand(encoder, command, binary("676780000f0000010000000052454c41592c3123"));
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/ExtremTracProtocolDecoderTest.java b/test/org/traccar/protocol/ExtremTracProtocolDecoderTest.java
new file mode 100644
index 000000000..82e461fc7
--- /dev/null
+++ b/test/org/traccar/protocol/ExtremTracProtocolDecoderTest.java
@@ -0,0 +1,30 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class ExtremTracProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ ExtremTracProtocolDecoder decoder = new ExtremTracProtocolDecoder(new ExtremTracProtocol());
+
+ verifyPosition(decoder, text(
+ "$GPRMC,10000000001,092313.299,A,2238.8947,N,11355.2253,E,0.00,311.19,010307,0,,"));
+
+ verifyPosition(decoder, text(
+ "$GPRMC,00000000000,092244.000,A,0000.0000,S,00000.0000,E,0.00,0.00,101016,0,,8000,0"));
+
+ verifyNothing(decoder, text(
+ "$GPRMC,092313.299,A,2238.8947,N,11355.2253,E,0.00,311.19,010307,0,,1111,1111"));
+
+ verifyNothing(decoder, text(
+ "$GPRMC,092313.299,A,2238.8947,N,11355.2253,E,0.00,311.19,010307,0,,"));
+
+ verifyNothing(decoder, text(
+ "$GPRMC,100936.000,A,0000.0000,S,00000.0000,E,0.00,0.00,101016,0,,8000,0"));
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/FifotrackProtocolDecoderTest.java b/test/org/traccar/protocol/FifotrackProtocolDecoderTest.java
new file mode 100644
index 000000000..7cde4b5c9
--- /dev/null
+++ b/test/org/traccar/protocol/FifotrackProtocolDecoderTest.java
@@ -0,0 +1,27 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class FifotrackProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ FifotrackProtocolDecoder decoder = new FifotrackProtocolDecoder(new FifotrackProtocol());
+
+ verifyPosition(decoder, text(
+ "$$105,866104023179743,AB,A00,,161007085534,A,54.738791,25.271918,0,350,151,0,17929,0000,0,,246|1|65|96DB,936|0*0B"));
+
+ verifyPosition(decoder, text(
+ "$$103,866104023179743,5,A00,,161006192841,A,54.738791,25.271918,0,342,200,0,4265,0000,0,,246|1|65|96DB,9C4|0*75"));
+
+ verifyPosition(decoder, text(
+ "$$103,866104023179743,4,A00,,161006192810,V,54.738791,25.271918,0,158,122,0,4235,0000,0,,246|1|65|96DB,9C5|0*69"));
+
+ verifyPosition(decoder, text(
+ "$$135,866104023192332,29,A01,,160606093046,A,22.546430,114.079730,0,186,181,0,415322,0000,02,2,460|0|27B3|EA7,A2F|3B9|3|0,940C7E,31.76|30.98*46"));
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index ea28928c0..fa8373898 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -10,6 +10,39 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol());
+ verifyAttributes(decoder, text(
+ "+RESP:GTINF,210102,A10000499AEF9B,,41,,0,0,0,15.0,9,3.87,0,1,1,0,0,20161101140211,72,,,,,20161101140211,00A3$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTNMR,210102,A10000499AEF9B,,0,0,1,9,0.0,0,288.0,-76.902364,39.578828,20161101134145,,,,,00,73,20161101134145,009F$"));
+
+ verifyPositions(decoder, text(
+ "+RESP:GTFRI,210102,A10000499AEF9B,,0,1,1,9,0.5,0,288.0,-76.902364,39.578828,20161101134124,,,,,00,73,20161101134123,009D$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTRTL,210102,A10000499AEF9B,,0,0,1,10,0.2,0,305.4,-76.902274,39.578517,20161101155001,,,,,00,73,20161101155001,00A6$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTINF,110100,358688000000158,,41,898600810906F8048812,18,99,0,33.23,1,4.19,1,1,1,0,0,20110714104934,100,,,,,20110714104934,0014$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTINF,080100,135790246811220,,16,898600810906F8048812,16,0,1,11870,,4.1,0,0,0,,20090214013254,,12340,,00,00,+0800,0,20090214093254,11F0$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTINF,040100,135790246811220,,16,898600810906F8048812,16,0,1,,0,4.4,0,0,0,0,20090214013254,13000,00,00,+0800,0,20090214093254,11F0$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTINF,060100,135790246811220,,16,898600810906F8048812,16,0,1,12000,,4.4,0,0,0,0,20090214013254,0,1300,2000,00,00,+0800,0,20090214093254,11F0$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTINF,1A0800,860599000773978,GL300,41,89701016426133851978,17,0,1,26.6,,3.90,1,1,0,0,0,20161003184043,69,1,44,,,20161004040811,022C$"));
+
+ verifyAttributes(decoder, text(
+ "+BUFF:GTINF,1A0800,860599000773978,GL300,41,89701016426133851978,23,0,1,204.7,,3.84,1,1,0,0,0,20161006072548,62,1,38,,,20161006082343,0C98$"));
+
+ verifyPosition(decoder, text(
+ "+RESP:GTFRI,360100,864251020141408,3VWGW6AJ0FM237324,gv500,,10,1,1,0.0,0,2258.4,-99.256948,19.555800,20160929214743,0334,0020,0084,65AC,00,0.0,,,,100,410000,0,nan,,20160929214743,13BA$"));
+
verifyPosition(decoder, text(
"+RESP:GTOBD,360201,864251020186064,4T1BE46KX7U018210,,0,19FFFF,4T1BE46KX7U018210,1,14283,983901C0,799,36,18,,33792,0,0,0,,,38,,6,53557,0,0.0,0,219.5,-76.661456,39.832588,20160507132153,20160507132154,0230$"));
@@ -144,10 +177,37 @@ public class Gl200ProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, text(
"+RESP:GTRTL,280100,A1000043D20139,,0,0,1,1,0.1,321,239.1,-76.661047,39.832501,20150615114455,0310,0484,00600019,0A52,,87,20150615074456,031E$"));
+
+ verifyAttributes(decoder, text(
+ "+BUFF:GTBPL,1A0800,860599000773978,GL300,3.55,0,0.0,0,257.1,60.565437,56.818277,20161006070553,,,,,204.7,20161006071028,0C75$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTTEM,1A0102,860599000000448,,3,33,0,5.8,0,33.4,117.201191,31.832502,20130109061410,0460,0000,5678,2079,,20130109061517,0091$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTJDR,0A0102,135790246811220,,0,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,20090214093254,11F0$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTJDS,0A0102,135790246811220,,2,0,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,20090214093254,11F0$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTSOS,020102,135790246811220,,0,0,1,1,4.3,92,70.0,121.354335,31.222073,20090214013254,0460,0000,18d8,6141,00,,20090214093254,11F0$"));
+
+ verifyAttributes(decoder, text(
+ "+RESP:GTVER,1A0800,860599000773978,GL300,GL300,0A03,0103,20161007041531,10F8$"));
verifyNothing(decoder, text(
"+ACK:GTHBD,1A0401,135790246811220,,20100214093254,11F0"));
+ verifyAttributes(decoder, text(
+ "+ACK:GTRTO,1A0800,860599000773978,GL300,VER,FFFF,20161006053520,0C19"));
+
+ verifyAttributes(decoder, text(
+ "+ACK:GTJDC,0A0102,135790246811220,,0016,20090214093254,11F0"));
+
+ verifyAttributes(decoder, text(
+ "+ACK:GTGEO,1A0102,135790246811220,,0,0008,20100310172830,11F0"));
+
}
}
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index 72b0be1b5..2640051fb 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest {
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new Gps103Protocol());
verifyAttributes(decoder, text(
+ "imei:359710049057798,OBD,161003192752,1785,,,0,54,96.47%,75,20.00%,1892,0.00,P0134,P0571,,;"));
+
+ verifyAttributes(decoder, text(
"imei:359710049090138,OBD,160629022949,51442,0.00,15.88,5632,122,40.39%,95,0.00%,2101,13.80,,,,;"));
verifyPosition(decoder, text(
diff --git a/test/org/traccar/protocol/H02FrameDecoderTest.java b/test/org/traccar/protocol/H02FrameDecoderTest.java
index a8417341a..7d54299a5 100644
--- a/test/org/traccar/protocol/H02FrameDecoderTest.java
+++ b/test/org/traccar/protocol/H02FrameDecoderTest.java
@@ -7,9 +7,17 @@ import org.traccar.ProtocolTest;
public class H02FrameDecoderTest extends ProtocolTest {
@Test
- public void testDecode() throws Exception {
+ public void testDecodeShort() throws Exception {
- H02FrameDecoder decoder = new H02FrameDecoder(32);
+ H02FrameDecoder decoder = new H02FrameDecoder(0);
+
+ Assert.assertEquals(
+ binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"),
+ decoder.decode(null, null, binary("2441060116601245431311165035313006004318210e000000fffffbffff0024")));
+
+ Assert.assertEquals(
+ binary("2441060116601245431311165035313006004318210e000000fffffbffff0024"),
+ decoder.decode(null, null, binary("2441060116601245431311165035313006004318210e000000fffffbffff00242a48512c343130363031313636302c56312c3132343535322c412c353033352e333132392c4e2c30303433312e383231312c452c3030302e32302c3030302c3133313131362c464646464642464623")));
Assert.assertEquals(
binary("2a48512c3335333538383036303031353536382c56312c3139333530352c412c3830392e303031302c532c333435342e383939372c572c302e30302c302e30302c3239313031332c65666666666266662c3030303264342c3030303030622c3030353338352c3030353261612c323523"),
@@ -21,4 +29,15 @@ public class H02FrameDecoderTest extends ProtocolTest {
}
+ @Test
+ public void testDecodeLong() throws Exception {
+
+ H02FrameDecoder decoder = new H02FrameDecoder(0);
+
+ Assert.assertEquals(
+ binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"),
+ decoder.decode(null, null, binary("24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f")));
+
+ }
+
}
diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
index e4db2f56f..b2e336076 100644
--- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -10,6 +10,24 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
H02ProtocolDecoder decoder = new H02ProtocolDecoder(new H02Protocol());
+ verifyNothing(decoder, buffer(
+ "*HQ,356803210091319,BS,,2d4,a,1b63,1969,26,1b63,10b2,31,0,0,25,,ffffffff,60#"));
+
+ verifyAttributes(decoder, buffer(
+ "*HQ,1400046168,NBR,160169,460,0,1,4,9338,3692,150,9338,3691,145,9338,3690,140,9338,3692,139,180813,FFFFFBFF#"));
+
+ verifyAttributes(decoder, buffer(
+ "*HQ,1600068860,NBR,120156,262,03,255,6,802,54702,46,802,5032,37,802,54782,30,802,5052,28,802,54712,12,802,5042,12,081116,FFFFFBFF#"));
+
+ verifyAttributes(decoder, buffer(
+ "*HQ,1600068860,NBR,110326,262,03,255,6,802,23152,23,812,49449,14,802,35382,13,802,35402,11,812,56622,09,802,23132,04,081116,FFFFFBFF#"));
+
+ verifyNothing(decoder, buffer(
+ "*HQ,1600068860,LINK,112137,20,8,67,0,0,081116,FFFFFBFF#"));
+
+ verifyNothing(decoder, buffer(
+ "*HQ,355488020533263,V3,121536,65501,04,000152,014001,156,-64,000161,010642,138,,000152,014003,129,,000152,013973,126,,02E4,0,X,071116,FFFFFBFF#"));
+
verifyPosition(decoder, buffer(
"*HQ,4209917484,V19,093043,V,5052.9749,N,00426.4322,E,000.00,000,130916,,0032475874141,8944538530000543700F,FFFFFBFF#"));
@@ -20,7 +38,7 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
"*HQ,4210051415,V1,164549,A,0956.3869,N,08406.7068,W,000.00,000,221215,FFFFFBFF,712,01,0,0,6#"),
position("2015-12-22 16:45:49.000", true, 9.93978, -84.11178));
- verifyNothing(decoder, buffer(
+ verifyAttributes(decoder, buffer(
"*HQ,1451316451,NBR,112315,724,10,2,2,215,2135,123,215,2131,121,011215,FFFFFFFF#"));
verifyPosition(decoder, buffer(
@@ -101,6 +119,9 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
"*HQ,8401016597,BASE,152609,0,0,0,0,211014,FFFFFFFF#"));
verifyPosition(decoder, binary(
+ "2441060116601245431311165035313006004318210e000000fffffbffff0024"));
+
+ verifyPosition(decoder, binary(
"24410600082621532131081504419390060740418306000000fffffbfdff0015060000002c02dc0c000000001f"),
position("2015-08-31 21:53:21.000", true, 4.69898, -74.06971));
diff --git a/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java b/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java
index 7cb6b65a0..e6c918ff3 100644
--- a/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/HuaShengProtocolDecoderTest.java
@@ -14,6 +14,18 @@ public class HuaShengProtocolDecoderTest extends ProtocolTest {
"c000000077aa0200000000000e000100143347315f48312e315f56312e30372e54000300133335353835353035303434303635380004000b3531323030303000050005010006000400070004000800050000090018383936313032353431343533333239313833360d000a000f796573696e7465726e6574c0"));
verifyPosition(decoder, binary(
+ "c00000004baa0000000000000f8000000031363130323030373236333600e6d4f9ffcc78c700000022003600000001001500000000000000000000059bffffffffff0005000a040300000253c0"));
+
+ verifyPosition(decoder, binary(
+ "c00000004baa000000000000098000000031363130303732323236343700e6d4efffcc789f000000000026000000010015000000000000000000000488ffffffffff0005000a10060000008dc0"));
+
+ /*verifyPosition(decoder, binary(
+ "c00000004baa0000000000000aa5a5a55a3f008000000031363130303732333139343600e61e4fffcc33fe0000000000470000000100150000000000000000000004b4ffffffffff0005000ac0"));*/
+
+ verifyPosition(decoder, binary(
+ "c00000004baa000000000000098000000031363130303732323236343700e6d4efffcc789f000000000026000000010015000000000000000000000488ffffffffff0005000a10060000008dc0"));
+
+ verifyPosition(decoder, binary(
"c00000004baa00000000000005c400000131363037303630323537303800e6c82effcc7cb0003900a30089000000010015000000000000000000f20559ff577ce3980005000a060500000087c0"));
verifyNothing(decoder, binary(
diff --git a/test/org/traccar/protocol/Jt600FrameDecoderTest.java b/test/org/traccar/protocol/Jt600FrameDecoderTest.java
index ccfbcf0d0..afa53ba13 100644
--- a/test/org/traccar/protocol/Jt600FrameDecoderTest.java
+++ b/test/org/traccar/protocol/Jt600FrameDecoderTest.java
@@ -12,6 +12,14 @@ public class Jt600FrameDecoderTest extends ProtocolTest {
Jt600FrameDecoder decoder = new Jt600FrameDecoder();
Assert.assertEquals(
+ binary("2475604055531611002311111600311326144436028210791d016c0000001f070000000020c03c4f6d07d80ccf"),
+ decoder.decode(null, null, binary("2475604055531611002311111600311326144436028210791d016c0000001f070000000020c03c4f6d07d80ccf")));
+
+ Assert.assertEquals(
+ binary("2475605035891613002328091601152806086750106533350c00000000000a000000000000e1ff4f97007f1607"),
+ decoder.decode(null, null, binary("2475605035891613002328091601152806086750106533350c00000000000a000000000000e1ff4f97007f1607")));
+
+ Assert.assertEquals(
binary("28333132303832303032392C5730312C30323535332E333535352C452C323433382E303939372C532C412C3137313031322C3035333333392C302C382C32302C362C33312C352C32302C323029"),
decoder.decode(null, null, binary("28333132303832303032392C5730312C30323535332E333535352C452C323433382E303939372C532C412C3137313031322C3035333333392C302C382C32302C362C33312C352C32302C323029")));
@@ -19,6 +27,10 @@ public class Jt600FrameDecoderTest extends ProtocolTest {
binary("24312082002911001B171012053405243809970255335555000406140003EE2B91044D1F02"),
decoder.decode(null, null, binary("24312082002911001B171012053405243809970255335555000406140003EE2B91044D1F02")));
+ Assert.assertEquals(
+ binary("28373536303430353535332c404a5429"),
+ decoder.decode(null, null, binary("28373536303430353535332c404a5429")));
+
}
}
diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
index b95d8ddce..59dc311aa 100644
--- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java
@@ -12,6 +12,45 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest {
Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new Jt600Protocol());
verifyPosition(decoder, binary(
+ "2475604055531611002311111600311326144436028210791d016c0000001f070000000020c03c4f6d07d80ccf"));
+
+ verifyPosition(decoder, binary(
+ "2475201509260111002313101503464722331560113555309F00000000002D0500CB206800F064109326381A03"));
+
+ verifyPosition(decoder, binary(
+ "2475605035891613002328091601152806086750106533350c00000000000a000000000000e1ff4f97007f1607"));
+
+ verifyPosition(decoder, buffer(
+ "(3301210003,U01,040812,185302,T,22.564025,N,113.242329,E,5.21,152,9,32%,00000000000011,10133,5173,22,100,1)"));
+
+ verifyPosition(decoder, buffer(
+ "(3301210003,U02,040812,185302,T,22.564025,N,113.242329,E,5,152,9,32%,00000000000011,10133,5173,22,100,1)"));
+
+ verifyPosition(decoder, buffer(
+ "(3301210003,U03,040812,185302,T,22.564025,N,113.242329,E,5,152,9,32%,00000000000011,10133,5173,22,100,1)"));
+
+ verifyNothing(decoder, buffer(
+ "(3301210003,U04)"));
+
+ verifyPosition(decoder, buffer(
+ "(3301210003,U06,1,040812,185302,T,22.564025,N,113.242329,E,5,152,9,32%,0000000000011,10133,5173,22,100,1,300,100,10)"));
+
+ verifyPosition(decoder, buffer(
+ "(3460311327,U01,220916,135251,T,9.552607,N,13.658292,W,0.31,0,9,0%,00001001000000,11012,10,27,0,0,33)"));
+
+ verifyPosition(decoder, buffer(
+ "(3460311327,U01,010100,000024,F,0.000000,N,0.000000,E,0.00,0,0,100%,00000001000000,263,1,18,0,0,33)"));
+
+ verifyNothing(decoder, buffer(
+ "(3460311327,@JT)"));
+
+ verifyPosition(decoder, buffer(
+ "(3460311327,U06,11,220916,135643,T,9.552553,N,13.658265,W,0.61,0,9,100%,00000001000000,11012,10,30,0,0,126,0,30)"));
+
+ verifyPosition(decoder, buffer(
+ "(3460311327,U06,10,220916,140619,T,9.552495,N,13.658227,W,0.43,0,7,0%,00101001000000,11012,10,0,0,0,126,0,30)"));
+
+ verifyPosition(decoder, binary(
"24311021600111001B16021105591022329862114046227B0598095080012327951435161F"),
position("2011-02-16 05:59:10.000", true, 22.54977, -114.07705));
@@ -31,11 +70,20 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, buffer(
"(3120820029,W01,02553.3555,E,2438.0997,S,A,171012,053339,0,8,20,6,31,5,20,20)"));
- /*verifyPosition(decoder, text( ChannelBuffers.copiedBuffer(
- "(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)", StandardCharsets.US_ASCII)));
+ verifyPosition(decoder, buffer(
+ "(3330104377,U01,010100,010228,F,00.000000,N,000.000000,E,0,0,0,0%,00001000000000,741,14,22,0,206)"));
+
+ verifyNothing(decoder, buffer(
+ "(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)"));
+
+ verifyPosition(decoder, buffer(
+ "(3301210003,U02,040812,185302,T,00.000000,N,000.000000,E,0,0,0,0%,00000000000011,741,51,22,0,1,05)"));
- verifyPosition(decoder, text( ChannelBuffers.copiedBuffer(
- "(6221107674,2,U09,129,2,A,280513113036,E,02711.0500,S,1721.0876,A,030613171243,E,02756.7618,S,2300.0325,3491,538200,14400,1)",StandardCharsets.US_ASCII))));*/
+ verifyPosition(decoder, buffer(
+ "(3301210003,U06,4,250916,133207,T,7.011013,N,25.060708,W,27.61,102,10,0%,00101011000000,0,1,0,448,0,126,1,30)"));
+
+ verifyPosition(decoder, buffer(
+ "(3551001012,U01,010100,000032,F,0.000000,N,0.000000,E,0.00,0,0,10%,00000000010000,15748,7923,23,0,0,3E)"));
}
diff --git a/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java b/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java
new file mode 100644
index 000000000..80802dc35
--- /dev/null
+++ b/test/org/traccar/protocol/Jt600ProtocolEncoderTest.java
@@ -0,0 +1,37 @@
+package org.traccar.protocol;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+import org.traccar.model.Command;
+
+public class Jt600ProtocolEncoderTest extends ProtocolTest {
+ Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder();
+ Command command = new Command();
+
+ @Test
+ public void testEngineStop() throws Exception {
+ command.setType(Command.TYPE_ENGINE_STOP);
+ assertEquals("(S07,0)", encoder.encodeCommand(command));
+ }
+
+ @Test
+ public void testEngineResume() throws Exception {
+ command.setType(Command.TYPE_ENGINE_RESUME);
+ assertEquals("(S07,1)", encoder.encodeCommand(command));
+ }
+
+ @Test
+ public void testSetTimezone() throws Exception {
+ command.setType(Command.TYPE_SET_TIMEZONE);
+ command.set(Command.KEY_TIMEZONE, 240 * 60);
+ assertEquals("(S09,1,240)", encoder.encodeCommand(command));
+ }
+
+ @Test
+ public void testReboot() throws Exception {
+ command.setType(Command.TYPE_REBOOT_DEVICE);
+ assertEquals("(S17)", encoder.encodeCommand(command));
+ }
+}
diff --git a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java
index 23477b186..d1fafe71a 100644
--- a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java
@@ -83,11 +83,14 @@ 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(
+ 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"));*/
+ "$AVRMC,MSG00002,050601,P,5114.4751,N,00534.3175,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*7D"));
+
+ verifyPosition(decoder, text(
+ "$AVRMC,96414215,170046,p,4310.7965,N,07652.0816,E,0.00,0.00,071016,0,4069,98,1,0,0*04"));
}
diff --git a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
index 58d761ed8..10fa3f971 100644
--- a/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/MeiligaoProtocolDecoderTest.java
@@ -10,6 +10,12 @@ public class MeiligaoProtocolDecoderTest extends ProtocolTest {
MeiligaoProtocolDecoder decoder = new MeiligaoProtocolDecoder(new MeiligaoProtocol());
+ verifyPosition(decoder, binary(
+ "242400706573402852404799553130313932372e3030302c412c313732362e38323739332c4e2c30373832382e31393637312c452c312e382c362e342c3137313131362c2c2a32427c312e36387c3534342e327c313030307c303030302c303030307c3030303032383638373a1a0d0a"));
+
+ verifyPosition(decoder, binary(
+ "2424007d0000000000000099553231303333302e3030302c562c343533342e333832342c532c30373230332e303630302c572c302e30302c302c3231313031362c2c2a31327c302e307c3332397c323030307c303030452c303030437c303244413030303145413634393541417c31307c30303030303030306e540d0a"));
+
verifyAttributes(decoder, binary(
"4040005066104020094432990131302E312C302C3135362C302E30302C31392E36312C2D33342C33342E32362C32312E38332C372E39312C313033332C322E36392C362E35352C302C302C309DBF0D0A"));
diff --git a/test/org/traccar/protocol/NavisProtocolDecoderTest.java b/test/org/traccar/protocol/NavisProtocolDecoderTest.java
index 4b612e941..432d0eaca 100644
--- a/test/org/traccar/protocol/NavisProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/NavisProtocolDecoderTest.java
@@ -16,6 +16,10 @@ public class NavisProtocolDecoderTest extends ProtocolTest {
verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"404E5443010000007B000000130044342A3E533A383631373835303035323035303739"));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "404e5443010000000000000059009adb2a3e54250000000000ff1500040b0a1008291838001200760ee600000000000000000000000f1500040b0a10ac20703fb1aec23f00000000320149668f430000000000000000000000000000000000000000000000f3808080"),
+ position("2016-11-11 21:00:04.000", true, 53.74336, 87.14437));
+
verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"404e544300000000040000005a00c6812a3e410125e3a60700011705071503011030210c0000fa200910e6000000000000000000000001082106150010ae97643f88a39f3f0000000090001fcc6c450000000000000000000000000000000000000000000000f6808080"));
diff --git a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java
index 3ea83ef60..8b1dd5ad6 100644
--- a/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Pt502ProtocolDecoderTest.java
@@ -11,6 +11,15 @@ public class Pt502ProtocolDecoderTest extends ProtocolTest {
Pt502ProtocolDecoder decoder = new Pt502ProtocolDecoder(new Pt502Protocol());
verifyPosition(decoder, text(
+ "$HDA,20007,134657.000,A,0626.1607,N,00330.2245,E,33.38,81.79,041016,,,A/00010,00000/270,0,0,0/19948900//fa4//"));
+
+ verifyPosition(decoder, text(
+ "$HDB,20007,134708.000,A,0626.1759,N,00330.3192,E,26.55,80.37,041016,,,A/00010,00000/23b,0,0,0/19949100//fa4//"));
+
+ verifyPosition(decoder, text(
+ "$POS,20007,134704.000,A,0626.1698,N,00330.2870,E,31.23,79.58,041016,,,A/00010,00000/26c,0,0,0/19949100//fa4//#"));
+
+ verifyPosition(decoder, text(
"$PHO6608,115099,133140.000,A,1307.1238,N,05936.4194,W,0.00,21.50,290816,,,A/00010,00000/0,0,0,0/185100//f59/"));
verifyPosition(decoder, text(
diff --git a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java
index 902752811..cc457efca 100644
--- a/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/RuptelaProtocolDecoderTest.java
@@ -9,6 +9,12 @@ public class RuptelaProtocolDecoderTest extends ProtocolTest {
public void testDecode() throws Exception {
RuptelaProtocolDecoder decoder = new RuptelaProtocolDecoder(new RuptelaProtocol());
+
+ verifyPositions(decoder, binary(
+ "01a4000315bc70f9b69244000458068f4a0030000d11398a1c0c19fd056524040b000c0a00090c0005010031f40032fd0033f200ce47002400002500001c010199000195010196010086000900aa0000001e0ff000d3ffff0043ffff01930000019200000194000002220000022300000200300000000200af000e872401008e000000000000000058068f4a0031000d11398a1c0c19fd056524040b000c0a00090400870000880000a90000820010008b0002021e0000021f0000021d0000021c0000022400000225000000890000008505f00220000002210000008300000084000002260000022700000228000003008a00000000008d00000000008c000000000058068f4a0032000d11398a1c0c19fd056524040b000c0a000905019f01005800001b1f00ad0000cfb10b02290000022a0000022b0000022c0000022d00000012000000130000001d367400c52f8000740055023e0502060097000000000096000058520041007746cb00d0000003f1005c0007c21b0072001864880058068f4a0033000d11398a1c0c19fd056524040b000c0a000900000001008e0000000000000000e815"));
+
+ verifyPositions(decoder, binary(
+ "033d000315bc70f9b69244000858068f3b0030010d11354e1c0c17a5055d54560c00000900050c0005010031f30032fb0033f300ce00002400002500001c010199000195010196010086000900aa0000001e0ff300d3ffff0043ffff01930000019200000194000002220000022300000200300000000000af000e872401008e000000000000000058068f3b0031010d11354e1c0c17a5055d54560c00000900050400870000880000a90000820010008b0000021e0000021f0000021d0000021c0000022400000225000000890000008500000220000002210000008300000084000002260000022700000228000003008a00000000008d00000000008c000000000058068f3b0032010d11354e1c0c17a5055d54560c000009000505019f01005800001b1f00ad0000cfac0b02290000022a0000022b0000022c0000022d00000012000000130000001d31b100c5000000740000023e0502060097000000000096000058520041007746be00d0000003f1005c0007c2150072001864880058068f3b0033010d11354e1c0c17a5055d54560c000009000500000001008e000000000000000058068f3b0130000d11354e1c0c17a5055d54560d00000900070c0005010031f30032fb0033f300ce00002400002500001c010199000195010196010086000900aa0000001e0ff300d3ffff0043ffff01930000019200000194000002220000022300000200300000000000af000e872401008e000000000000000058068f3b0131000d11354e1c0c17a5055d54560d00000900070400870000880000a90000820010008b0000021e0000021f0000021d0000021c0000022400000225000000890000008500000220000002210000008300000084000002260000022700000228000003008a00000000008d00000000008c000000000058068f3b0132000d11354e1c0c17a5055d54560d000009000705019f01005800001b1f00ad0000cfac0b02290000022a0000022b0000022c0000022d00000012000000130000001d31ae00c5000000740000023e0502060097000000000096000058520041007746be00d0000003f1005c0007c2150072001864880058068f3b0133000d11354e1c0c17a5055d54560d000009000700000001008e0000000000000000084d"));
verifyPositions(decoder, binary(
"0050000310f5615f419c0100015613d8ed0000fff5b37a035af37801e700000900000d07071b0c020003001c01202cad000500064302a81d33e61e100116317cd3ffff174ad60241000077fa960000f232003c2e"));
diff --git a/test/org/traccar/protocol/SmokeyProtocolDecoderTest.java b/test/org/traccar/protocol/SmokeyProtocolDecoderTest.java
new file mode 100644
index 000000000..fd862b437
--- /dev/null
+++ b/test/org/traccar/protocol/SmokeyProtocolDecoderTest.java
@@ -0,0 +1,30 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class SmokeyProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ SmokeyProtocolDecoder decoder = new SmokeyProtocolDecoder(new SmokeyProtocol());
+
+ verifyAttributes(decoder, binary(
+ "534D0300865628025161227F030100000000029E03020200A4021405028F0007010658300200028F0007010625F21D028F00070106000027028F00070106584E19028F000701065DCF2707537265696C6C69634E657400E8DE27400DF0A80084C9B2D85A1DB7537265696C6C69634E657400E8DE27401048D44350455F44423745393900A8A668DB7E99A94D794E6574776F726B4E616D6500002675ED6D70AB74686170616E6500002675F4DA3CA94D75666173610088CEFA735AFCA9C524"));
+
+ verifyAttributes(decoder, binary(
+ "534d0300865628025163272f031400000000001c000200000c0168028f000102c9f93a011f538d"));
+
+ verifyAttributes(decoder, binary(
+ "534d0300865628025163272f031400000000001f000200000c0167028f000102c9f93a011f5082"));
+
+ verifyAttributes(decoder, binary(
+ "534d0300865628025163272f031400000000001d000200000c0167028f000102c9f93a011f5282"));
+
+ verifyAttributes(decoder, binary(
+ "534d0300865628025163272f031400000000001e000200000c0167028f000102c9f93a011f5182"));
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java
index 501466eeb..34ae1ab90 100644
--- a/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk102ProtocolDecoderTest.java
@@ -10,32 +10,41 @@ public class Tk102ProtocolDecoderTest extends ProtocolTest {
Tk102ProtocolDecoder decoder = new Tk102ProtocolDecoder(new Tk102Protocol());
- verifyNothing(decoder, text(
- ""));
+ verifyNothing(decoder, buffer(
+ "[\u00800000000000\u000821315452]"));
- verifyNothing(decoder, text(
- "[!0000000081r(353327023367238,TK102-W998_01_V1.1.001_130219,255,001,255,001,0,100,100,0,internet,0000,0000,0,0,255,0,4,1,11,00)"));
+ verifyNothing(decoder, buffer(
+ "[\u00f00000000000\u000821315452]"));
+
+ verifyPosition(decoder, buffer(
+ "[\u00900100100001\u0036(ONE025857A2232.0729N11356.0030E000.02109110100000000)]"));
+
+ verifyPosition(decoder, buffer(
+ "[\u00900100100001\u0036(ITV025857A2232.0729N11356.0030E000.02109110100000000)]"));
+
+ verifyNothing(decoder, buffer(
+ "[\u00210000000081\u0072(353327023367238,TK102-W998_01_V1.1.001_130219,255,001,255,001,0,100,100,0,internet,0000,0000,0,0,255,0,4,1,11,00)]"));
- verifyNothing(decoder, text(
- "[L0000001323N(GSM,0,0,07410001,20120101162600,404,010,9261,130,0,2353,130,35,9263,130,33,1)"));
+ verifyNothing(decoder, buffer(
+ "[\u004c0000001323\u004e(GSM,0,0,07410001,20120101162600,404,010,9261,130,0,2353,130,35,9263,130,33,1)]"));
- verifyNothing(decoder, text(
- "[%0000000082\u001d(100100000000000600-30-65535)"));
+ verifyNothing(decoder, buffer(
+ "[\u00250000000082\u001d(100100000000000600-30-65535)]"));
- verifyNothing(decoder, text(
- "[#0000000004\u0018(062100000000000600-0-0)"));
+ verifyNothing(decoder, buffer(
+ "[\u00230000000004\u0018(062100000000000600-0-0)]"));
- verifyPosition(decoder, text(
- "[=00000000836(ITV013939A4913.8317N02824.9241E000.90018031310010000)"));
+ verifyPosition(decoder, buffer(
+ "[\u003d0000000083\u0036(ITV013939A4913.8317N02824.9241E000.90018031310010000)]"));
- verifyPosition(decoder, text(
- "[=00000000366(ITV012209A4913.8281N02824.9258E000.32018031310010000)"));
+ verifyPosition(decoder, buffer(
+ "[\u003d0000000036\u0036(ITV012209A4913.8281N02824.9258E000.32018031310010000)]"));
- verifyPosition(decoder, text(
- "[;00000000106(ONE200834A5952.8114N01046.0832E003.93212071305010000)"));
+ verifyPosition(decoder, buffer(
+ "[\u003b0000000010\u0036(ONE200834A5952.8114N01046.0832E003.93212071305010000)]"));
- verifyPosition(decoder, text(
- "[\u00930000000000F(ITV153047A1534.0805N03233.0888E000.00029041500000400&Wsz-wl001&B0000)]"));
+ verifyPosition(decoder, buffer(
+ "[\u00930000000000\u0046(ITV153047A1534.0805N03233.0888E000.00029041500000400&Wsz-wl001&B0000)]"));
}
diff --git a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
index ba820f2f6..4c6f0e004 100644
--- a/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tk103ProtocolDecoderTest.java
@@ -10,6 +10,12 @@ public class Tk103ProtocolDecoderTest extends ProtocolTest {
Tk103ProtocolDecoder decoder = new Tk103ProtocolDecoder(new Tk103Protocol());
+ verifyNothing(decoder, text(
+ "(027028258309BQ86,0,05550c21b10d1d0f431008bd114c0ea5078400010007a100423932,161117005322,01000001)"));
+
+ verifyNothing(decoder, text(
+ "(027028258309BQ86,0,05470c0eb20d040f4410022911360e92077e00010007a1004237c7,161117005232,01000001)"));
+
verifyPosition(decoder, text(
"(01602009983BR00160830V1855.7022S4817.8731W000.0002729000.0010000000L00000000)"));
diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java
index 8ff2e6f11..89400fe22 100644
--- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java
@@ -11,6 +11,12 @@ public class TotemProtocolDecoderTest extends ProtocolTest {
TotemProtocolDecoder decoder = new TotemProtocolDecoder(new TotemProtocol());
verifyPosition(decoder, text(
+ "$$0116AA864244026065291|18001800140916020524401100000000000027BA0E57063100000001.200000002237.8119N11403.5075E052020"));
+
+ verifyPosition(decoder, text(
+ "$$0116AA867119025683137|108000001611020925324112000000000000616027F7001300000099.900000000000.0000N00000.0000E531824"));
+
+ verifyPosition(decoder, text(
"$$0128AA864244026065291|18001800140916020524401100000000000000000000000027BA0E57063100000001.200000002237.8119N11403.5075E05202D"));
verifyPosition(decoder, text(
diff --git a/test/org/traccar/protocol/TrakMateProtocolDecoderTest.java b/test/org/traccar/protocol/TrakMateProtocolDecoderTest.java
new file mode 100644
index 000000000..b08decc92
--- /dev/null
+++ b/test/org/traccar/protocol/TrakMateProtocolDecoderTest.java
@@ -0,0 +1,24 @@
+package org.traccar.protocol;
+
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+public class TrakMateProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testDecode() throws Exception {
+
+ TrakMateProtocolDecoder decoder = new TrakMateProtocolDecoder(new TrakMateProtocol());
+
+ verifyPosition(decoder, text(
+ "^TMPER|354678456723764|1|12.59675|77.56789|123456|030414|2.3|34.0|1|0|0|0.015|3.9|12.0|23.4|23.4|1|1|0|#"));
+
+ verifyPosition(decoder, text(
+ "^TMALT|354678456723764|3|2|1|12.59675|77.56789|123456|030414|1.2|34.0|#"));
+
+ verifyPosition(decoder, text(
+ "^TMSRT|354678456723764|12.59675|77.56789|123456|030414|1.03|1.01|#"));
+
+ }
+
+}
diff --git a/test/org/traccar/protocol/TramigoProtocolDecoderTest.java b/test/org/traccar/protocol/TramigoProtocolDecoderTest.java
index 9cf7b9006..6da14ba64 100644
--- a/test/org/traccar/protocol/TramigoProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TramigoProtocolDecoderTest.java
@@ -13,6 +13,9 @@ public class TramigoProtocolDecoderTest extends ProtocolTest {
TramigoProtocolDecoder decoder = new TramigoProtocolDecoder(new TramigoProtocol());
verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "80009e08b00086000101bc1803778a59c58dea57546573742054323320547261636b65723a204d6f76696e672c20312e3639206b6d204e57206f66205574656b6f6e2c2045646f2c204e472c20362e34363137302c20352e36313938322c20452077697468207370656564203333206b6d2f682c2031363a3138205365702032372020454f46"));
+
+ verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"8000853eb000b8000101fcff032f14665a89e2564176656e7369732053797353657276653a2049676e6974696f6e206f6e2064657465637465642c206d6f76696e672c20302e3135206b6d205357206f66204261626120416e696d61736861756e205374726565742d426f64652054686f6d61732053742e2c20537572756c6572652c204c61676f7320436974792c204e472c20362e34383736352c20332e33343735352c2031303a3031204d6172203131202020454f46"));
verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN,
@@ -39,12 +42,6 @@ public class TramigoProtocolDecoderTest extends ProtocolTest {
verifyAttributes(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"8000011bb0009e0001015b93032ef6f35994a9545472616d69676f3a204d6f76696e672c20302e3930206b6d205345206f66204372616e6562726f6f6b20466972652053746174696f6e2c2050656e726974682c205379646e65792c2041552c202d33332e37303732322c203135302e37313735392c2053452077697468207370656564203337206b6d2f682c2031393a3438204a616e20342020454f46"));
- // Tramigo: Parked, 0.12 km E of McDonald's H.V. dela Costa, Makati, 11:07 Mar 27
- // Tramigo: Moving, 0.90 km SE of Cranebrook Fire Station, Penrith, Sydney, AU, -33.70722, 150.71759, SE with speed 37 km/h, 19:48 Jan 4 EOF
-
- //verifyPosition(decoder, text( ChannelBuffers.wrappedBuffer(BcdUtil.convertArray(
- // new int[] {0x68,0x68,0x25,0x00,0x00,0x01,0x23,0x45,0x67,0x89,0x01,0x23,0x45,0x00,0x01,0x10,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x6B,0x3F,0x3E,0x02,0x6B,0x3F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0D,0x0A}))));
-
}
}
diff --git a/test/org/traccar/protocol/UlbotechFrameDecoderTest.java b/test/org/traccar/protocol/UlbotechFrameDecoderTest.java
index 3a21fd209..03a4fb336 100644
--- a/test/org/traccar/protocol/UlbotechFrameDecoderTest.java
+++ b/test/org/traccar/protocol/UlbotechFrameDecoderTest.java
@@ -12,6 +12,10 @@ public class UlbotechFrameDecoderTest extends ProtocolTest {
UlbotechFrameDecoder decoder = new UlbotechFrameDecoder();
Assert.assertEquals(
+ binary("f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8"),
+ decoder.decode(null, null, binary("f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8")));
+
+ Assert.assertEquals(
binary("2a545330312c33353430343330353133383934363023"),
decoder.decode(null, null, binary("2a545330312c33353430343330353133383934363023")));
diff --git a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java
index cb4e43c38..2c271976e 100644
--- a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class UlbotechProtocolDecoderTest extends ProtocolTest {
UlbotechProtocolDecoder decoder = new UlbotechProtocolDecoder(new UlbotechProtocol());
verifyPosition(decoder, binary(
+ "f8010103515810532780699f7e2e3f010e015ee4c906bde45c00000000008b0304004000000404002c776005060373193622110b00240b00fee8ffff807dffff606d0b00fee9af000000af0000000b00feee7d78807dffffffff100101cc2af8"));
+
+ verifyPosition(decoder, binary(
"F8010103596580420045259CFB3329010E015ED91506BDE5A800000000009E030402420000040400492AA405060344197E220D071131058F410C1591310D48312F8F413107C60804027666B00C138254D182607A826EE083BE554385F50019423CAD1DF8"));
verifyNotNull(decoder, binary(
diff --git a/test/org/traccar/protocol/UproProtocolDecoderTest.java b/test/org/traccar/protocol/UproProtocolDecoderTest.java
index c58a748a1..711fe39b6 100644
--- a/test/org/traccar/protocol/UproProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/UproProtocolDecoderTest.java
@@ -11,7 +11,27 @@ public class UproProtocolDecoderTest extends ProtocolTest {
UproProtocolDecoder decoder = new UproProtocolDecoder(new UproProtocol());
verifyPosition(decoder, text(
- "*AI200905300036,AH&A0317264913209801844913060000251115&B0500000000&C0;4?72:9&F0000#"));
+ "*MG201693502000035441,BA&A1213073325458307036690710000151116&P0730000032ce4fb3&D1&B0000000000&C005799?7&S3,20161115120025,07035.54659E,3324.87721N,3000,0,0,0,0,847,599,8,40,0,19,20&U_P\0\0\0\0\0\0\0\0\0\0\0\0\0\0&T0107#"));
+
+ verifyPosition(decoder, text(
+ "*MG201693502000034964,AB&A0800253335360507036975710000091116&P0730000032d2a94d&B0000000000&N13&Z12&U_P\0\0\0\u0004\0\0\0\0\0\0\0\0\0\0#"),
+ position("2016-11-09 08:00:25.000", true, -33.58934, -70.61626));
+
+ verifyNothing(decoder, text(
+ "*MG20113800138000,AH#"));
+
+ verifyPosition(decoder, text(
+ "*MG201693502000034964,AB&A0200183324418107033792800009051116&B0000000000&N15&Z94&U_P\0\0\0\0\0\0\0\0\0\0\0\0\0\0#"));
+
+ verifyPosition(decoder, text(
+ "*MG201693502000034964,AB&A0200543324412007033805910000051116&P0730000032d66785&B0000000000&N15&Z92&U_P\0\0\0\0\0\0\0\0\0\0\0\0\0\0#"));
+
+ verifyPosition(decoder, text(
+ "*AI2000905447674,BA&A2003064913201201845107561627121016&B0100000000&C05>8=961&F0333&K023101002154A7#"));
+
+ verifyPosition(decoder, text(
+ "*AI200905300036,AH&A0317264913209801844913060000251115&B0500000000&C0;4?72:9&F0000#"),
+ position("2015-11-25 03:17:26.000", false, 49.22016, 18.74855));
verifyPosition(decoder, text(
"*AI2000905300036,AS&A1647304913209801844913060000251115&B0400000000&C0;4?72:9&F0000"));
diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
index 2e36010c7..f68497304 100644
--- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
@@ -11,6 +11,10 @@ public class V680ProtocolDecoderTest extends ProtocolTest {
V680ProtocolDecoder decoder = new V680ProtocolDecoder(new V680Protocol());
verifyPosition(decoder, text(
+ "#867967020910610#01234567890#1#0000#AUT#1#0500000000120000#114.036291,E,22.665795,N,111.00,000.00#111116#193333##"),
+ position("2016-11-11 19:33:33.000", true, 22.66579, 114.03629));
+
+ verifyPosition(decoder, text(
"#355488020168617##1#0000#AUT#01#260001a412966f#1834.790700,E,5302.748800,N,0.00,0.00#310316#174538.000##"));
verifyPosition(decoder, text(
@@ -23,7 +27,8 @@ public class V680ProtocolDecoderTest extends ProtocolTest {
"#135790246811222#13486119277#1#0000#SOS#1#27bc10af#11407.4182,E,2232.7632,N,0.00,79.50#070709#134147.000##"));
verifyPosition(decoder, text(
- "#356823031193431##0#0000#SF#1#72403#V#04702.3025,W,2252.18380,S,008.18,0#090413#134938"));
+ "#356823031193431##0#0000#SF#1#72403#V#04702.3025,W,2252.18380,S,008.18,0#090413#134938"),
+ position("2013-04-09 13:49:38.000", false, -22.86973, -47.038375));
verifyPosition(decoder, text(
"#356823033219838#1000#0#1478#AUT#1#66830FFB#03855.6628,E,4716.6821,N,001.41,259#130812#143905"));
diff --git a/test/org/traccar/protocol/WatchProtocolDecoderTest.java b/test/org/traccar/protocol/WatchProtocolDecoderTest.java
index 6116c2c2b..25d4f7cc2 100644
--- a/test/org/traccar/protocol/WatchProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/WatchProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest {
WatchProtocolDecoder decoder = new WatchProtocolDecoder(new WatchProtocol());
verifyPosition(decoder, text(
+ "[3G*6430073509*00E7*UD2,241016,081622,V,09.951861,N,-84.1422119,W,0.00,0.0,0.0,0,39,94,0,0,00000000,1,0,712,3,2007,18961,123,4,Luz,00:23:6a:34:ee:76,-70,familia,b0:c5:54:b9:90:ef,-78,fam salas delgado,fc:b4:e6:5d:50:ea,-81,QWERTY,c8:3a:35:43:0f:e8,-93"));
+
+ verifyPosition(decoder, text(
"[3G*6105117105*008D*UD2,210716,231601,V,-33.480366,N,-70.7630692,E,0.00,0.0,0.0,0,100,34,0,0,00000000,3,255,730,2,29731,54315,167,29731,54316,162,29731,54317,145"),
position("2016-07-21 23:16:01.000", false, -33.48037, -70.76307));