aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-12-17 00:26:20 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-12-17 00:26:20 -0800
commitef2bd4662484e4a82bea5afb0d399eed33e859db (patch)
tree63a6d011ca99294b85a3e0b959ecb2e2f7b53643
parent1b30b26b56e3804f34dae87eb69b2291635175d9 (diff)
downloadtraccar-server-ef2bd4662484e4a82bea5afb0d399eed33e859db.tar.gz
traccar-server-ef2bd4662484e4a82bea5afb0d399eed33e859db.tar.bz2
traccar-server-ef2bd4662484e4a82bea5afb0d399eed33e859db.zip
Handle no GPS data
-rw-r--r--src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java b/src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java
index dc77dda68..cd8b74c9a 100644
--- a/src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/OmnicommProtocolDecoder.java
@@ -123,7 +123,9 @@ public class OmnicommProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_SATELLITES, nav.getGPSNSat());
}
- positions.add(position);
+ if (position.getFixTime() != null) {
+ positions.add(position);
+ }
}
if (positions.isEmpty()) {
diff --git a/src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java
index 5219e125b..a2977499a 100644
--- a/src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/OmnicommProtocolDecoderTest.java
@@ -1,12 +1,10 @@
package org.traccar.protocol;
-import org.junit.Ignore;
import org.junit.Test;
import org.traccar.ProtocolTest;
public class OmnicommProtocolDecoderTest extends ProtocolTest {
- //@Ignore
@Test
public void testDecode() throws Exception {
@@ -16,6 +14,9 @@ public class OmnicommProtocolDecoderTest extends ProtocolTest {
"c080080061a61915340100001dec"));
verifyPositions(decoder, binary(
+ "c0863e05a5da0300a9168e14000c000a0211031308a9adb8a401140a0008111308d1aeb8a401140a0008111308feaeb8a401140a00081113088bafb8a40114430008011308bfb0b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c43080010001806200028003006446c0008121308c0b0b8a4011483010a5c4c6f616450726f746f4275663a20455252202d20636f7272757074656420535450425b305d0d0a566572333038204d617220323020323031395253544142434432303030205433343438353632333250303e3143303a3130303131208401430008011308f3b1b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308a7b3b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308dbb4b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c43080010001806200028003006444300080113088fb6b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308c3b7b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308f7b8b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308abbab8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308dfbbb8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c430800100018062000280030064443000801130893bdb8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308c7beb8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308fbbfb8a40120022800380040d801482950d2016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308afc1b8a40120022800380040d801482950d2016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308e3c2b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c430800100018062000280030064443000801130897c4b8a40120022800380040d801482950d2016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308cbc5b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644430008011308ffc6b8a40120022800380040d801482950d4016000680070008001028801bbdffe06142b0800100018002000280030002c4308001000180620002800300644"));
+
+ verifyPositions(decoder, binary(
"C0866300CD1400002273231400580008011308A2E68DA10110002006280030003800400048005000600068007000142B08EC979EB60410EEB7CC8C02180020002804300038A2E68DA1012C33080010001800200028003000344308381000180220382800300244DF2A"));
}